about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2023-07-16 22:33:38 -0700
committerDavid Tolnay <dtolnay@gmail.com>2023-07-20 11:04:31 -0700
commitc80cbe4baedfe1ef8ea6f88f3cf2f8db06c8c399 (patch)
treec75c518e6342d8a9ffa96b34487947d39d5278d6 /compiler/rustc_codegen_llvm/src
parent5a60660ff8c35e2f270658900073443bbb984180 (diff)
downloadrust-c80cbe4baedfe1ef8ea6f88f3cf2f8db06c8c399.tar.gz
rust-c80cbe4baedfe1ef8ea6f88f3cf2f8db06c8c399.zip
Implement printing to file in codegen_backend.print
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/lib.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs
index 38a32ac845d..3ff66413647 100644
--- a/compiler/rustc_codegen_llvm/src/lib.rs
+++ b/compiler/rustc_codegen_llvm/src/lib.rs
@@ -262,10 +262,10 @@ impl CodegenBackend for LlvmCodegenBackend {
             |tcx, ()| llvm_util::global_llvm_features(tcx.sess, true)
     }
 
-    fn print(&self, req: &PrintRequest, sess: &Session) {
+    fn print(&self, req: &PrintRequest, out: &mut dyn PrintBackendInfo, sess: &Session) {
         match req.kind {
             PrintKind::RelocationModels => {
-                println!("Available relocation models:");
+                writeln!(out, "Available relocation models:");
                 for name in &[
                     "static",
                     "pic",
@@ -276,26 +276,27 @@ impl CodegenBackend for LlvmCodegenBackend {
                     "ropi-rwpi",
                     "default",
                 ] {
-                    println!("    {}", name);
+                    writeln!(out, "    {}", name);
                 }
-                println!();
+                writeln!(out);
             }
             PrintKind::CodeModels => {
-                println!("Available code models:");
+                writeln!(out, "Available code models:");
                 for name in &["tiny", "small", "kernel", "medium", "large"] {
-                    println!("    {}", name);
+                    writeln!(out, "    {}", name);
                 }
-                println!();
+                writeln!(out);
             }
             PrintKind::TlsModels => {
-                println!("Available TLS models:");
+                writeln!(out, "Available TLS models:");
                 for name in &["global-dynamic", "local-dynamic", "initial-exec", "local-exec"] {
-                    println!("    {}", name);
+                    writeln!(out, "    {}", name);
                 }
-                println!();
+                writeln!(out);
             }
             PrintKind::StackProtectorStrategies => {
-                println!(
+                writeln!(
+                    out,
                     r#"Available stack protector strategies:
     all
         Generate stack canaries in all functions.