summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-07-21 15:39:05 +0000
committerZachary Turner <zturner@google.com>2018-07-21 15:39:05 +0000
commit322f6d046b0761b941fcb94180a1a6e8bd628b64 (patch)
tree89f403b427cf60012625112d06cf7fd737238270
parent0754d77d6ad98476da03f88c8ca54ce7149eeb3c (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337645 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/llvm-undname/llvm-undname.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/llvm-undname/llvm-undname.cpp b/tools/llvm-undname/llvm-undname.cpp
index f18702af2f5..2124ec16945 100644
--- a/tools/llvm-undname/llvm-undname.cpp
+++ b/tools/llvm-undname/llvm-undname.cpp
@@ -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";
}