Skip to content

Commit c93b870

Browse files
author
Zachary Turner
committed
[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. llvm-svn: 337645
1 parent 3d5a6dd commit c93b870

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/tools/llvm-undname/llvm-undname.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@ int main(int argc, char **argv) {
6262
// them to the terminal a second time. If they're coming from redirected
6363
// input, however, then we should display the input line so that the
6464
// mangled and demangled name can be easily correlated in the output.
65-
if (!sys::Process::StandardInIsUserInput())
65+
if (!sys::Process::StandardInIsUserInput()) {
6666
outs() << Line << "\n";
67+
outs().flush();
68+
}
6769
demangle(Line);
6870
outs() << "\n";
6971
}
7072
} else {
7173
for (StringRef S : Symbols) {
7274
outs() << S << "\n";
75+
outs().flush();
7376
demangle(S);
7477
outs() << "\n";
7578
}

0 commit comments

Comments
 (0)