Add all options needed to support -fapple-kext. wip.
llvm-svn: 122987
This commit is contained in:
parent
dd47216cc4
commit
a4cfff87b9
|
@ -45,6 +45,7 @@ public:
|
|||
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 @@ public:
|
|||
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;
|
||||
|
|
|
@ -461,6 +461,8 @@ def fobjc_gc : Flag<"-fobjc-gc">,
|
|||
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">,
|
||||
|
|
|
@ -1284,6 +1284,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// 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,
|
||||
|
@ -1520,8 +1529,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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
|
||||
|
|
|
@ -639,6 +639,9 @@ static void LangOptsToArgs(const LangOptions &Opts,
|
|||
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) {
|
||||
|
@ -1352,6 +1355,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
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))
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue