1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -g -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 dereferenceable({{[0-9]+}}) %class.S* @_ZN1SaSERKS_
36// CHECK-NEXT: ret void
37
38// Don't attach debug locations to the prologue instructions. These were
39// leaking over from the previous function emission by accident.
40// CHECK: define internal void @"\01-[I setBounds:]"
41// CHECK-NOT: !dbg
42// CHECK: call void @llvm.dbg.declare
43- (void)setFrame:(CGRect)frameRect {}
44- (CGRect)frame {return bounds;}
45
46- (void)initWithOwner {
47  I* _labelLayer;
48  CGRect labelLayerFrame = self.bounds;
49  labelLayerFrame = self.bounds;
50  _labelLayer.frame = labelLayerFrame;
51}
52
53// rdar://8366604
54- (void)dealloc
55  {
56      CGRect cgrect = self.extent;
57  }
58- (struct CGRect)extent {return bounds;}
59
60@end
61
62// CHECK-LABEL: define i32 @main
63// CHECK: call void @_ZN1SC1ERKS_(%class.S* [[AGGTMP:%[a-zA-Z0-9\.]+]], %class.S* dereferenceable({{[0-9]+}}) {{%[a-zA-Z0-9\.]+}})
64// 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]])
65// CHECK-NEXT: ret i32 0
66int main() {
67  I *i;
68  S s1;
69  i.position = s1;
70  return 0;
71}
72
73// rdar://8379892
74// CHECK-LABEL: define void @_Z1fP1A
75// CHECK: call void @_ZN1XC1Ev(%struct.X* [[LVTEMP:%[a-zA-Z0-9\.]+]])
76// CHECK: call void @_ZN1XC1ERKS_(%struct.X* [[AGGTMP:%[a-zA-Z0-9\.]+]], %struct.X* dereferenceable({{[0-9]+}}) [[LVTEMP]])
77// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %struct.X*)*)({{.*}} %struct.X* [[AGGTMP]])
78struct X {
79  X();
80  X(const X&);
81  ~X();
82};
83
84@interface A {
85  X xval;
86}
87- (X)x;
88- (void)setX:(X)x;
89@end
90
91void f(A* a) {
92  a.x = X();
93}
94