[cfe-commits] r95006 - in /cfe/trunk: include/clang/Driver/ToolChain.h lib/Driver/ToolChains.h lib/Driver/Tools.cpp test/Driver/darwin-iphone-defaults.m

Daniel Dunbar daniel at zuster.org
Mon Feb 1 13:07:43 PST 2010


Author: ddunbar
Date: Mon Feb  1 15:07:43 2010
New Revision: 95006

URL: http://llvm.org/viewvc/llvm-project?rev=95006&view=rev
Log:
Driver/Darwin: Darwin uses -fobjc-legacy-dispatch on ARM.

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

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=95006&r1=95005&r2=95006&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Mon Feb  1 15:07:43 2010
@@ -94,6 +94,11 @@
   /// -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; }

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=95006&r1=95005&r2=95006&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Mon Feb  1 15:07:43 2010
@@ -161,6 +161,11 @@
     // 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.

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=95006&r1=95005&r2=95006&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Feb  1 15:07:43 2010
@@ -1031,7 +1031,7 @@
       // 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");
     }
   }

Modified: cfe/trunk/test/Driver/darwin-iphone-defaults.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-iphone-defaults.m?rev=95006&r1=95005&r2=95006&view=diff

==============================================================================
--- cfe/trunk/test/Driver/darwin-iphone-defaults.m (original)
+++ cfe/trunk/test/Driver/darwin-iphone-defaults.m Mon Feb  1 15:07:43 2010
@@ -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 @@
 @implementation I0
 @synthesize p0 = __sythesized_p0;
 @end
+
+ at interface I1
++(id) alloc;
+ at end
+
+void f1() {
+  [I1 alloc];
+}
+





More information about the cfe-commits mailing list