xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/property-objects.mm (revision 0b98e8aad89f2bd4ba80b523d73cf29e9dd82ce1)
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2
3class S {
4public:
5	S& operator = (const S&);
6	S (const S&);
7	S ();
8};
9
10struct CGRect {
11	CGRect & operator = (const CGRect &);
12};
13
14@interface I {
15  S position;
16  CGRect bounds;
17}
18
19@property(assign, nonatomic) S position;
20@property CGRect bounds;
21@property CGRect frame;
22- (void)setFrame:(CGRect)frameRect;
23- (CGRect)frame;
24- (void) initWithOwner;
25- (CGRect)extent;
26- (void)dealloc;
27@end
28
29@implementation I
30@synthesize position;
31@synthesize bounds;
32@synthesize frame;
33
34// CHECK: define internal void @"\01-[I setPosition:]"
35// CHECK: call %class.S* @_ZN1SaSERKS_
36// CHECK-NEXT: ret void
37
38- (void)setFrame:(CGRect)frameRect {}
39- (CGRect)frame {return bounds;}
40
41- (void)initWithOwner {
42  I* _labelLayer;
43  CGRect labelLayerFrame = self.bounds;
44  labelLayerFrame = self.bounds;
45  _labelLayer.frame = labelLayerFrame;
46}
47
48// rdar://8366604
49- (void)dealloc
50  {
51      CGRect cgrect = self.extent;
52  }
53- (struct CGRect)extent {return bounds;}
54
55@end
56
57// CHECK-LABEL: 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
61int main() {
62  I *i;
63  S s1;
64  i.position = s1;
65  return 0;
66}
67
68// rdar://8379892
69// CHECK-LABEL: define void @_Z1fP1A
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]])
73struct 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}
89