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 dereferenceable({{[0-9]+}}) %class.S* @_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;
56 CGRect cgrect = self.extent;
58 - (struct CGRect)extent {return bounds;}
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
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]])
96 // Ensure that pseudo-objecet expressions that require the RHS to be
97 // rewritten don't result in crashes or redundant emission of code.
98 struct B0 { long long x; };
99 struct B1 { long long x; }; B1 operator+(B1, B1);
101 struct B3 { B3(); B1 x; operator B1(); };
111 // Note that there's a promotion from int to long long, so
112 // the syntactic form of the RHS will be bogus.
114 b.b0 = { b_makeInt() };
117 b.b1 += { b_makeInt() };
119 // CHECK: define void @_Z6testB0P1B([[B:%.*]]*
120 // CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
121 // CHECK: [[TEMP:%.*]] = alloca [[B0:%.*]], align 8
122 // CHECK: [[X:%.*]] = getelementptr inbounds [[B0]], [[B0]]* [[TEMP]], i32 0, i32 0
123 // CHECK-NEXT: [[T0:%.*]] = call i32 @_Z9b_makeIntv()
124 // CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
125 // CHECK-NEXT: store i64 [[T1]], i64* [[X]], align 8
126 // CHECK: load [[B]]*, [[B]]** [[BVAR]]
128 // CHECK: call void @llvm.memcpy
130 // CHECK: call void bitcast {{.*}} @objc_msgSend
134 // CHECK: define void @_Z6testB1P1B([[B]]*
135 // CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
136 // CHECK: load [[B]]*, [[B]]** [[BVAR]]
138 // CHECK: [[T0:%.*]] = call i64 bitcast {{.*}} @objc_msgSend
140 // CHECK: store i64 [[T0]],
142 // CHECK: [[T0:%.*]] = call i32 @_Z9b_makeIntv()
143 // CHECK-NEXT: [[T1:%.*]] = sext i32 [[T0]] to i64
144 // CHECK-NEXT: store i64 [[T1]], i64* {{.*}}, align 8
146 // CHECK: [[T0:%.*]] = call i64 @_Zpl2B1S_
148 // CHECK: store i64 [[T0]],
150 // CHECK: call void @llvm.memcpy
152 // CHECK: call void bitcast {{.*}} @objc_msgSend
156 // Another example of a conversion that needs to be applied
157 // in the semantic form.
162 // CHECK: define void @_Z6testB2P1B([[B]]*
163 // CHECK: [[BVAR:%.*]] = alloca [[B]]*, align 8
164 // CHECK: call void @llvm.dbg.declare(
165 // CHECK: call void @_ZN2B3C1Ev(
166 // CHECK-NEXT: [[T0:%.*]] = call i64 @_ZN2B3cv2B1Ev(
168 // CHECK: store i64 [[T0]],
169 // CHECK: load [[B]]*, [[B]]** [[BVAR]]
171 // CHECK: call void @llvm.memcpy
173 // CHECK: call void bitcast {{.*}} @objc_msgSend
177 // A similar test to B, but using overloaded function references.
180 friend C1 operator+(C1, void(&)());
183 @property void (*c0)();
194 // CHECK: define void @_Z6testC0P1C([[C:%.*]]*
195 // CHECK: [[CVAR:%.*]] = alloca [[C]]*, align 8
196 // CHECK: load [[C]]*, [[C]]** [[CVAR]]
198 // CHECK: call void bitcast {{.*}} @objc_msgSend {{.*}} @_Z8c_helperv
200 // CHECK: call void bitcast {{.*}} @objc_msgSend {{.*}} @_Z8c_helperv
207 // CHECK: define void @_Z6testC1P1C([[C]]*
208 // CHECK: [[CVAR:%.*]] = alloca [[C]]*, align 8
209 // CHECK: load [[C]]*, [[C]]** [[CVAR]]
211 // CHECK: [[T0:%.*]] = call i32 bitcast {{.*}} @objc_msgSend
213 // CHECK: store i32 [[T0]],
215 // CHECK: [[T0:%.*]] = call i32 @_Zpl2C1RFvvE({{.*}} @_Z8c_helperv
217 // CHECK: store i32 [[T0]],
219 // CHECK: call void @llvm.memcpy
221 // CHECK: call void bitcast {{.*}} @objc_msgSend