[cfe-commits] r152861 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/noinline.c test/Driver/noinline.c
Chad Rosier
mcrosier at apple.com
Thu Mar 15 15:31:42 PDT 2012
Author: mcrosier
Date: Thu Mar 15 17:31:42 2012
New Revision: 152861
URL: http://llvm.org/viewvc/llvm-project?rev=152861&view=rev
Log:
[frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matches
the behavior of gcc with respect to the -fno-inline and -fno-inline-functions
flags.
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/noinline.c
cfe/trunk/test/Driver/noinline.c
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Mar 15 17:31:42 2012
@@ -516,6 +516,8 @@
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 use of inline keyword">;
def fno_inline_functions : Flag<"-fno-inline-functions">,
HelpText<"Disable automatic function inlining">;
def fno_gnu_keywords : Flag<"-fno-gnu-keywords">,
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Mar 15 17:31:42 2012
@@ -420,7 +420,7 @@
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<f_Group>;
-def fno_inline : Flag<"-fno-inline">, Group<clang_ignored_f_Group>;
+def fno_inline : Flag<"-fno-inline">, Group<f_Group>;
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>,
Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Thu Mar 15 17:31:42 2012
@@ -78,8 +78,8 @@
unsigned NoGlobalMerge : 1; /// Set when -mno-global-merge is enabled.
unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not +-Inf.
- unsigned NoInline : 1; /// Set when -fno-inline-functions is enabled.
- /// Disables use of inline keyword.
+ unsigned NoInline : 1; /// Set when -fno-inline is enabled. Disables
+ /// use of the inline keyword.
unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN.
unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 15 17:31:42 2012
@@ -2173,6 +2173,9 @@
false))
CmdArgs.push_back("-fgnu89-inline");
+ if (Args.hasArg(options::OPT_fno_inline))
+ CmdArgs.push_back("-fno-inline");
+
if (Args.hasArg(options::OPT_fno_inline_functions))
CmdArgs.push_back("-fno-inline-functions");
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Mar 15 17:31:42 2012
@@ -1165,9 +1165,9 @@
Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
: CodeGenOptions::OnlyAlwaysInlining;
// -fno-inline-functions overrides OptimizationLevel > 1.
- Opts.NoInline = Args.hasArg(OPT_fno_inline_functions);
- Opts.Inlining = Opts.NoInline ? CodeGenOptions::OnlyAlwaysInlining :
- Opts.Inlining;
+ Opts.NoInline = Args.hasArg(OPT_fno_inline);
+ Opts.Inlining = Args.hasArg(OPT_fno_inline_functions) ?
+ CodeGenOptions::OnlyAlwaysInlining : Opts.Inlining;
Opts.DebugInfo = Args.hasArg(OPT_g);
Opts.LimitDebugInfo = !Args.hasArg(OPT_fno_limit_debug_info)
@@ -2012,9 +2012,7 @@
// This is the __NO_INLINE__ define, which just depends on things like the
// optimization level and -fno-inline, not actually whether the backend has
// inlining enabled.
- //
- // FIXME: This is affected by other options (-fno-inline).
- Opts.NoInlineDefine = !Opt;
+ Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
Opts.FastMath = Args.hasArg(OPT_ffast_math);
Modified: cfe/trunk/test/CodeGen/noinline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/noinline.c?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/noinline.c (original)
+++ cfe/trunk/test/CodeGen/noinline.c Thu Mar 15 17:31:42 2012
@@ -1,7 +1,7 @@
// Make sure -fno-inline-functions is behaving correctly.
// rdar://10972766
-// RUN: %clang_cc1 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -O3 -fno-inline -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
inline int dont_inline_me(int a, int b) { return(a+b); }
Modified: cfe/trunk/test/Driver/noinline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/noinline.c?rev=152861&r1=152860&r2=152861&view=diff
==============================================================================
--- cfe/trunk/test/Driver/noinline.c (original)
+++ cfe/trunk/test/Driver/noinline.c Thu Mar 15 17:31:42 2012
@@ -2,8 +2,9 @@
// rdar://10972766
// RUN: %clang -target x86_64-apple-darwin10 \
-// RUN: -fno-inline-functions -### -fsyntax-only %s 2> %t
+// RUN: -fno-inline -fno-inline-functions -### -fsyntax-only %s 2> %t
// RUN: FileCheck --check-prefix=CHECK < %t %s
// CHECK: clang
+// CHECK: "-fno-inline"
// CHECK: "-fno-inline-functions"
More information about the cfe-commits
mailing list