]> granicus.if.org Git - clang/commitdiff
clang-cl: Flush stdout after writing the /showIncludes output
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Thu, 17 Jul 2014 19:08:19 +0000 (19:08 +0000)
committerEhsan Akhgari <ehsan.akhgari@gmail.com>
Thu, 17 Jul 2014 19:08:19 +0000 (19:08 +0000)
Summary:
Before this patch, you could get lines in the output such as:
Note: including file:   ../../dist/include/js/Tc:/path/to/foo.cpp(1,1) :  error(clang): static_assert failed...

This patch ensures that the stdout output from showIncludes won't be garbled
in the terminal like this, and it also helps applications that use the output
to generate dependency information if they happen to capture both stdout and
stderr.

Test Plan:
Tested locally, it's hard to write an automated test for this as
the behavior depends on the buffering of the ostreams.

Reviewers: nico

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213297 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/HeaderIncludeGen.cpp

index 8b2435ba9be12448d40558c53198f77a85ab7149..a2f5896746af788691392bd583d9272fc371243a 100644 (file)
@@ -131,5 +131,6 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
     Msg += '\n';
 
     OutputFile->write(Msg.data(), Msg.size());
+    OutputFile->flush();
   }
 }