xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/next-objc-dispatch.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s \
2*f4a2713aSLionel Sambuc// RUN:   -fobjc-dispatch-method=legacy | \
3*f4a2713aSLionel Sambuc// RUN:   FileCheck -check-prefix CHECK-FRAGILE_LEGACY %s
4*f4a2713aSLionel Sambuc//
5*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s    \
6*f4a2713aSLionel Sambuc// RUN:   -fobjc-dispatch-method=legacy | \
7*f4a2713aSLionel Sambuc// RUN:   FileCheck -check-prefix CHECK-NONFRAGILE_LEGACY %s
8*f4a2713aSLionel Sambuc//
9*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s    \
10*f4a2713aSLionel Sambuc// RUN:   -fobjc-dispatch-method=non-legacy | \
11*f4a2713aSLionel Sambuc// RUN:   FileCheck -check-prefix CHECK-NONFRAGILE_NONLEGACY %s
12*f4a2713aSLionel Sambuc//
13*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s    \
14*f4a2713aSLionel Sambuc// RUN:   -fobjc-dispatch-method=mixed | \
15*f4a2713aSLionel Sambuc// RUN:   FileCheck -check-prefix CHECK-NONFRAGILE_MIXED %s
16*f4a2713aSLionel Sambuc//
17*f4a2713aSLionel Sambuc// <rdar://problem/7866951>
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc// There are basically four ways that we end up doing message dispatch for the
20*f4a2713aSLionel Sambuc// NeXT runtime. They are:
21*f4a2713aSLionel Sambuc//  (1) fragile ABI, legacy dispatch
22*f4a2713aSLionel Sambuc//  (2) non-fragile ABI, legacy dispatch
23*f4a2713aSLionel Sambuc//  (2) non-fragile ABI, non-legacy dispatch
24*f4a2713aSLionel Sambuc//  (2) non-fragile ABI, mixed dispatch
25*f4a2713aSLionel Sambuc//
26*f4a2713aSLionel Sambuc// Note that fragile ABI and non-fragile ABI legacy dispatch are not the same,
27*f4a2713aSLionel Sambuc// they use some different API calls (objc_msgSendSuper vs objc_msgSendSuper2).
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc// CHECK-FRAGILE_LEGACY: ModuleID
30*f4a2713aSLionel Sambuc// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
31*f4a2713aSLionel Sambuc// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
32*f4a2713aSLionel Sambuc// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSendSuper(
33*f4a2713aSLionel Sambuc// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSend(
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_LEGACY: ModuleID
36*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
37*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
38*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSendSuper2(
39*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSend(
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_NONLEGACY: ModuleID
42*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSendSuper2_fixup(
43*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSend_fixup(
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2_fixup(
46*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2(
47*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend_fixup(
48*f4a2713aSLionel Sambuc// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend(
49*f4a2713aSLionel Sambuc
50*f4a2713aSLionel Sambuc@interface NSObject
51*f4a2713aSLionel Sambuc+ (id)alloc;
52*f4a2713aSLionel Sambuc- (id)init;
53*f4a2713aSLionel Sambuc@end
54*f4a2713aSLionel Sambuc
55*f4a2713aSLionel Sambuc@interface I0 : NSObject
56*f4a2713aSLionel Sambuc-(void) im0;
57*f4a2713aSLionel Sambuc@end
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc@implementation I0
60*f4a2713aSLionel Sambuc+(id) alloc {
61*f4a2713aSLionel Sambuc  return [super alloc];
62*f4a2713aSLionel Sambuc}
63*f4a2713aSLionel Sambuc-(id) init {
64*f4a2713aSLionel Sambuc [super init];
65*f4a2713aSLionel Sambuc return self;
66*f4a2713aSLionel Sambuc}
67*f4a2713aSLionel Sambuc-(void) im0 {}
68*f4a2713aSLionel Sambuc@end
69*f4a2713aSLionel Sambuc
70*f4a2713aSLionel Sambucvoid f0(I0 *a) {
71*f4a2713aSLionel Sambuc  [I0 alloc];
72*f4a2713aSLionel Sambuc  [a im0];
73*f4a2713aSLionel Sambuc}
74