1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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
This commit is contained in:
Zachary Turner 2018-07-21 15:39:05 +00:00
parent 1e18ab12db
commit 9ef1f44d7b

View File

@ -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";
}