summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-05-24 20:40:51 +0000
committerHans Wennborg <hans@hanshq.net>2016-05-24 20:40:51 +0000
commit7a00888a08fa68212a5679263c8f82313fa036ea (patch)
treee23b6810f2594c10b8e81e46dce8c7021632f3fb /clang/lib/Frontend/CompilerInvocation.cpp
parent042975183e8f6e970d12195588b27b67560a9712 (diff)
downloadbcm5719-llvm-7a00888a08fa68212a5679263c8f82313fa036ea.tar.gz
bcm5719-llvm-7a00888a08fa68212a5679263c8f82313fa036ea.zip
[Driver] Add support for -finline-functions and /Ob2 flags
-finline-functions and /Ob2 are currently ignored by Clang. The only way to enable inlining is to use the global O flags, which also enable other options, or to emit LLVM bitcode using Clang, then running opt by hand with the inline pass. This patch allows to simply use the -finline-functions flag (same as GCC) or /Ob2 in clang-cl mode to enable inlining without other optimizations. This is the first patch of a serie to improve support for the /Ob flags. Patch by Rudy Pons <rudy.pons@ilod.org>! Differential Revision: http://reviews.llvm.org/D20576 llvm-svn: 270609
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 852801ab240..aa1c5a04f5b 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -441,8 +441,12 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
: CodeGenOptions::OnlyAlwaysInlining);
// -fno-inline-functions overrides OptimizationLevel > 1.
Opts.NoInline = Args.hasArg(OPT_fno_inline);
- Opts.setInlining(Args.hasArg(OPT_fno_inline_functions) ?
- CodeGenOptions::OnlyAlwaysInlining : Opts.getInlining());
+ if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions,
+ options::OPT_fno_inline_functions)) {
+ Opts.setInlining(
+ InlineArg->getOption().matches(options::OPT_finline_functions) ?
+ CodeGenOptions::NormalInlining : CodeGenOptions::OnlyAlwaysInlining);
+ }
if (Arg *A = Args.getLastArg(OPT_fveclib)) {
StringRef Name = A->getValue();
OpenPOWER on IntegriCloud