Skip to content

Commit

Permalink
clang-cl: Flush stdout after writing the /showIncludes output
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ehsan committed Jul 17, 2014
1 parent d3d6716 commit bd927b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/Frontend/HeaderIncludeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
Msg += '\n';

OutputFile->write(Msg.data(), Msg.size());
OutputFile->flush();
}
}

0 comments on commit bd927b6

Please sign in to comment.