From 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 24 Nov 2014 09:15:30 +0000 Subject: Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release): https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957 --- lib/Frontend/HeaderIncludeGen.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/Frontend/HeaderIncludeGen.cpp') diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index 237e5b1ac0c6..a2f5896746af 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -40,23 +40,24 @@ public: delete OutputFile; } - virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::CharacteristicKind FileType, - FileID PrevFID); + void FileChanged(SourceLocation Loc, FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) override; }; } void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, StringRef OutputPath, bool ShowDepth, bool MSStyle) { - raw_ostream *OutputFile = &llvm::errs(); + raw_ostream *OutputFile = MSStyle ? &llvm::outs() : &llvm::errs(); bool OwnsOutputFile = false; // Open the output file, if used. if (!OutputPath.empty()) { std::string Error; llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream( - OutputPath.str().c_str(), Error, llvm::sys::fs::F_Append); + OutputPath.str().c_str(), Error, + llvm::sys::fs::F_Append | llvm::sys::fs::F_Text); if (!Error.empty()) { PP.getDiagnostics().Report( clang::diag::warn_fe_cc_print_header_failure) << Error; @@ -130,5 +131,6 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc, Msg += '\n'; OutputFile->write(Msg.data(), Msg.size()); + OutputFile->flush(); } } -- cgit v1.2.3