]> granicus.if.org Git - clang/commitdiff
Driver/Frontend: Add support for -fobjc-legacy-dispatch, not yet used.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 21:07:25 +0000 (21:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 21:07:25 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95004 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/CodeGen/CodeGenOptions.h
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp

index 8682715ce552d36ec586888f71f4d7ca973b2c31..e1d4ad1b1cce75438753420a4f6312a088459e40 100644 (file)
@@ -41,6 +41,8 @@ public:
   unsigned NoCommon          : 1; /// Set when -fno-common or C++ is enabled.
   unsigned NoImplicitFloat   : 1; /// Set when -mno-implicit-float is enabled.
   unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
+  unsigned ObjCLegacyDispatch: 1; /// Use legacy Objective-C dispatch, even with
+                                  /// 2.0 runtime.
   unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
   unsigned OptimizeSize      : 1; /// If -Os is specified.
   unsigned SoftFloat         : 1; /// -soft-float.
@@ -90,12 +92,13 @@ public:
     NoCommon = 0;
     NoImplicitFloat = 0;
     NoZeroInitializedInBSS = 0;
+    ObjCLegacyDispatch = 0;
     OptimizationLevel = 0;
     OptimizeSize = 0;
-    UnrollLoops = 0;
     SoftFloat = 0;
     TimePasses = 0;
     UnitAtATime = 1;
+    UnrollLoops = 0;
     UnwindTables = 0;
     VerifyModule = 1;
 
index 6d8ec114c1fbbae39117d73f8c6516f9f6270ff3..6fb1b5ec646ecc91db477e579833fd9cd29cfa15 100644 (file)
@@ -347,6 +347,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 fobjc_legacy_dispatch : Flag<"-fobjc-legacy-dispatch">,
+  HelpText<"Use legacy dispatch with the Objective-C non-fragile ABI">;
 def print_ivar_layout : Flag<"-print-ivar-layout">,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">,
index 4b99956da2b003a1f7e002f4d45305fe55c82a12..881ca0381bfdf25720bef51181f435871f46206f 100644 (file)
@@ -303,6 +303,7 @@ def fno_keep_inline_functions : Flag<"-fno-keep-inline-functions">, Group<clang_
 def fno_math_errno : Flag<"-fno-math-errno">, Group<f_Group>;
 def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, Group<f_Group>;
 def fno_ms_extensions : Flag<"-fno-ms-extensions">, Group<f_Group>;
+def fno_objc_legacy_dispatch : Flag<"-fno-objc-legacy-dispatch">, Group<f_Group>;
 def fno_omit_frame_pointer : Flag<"-fno-omit-frame-pointer">, Group<f_Group>;
 def fno_pascal_strings : Flag<"-fno-pascal-strings">, Group<f_Group>;
 def fno_rtti : Flag<"-fno-rtti">, Group<f_Group>;
@@ -318,6 +319,7 @@ def fobjc_atdefs : Flag<"-fobjc-atdefs">, Group<clang_ignored_f_Group>;
 def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
 def fobjc_gc_only : Flag<"-fobjc-gc-only">, Group<f_Group>;
 def fobjc_gc : Flag<"-fobjc-gc">, Group<f_Group>;
+def fobjc_legacy_dispatch : Flag<"-fobjc-legacy-dispatch">, Group<f_Group>;
 def fobjc_new_property : Flag<"-fobjc-new-property">, Group<clang_ignored_f_Group>;
 def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">, Group<f_Group>;
 def fobjc_sender_dependent_dispatch : Flag<"-fobjc-sender-dependent-dispatch">, Group<f_Group>;
index 5bc8830765d58d5612a52b99cb7ea6290845ec08..88dffa98f96c9a005314fe7c4b02cc7277656124 100644 (file)
@@ -1024,10 +1024,22 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // -fobjc-nonfragile-abi=0 is default.
   if (types::isObjC(InputType)) {
     if (Args.hasArg(options::OPT_fobjc_nonfragile_abi) ||
-        getToolChain().IsObjCNonFragileABIDefault())
+        getToolChain().IsObjCNonFragileABIDefault()) {
       CmdArgs.push_back("-fobjc-nonfragile-abi");
+      
+      // -fobjc-legacy-dispatch is only relevant with the nonfragile-abi, and
+      // defaults to off.
+      if (Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
+                       options::OPT_fno_objc_legacy_dispatch,
+                       false))
+        CmdArgs.push_back("-fobjc-legacy-dispatch");
+    }
   }
 
+  if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
+                    options::OPT_fno_assume_sane_operator_new))
+    CmdArgs.push_back("-fno-assume-sane-operator-new");
+
   // -fshort-wchar default varies depending on platform; only
   // pass if specified.
   if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar)) {
index 06fc15b5974239e62ec31f41aa25dc7333903026..6ece1f90a4fb2c248e75ff4fff735088d3a57462 100644 (file)
@@ -170,6 +170,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
   }
   if (Opts.NoZeroInitializedInBSS)
     Res.push_back("-mno-zero-initialized-bss");
+  if (Opts.ObjCLegacyDispatch)
+    Res.push_back("-fobjc-legacy-dispatch");
   if (Opts.SoftFloat)
     Res.push_back("-msoft-float");
   if (Opts.UnwindTables)
@@ -772,6 +774,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
   Opts.FloatABI = getLastArgValue(Args, OPT_mfloat_abi);
   Opts.LimitFloatPrecision = getLastArgValue(Args, OPT_mlimit_float_precision);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
+  Opts.ObjCLegacyDispatch = Args.hasArg(OPT_fobjc_legacy_dispatch);
   Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
   Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
   Opts.RelocationModel = getLastArgValue(Args, OPT_mrelocation_model, "pic");