Move the space in overview output for commands out of each of the
[oota-llvm.git] / tools / llvm-upgrade / llvm-upgrade.cpp
index 64ae5abf9a2a8c1c704a244a0b9bd9c7f290f101..f7af675f4ac695be6a72535742fb4ea3e63d6824 100644 (file)
@@ -19,7 +19,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "ParserInternals.h"
+#include "UpgradeInternals.h"
+#include "llvm/Module.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Streams.h"
@@ -45,12 +46,12 @@ AddAttrs("add-attrs", cl::desc("Add function result and argument attributes"),
          cl::init(false));
 
 static cl::opt<bool>
-Debug("debug", cl::desc("Print debug output from yacc parser"),cl::Hidden,
-    cl::init(false));
+Debug("debug-upgrade-yacc", cl::desc("Print debug output from yacc parser"),
+      cl::Hidden, cl::init(false));
 
 int main(int argc, char **argv) {
   llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
-  cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n");
+  cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
   sys::PrintStackTraceOnErrorSignal();
 
   int exitCode = 0;
@@ -119,7 +120,15 @@ int main(int argc, char **argv) {
       return 1;
     }
 
-    UpgradeAssembly(InputFilename, *In, *Out, Debug, AddAttrs);
+    Module *M = UpgradeAssembly(InputFilename, *In, Debug, AddAttrs);
+    if (!M) {
+      cerr << argv[0] << ": No module returned from assembly parsing\n";
+      *Out << argv[0] << ": parse failed.";
+      exit(1);
+    }
+
+    // Finally, print the module on the output stream.
+    M->print(Out);
 
   } catch (const std::string& caught_message) {
     cerr << argv[0] << ": " << caught_message << "\n";