blob: cd7847421812b33773b7eb4a9ce534dc04b6a59e [file] [log] [blame]
John McCallf85e1932011-06-15 23:02:42 +00001// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
2
3@interface NSObject
4+ (id)alloc;
5- (id)init;
6- (id)retain;
7@end
8
9@interface NSString : NSObject
10@end
11
Stephen Lin93ab6bf2013-08-15 06:47:53 +000012// CHECK-LABEL: define void @test1()
John McCallf85e1932011-06-15 23:02:42 +000013void test1() {
14 // CHECK: {{call.*@objc_msgSend}}
15 // CHECK: {{call.*@objc_msgSend}}
16 // CHECK: {{call.*@objc_msgSend}}
17 // CHECK: bitcast i8*
18 NSString *str1 = [[[NSString alloc] init] retain];
19}
20
Stephen Lin93ab6bf2013-08-15 06:47:53 +000021// CHECK-LABEL: define void @test2()
John McCallf85e1932011-06-15 23:02:42 +000022void test2() {
23 // CHECK: {{call.*@objc_msgSend}}
24 // CHECK: {{call.*@objc_msgSend}}
25 // CHECK: {{call.*@objc_msgSend}}
26 // CHECK: bitcast i8*
27 NSString *str1 = NSString.alloc.init.retain;
28}
29
30@interface Test2 : NSString
31- (id)init;
32@end
33
34@implementation Test2
35// CHECK: define internal i8* @"\01-[Test2 init]"
36- (id)init {
37 // CHECK: {{call.*@objc_msgSendSuper}}
38 // CHECK-NEXT: bitcast i8*
39 return [super init];
40}
41@end
42
43@interface Test3 : NSString
44- (id)init;
45@end
46
47@implementation Test3
48// CHECK: define internal i8* @"\01-[Test3 init]"
49- (id)init {
50 // CHECK: {{call.*@objc_msgSendSuper}}
51 // CHECK-NEXT: bitcast i8*
52 return [super init];
53}
54@end