summaryrefslogtreecommitdiff
path: root/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2010-12-02 20:35:16 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2010-12-02 20:35:16 +0000
commit7593f34d67f1f88bd09960dd92041d89de85a873 (patch)
tree6278aee3ac93ff7ab6bde424a14a58d8e3953e0f /tools/opt/opt.cpp
parent7ece6027a9934c7282a42303e88458cfa6ad7b1e (diff)
downloadllvm-7593f34d67f1f88bd09960dd92041d89de85a873.tar.gz
llvm-7593f34d67f1f88bd09960dd92041d89de85a873.tar.bz2
llvm-7593f34d67f1f88bd09960dd92041d89de85a873.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r--tools/opt/opt.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 269b936c24..2b6109f2bc 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -418,11 +418,6 @@ int main(int argc, char **argv) {
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 @@ int main(int argc, char **argv) {
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;