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.

llvm-svn: 120732
This commit is contained in:
Tobias Grosser 2010-12-02 20:35:16 +00:00
parent 5a94ed2d67
commit a4ebf65d00

View File

@ -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;