Force clang to produce legacy api for messaging
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101791 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index f038509..d70537e 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -4264,7 +4264,10 @@
bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) {
if (CGM.getCodeGenOpts().ObjCLegacyDispatch)
return true;
-
+ /* Leopard */
+ if (CGM.getContext().Target.getTriple().getDarwinMajorNumber() <= 9)
+ return false;
+
if (NonLegacyDispatchMethods.empty()) {
NonLegacyDispatchMethods.insert(GetNullarySelector("alloc"));
NonLegacyDispatchMethods.insert(GetNullarySelector("class"));
diff --git a/test/CodeGenObjC/legacy-api-leopard-test.m b/test/CodeGenObjC/legacy-api-leopard-test.m
new file mode 100644
index 0000000..1a229c6
--- /dev/null
+++ b/test/CodeGenObjC/legacy-api-leopard-test.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// rdar: // 7866951
+
+@interface NSObject
+- (id)init;
+@end
+
+@interface ClangTest : NSObject @end
+
+@implementation ClangTest
+- (id)init
+{
+ [super init];
+ return self;
+}
+@end
+
+// CHECK-LP64: objc_msgSendSuper2_fixup_init
+// CHECK-LP64: objc_msgSendSuper2_fixup