Update for LLVM api change

llvm-svn: 216396
diff --git a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
index 3929806..f90e29a 100644
--- a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -245,11 +245,10 @@
     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);
diff --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 5c825b7..4559a26 100644
--- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -271,10 +271,9 @@
     }
 
     // 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;
     }
diff --git a/clang-tools-extra/clang-modernize/Core/PerfSupport.cpp b/clang-tools-extra/clang-modernize/Core/PerfSupport.cpp
index 8928cae..77a58d5 100644
--- a/clang-tools-extra/clang-modernize/Core/PerfSupport.cpp
+++ b/clang-tools-extra/clang-modernize/Core/PerfSupport.cpp
@@ -50,9 +50,8 @@
   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(),
diff --git a/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp b/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
index 0251a9e..62a9740 100644
--- a/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
+++ b/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
@@ -72,11 +72,10 @@
       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;
     }
diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp
index ba9912d..a109f58 100644
--- a/clang-tools-extra/modularize/ModuleAssistant.cpp
+++ b/clang-tools-extra/modularize/ModuleAssistant.cpp
@@ -247,11 +247,11 @@
   }
 
   // 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;
   }
 
diff --git a/clang-tools-extra/pp-trace/PPTrace.cpp b/clang-tools-extra/pp-trace/PPTrace.cpp
index cb0aefa..917949f5 100644
--- a/clang-tools-extra/pp-trace/PPTrace.cpp
+++ b/clang-tools-extra/pp-trace/PPTrace.cpp
@@ -212,12 +212,11 @@
     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;
     }