[cfe-commits] [PATCH] Add -fobjc-direct-class-refs

John McCall rjmccall at apple.com
Sat May 19 12:34:14 PDT 2012

On May 19, 2012, at 11:38 AM, Jonathan Schleifer wrote:
> Here is an improved version, please use this. The old one did not override the current default behaviour for all GNU runtimes to use the latest ABI version which is not implemented by anything besides GNUstep - it's actually not a GNU ABI anymore, but a GNUstep ABI. This should really be changed to a sane default and only enabled when using -fgnustep-runtime, which should be done similarly to how I did -fobjfw-runtime now.

This is a lot better, thanks.

Two critiques:

--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -81,6 +81,7 @@ LANGOPT(TraditionalCPP    , 1, 0, "traditional CPP emulation")
 LANGOPT(RTTI              , 1, 1, "run-time type information")
 LANGOPT(MSBitfields       , 1, 0, "Microsoft-compatible structure layout")
 LANGOPT(NeXTRuntime       , 1, 1, "NeXT Objective-C runtime")
+LANGOPT(ObjFWRuntime      , 1, 0, "ObjFW runtime")
 LANGOPT(Freestanding, 1, 0, "freestanding implementation")
 LANGOPT(NoBuiltin         , 1, 0, "disable builtin functions")

Let's go ahead and future-proof this into a single, enumerated field, with
isNeXTRuntime() and isGNURuntime() convenience accessors.
You'll need to introduce an 'ObjCRuntimeKind' enum.

--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -416,6 +416,7 @@ def fgnu89_inline : Flag<"-fgnu89-inline">, Group<f_Group>, Flags<[CC1Option]>,
 def fno_gnu89_inline : Flag<"-fno-gnu89-inline">, Group<f_Group>;
 def fgnu_runtime : Flag<"-fgnu-runtime">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Generate output compatible with the standard GNU Objective-C runtime">;
+def fobjfw_runtime: Flag<"-fobjfw-runtime">, Group<f_Group>, Flags<[CC1Option]>;
 def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">, Flags<[CC1Option]>;
 def filelist : Separate<"-filelist">, Flags<[LinkerInput]>;
 def findirect_virtual_calls : Flag<"-findirect-virtual-calls">, Alias<fapple_kext>;

Similarly, I think this is a good point at which to adopt a single -fobjc-runtime=<foo>
flag instead of having separate arguments for each new runtime.

I apologize that this means significantly more work for you;  it's always
awkward being the one forcing a generalization.


More information about the cfe-commits mailing list