]> granicus.if.org Git - clang/commitdiff
Driver/Darwin: Darwin uses -fobjc-legacy-dispatch on ARM.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 21:07:43 +0000 (21:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 1 Feb 2010 21:07:43 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95006 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/ToolChain.h
lib/Driver/ToolChains.h
lib/Driver/Tools.cpp
test/Driver/darwin-iphone-defaults.m

index 501e833202b15fe6b67a7168e043eb7adbf66f7d..c4209ac3bad4d6c33118f70f9ad6ed2214c5cdcc 100644 (file)
@@ -94,6 +94,11 @@ public:
   /// -fobjc-nonfragile-abi by default.
   virtual bool IsObjCNonFragileABIDefault() const { return false; }
 
+  /// IsObjCLegacyDispatchDefault - Does this tool chain set
+  /// -fobjc-legacy-dispatch by default (this is only used with the non-fragile
+  /// ABI).
+  virtual bool IsObjCLegacyDispatchDefault() const { return false; }
+
   /// GetDefaultStackProtectorLevel - Get the default stack protector level for
   /// this tool chain (0=off, 1=on, 2=all).
   virtual unsigned GetDefaultStackProtectorLevel() const { return 0; }
index e683c2d484284edae36bc917edb2c63434d2eaea..fbb1136199db21c3b208da25069415a8e25626d8 100644 (file)
@@ -161,6 +161,11 @@ public:
     // Non-fragile ABI default to on for iPhoneOS and x86-64.
     return isTargetIPhoneOS() || getTriple().getArch() == llvm::Triple::x86_64;
   }
+  virtual bool IsObjCLegacyDispatchDefault() const {
+    // This is only used with the non-fragile ABI.
+    return (getTriple().getArch() == llvm::Triple::arm ||
+            getTriple().getArch() == llvm::Triple::thumb);
+  }
   virtual bool IsUnwindTablesDefault() const;
   virtual unsigned GetDefaultStackProtectorLevel() const {
     // Stack protectors default to on for 10.6 and beyond.
index 88dffa98f96c9a005314fe7c4b02cc7277656124..b0278b8aece6e4f3a3e62b34cabf0c5a7adcd0c5 100644 (file)
@@ -1031,7 +1031,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       // defaults to off.
       if (Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
                        options::OPT_fno_objc_legacy_dispatch,
-                       false))
+                       getToolChain().IsObjCLegacyDispatchDefault()))
         CmdArgs.push_back("-fobjc-legacy-dispatch");
     }
   }
index 61bc44125a5ecbb90c1f6b7c3234b3eb4d75991c..97ac4a42a54b3664b3752aa1ef390b372d53a097 100644 (file)
@@ -4,6 +4,9 @@
 // CHECK-NOT: ssp
 // CHECK: ) {
 // CHECK: @__f0_block_invoke
+// CHECK: void @f1
+// CHECK-NOT: msgSend_fixup_alloc
+// CHECK: OBJC_SELECTOR_REFERENCES
 
 int f0() {
   return ^(){ return 0; }();
@@ -16,3 +19,12 @@ int f0() {
 @implementation I0
 @synthesize p0 = __sythesized_p0;
 @end
+
+@interface I1
++(id) alloc;
+@end
+
+void f1() {
+  [I1 alloc];
+}
+