[llvm] r337645 - [llvm-undname] Flush output before demangling.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 21 08:39:05 PDT 2018


Author: zturner
Date: Sat Jul 21 08:39:05 2018
New Revision: 337645

URL: http://llvm.org/viewvc/llvm-project?rev=337645&view=rev
Log:
[llvm-undname] Flush output before demangling.

If an error occurs and we write it to stderr, it could appear
before we wrote the mangled name which we're undecorating.
By flushing stdout first, we ensure that the messages are always
sequenced in the correct order.

Modified:
    llvm/trunk/tools/llvm-undname/llvm-undname.cpp

Modified: llvm/trunk/tools/llvm-undname/llvm-undname.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-undname/llvm-undname.cpp?rev=337645&r1=337644&r2=337645&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-undname/llvm-undname.cpp (original)
+++ llvm/trunk/tools/llvm-undname/llvm-undname.cpp Sat Jul 21 08:39:05 2018
@@ -62,14 +62,17 @@ int main(int argc, char **argv) {
       // them to the terminal a second time.  If they're coming from redirected
       // input, however, then we should display the input line so that the
       // mangled and demangled name can be easily correlated in the output.
-      if (!sys::Process::StandardInIsUserInput())
+      if (!sys::Process::StandardInIsUserInput()) {
         outs() << Line << "\n";
+        outs().flush();
+      }
       demangle(Line);
       outs() << "\n";
     }
   } else {
     for (StringRef S : Symbols) {
       outs() << S << "\n";
+      outs().flush();
       demangle(S);
       outs() << "\n";
     }




More information about the llvm-commits mailing list