From bd927b645788914de62152c0d18f717610ed2ca6 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 17 Jul 2014 19:08:19 +0000 Subject: [PATCH] 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 llvm-svn: 213297 --- clang/lib/Frontend/HeaderIncludeGen.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp index 8b2435b..a2f5896 100644 --- a/clang/lib/Frontend/HeaderIncludeGen.cpp +++ b/clang/lib/Frontend/HeaderIncludeGen.cpp @@ -131,5 +131,6 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc, Msg += '\n'; OutputFile->write(Msg.data(), Msg.size()); + OutputFile->flush(); } } -- 2.7.4