[llvm-commits] [llvm] r120732 - /llvm/trunk/tools/opt/opt.cpp

Tobias Grosser grosser at fim.uni-passau.de
Thu Dec 2 12:35:16 PST 2010


Author: grosser
Date: Thu Dec  2 14:35:16 2010
New Revision: 120732

URL: http://llvm.org/viewvc/llvm-project?rev=120732&view=rev
Log:
Move check of command line options after command line parsing.

The check to not allow -analyze and -disable-output at the same time was done
before parsing the command line flags. Therefore it never triggered, and in case
both options where used opt segfaulted. Fix this by moving this check a after
command line parsing.

Modified:
    llvm/trunk/tools/opt/opt.cpp

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=120732&r1=120731&r2=120732&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Thu Dec  2 14:35:16 2010
@@ -418,11 +418,6 @@
   sys::PrintStackTraceOnErrorSignal();
   llvm::PrettyStackTraceProgram X(argc, argv);
 
-  if (AnalyzeOnly && NoOutput) {
-    errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
-    return 1;
-  }
-  
   // Enable debug stream buffering.
   EnableDebugBuffering = true;
 
@@ -444,6 +439,11 @@
   cl::ParseCommandLineOptions(argc, argv,
     "llvm .bc -> .bc modular optimizer and analysis printer\n");
 
+  if (AnalyzeOnly && NoOutput) {
+    errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
+    return 1;
+  }
+
   // Allocate a full target machine description only if necessary.
   // FIXME: The choice of target should be controllable on the command line.
   std::auto_ptr<TargetMachine> target;





More information about the llvm-commits mailing list