John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1 | // 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 Lin | 93ab6bf | 2013-08-15 06:47:53 +0000 | [diff] [blame] | 12 | // CHECK-LABEL: define void @test1() |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 13 | void 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 Lin | 93ab6bf | 2013-08-15 06:47:53 +0000 | [diff] [blame] | 21 | // CHECK-LABEL: define void @test2() |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 22 | void 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 |