From: Daniel Dunbar Date: Thu, 13 Nov 2008 05:09:21 +0000 (+0000) Subject: [LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26fb272713809af97e6f58ca61b8b9dcba37afc7;p=clang [LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that the Backend output should be done in binary mode. - I'd appreciate it if someone who has a Windows build could verify this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59221 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp index f606c87742..10e69686ad 100644 --- a/Driver/AnalysisConsumer.cpp +++ b/Driver/AnalysisConsumer.cpp @@ -554,7 +554,7 @@ static ExplodedNodeImpl::Auditor* CreateUbiViz() { llvm::OwningPtr Stream; std::string filename = Filename.toString(); - Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), ErrMsg)); + Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), false, ErrMsg)); if (!ErrMsg.empty()) return 0; diff --git a/Driver/Backend.cpp b/Driver/Backend.cpp index f16c069497..aad2d04714 100644 --- a/Driver/Backend.cpp +++ b/Driver/Backend.cpp @@ -170,8 +170,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) { OutputFile = Path.toString(); } - // FIXME: Should be binary. - AsmOutStream = new raw_fd_ostream(OutputFile.c_str(), Error); + AsmOutStream = new raw_fd_ostream(OutputFile.c_str(), true, Error); if (!Error.empty()) return false; } diff --git a/Driver/CacheTokens.cpp b/Driver/CacheTokens.cpp index 5aeb1a6da3..6b37830c00 100644 --- a/Driver/CacheTokens.cpp +++ b/Driver/CacheTokens.cpp @@ -115,7 +115,7 @@ void clang::CacheTokens(Preprocessor& PP, const std::string& OutFile) { uint32_t idcount = 0; std::string ErrMsg; - llvm::raw_fd_ostream Out(OutFile.c_str(), ErrMsg); + llvm::raw_fd_ostream Out(OutFile.c_str(), true, ErrMsg); if (!ErrMsg.empty()) { os << "PCH error: " << ErrMsg << "\n"; diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index fd150ae3c7..923439c070 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -476,7 +476,7 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, // Open the output buffer. std::string Err; - llvm::raw_fd_ostream OS(OutFile.empty() ? "-" : OutFile.c_str(), Err); + llvm::raw_fd_ostream OS(OutFile.empty() ? "-" : OutFile.c_str(), false, Err); if (!Err.empty()) { fprintf(stderr, "%s\n", Err.c_str()); exit(1); diff --git a/Driver/RewriteMacros.cpp b/Driver/RewriteMacros.cpp index 8931014081..d10bf55853 100644 --- a/Driver/RewriteMacros.cpp +++ b/Driver/RewriteMacros.cpp @@ -212,7 +212,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP,const std::string &InFileName, OutFile = &llvm::outs(); } else if (!OutFileName.empty()) { std::string Err; - OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), Err); + OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), false, Err); OwnedStream.reset(OutFile); } else if (InFileName == "-") { OutFile = &llvm::outs(); @@ -221,7 +221,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP,const std::string &InFileName, Path.eraseSuffix(); Path.appendSuffix("cpp"); std::string Err; - OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), Err); + OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), false, Err); OwnedStream.reset(OutFile); } diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 65e8841ec7..6d673230fa 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -4107,7 +4107,7 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { OutFile = &llvm::outs(); } else if (!OutFileName.empty()) { std::string Err; - OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), Err); + OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), false, Err); OwnedStream.reset(OutFile); } else if (InFileName == "-") { OutFile = &llvm::outs(); @@ -4116,7 +4116,7 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { Path.eraseSuffix(); Path.appendSuffix("cpp"); std::string Err; - OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), Err); + OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), false, Err); OwnedStream.reset(OutFile); } diff --git a/Driver/SerializationTest.cpp b/Driver/SerializationTest.cpp index 9f93479912..e489a19ff8 100644 --- a/Driver/SerializationTest.cpp +++ b/Driver/SerializationTest.cpp @@ -65,7 +65,7 @@ bool SerializationTest::Serialize(llvm::sys::Path& Filename, { // Pretty-print the decls to a temp file. std::string Err; - llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), Err); + llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), true, Err); assert (Err.empty() && "Could not open file for printing out decls."); llvm::OwningPtr FilePrinter(CreateASTPrinter(&DeclPP)); @@ -89,7 +89,7 @@ bool SerializationTest::Deserialize(llvm::sys::Path& Filename, { // Pretty-print the deserialized decls to a temp file. std::string Err; - llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), Err); + llvm::raw_fd_ostream DeclPP(FNameDeclPrint.c_str(), true, Err); assert (Err.empty() && "Could not open file for printing out decls."); llvm::OwningPtr FilePrinter(CreateASTPrinter(&DeclPP)); diff --git a/lib/AST/InheritViz.cpp b/lib/AST/InheritViz.cpp index 5e4dab4a5e..dd2fc14ab2 100644 --- a/lib/AST/InheritViz.cpp +++ b/lib/AST/InheritViz.cpp @@ -149,7 +149,7 @@ void CXXRecordDecl::viewInheritance(ASTContext& Context) const { llvm::errs() << "Writing '" << Filename.c_str() << "'... "; - llvm::raw_fd_ostream O(Filename.c_str(), ErrMsg); + llvm::raw_fd_ostream O(Filename.c_str(), false, ErrMsg); if (ErrMsg.empty()) { InheritanceHierarchyWriter Writer(Context, O); diff --git a/lib/Driver/PlistDiagnostics.cpp b/lib/Driver/PlistDiagnostics.cpp index 500524157e..b9e35aa815 100644 --- a/lib/Driver/PlistDiagnostics.cpp +++ b/lib/Driver/PlistDiagnostics.cpp @@ -195,7 +195,7 @@ void PlistDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) { // Now create the plist file. std::string ErrMsg; - llvm::raw_fd_ostream o(H.toString().c_str(), ErrMsg); + llvm::raw_fd_ostream o(H.toString().c_str(), false, ErrMsg); if (!ErrMsg.empty()) { llvm::errs() << "warning: could not creat file: " << H.toString() << '\n';