diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-25 18:17:04 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-25 18:17:04 +0000 |
commit | dae941a6c8c6dc885d3e5be9d5b8d81076dd4d4e (patch) | |
tree | ea0be51cbace104c42852d840b7ce510733d0710 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | b14bd53e6d53919eb11a7fc7afd707a2fc9fc09a (diff) | |
download | bcm5719-llvm-dae941a6c8c6dc885d3e5be9d5b8d81076dd4d4e.tar.gz bcm5719-llvm-dae941a6c8c6dc885d3e5be9d5b8d81076dd4d4e.zip |
Update for llvm api change.
llvm-svn: 216397
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index d8f4400f447..9537e85e631 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -134,17 +134,17 @@ void CompilerInstance::setModuleDepCollector( static void SetUpDiagnosticLog(DiagnosticOptions *DiagOpts, const CodeGenOptions *CodeGenOpts, DiagnosticsEngine &Diags) { - std::string ErrorInfo; + std::error_code EC; bool OwnsStream = false; raw_ostream *OS = &llvm::errs(); if (DiagOpts->DiagnosticLogFile != "-") { // Create the output stream. llvm::raw_fd_ostream *FileOS(new llvm::raw_fd_ostream( - DiagOpts->DiagnosticLogFile.c_str(), ErrorInfo, + DiagOpts->DiagnosticLogFile, EC, llvm::sys::fs::F_Append | llvm::sys::fs::F_Text)); - if (!ErrorInfo.empty()) { + if (EC) { Diags.Report(diag::warn_fe_cc_log_diagnostics_failure) - << DiagOpts->DiagnosticLogFile << ErrorInfo; + << DiagOpts->DiagnosticLogFile << EC.message(); } else { FileOS->SetUnbuffered(); FileOS->SetUseAtomicWrites(true); @@ -164,14 +164,14 @@ static void SetUpDiagnosticLog(DiagnosticOptions *DiagOpts, static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts, DiagnosticsEngine &Diags, StringRef OutputFile) { - std::string ErrorInfo; + std::error_code EC; std::unique_ptr<llvm::raw_fd_ostream> OS; - OS.reset(new llvm::raw_fd_ostream(OutputFile.str().c_str(), ErrorInfo, - llvm::sys::fs::F_None)); + OS.reset( + new llvm::raw_fd_ostream(OutputFile.str(), EC, llvm::sys::fs::F_None)); - if (!ErrorInfo.empty()) { - Diags.Report(diag::warn_fe_serialized_diag_failure) - << OutputFile << ErrorInfo; + if (EC) { + Diags.Report(diag::warn_fe_serialized_diag_failure) << OutputFile + << EC.message(); return; } @@ -573,17 +573,14 @@ CompilerInstance::createOutputFile(StringRef OutputPath, StringRef Extension, bool UseTemporary, bool CreateMissingDirectories) { - std::string Error, OutputPathName, TempPathName; - llvm::raw_fd_ostream *OS = createOutputFile(OutputPath, Error, Binary, - RemoveFileOnSignal, - InFile, Extension, - UseTemporary, - CreateMissingDirectories, - &OutputPathName, - &TempPathName); + std::string OutputPathName, TempPathName; + std::error_code EC; + llvm::raw_fd_ostream *OS = createOutputFile( + OutputPath, EC, Binary, RemoveFileOnSignal, InFile, Extension, + UseTemporary, CreateMissingDirectories, &OutputPathName, &TempPathName); if (!OS) { - getDiagnostics().Report(diag::err_fe_unable_to_open_output) - << OutputPath << Error; + getDiagnostics().Report(diag::err_fe_unable_to_open_output) << OutputPath + << EC.message(); return nullptr; } @@ -595,17 +592,11 @@ CompilerInstance::createOutputFile(StringRef OutputPath, return OS; } -llvm::raw_fd_ostream * -CompilerInstance::createOutputFile(StringRef OutputPath, - std::string &Error, - bool Binary, - bool RemoveFileOnSignal, - StringRef InFile, - StringRef Extension, - bool UseTemporary, - bool CreateMissingDirectories, - std::string *ResultPathName, - std::string *TempPathName) { +llvm::raw_fd_ostream *CompilerInstance::createOutputFile( + StringRef OutputPath, std::error_code &Error, bool Binary, + bool RemoveFileOnSignal, StringRef InFile, StringRef Extension, + bool UseTemporary, bool CreateMissingDirectories, + std::string *ResultPathName, std::string *TempPathName) { assert((!CreateMissingDirectories || UseTemporary) && "CreateMissingDirectories is only allowed when using temporary files"); @@ -674,9 +665,9 @@ CompilerInstance::createOutputFile(StringRef OutputPath, if (!OS) { OSFile = OutFile; OS.reset(new llvm::raw_fd_ostream( - OSFile.c_str(), Error, + OSFile, Error, (Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text))); - if (!Error.empty()) + if (Error) return nullptr; } @@ -1136,9 +1127,8 @@ static void checkConfigMacro(Preprocessor &PP, StringRef ConfigMacro, /// \brief Write a new timestamp file with the given path. static void writeTimestampFile(StringRef TimestampFile) { - std::string ErrorInfo; - llvm::raw_fd_ostream Out(TimestampFile.str().c_str(), ErrorInfo, - llvm::sys::fs::F_None); + std::error_code EC; + llvm::raw_fd_ostream Out(TimestampFile.str(), EC, llvm::sys::fs::F_None); } /// \brief Prune the module cache of modules that haven't been accessed in |