Debian Codegraph @

clang/test/CodeGenObjC/next-objc-dispatch.m

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