1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -debug-info-kind=limited -o - | FileCheck %s
5 S& operator = (const S&);
11 CGRect & operator = (const CGRect &);
19 @property(assign, nonatomic) S position;
20 @property CGRect bounds;
21 @property CGRect frame;
22 - (void)setFrame:(CGRect)frameRect;
24 - (void) initWithOwner;
34 // CHECK: define internal void @"\01-[I setPosition:]"
35 // CHECK: call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @_ZN1SaSERKS_
36 // CHECK-NEXT: ret void
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:]"({{.*}} {
42 // CHECK: call void @llvm.dbg.declare
43 - (void)setFrame:(CGRect)frameRect {}
44 - (CGRect)frame {return bounds;}
46 - (void)initWithOwner {
48 CGRect labelLayerFrame = self.bounds;
49 labelLayerFrame = self.bounds;
50 _labelLayer.frame = labelLayerFrame;
55 CGRect cgrect = self.extent;
57 - (struct CGRect)extent {return bounds;}
61 // CHECK-LABEL: define{{.*}} i32 @main
62 // CHECK: call void @_ZN1SC1ERKS_(ptr {{[^,]*}} [[AGGTMP:%[a-zA-Z0-9\.]+]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) {{%[a-zA-Z0-9\.]+}})
63 // CHECK: call void @objc_msgSend(ptr noundef {{%[a-zA-Z0-9\.]+}}, ptr noundef {{%[a-zA-Z0-9\.]+}}, ptr noundef [[AGGTMP]])
64 // CHECK-NEXT: ret i32 0
72 // CHECK-LABEL: define{{.*}} void @_Z1fP1A
73 // CHECK: call void @_ZN1XC1Ev(ptr {{[^,]*}} [[LVTEMP:%[a-zA-Z0-9\.]+]])
74 // CHECK: call void @_ZN1XC1ERKS_(ptr {{[^,]*}} [[AGGTMP:%[a-zA-Z0-9\.]+]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[LVTEMP]])
75 // CHECK: call void @objc_msgSend({{.*}} ptr noundef [[AGGTMP]])
93 // Ensure that pseudo-objecet expressions that require the RHS to be
94 // rewritten don't result in crashes or redundant emission of code.
95 struct B0 { long long x; };
96 struct B1 { long long x; }; B1 operator+(B1, B1);
98 struct B3 { B3(); B1 x; operator B1(); };
108 // Note that there's a promotion from int to long long, so
109 // the syntactic form of the RHS will be bogus.
111 b.b0 = { b_makeInt() };
114 b.b1 += { b_makeInt() };
116 // CHECK: define{{.*}} void @_Z6testB0P1B(ptr
117 // CHECK: [[BVAR:%.*]] = alloca ptr, align 8
118 // CHECK: [[TEMP:%.*]] = alloca [[B0:%.*]], align 8
119 // CHECK: [[X:%.*]] = getelementptr inbounds [[B0]], ptr [[TEMP]], i32 0, i32 0
120 // CHECK-NEXT: [[T0:%.*]] = call noundef i32 @_Z9b_makeIntv()
121 // CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
122 // CHECK-NEXT: store i64 [[T1]], ptr [[X]], align 8
123 // CHECK: load ptr, ptr [[BVAR]]
125 // CHECK: call void @llvm.memcpy
127 // CHECK: call void @objc_msgSend
131 // CHECK: define{{.*}} void @_Z6testB1P1B(ptr
132 // CHECK: [[BVAR:%.*]] = alloca ptr, align 8
133 // CHECK: load ptr, ptr [[BVAR]]
135 // CHECK: [[T0:%.*]] = call i64 @objc_msgSend
137 // CHECK: store i64 [[T0]],
139 // CHECK: [[T0:%.*]] = call noundef i32 @_Z9b_makeIntv()
140 // CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
141 // CHECK-NEXT: store i64 [[T1]], ptr {{.*}}, align 8
143 // CHECK: [[T0:%.*]] = call i64 @_Zpl2B1S_
145 // CHECK: store i64 [[T0]],
147 // CHECK: call void @llvm.memcpy
149 // CHECK: call void @objc_msgSend
153 // Another example of a conversion that needs to be applied
154 // in the semantic form.
159 // CHECK: define{{.*}} void @_Z6testB2P1B(ptr
160 // CHECK: [[BVAR:%.*]] = alloca ptr, align 8
161 // CHECK: call void @llvm.dbg.declare(
162 // CHECK: call void @_ZN2B3C1Ev(
163 // CHECK-NEXT: [[T0:%.*]] = call i64 @_ZN2B3cv2B1Ev(
165 // CHECK: store i64 [[T0]],
166 // CHECK: load ptr, ptr [[BVAR]]
168 // CHECK: call void @llvm.memcpy
170 // CHECK: call void @objc_msgSend
174 // A similar test to B, but using overloaded function references.
177 friend C1 operator+(C1, void(&)());
180 @property void (*c0)();
191 // CHECK: define{{.*}} void @_Z6testC0P1C(ptr
192 // CHECK: [[CVAR:%.*]] = alloca ptr, align 8
193 // CHECK: load ptr, ptr [[CVAR]]
195 // CHECK: call void @objc_msgSend({{.*}} @_Z8c_helperv
197 // CHECK: call void @objc_msgSend({{.*}} @_Z8c_helperv
204 // CHECK: define{{.*}} void @_Z6testC1P1C(ptr
205 // CHECK: [[CVAR:%.*]] = alloca ptr, align 8
206 // CHECK: load ptr, ptr [[CVAR]]
208 // CHECK: [[T0:%.*]] = call i32 @objc_msgSend
210 // CHECK: store i32 [[T0]],
212 // CHECK: [[T0:%.*]] = call i32 @_Zpl2C1RFvvE({{.*}} @_Z8c_helperv
214 // CHECK: store i32 [[T0]],
216 // CHECK: call void @llvm.memcpy
218 // CHECK: call void @objc_msgSend