[PATCH] D14543: llvm-config: Explicitly flush ostream so output can be piped into other programs.

Jonathan Roelofs via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 09:51:20 PST 2015


jroelofs added inline comments.

================
Comment at: tools/llvm-config/llvm-config.cpp:422
@@ -421,3 +421,3 @@
 
   raw_ostream &OS = outs();
   for (int i = 1; i != argc; ++i) {
----------------
Maybe it's best to create a RAII object here that calls `OS.flush()` in its destructor?

================
Comment at: tools/llvm-config/llvm-config.cpp:522
@@ -521,3 +521,3 @@
       OS << "shared\n";
       return 0;
     }
----------------
otherwise you have to call `flush` here...

================
Comment at: tools/llvm-config/llvm-config.cpp:549
@@ -548,3 +548,3 @@
           OS << "static\n";
           return 0;
         }
----------------
and here...

================
Comment at: tools/llvm-config/llvm-config.cpp:556
@@ -555,3 +555,3 @@
         OS << "shared\n";
         return 0;
       } else {
----------------
and here...

================
Comment at: tools/llvm-config/llvm-config.cpp:559
@@ -558,3 +558,3 @@
         OS << "static\n";
         return 0;
       }
----------------
and here, which is fragile.


http://reviews.llvm.org/D14543





More information about the llvm-commits mailing list