[clang-tools-extra] r216396 - Update for LLVM api change
Rafael Espindola
rafael.espindola at gmail.com
Mon Aug 25 11:17:00 PDT 2014
Author: rafael
Date: Mon Aug 25 13:17:00 2014
New Revision: 216396
URL: http://llvm.org/viewvc/llvm-project?rev=216396&view=rev
Log:
Update for LLVM api change
Modified:
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
clang-tools-extra/trunk/clang-modernize/Core/PerfSupport.cpp
clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp
clang-tools-extra/trunk/modularize/ModuleAssistant.cpp
clang-tools-extra/trunk/pp-trace/PPTrace.cpp
Modified: clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp Mon Aug 25 13:17:00 2014
@@ -245,11 +245,10 @@ bool writeFiles(const clang::Rewriter &R
const char *FileName =
Rewrites.getSourceMgr().getFileEntryForID(BufferI->first)->getName();
- std::string ErrorInfo;
-
- llvm::raw_fd_ostream FileStream(FileName, ErrorInfo, llvm::sys::fs::F_Text);
- if (!ErrorInfo.empty()) {
- errs() << "Warning: Could not write to " << FileName << "\n";
+ std::error_code EC;
+ llvm::raw_fd_ostream FileStream(FileName, EC, llvm::sys::fs::F_Text);
+ if (EC) {
+ errs() << "Warning: Could not write to " << EC.message() << "\n";
continue;
}
BufferI->second.write(FileStream);
Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp Mon Aug 25 13:17:00 2014
@@ -271,10 +271,9 @@ int main(int argc, char **argv) {
}
// Write new file to disk
- std::string ErrorInfo;
- llvm::raw_fd_ostream FileStream(I->getKey().str().c_str(), ErrorInfo,
- llvm::sys::fs::F_Text);
- if (!ErrorInfo.empty()) {
+ std::error_code EC;
+ llvm::raw_fd_ostream FileStream(I->getKey(), EC, llvm::sys::fs::F_Text);
+ if (EC) {
llvm::errs() << "Could not open " << I->getKey() << " for writing\n";
continue;
}
Modified: clang-tools-extra/trunk/clang-modernize/Core/PerfSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/PerfSupport.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/PerfSupport.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/PerfSupport.cpp Mon Aug 25 13:17:00 2014
@@ -50,9 +50,8 @@ void writePerfDataJSON(
SS << DirectoryName << "/" << static_cast<int>(T.getWallTime()) << "_" << Pid
<< ".json";
- std::string ErrorInfo;
- llvm::raw_fd_ostream FileStream(SS.str().c_str(), ErrorInfo,
- llvm::sys::fs::F_Text);
+ std::error_code EC;
+ llvm::raw_fd_ostream FileStream(SS.str(), EC, llvm::sys::fs::F_Text);
FileStream << "{\n";
FileStream << " \"Sources\" : [\n";
for (SourcePerfData::const_iterator I = TimingResults.begin(),
Modified: clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp Mon Aug 25 13:17:00 2014
@@ -72,11 +72,10 @@ bool ReplacementHandling::serializeRepla
continue;
}
- std::string ErrorInfo;
- raw_fd_ostream ReplacementsFile(ReplacementsFileName.c_str(), ErrorInfo,
- fs::F_None);
- if (!ErrorInfo.empty()) {
- errs() << "Error opening file: " << ErrorInfo << "\n";
+ std::error_code EC;
+ raw_fd_ostream ReplacementsFile(ReplacementsFileName, EC, fs::F_None);
+ if (EC) {
+ errs() << "Error opening file: " << EC.message() << "\n";
Errors = true;
continue;
}
Modified: clang-tools-extra/trunk/modularize/ModuleAssistant.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/ModuleAssistant.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/ModuleAssistant.cpp (original)
+++ clang-tools-extra/trunk/modularize/ModuleAssistant.cpp Mon Aug 25 13:17:00 2014
@@ -247,11 +247,11 @@ static bool writeModuleMap(llvm::StringR
}
// Set up module map output file.
- std::string Error;
- llvm::tool_output_file Out(FilePath.c_str(), Error, llvm::sys::fs::F_Text);
- if (!Error.empty()) {
- llvm::errs() << Argv0 << ": error opening " << FilePath << ":" << Error
- << "\n";
+ std::error_code EC;
+ llvm::tool_output_file Out(FilePath, EC, llvm::sys::fs::F_Text);
+ if (EC) {
+ llvm::errs() << Argv0 << ": error opening " << FilePath << ":"
+ << EC.message() << "\n";
return false;
}
Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=216396&r1=216395&r2=216396&view=diff
==============================================================================
--- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original)
+++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Mon Aug 25 13:17:00 2014
@@ -212,12 +212,11 @@ int main(int Argc, const char **Argv) {
HadErrors = outputPPTrace(CallbackCalls, llvm::outs());
} else {
// Set up output file.
- std::string Error;
- llvm::tool_output_file Out(OutputFileName.c_str(), Error,
- llvm::sys::fs::F_Text);
- if (!Error.empty()) {
+ std::error_code EC;
+ llvm::tool_output_file Out(OutputFileName, EC, llvm::sys::fs::F_Text);
+ if (EC) {
llvm::errs() << "pp-trace: error creating " << OutputFileName << ":"
- << Error << "\n";
+ << EC.message() << "\n";
return 1;
}
More information about the cfe-commits
mailing list