Clean up indentation.
[oota-llvm.git] / tools / llvm-dis / llvm-dis.cpp
index 2066fffd2904eb343ed9fc19ce866bbd1e6b363d..b8b1a39384cd766dcd7057130e07ce6d48cd5abe 100644 (file)
@@ -18,9 +18,7 @@
 
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
-#include "llvm/PassManager.h"
 #include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -38,7 +36,7 @@ OutputFilename("o", cl::desc("Override output filename"),
                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);
@@ -89,30 +87,24 @@ int main(int argc, char **argv) {
         OutputFilename = IFN+".ll";
     }
   }
-  
+
+  // Make sure that the Out file gets unlinked from the disk if we get a
+  // SIGINT.
+  if (OutputFilename != "-")
+    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
+
   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;
   }
 
-  // Make sure that the Out file gets unlinked from the disk if we get a
-  // SIGINT.
-  if (OutputFilename != "-")
-    sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
   // All that llvm-dis does is write the assembly to a file.
-  if (!DontPrint) {
-    PassManager Passes;
-    Passes.add(createPrintModulePass(Out.get()));
-    Passes.run(*M.get());
-  }
+  if (!DontPrint)
+    *Out << *M;
 
   return 0;
 }