diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2012-02-06 00:40:31 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2012-02-06 00:40:31 +0000 |
commit | e6cc51d9d7100d2d3e3ba48b476ab86fa1feca82 (patch) | |
tree | ea5730afba76b0d208e81a420f55d36ac8d6956b /lib/Frontend/CompilerInvocation.cpp | |
parent | 96ad633771182c54b5b62fa4be23f866ed0beb15 (diff) |
Invalid O levels on the command line no longer have a confusing error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 7876bcb243..8417aa48c0 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1076,13 +1076,14 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, using namespace cc1options; bool Success = true; - Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags); - if (Opts.OptimizationLevel > 3) { + unsigned OptLevel = getOptimizationLevel(Args, IK, Diags); + if (OptLevel > 3) { Diags.Report(diag::err_drv_invalid_value) - << Args.getLastArg(OPT_O)->getAsString(Args) << Opts.OptimizationLevel; - Opts.OptimizationLevel = 3; + << Args.getLastArg(OPT_O)->getAsString(Args) << OptLevel; + OptLevel = 3; Success = false; } + Opts.OptimizationLevel = OptLevel; // We must always run at least the always inlining pass. Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining |