aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-11-15 20:40:58 +0000
committerAlp Toker <alp@nuanti.com>2013-11-15 20:40:58 +0000
commit7874bdc6c1429b11cbb6d7e38e884f25264260fb (patch)
tree4e5c0bebd77e3af1bdc6106695e2aa6e11380551 /clang/lib/Frontend/CompilerInvocation.cpp
parent15ba1e20db232854a65f6b385a0368151596051f (diff)
downloadllvm-7874bdc6c1429b11cbb6d7e38e884f25264260fb.zip
llvm-7874bdc6c1429b11cbb6d7e38e884f25264260fb.tar.gz
llvm-7874bdc6c1429b11cbb6d7e38e884f25264260fb.tar.bz2
Revert "Using an invalid -O falls back on -O3 instead of an error"
Trying to fix test failures since earlier today. One of the tests added in this commit is outputting test/Driver/clang_f_opts.s which the builders that build in-tree (eg. clang-native-arm-cortex-a9) are trying to run as a test case, causing failures. clang_f_opts.c: If -### doesn't emit the warning then this test probably shouldn't be in here in the first place. Frontend maybe? invalid-o-level.c: Running %clang_cc1 in the Driver tests doesn't make sense because -cc1 bypasses the driver. (I'm not reverting the commit that introduced this but please fix instead of keeping it this way.) Reverting to fix the build failures and also so that the tests can be thought out more thoroughly. This reverts commit r194817. llvm-svn: 194845
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index f5079dd..581d56d 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/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_optimization_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(