r213297 - clang-cl: Flush stdout after writing the /showIncludes output

Ehsan Akhgari ehsan.akhgari at gmail.com
Thu Jul 17 12:08:19 PDT 2014


Author: ehsan
Date: Thu Jul 17 14:08:19 2014
New Revision: 213297

URL: http://llvm.org/viewvc/llvm-project?rev=213297&view=rev
Log:
clang-cl: Flush stdout after writing the /showIncludes output

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

Modified:
    cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp

Modified: cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp?rev=213297&r1=213296&r2=213297&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp (original)
+++ cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp Thu Jul 17 14:08:19 2014
@@ -131,5 +131,6 @@ void HeaderIncludesCallback::FileChanged
     Msg += '\n';
 
     OutputFile->write(Msg.data(), Msg.size());
+    OutputFile->flush();
   }
 }





More information about the cfe-commits mailing list