[driver] Add support for -fno-inline.

rdar://10972766

llvm-svn: 152130
This commit is contained in:
Chad Rosier 2012-03-06 18:49:20 +00:00
parent 579e701fd9
commit 806031896d
6 changed files with 34 additions and 3 deletions

View File

@ -496,6 +496,8 @@ def fgnu_keywords : Flag<"-fgnu-keywords">,
HelpText<"Allow GNU-extension keywords regardless of language standard">;
def fgnu89_inline : Flag<"-fgnu89-inline">,
HelpText<"Use the gnu89 inline semantics">;
def fno_inline : Flag<"-fno-inline">,
HelpText<"Disable function inlining">;
def fno_gnu_keywords : Flag<"-fno-gnu-keywords">,
HelpText<"Disallow GNU-extension keywords regardless of language standard">;
def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">,

View File

@ -412,7 +412,7 @@ def fno_eliminate_unused_debug_symbols : Flag<"-fno-eliminate-unused-debug-symbo
def fno_exceptions : Flag<"-fno-exceptions">, Group<f_Group>;
def fno_gnu_keywords : Flag<"-fno-gnu-keywords">, Group<f_Group>;
def fno_inline_functions : Flag<"-fno-inline-functions">, Group<clang_ignored_f_Group>;
def fno_inline : Flag<"-fno-inline">, Group<clang_ignored_f_Group>;
def fno_inline : Flag<"-fno-inline">;
def fno_keep_inline_functions : Flag<"-fno-keep-inline-functions">, Group<clang_ignored_f_Group>;
def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">, Group<f_Group>;
def fno_limit_debug_info : Flag<"-fno-limit-debug-info">, Group<f_Group>,

View File

@ -2138,6 +2138,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
false))
CmdArgs.push_back("-fgnu89-inline");
if (Args.hasArg(options::OPT_fno_inline))
CmdArgs.push_back("-fno-inline");
// -fobjc-nonfragile-abi=0 is default.
ObjCRuntime objCRuntime;
unsigned objcABIVersion = 0;

View File

@ -1096,6 +1096,9 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
// We must always run at least the always inlining pass.
Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
: CodeGenOptions::OnlyAlwaysInlining;
// -fno-inline overrides OptimizationLevel > 1.
Opts.Inlining = Args.hasArg(OPT_fno_inline) ?
CodeGenOptions::OnlyAlwaysInlining : Opts.Inlining;
Opts.DebugInfo = Args.hasArg(OPT_g);
Opts.LimitDebugInfo = !Args.hasArg(OPT_fno_limit_debug_info)
@ -1915,8 +1918,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
// optimization level and -fno-inline, not actually whether the backend has
// inlining enabled.
//
// FIXME: This is affected by other options (-fno-inline).
Opts.NoInline = !Opt;
Opts.NoInline = !Opt || Args.hasArg(OPT_fno_inline);
Opts.FastMath = Args.hasArg(OPT_ffast_math);

View File

@ -0,0 +1,14 @@
// Make sure -fno-inline is behaving correctly.
// rdar://10972766
// RUN: %clang_cc1 -O3 -fno-inline -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
int dont_inline_me(int a, int b) { return(a+b); }
volatile int *pa = (int*) 0x1000;
void foo() {
// NOINLINE: @foo
// NOINLINE: dont_inline_me
pa[0] = dont_inline_me(pa[1],pa[2]);
}

View File

@ -0,0 +1,10 @@
// Make sure the driver is correctly passing -fno-inline
// rdar://10972766
// RUN: %clang -target x86_64-apple-darwin10 \
// RUN: -fno-inline -### -fsyntax-only %s 2> %t
// RUN: FileCheck --check-prefix=CHECK < %t %s
// CHECK: clang
// CHECK: "-fno-inline"