John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 2 | |
| 3 | class S { |
| 4 | public: |
| 5 | S& operator = (const S&); |
| 6 | S (const S&); |
| 7 | S (); |
| 8 | }; |
| 9 | |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 10 | struct CGRect { |
| 11 | CGRect & operator = (const CGRect &); |
| 12 | }; |
| 13 | |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 14 | @interface I { |
| 15 | S position; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 16 | CGRect bounds; |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 17 | } |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 18 | |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 19 | @property(assign, nonatomic) S position; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 20 | @property CGRect bounds; |
Fariborz Jahanian | 0ca0b1f | 2010-05-15 23:05:52 +0000 | [diff] [blame] | 21 | @property CGRect frame; |
| 22 | - (void)setFrame:(CGRect)frameRect; |
| 23 | - (CGRect)frame; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 24 | - (void) initWithOwner; |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 25 | - (CGRect)extent; |
Fariborz Jahanian | 98c9d1f | 2010-09-01 19:36:41 +0000 | [diff] [blame] | 26 | - (void)dealloc; |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 27 | @end |
| 28 | |
| 29 | @implementation I |
| 30 | @synthesize position; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 31 | @synthesize bounds; |
Fariborz Jahanian | 0ca0b1f | 2010-05-15 23:05:52 +0000 | [diff] [blame] | 32 | @synthesize frame; |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 33 | |
| 34 | // CHECK: define internal void @"\01-[I setPosition:]" |
| 35 | // CHECK: call %class.S* @_ZN1SaSERKS_ |
| 36 | // CHECK-NEXT: ret void |
| 37 | |
Fariborz Jahanian | 0ca0b1f | 2010-05-15 23:05:52 +0000 | [diff] [blame] | 38 | - (void)setFrame:(CGRect)frameRect {} |
| 39 | - (CGRect)frame {return bounds;} |
| 40 | |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 41 | - (void)initWithOwner { |
Fariborz Jahanian | 0ca0b1f | 2010-05-15 23:05:52 +0000 | [diff] [blame] | 42 | I* _labelLayer; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 43 | CGRect labelLayerFrame = self.bounds; |
| 44 | labelLayerFrame = self.bounds; |
Fariborz Jahanian | 0ca0b1f | 2010-05-15 23:05:52 +0000 | [diff] [blame] | 45 | _labelLayer.frame = labelLayerFrame; |
Fariborz Jahanian | b3ebe94 | 2010-05-10 22:57:35 +0000 | [diff] [blame] | 46 | } |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 47 | |
Fariborz Jahanian | 98c9d1f | 2010-09-01 19:36:41 +0000 | [diff] [blame] | 48 | // rdar://8366604 |
| 49 | - (void)dealloc |
| 50 | { |
| 51 | CGRect cgrect = self.extent; |
| 52 | } |
| 53 | - (struct CGRect)extent {return bounds;} |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 54 | |
Fariborz Jahanian | 97a73cd | 2010-05-06 15:45:36 +0000 | [diff] [blame] | 55 | @end |
Fariborz Jahanian | bbb5224 | 2010-05-07 18:56:13 +0000 | [diff] [blame] | 56 | |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 57 | // CHECK: define i32 @main |
| 58 | // CHECK: call void @_ZN1SC1ERKS_(%class.S* [[AGGTMP:%[a-zA-Z0-9\.]+]], %class.S* {{%[a-zA-Z0-9\.]+}}) |
| 59 | // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %class.S*)*)(i8* {{%[a-zA-Z0-9\.]+}}, i8* {{%[a-zA-Z0-9\.]+}}, %class.S* [[AGGTMP]]) |
| 60 | // CHECK-NEXT: ret i32 0 |
Fariborz Jahanian | bbb5224 | 2010-05-07 18:56:13 +0000 | [diff] [blame] | 61 | int main() { |
| 62 | I *i; |
| 63 | S s1; |
| 64 | i.position = s1; |
| 65 | return 0; |
| 66 | } |
| 67 | |
Fariborz Jahanian | 4088ec0 | 2010-09-09 23:01:10 +0000 | [diff] [blame] | 68 | // rdar://8379892 |
| 69 | // CHECK: define void @_Z1fP1A |
Eli Friedman | 25f071e | 2012-11-13 23:16:33 +0000 | [diff] [blame] | 70 | // CHECK: call void @_ZN1XC1Ev(%struct.X* [[LVTEMP:%[a-zA-Z0-9\.]+]]) |
| 71 | // CHECK: call void @_ZN1XC1ERKS_(%struct.X* [[AGGTMP:%[a-zA-Z0-9\.]+]], %struct.X* [[LVTEMP]]) |
| 72 | // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %struct.X*)*)({{.*}} %struct.X* [[AGGTMP]]) |
Fariborz Jahanian | 4088ec0 | 2010-09-09 23:01:10 +0000 | [diff] [blame] | 73 | struct X { |
| 74 | X(); |
| 75 | X(const X&); |
| 76 | ~X(); |
| 77 | }; |
| 78 | |
| 79 | @interface A { |
| 80 | X xval; |
| 81 | } |
| 82 | - (X)x; |
| 83 | - (void)setX:(X)x; |
| 84 | @end |
| 85 | |
| 86 | void f(A* a) { |
| 87 | a.x = X(); |
| 88 | } |