diff options
Diffstat (limited to 'lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r-- | lib/Frontend/HeaderIncludeGen.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Frontend/HeaderIncludeGen.cpp b/lib/Frontend/HeaderIncludeGen.cpp index a2f5896746..50117f6028 100644 --- a/lib/Frontend/HeaderIncludeGen.cpp +++ b/lib/Frontend/HeaderIncludeGen.cpp @@ -54,13 +54,12 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, // Open the output file, if used. if (!OutputPath.empty()) { - std::string Error; + std::error_code EC; llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream( - 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; + OutputPath.str(), EC, llvm::sys::fs::F_Append | llvm::sys::fs::F_Text); + if (EC) { + PP.getDiagnostics().Report(clang::diag::warn_fe_cc_print_header_failure) + << EC.message(); delete OS; } else { OS->SetUnbuffered(); |