blob: a3c2ed37466ef0ab717f7898beafd75ddff21d2f [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +00002
3class S {
4public:
5 S& operator = (const S&);
6 S (const S&);
7 S ();
8};
9
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000010struct CGRect {
11 CGRect & operator = (const CGRect &);
12};
13
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +000014@interface I {
15 S position;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000016 CGRect bounds;
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +000017}
Eli Friedman25f071e2012-11-13 23:16:33 +000018
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +000019@property(assign, nonatomic) S position;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000020@property CGRect bounds;
Fariborz Jahanian0ca0b1f2010-05-15 23:05:52 +000021@property CGRect frame;
22- (void)setFrame:(CGRect)frameRect;
23- (CGRect)frame;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000024- (void) initWithOwner;
Eli Friedman25f071e2012-11-13 23:16:33 +000025- (CGRect)extent;
Fariborz Jahanian98c9d1f2010-09-01 19:36:41 +000026- (void)dealloc;
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +000027@end
28
29@implementation I
30@synthesize position;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000031@synthesize bounds;
Fariborz Jahanian0ca0b1f2010-05-15 23:05:52 +000032@synthesize frame;
Eli Friedman25f071e2012-11-13 23:16:33 +000033
34// CHECK: define internal void @"\01-[I setPosition:]"
35// CHECK: call %class.S* @_ZN1SaSERKS_
36// CHECK-NEXT: ret void
37
Fariborz Jahanian0ca0b1f2010-05-15 23:05:52 +000038- (void)setFrame:(CGRect)frameRect {}
39- (CGRect)frame {return bounds;}
40
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000041- (void)initWithOwner {
Fariborz Jahanian0ca0b1f2010-05-15 23:05:52 +000042 I* _labelLayer;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000043 CGRect labelLayerFrame = self.bounds;
44 labelLayerFrame = self.bounds;
Fariborz Jahanian0ca0b1f2010-05-15 23:05:52 +000045 _labelLayer.frame = labelLayerFrame;
Fariborz Jahanianb3ebe942010-05-10 22:57:35 +000046}
Eli Friedman25f071e2012-11-13 23:16:33 +000047
Fariborz Jahanian98c9d1f2010-09-01 19:36:41 +000048// rdar://8366604
49- (void)dealloc
50 {
51 CGRect cgrect = self.extent;
52 }
53- (struct CGRect)extent {return bounds;}
Eli Friedman25f071e2012-11-13 23:16:33 +000054
Fariborz Jahanian97a73cd2010-05-06 15:45:36 +000055@end
Fariborz Jahanianbbb52242010-05-07 18:56:13 +000056
Eli Friedman25f071e2012-11-13 23:16:33 +000057// 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 Jahanianbbb52242010-05-07 18:56:13 +000061int main() {
62 I *i;
63 S s1;
64 i.position = s1;
65 return 0;
66}
67
Fariborz Jahanian4088ec02010-09-09 23:01:10 +000068// rdar://8379892
69// CHECK: define void @_Z1fP1A
Eli Friedman25f071e2012-11-13 23:16:33 +000070// 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 Jahanian4088ec02010-09-09 23:01:10 +000073struct 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
86void f(A* a) {
87 a.x = X();
88}