[cfe-commits] r122987 - in /cfe/trunk: include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/Driver/apple-kext-mkernel.c
Fariborz Jahanian
fjahanian at apple.com
Thu Jan 6 17:05:02 PST 2011
Author: fjahanian
Date: Thu Jan 6 19:05:02 2011
New Revision: 122987
URL: http://llvm.org/viewvc/llvm-project?rev=122987&view=rev
Log:
Add all options needed to support -fapple-kext. wip.
Added:
cfe/trunk/test/Driver/apple-kext-mkernel.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=122987&r1=122986&r2=122987&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Jan 6 19:05:02 2011
@@ -45,6 +45,7 @@
unsigned ObjCNonFragileABI : 1; // Objective-C modern abi enabled
unsigned ObjCNonFragileABI2 : 1; // Objective-C enhanced modern abi enabled
unsigned ObjCDefaultSynthProperties : 1; // Objective-C auto-synthesized properties.
+ unsigned AppleKext : 1; // Allow apple kext features.
unsigned PascalStrings : 1; // Allow Pascal strings
unsigned WritableStrings : 1; // Allow writable strings
@@ -156,6 +157,7 @@
GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0;
HexFloats = 0;
GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
+ AppleKext = 0;
ObjCDefaultSynthProperties = 0;
NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=122987&r1=122986&r2=122987&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Jan 6 19:05:02 2011
@@ -461,6 +461,8 @@
HelpText<"Enable Objective-C garbage collection">;
def fobjc_gc_only : Flag<"-fobjc-gc-only">,
HelpText<"Use GC exclusively for Objective-C related memory management">;
+def fapple_kext : Flag<"-fapple-kext">,
+ HelpText<"Use apple's kext abi">;
def fobjc_dispatch_method_EQ : Joined<"-fobjc-dispatch-method=">,
HelpText<"Objective-C dispatch method to use">;
def fobjc_default_synthesize_properties : Flag<"-fobjc-default-synthesize-properties">,
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=122987&r1=122986&r2=122987&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 6 19:05:02 2011
@@ -1284,6 +1284,9 @@
}
}
+ if (Args.getLastArg(options::OPT_fapple_kext))
+ CmdArgs.push_back("-fapple-kext");
+
Args.AddLastArg(CmdArgs, options::OPT_fno_show_column);
Args.AddLastArg(CmdArgs, options::OPT_fobjc_sender_dependent_dispatch);
Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_print_source_range_info);
@@ -1321,8 +1324,14 @@
// Forward -f options with positive and negative forms; we translate
// these by hand.
+ if (Args.hasArg(options::OPT_mkernel)) {
+ if (!Args.hasArg(options::OPT_fapple_kext))
+ CmdArgs.push_back("-fapple-kext");
+ if (!Args.hasArg(options::OPT_fbuiltin))
+ CmdArgs.push_back("-fno-builtin");
+ }
// -fbuiltin is default.
- if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin))
+ else if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin))
CmdArgs.push_back("-fno-builtin");
if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
@@ -1519,9 +1528,14 @@
options::OPT_mno_pascal_strings,
false))
CmdArgs.push_back("-fpascal-strings");
-
+
+ if (Args.hasArg(options::OPT_mkernel) ||
+ Args.hasArg(options::OPT_fapple_kext)) {
+ if (!Args.hasArg(options::OPT_fcommon))
+ CmdArgs.push_back("-fno-common");
+ }
// -fcommon is default, only pass non-default.
- if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common))
+ else if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common))
CmdArgs.push_back("-fno-common");
// -fsigned-bitfields is default, and clang doesn't yet support
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=122987&r1=122986&r2=122987&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Jan 6 19:05:02 2011
@@ -639,6 +639,9 @@
Res.push_back("-fobjc-gc-only");
}
}
+ if (Opts.AppleKext)
+ Res.push_back("-fapple-kext");
+
if (Opts.getVisibilityMode() != DefaultVisibility) {
Res.push_back("-fvisibility");
if (Opts.getVisibilityMode() == HiddenVisibility) {
@@ -1351,7 +1354,9 @@
Opts.setGCMode(LangOptions::GCOnly);
else if (Args.hasArg(OPT_fobjc_gc))
Opts.setGCMode(LangOptions::HybridGC);
-
+
+ if (Args.hasArg(OPT_fapple_kext))
+ Opts.AppleKext = 1;
if (Args.hasArg(OPT_print_ivar_layout))
Opts.ObjCGCBitmapPrint = 1;
if (Args.hasArg(OPT_fno_constant_cfstrings))
Added: cfe/trunk/test/Driver/apple-kext-mkernel.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/apple-kext-mkernel.c?rev=122987&view=auto
==============================================================================
--- cfe/trunk/test/Driver/apple-kext-mkernel.c (added)
+++ cfe/trunk/test/Driver/apple-kext-mkernel.c Thu Jan 6 19:05:02 2011
@@ -0,0 +1,6 @@
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -mkernel -### -fsyntax-only %s 2> %t
+// RUN grep "-disable-red-zone" %t
+// RUN grep "-fapple-kext" %t
+// RUN grep "-fno-builtin" %t
+// RUN grep "-fno-rtti" %t
+// RUN grep "-fno-common" %t
More information about the cfe-commits
mailing list