Invalid O levels on the command line no longer have a confusing error.

llvm-svn: 149852
This commit is contained in:
Aaron Ballman
2012-02-06 00:40:31 +00:00
parent 40d79093d9
commit 746c62bf88
2 changed files with 9 additions and 4 deletions

View File

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