• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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// <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}
74