Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75802 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/InheritViz.cpp b/lib/AST/InheritViz.cpp
index dd2fc14..1188ba5 100644
--- a/lib/AST/InheritViz.cpp
+++ b/lib/AST/InheritViz.cpp
@@ -149,7 +149,7 @@
 
   llvm::errs() << "Writing '" << Filename.c_str() << "'... ";
 
-  llvm::raw_fd_ostream O(Filename.c_str(), false, ErrMsg);
+  llvm::raw_fd_ostream O(Filename.c_str(), false, /*Force=*/true, ErrMsg);
 
   if (ErrMsg.empty()) {
     InheritanceHierarchyWriter Writer(Context, O);
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp
index 06af2d9..6433bdf 100644
--- a/lib/Frontend/AnalysisConsumer.cpp
+++ b/lib/Frontend/AnalysisConsumer.cpp
@@ -587,7 +587,8 @@
   
   llvm::OwningPtr<llvm::raw_fd_ostream> Stream;
   std::string filename = Filename.toString();
-  Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), false, ErrMsg));
+  Stream.reset(new llvm::raw_fd_ostream(filename.c_str(), false,
+                                        /*Force=*/true, ErrMsg));
 
   if (!ErrMsg.empty())
     return 0;
diff --git a/lib/Frontend/FixItRewriter.cpp b/lib/Frontend/FixItRewriter.cpp
index 1ed89d7..cd7cee0 100644
--- a/lib/Frontend/FixItRewriter.cpp
+++ b/lib/Frontend/FixItRewriter.cpp
@@ -47,6 +47,7 @@
     OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), 
                                        // set binary mode (critical for Windoze)
                                        true, 
+                                       /*Force=*/true,
                                        Err);
     OwnedStream.reset(OutFile);
   } else if (InFileName == "-") {
@@ -60,6 +61,7 @@
     OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), 
                                        // set binary mode (critical for Windoze)
                                        true, 
+                                       /*Force=*/true,
                                        Err);
     OwnedStream.reset(OutFile);
   }  
diff --git a/lib/Frontend/PlistDiagnostics.cpp b/lib/Frontend/PlistDiagnostics.cpp
index 387ed45..f3a9543 100644
--- a/lib/Frontend/PlistDiagnostics.cpp
+++ b/lib/Frontend/PlistDiagnostics.cpp
@@ -319,7 +319,7 @@
 
   // Open the file.
   std::string ErrMsg;
-  llvm::raw_fd_ostream o(OutputFile.c_str(), false, ErrMsg);
+  llvm::raw_fd_ostream o(OutputFile.c_str(), false, /*Force=*/true, ErrMsg);
   if (!ErrMsg.empty()) {
     llvm::errs() << "warning: could not creat file: " << OutputFile << '\n';
     return;
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 18bd884..def46c2 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -1682,7 +1682,7 @@
   
   std::string ErrorInfo;
   BuildLogFile = new llvm::raw_fd_ostream(DumpBuildInformation.c_str(), false,
-                                          ErrorInfo);
+                                          /*Force=*/true, ErrorInfo);
   
   if (!ErrorInfo.empty()) {
     llvm::errs() << "error opening -dump-build-information file '"
@@ -1735,7 +1735,8 @@
       llvm::sys::Program::ChangeStdoutToBinary();
   } else {
     std::string Error;
-    Ret = new llvm::raw_fd_ostream(OutFile.c_str(), Binary, Error);
+    Ret = new llvm::raw_fd_ostream(OutFile.c_str(), Binary,
+                                   /*Force=*/true, Error);
     if (!Error.empty()) {
       // FIXME: Don't fail this way.
       llvm::cerr << "ERROR: " << Error << "\n";
@@ -2276,7 +2277,8 @@
       }
       std::string ErrStr;
       DependencyOS =
-          new llvm::raw_fd_ostream(DependencyFile.c_str(), false, ErrStr);
+          new llvm::raw_fd_ostream(DependencyFile.c_str(), false,
+                                   /*Force=*/true, ErrStr);
       if (!ErrStr.empty()) {
         // FIXME: Use a proper diagnostic
         llvm::cerr << "unable to open dependency file: " + ErrStr;