[llvm-commits] [llvm] r79990 - in /llvm/trunk: examples/BrainF/ include/llvm/Support/ lib/Analysis/ lib/Bitcode/Writer/ lib/Support/ tools/bugpoint/ tools/gold/ tools/llc/ tools/llvm-as/ tools/llvm-dis/ tools/llvm-extract/ tools/llvm-ld/ tools/llvm-link/ tools/llvm-mc/ tools/lto/ tools/opt/ utils/FileUpdate/ utils/TableGen/

Dan Gohman gohman at apple.com
Tue Aug 25 08:34:52 PDT 2009


Author: djg
Date: Tue Aug 25 10:34:52 2009
New Revision: 79990

URL: http://llvm.org/viewvc/llvm-project?rev=79990&view=rev
Log:
Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.

Modified:
    llvm/trunk/examples/BrainF/BrainFDriver.cpp
    llvm/trunk/include/llvm/Support/GraphWriter.h
    llvm/trunk/include/llvm/Support/raw_ostream.h
    llvm/trunk/lib/Analysis/CFGPrinter.cpp
    llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
    llvm/trunk/lib/Support/raw_ostream.cpp
    llvm/trunk/tools/bugpoint/ExtractFunction.cpp
    llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
    llvm/trunk/tools/bugpoint/ToolRunner.cpp
    llvm/trunk/tools/gold/gold-plugin.cpp
    llvm/trunk/tools/llc/llc.cpp
    llvm/trunk/tools/llvm-as/llvm-as.cpp
    llvm/trunk/tools/llvm-dis/llvm-dis.cpp
    llvm/trunk/tools/llvm-extract/llvm-extract.cpp
    llvm/trunk/tools/llvm-ld/llvm-ld.cpp
    llvm/trunk/tools/llvm-link/llvm-link.cpp
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp
    llvm/trunk/tools/opt/GraphPrinters.cpp
    llvm/trunk/tools/opt/opt.cpp
    llvm/trunk/utils/FileUpdate/FileUpdate.cpp
    llvm/trunk/utils/TableGen/TableGen.cpp

Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original)
+++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Tue Aug 25 10:34:52 2009
@@ -110,7 +110,6 @@
     if (OutputFilename != "-") {
       std::string ErrInfo;
       out = new raw_fd_ostream(OutputFilename.c_str(), ErrInfo,
-                               raw_fd_ostream::F_Force|
                                raw_fd_ostream::F_Binary);
     }
   }

Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Tue Aug 25 10:34:52 2009
@@ -274,7 +274,7 @@
   errs() << "Writing '" << Filename.str() << "'... ";
 
   std::string ErrorInfo;
-  raw_fd_ostream O(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force);
+  raw_fd_ostream O(Filename.c_str(), ErrorInfo);
 
   if (ErrorInfo.empty()) {
     WriteGraph(O, G, ShortNames, Name, Title);

Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 25 10:34:52 2009
@@ -328,18 +328,17 @@
 public:
   
   enum {
-    /// F_Force - When opening a file, this flag makes raw_fd_ostream overwrite
-    /// a file if it already exists instead of emitting an error.   This may not
-    /// be specified with F_Append.
-    F_Force  = 1,
+    /// F_Excl - When opening a file, this flag makes raw_fd_ostream
+    /// report an error if the file already exists.
+    F_Excl  = 1,
 
     /// F_Append - When opening a file, if it already exists append to the
     /// existing file instead of returning an error.  This may not be specified
-    /// with F_Force.
+    /// with F_Excl.
     F_Append = 2,
 
     /// F_Binary - The file should be opened in binary mode on platforms that
-    /// support this distinction.
+    /// make this distinction.
     F_Binary = 4
   };
   

Modified: llvm/trunk/lib/Analysis/CFGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFGPrinter.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/CFGPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/CFGPrinter.cpp Tue Aug 25 10:34:52 2009
@@ -138,7 +138,7 @@
       errs() << "Writing '" << Filename << "'...";
       
       std::string ErrorInfo;
-      raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force);
+      raw_fd_ostream File(Filename.c_str(), ErrorInfo);
 
       if (ErrorInfo.empty())
         WriteGraph(File, (const Function*)&F);
@@ -170,7 +170,7 @@
       errs() << "Writing '" << Filename << "'...";
 
       std::string ErrorInfo;
-      raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force);
+      raw_fd_ostream File(Filename.c_str(), ErrorInfo);
       
       if (ErrorInfo.empty())
         WriteGraph(File, (const Function*)&F, true);

Modified: llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp Tue Aug 25 10:34:52 2009
@@ -18,7 +18,7 @@
 int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
   std::string ErrorInfo;
   raw_fd_ostream OS(Path, ErrorInfo,
-                    raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                    raw_fd_ostream::F_Binary);
   
   if (!ErrorInfo.empty())
     return -1;

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 25 10:34:52 2009
@@ -335,9 +335,9 @@
 /// if no error occurred.
 raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
                                unsigned Flags) : pos(0) {
-  // Verify that we don't have both "append" and "force".
-  assert((!(Flags & F_Force) || !(Flags & F_Append)) &&
-         "Cannot specify both 'force' and 'append' file creation flags!");
+  // Verify that we don't have both "append" and "excl".
+  assert((!(Flags & F_Excl) || !(Flags & F_Append)) &&
+         "Cannot specify both 'excl' and 'append' file creation flags!");
   
   ErrorInfo.clear();
 
@@ -358,11 +358,11 @@
     OpenFlags |= O_BINARY;
 #endif
   
-  if (Flags & F_Force)
-    OpenFlags |= O_TRUNC;
-  else if (Flags & F_Append)
+  if (Flags & F_Append)
     OpenFlags |= O_APPEND;
   else
+    OpenFlags |= O_TRUNC;
+  if (Flags & F_Excl)
     OpenFlags |= O_EXCL;
   
   FD = open(Filename, OpenFlags, 0664);

Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Tue Aug 25 10:34:52 2009
@@ -337,8 +337,7 @@
   sys::RemoveFileOnSignal(uniqueFilename);
 
   std::string ErrorInfo;
-  raw_fd_ostream BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo,
-                                        raw_fd_ostream::F_Force);
+  raw_fd_ostream BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo);
   if (!ErrorInfo.empty()) {
     outs() << "*** Basic Block extraction failed!\n";
     errs() << "Error writing list of blocks to not extract: " << ErrorInfo

Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Tue Aug 25 10:34:52 2009
@@ -53,7 +53,7 @@
                                    Module *M) const {
   std::string ErrInfo;
   raw_fd_ostream Out(Filename.c_str(), ErrInfo,
-                     raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                     raw_fd_ostream::F_Binary);
   if (!ErrInfo.empty()) return true;
   
   WriteBitcodeToFile(M ? M : Program, Out);
@@ -85,7 +85,7 @@
 int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
   std::string ErrInfo;
   raw_fd_ostream OutFile(ChildOutput.c_str(), ErrInfo,
-                         raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                         raw_fd_ostream::F_Binary);
   if (!ErrInfo.empty()) {
     errs() << "Error opening bitcode file: " << ChildOutput << "\n";
     return 1;
@@ -148,7 +148,7 @@
   
   std::string ErrInfo;
   raw_fd_ostream InFile(inputFilename.c_str(), ErrInfo,
-                        raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                        raw_fd_ostream::F_Binary);
   
   
   if (!ErrInfo.empty()) {

Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Tue Aug 25 10:34:52 2009
@@ -368,7 +368,6 @@
 
   LLCArgs.push_back ("-o");
   LLCArgs.push_back (OutputAsmFile.c_str()); // Output to the Asm file
-  LLCArgs.push_back ("-f");                  // Overwrite as necessary...
   LLCArgs.push_back (Bitcode.c_str());      // This is the input bitcode
   LLCArgs.push_back (0);
 

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Tue Aug 25 10:34:52 2009
@@ -364,7 +364,7 @@
   }
   raw_fd_ostream *objFile = 
     new raw_fd_ostream(uniqueObjPath.c_str(), ErrMsg,
-                       raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                       raw_fd_ostream::F_Binary);
   if (!ErrMsg.empty()) {
     delete objFile;
     (*message)(LDPL_ERROR, "%s", ErrMsg.c_str());

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Tue Aug 25 10:34:52 2009
@@ -55,7 +55,8 @@
 static cl::opt<std::string>
 OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
 
-static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
+static cl::opt<bool>
+Force("f", cl::desc("Enable binary output on terminals"));
 
 // Determine optimization level.
 static cl::opt<char>
@@ -139,12 +140,9 @@
     std::string error;
     raw_fd_ostream *FDOut =
       new raw_fd_ostream(OutputFilename.c_str(), error,
-                         (Force ? raw_fd_ostream::F_Force : 0)|
                          raw_fd_ostream::F_Binary);
     if (!error.empty()) {
       errs() << error << '\n';
-      if (!Force)
-        errs() << "Use -f command line argument to force output\n";
       delete FDOut;
       return 0;
     }
@@ -190,14 +188,11 @@
 
   std::string error;
   unsigned OpenFlags = 0;
-  if (Force) OpenFlags |= raw_fd_ostream::F_Force;
   if (Binary) OpenFlags |= raw_fd_ostream::F_Binary;
   raw_fd_ostream *FDOut = new raw_fd_ostream(OutputFilename.c_str(), error,
                                              OpenFlags);
   if (!error.empty()) {
     errs() << error << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     delete FDOut;
     return 0;
   }

Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/trunk/tools/llvm-as/llvm-as.cpp Tue Aug 25 10:34:52 2009
@@ -38,7 +38,7 @@
                cl::value_desc("filename"));
 
 static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::opt<bool>
 DisableOutput("disable-output", cl::desc("Disable output"), cl::init(false));
@@ -98,12 +98,9 @@
   std::string ErrorInfo;
   std::auto_ptr<raw_ostream> Out
   (new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                      (Force?raw_fd_ostream::F_Force : 0) |
                       raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     return 1;
   }
   

Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
+++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Tue Aug 25 10:34:52 2009
@@ -38,7 +38,7 @@
                cl::value_desc("filename"));
 
 static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::opt<bool>
 DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
@@ -93,12 +93,9 @@
   std::string ErrorInfo;
   std::auto_ptr<raw_fd_ostream> 
   Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                         (Force?raw_fd_ostream::F_Force : 0) |
                          raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     return 1;
   }
 

Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
+++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Tue Aug 25 10:34:52 2009
@@ -23,6 +23,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/SystemUtils.h"
 #include "llvm/System/Signals.h"
 #include <memory>
 using namespace llvm;
@@ -37,7 +38,7 @@
                cl::value_desc("filename"), cl::init("-"));
 
 static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::opt<bool>
 DeleteFn("delete", cl::desc("Delete specified Globals from Module"));
@@ -113,16 +114,15 @@
   std::string ErrorInfo;
   std::auto_ptr<raw_fd_ostream>
   Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                         raw_fd_ostream::F_Binary |
-                         (Force ? raw_fd_ostream::F_Force : 0)));
+                         raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     return 1;
   }
 
-  Passes.add(createBitcodeWriterPass(*Out));
+  if (Force || !CheckBitcodeOutputToConsole(*Out, true))
+    Passes.add(createBitcodeWriterPass(*Out));
+
   Passes.run(*M.get());
 
   return 0;

Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Tue Aug 25 10:34:52 2009
@@ -12,7 +12,7 @@
 // Additionally, this program outputs a shell script that is used to invoke LLI
 // to execute the program.  In this manner, the generated executable (a.out for
 // example), is directly executable, whereas the bitcode file actually lives in
-// the a.out.bc file generated by this program.  Also, Force is on by default.
+// the a.out.bc file generated by this program.
 //
 // Note that if someone (or a script) deletes the executable program generated,
 // the .bc file will be left around.  Considering that this is a temporary hack,
@@ -231,7 +231,7 @@
   // Create the output file.
   std::string ErrorInfo;
   raw_fd_ostream Out(FileName.c_str(), ErrorInfo,
-                     raw_fd_ostream::F_Force | raw_fd_ostream::F_Binary);
+                     raw_fd_ostream::F_Binary);
   if (!ErrorInfo.empty())
     PrintAndExit(ErrorInfo);
 
@@ -428,8 +428,7 @@
 
   // Output the script to start the program...
   std::string ErrorInfo;
-  raw_fd_ostream Out2(OutputFilename.c_str(), ErrorInfo,
-                      llvm::raw_fd_ostream::F_Force);
+  raw_fd_ostream Out2(OutputFilename.c_str(), ErrorInfo);
   if (!ErrorInfo.empty())
     PrintAndExit(ErrorInfo);
 

Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/trunk/tools/llvm-link/llvm-link.cpp Tue Aug 25 10:34:52 2009
@@ -22,6 +22,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/SystemUtils.h"
 #include "llvm/System/Signals.h"
 #include "llvm/System/Path.h"
 #include <memory>
@@ -35,7 +36,8 @@
 OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
                cl::value_desc("filename"));
 
-static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
+static cl::opt<bool>
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::opt<bool>
 Verbose("v", cl::desc("Print information about actions taken"));
@@ -122,12 +124,9 @@
   std::string ErrorInfo;
   std::auto_ptr<raw_ostream> 
   Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                         raw_fd_ostream::F_Binary |
-                         (Force ? raw_fd_ostream::F_Force : 0)));
+                         raw_fd_ostream::F_Binary));
   if (!ErrorInfo.empty()) {
     errs() << ErrorInfo << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     return 1;
   }
 
@@ -142,7 +141,8 @@
   }
 
   if (Verbose) errs() << "Writing bitcode...\n";
-  WriteBitcodeToFile(Composite.get(), *Out);
+  if (Force || !CheckBitcodeOutputToConsole(*Out, true))
+    WriteBitcodeToFile(Composite.get(), *Out);
 
   return 0;
 }

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Aug 25 10:34:52 2009
@@ -53,7 +53,7 @@
        clEnumValEnd));
 
 static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::list<std::string>
 IncludeDirs("I", cl::desc("Directory of include files"),
@@ -184,12 +184,9 @@
 
   std::string Err;
   raw_fd_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), Err,
-                                           raw_fd_ostream::F_Binary |
-                                         (Force ? raw_fd_ostream::F_Force : 0));
+                                           raw_fd_ostream::F_Binary);
   if (!Err.empty()) {
     errs() << Err << '\n';
-    if (!Force)
-      errs() << "Use -f command line argument to force output\n";
     delete Out;
     return 0;
   }

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Tue Aug 25 10:34:52 2009
@@ -148,7 +148,7 @@
   // create output file
   std::string ErrInfo;
   raw_fd_ostream Out(path, ErrInfo,
-                     raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                     raw_fd_ostream::F_Binary);
   if (!ErrInfo.empty()) {
     errMsg = "could not open bitcode file for writing: ";
     errMsg += path;
@@ -179,8 +179,7 @@
     // generate assembly code
     bool genResult = false;
     {
-      raw_fd_ostream asmFD(uniqueAsmPath.c_str(), errMsg,
-                           raw_fd_ostream::F_Force);
+      raw_fd_ostream asmFD(uniqueAsmPath.c_str(), errMsg);
       formatted_raw_ostream asmFile(asmFD);
       if (!errMsg.empty())
         return NULL;

Modified: llvm/trunk/tools/opt/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/GraphPrinters.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/opt/GraphPrinters.cpp (original)
+++ llvm/trunk/tools/opt/GraphPrinters.cpp Tue Aug 25 10:34:52 2009
@@ -29,7 +29,7 @@
   std::string Filename = GraphName + ".dot";
   O << "Writing '" << Filename << "'...";
   std::string ErrInfo;
-  raw_fd_ostream F(Filename.c_str(), ErrInfo, raw_fd_ostream::F_Force);
+  raw_fd_ostream F(Filename.c_str(), ErrInfo);
 
   if (ErrInfo.empty())
     WriteGraph(F, GT);

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Aug 25 10:34:52 2009
@@ -55,7 +55,7 @@
                cl::value_desc("filename"), cl::init("-"));
 
 static cl::opt<bool>
-Force("f", cl::desc("Overwrite output files"));
+Force("f", cl::desc("Enable binary output on terminals"));
 
 static cl::opt<bool>
 PrintEachXForm("p", cl::desc("Print module after each transformation"));
@@ -367,12 +367,9 @@
     if (OutputFilename != "-") {
       std::string ErrorInfo;
       Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
-                               raw_fd_ostream::F_Binary |
-                               (Force ? raw_fd_ostream::F_Force : 0));
+                               raw_fd_ostream::F_Binary);
       if (!ErrorInfo.empty()) {
         errs() << ErrorInfo << '\n';
-        if (!Force)
-          errs() << "Use -f command line argument to force output\n";
         delete Out;
         return 1;
       }

Modified: llvm/trunk/utils/FileUpdate/FileUpdate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileUpdate/FileUpdate.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/utils/FileUpdate/FileUpdate.cpp (original)
+++ llvm/trunk/utils/FileUpdate/FileUpdate.cpp Tue Aug 25 10:34:52 2009
@@ -66,7 +66,7 @@
     outs() << argv[0] << ": Updating '" << OutputFilename
            << "', contents changed.\n";
   raw_fd_ostream OutStream(OutputFilename.c_str(), ErrorStr,
-                           raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+                           raw_fd_ostream::F_Binary);
   if (!ErrorStr.empty()) {
     errs() << argv[0] << ": Unable to write output '"
            << OutputFilename << "': " << ErrorStr << '\n';

Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=79990&r1=79989&r2=79990&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Tue Aug 25 10:34:52 2009
@@ -171,8 +171,7 @@
   raw_ostream *Out = &outs();
   if (OutputFilename != "-") {
     std::string Error;
-    Out = new raw_fd_ostream(OutputFilename.c_str(), Error,
-                             raw_fd_ostream::F_Force);
+    Out = new raw_fd_ostream(OutputFilename.c_str(), Error);
 
     if (!Error.empty()) {
       errs() << argv[0] << ": error opening " << OutputFilename 





More information about the llvm-commits mailing list