diff options
author | Sylvestre Ledru <sylvestre@debian.org> | 2013-11-11 20:51:44 +0000 |
---|---|---|
committer | Sylvestre Ledru <sylvestre@debian.org> | 2013-11-11 20:51:44 +0000 |
commit | 849f3ececee1293371bc0930fcb74b0a44f22c98 (patch) | |
tree | b2f4770031eacad0b92bec7b9d327f04d0b82264 /lib/Frontend/CompilerInvocation.cpp | |
parent | 51a0ab82d98a1a8c1c03ca8699e1253613a241bb (diff) | |
download | clang-849f3ececee1293371bc0930fcb74b0a44f22c98.tar.gz |
Revert "Using an invalid -O falls back on -O3 instead of an error"
This reverts commit r194403.
Was breaking too many tests...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194420 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index d02e4a3e98..98745aca68 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -299,14 +299,14 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, using namespace options; bool Success = true; - Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags); - unsigned MaxOptLevel = 3; - if (Opts.OptimizationLevel > MaxOptLevel) { - // If the optimization level is not supported, fall back on the default optimization - Diags.Report(diag::warn_drv_invalid_value) - << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel; - Opts.OptimizationLevel = MaxOptLevel; + unsigned OptLevel = getOptimizationLevel(Args, IK, Diags); + if (OptLevel > 3) { + Diags.Report(diag::err_drv_invalid_value) + << 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.setInlining( |