blob: 6afd658e03a78ffe0567bb7967b01d4aec49a0db [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s \
Daniel Dunbarf643b9b2010-04-24 17:56:46 +00002// RUN: -fobjc-dispatch-method=legacy | \
3// RUN: FileCheck -check-prefix CHECK-FRAGILE_LEGACY %s
4//
5// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
John McCalld1e40d52011-10-02 01:16:38 +00006// RUN: -fobjc-dispatch-method=legacy | \
Daniel Dunbarf643b9b2010-04-24 17:56:46 +00007// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_LEGACY %s
8//
9// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
John McCalld1e40d52011-10-02 01:16:38 +000010// RUN: -fobjc-dispatch-method=non-legacy | \
Daniel Dunbarf643b9b2010-04-24 17:56:46 +000011// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_NONLEGACY %s
12//
13// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
John McCalld1e40d52011-10-02 01:16:38 +000014// RUN: -fobjc-dispatch-method=mixed | \
Daniel Dunbarf643b9b2010-04-24 17:56:46 +000015// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_MIXED %s
16//
17// <rdar://problem/7866951>
18
19// There are basically four ways that we end up doing message dispatch for the
20// NeXT runtime. They are:
21// (1) fragile ABI, legacy dispatch
22// (2) non-fragile ABI, legacy dispatch
23// (2) non-fragile ABI, non-legacy dispatch
24// (2) non-fragile ABI, mixed dispatch
25//
26// Note that fragile ABI and non-fragile ABI legacy dispatch are not the same,
27// they use some different API calls (objc_msgSendSuper vs objc_msgSendSuper2).
28
29// CHECK-FRAGILE_LEGACY: ModuleID
30// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
31// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
32// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSendSuper(
33// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSend(
34
35// CHECK-NONFRAGILE_LEGACY: ModuleID
36// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
37// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
38// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSendSuper2(
39// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSend(
40
41// CHECK-NONFRAGILE_NONLEGACY: ModuleID
42// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSendSuper2_fixup(
43// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSend_fixup(
44
45// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2_fixup(
46// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2(
47// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend_fixup(
48// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend(
49
50@interface NSObject
51+ (id)alloc;
52- (id)init;
53@end
54
55@interface I0 : NSObject
56-(void) im0;
57@end
58
59@implementation I0
60+(id) alloc {
61 return [super alloc];
62}
63-(id) init {
64 [super init];
65 return self;
66}
67-(void) im0 {}
68@end
69
70void f0(I0 *a) {
71 [I0 alloc];
72 [a im0];
73}