diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-04 01:50:45 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2010-12-04 01:50:45 +0000 |
commit | 31587c86c161f29f5ce6144207a6043edae82c9f (patch) | |
tree | 3eee319f74fd018a3ef88a9e56928422c775f1a1 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | b8e5dd44edd52942c6c291823841369342e8365f (diff) | |
download | bcm5719-llvm-31587c86c161f29f5ce6144207a6043edae82c9f.tar.gz bcm5719-llvm-31587c86c161f29f5ce6144207a6043edae82c9f.zip |
Implement -cl-opt-disable
llvm-svn: 120876
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index b4e676b43ec..8795b38a41c 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/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, |