aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2010-12-04 01:50:45 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2010-12-04 01:50:45 +0000
commit61e07861dd3a70c31f658bad8c4b911994e4933b (patch)
treefe32a5b933990be2cf6d7b0743577e4d52668232 /lib/Frontend/CompilerInvocation.cpp
parent0a3c03cb1fbc1f84f851d6ad642d22b978b031fd (diff)
Implement -cl-opt-disable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120876 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--lib/Frontend/CompilerInvocation.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index b4e676b43e..8795b38a41 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -774,8 +774,12 @@ using namespace clang::driver::cc1options;
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
Diagnostic &Diags) {
+ unsigned DefaultOpt = 0;
+ if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
+ DefaultOpt = 2;
// -Os implies -O2
- return Args.hasArg(OPT_Os) ? 2 : Args.getLastArgIntValue(OPT_O, 0, Diags);
+ return Args.hasArg(OPT_Os) ? 2 :
+ Args.getLastArgIntValue(OPT_O, DefaultOpt, Diags);
}
static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,