1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
9 // CHECK: call void @_ZN1AC1Ev
10 // CHECK: call void @_ZN1AD1Ev
13 // CHECK: call void @_ZN1AC1Ev
14 // CHECK: call void @_ZN1AD1Ev
27 // CHECK-NOT: call void @_ZN1BC1Ev
28 // CHECK: call void @_ZN1BD1Ev
32 // Member function calls
41 // CHECK: call void @_ZN1CC1Ev
42 // CHECK: call void @_ZN1CD1Ev
43 // CHECK: call void @_ZN1CD1Ev
47 // Function call operator
56 // CHECK: call void @_ZN1DC1Ev
57 // CHECK: call void @_ZN1DD1Ev
58 // CHECK: call void @_ZN1DD1Ev
62 // Overloaded operators
66 E
operator+(const E
&);
71 // CHECK: call void @_ZN1EC1Ev
72 // CHECK: call void @_ZN1EC1Ev
73 // CHECK: call void @_ZN1ED1Ev
74 // CHECK: call void @_ZN1ED1Ev
75 // CHECK: call void @_ZN1ED1Ev
78 // CHECK: call void @_ZN1EC1Ev
79 // CHECK: call void @_ZN1ED1Ev
80 // CHECK: call void @_ZN1ED1Ev
91 // CHECK: call void @_ZN1FC1Ev
92 // CHECK: call void @_ZN1FD1Ev
106 // CHECK: call void @_ZN1AC1Ev
107 // CHECK: call void @_Z1aRK1A
108 // CHECK: call void @_ZN1AD1Ev
111 // CHECK: call void @_ZN1GC1Ev
112 // CHECK: call void @_ZN1Gcv1AEv
113 // CHECK: call void @_Z1aRK1A
114 // CHECK: call void @_ZN1AD1Ev
115 // CHECK: call void @_ZN1GD1Ev
138 // CHECK: call void @_ZN6PR50771AC1Ev
139 // CHECK: call i32 @_ZN6PR50771A1fEv
140 // CHECK: call void @_ZN6PR50771AD1Ev
142 // CHECK: call void @_ZN6PR50771AC1Ev
143 // CHECK: call i32 @_ZN6PR50771gERKNS_1AE
144 // CHECK: call void @_ZN6PR50771AD1Ev
147 // CHECK: call void @_ZN6PR50771fEv
158 // CHECK: call void @_ZN6PR50771BC1Ev
160 // CHECK: call void @_ZN6PR50771fEv
163 // CHECK: call void @_ZN6PR50771BD1Ev
168 // CHECK: call void @_ZN1AC1Ev
169 // CHECK-NOT: call void @_ZN1AD1Ev
181 // CHECK: call void @_ZN1HC1Ev
182 // CHECK: call void @_Z2f91H
183 // CHECK: call void @_ZN1HD1Ev
186 // CHECK: call void @_ZN1HC1ERKS_
187 // CHECK: call void @_Z2f91H
188 // CHECK: call void @_ZN1HD1Ev
195 // CHECK: call void @_ZN1HC1Ev
196 // CHECK: call void @_Z3f10RK1H
197 // CHECK: call void @_ZN1HD1Ev
200 // CHECK: call void @_Z3f10RK1H
201 // CHECK-NOT: call void @_ZN1HD1Ev
214 // CHECK: call void @_ZN1IC1EPKc
215 // CHECK-NOT: call void @_ZN1ID1Ev
229 // CHECK: define void @_ZN6PR58671gEv
231 // CHECK: call void @_ZN6PR58671SC1Ev
232 // CHECK-NEXT: call void @_ZN6PR58671fENS_1SEi
233 // CHECK-NEXT: call void @_ZN6PR58671SD1Ev
234 // CHECK-NEXT: ret void
238 // CHECK: define linkonce_odr void @_ZN6PR58672g2IiEEvT_
241 // CHECK: call void @_ZN6PR58671SC1Ev
242 // CHECK-NEXT: call void @_ZN6PR58671fENS_1SEi
243 // CHECK-NEXT: call void @_ZN6PR58671SD1Ev
244 // CHECK-NEXT: ret void
257 struct B
{ operator A(); };
259 // CHECK: define weak_odr void @_ZN6PR61992f2IiEENS_1AET_
260 template<typename T
> A
f2(T
) {
262 // CHECK: call void @_ZN6PR61991BcvNS_1AEEv
263 // CHECK-NEXT: ret void
267 template A f2
<int>(int);
281 // CHECK: define void @_ZN3T121gEv
283 // CHECK: call void @_ZN3T121AC1Ev
284 // CHECK-NEXT: call i32 @_ZN3T121A1fEv(
285 // CHECK-NEXT: call i32* @_ZN3T121fEi(
286 // CHECK-NEXT: call void @_ZN3T121AD1Ev(
300 // CHECK: call %"struct.PR6648::D"* @_ZN6PR66483zedENS_1BE
305 namespace UserConvertToValue
{
314 // CHECK: void @_ZN18UserConvertToValue1gEv()
316 // CHECK: call void @_ZN18UserConvertToValue1XC1Ei
317 // CHECK: call void @_ZN18UserConvertToValue1fENS_1XE
318 // CHECK: call void @_ZN18UserConvertToValue1XD1Ev
326 struct B
{ int i
; ~B(); };
327 struct C
{ int C::*pm
; ~C(); };
328 // CHECK: define void @_ZN6PR75563fooEv()
330 // CHECK: call void @_ZN6PR75561AD1Ev
332 // CHECK: call void @llvm.memset.p0i8.i64
333 // CHECK: call void @_ZN6PR75561BD1Ev
335 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64
336 // CHECK: call void @_ZN6PR75561CD1Ev
338 // CHECK-NEXT: ret void
344 A(); A(const A
&); ~A();
353 // CHECK: define void @_ZN7Elision5test0Ev()
355 // CHECK: [[I:%.*]] = alloca [[A:%.*]], align 8
356 // CHECK-NEXT: [[J:%.*]] = alloca [[A]], align 8
357 // CHECK-NEXT: [[T0:%.*]] = alloca [[A]], align 8
358 // CHECK-NEXT: [[K:%.*]] = alloca [[A]], align 8
359 // CHECK-NEXT: [[T1:%.*]] = alloca [[A]], align 8
361 // CHECK-NEXT: call void @_ZN7Elision3fooEv()
362 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[I]])
365 // CHECK-NEXT: call void @_ZN7Elision4fooAEv([[A]]* sret [[T0]])
366 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[J]])
367 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T0]])
370 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[T1]])
371 // CHECK-NEXT: call void @_ZN7Elision4fooAEv([[A]]* sret [[K]])
372 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T1]])
375 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[K]])
376 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[J]])
377 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[I]])
381 // CHECK: define void @_ZN7Elision5test1EbNS_1AE(
382 void test1(bool c
, A x
) {
383 // CHECK: [[I:%.*]] = alloca [[A]], align 8
384 // CHECK-NEXT: [[J:%.*]] = alloca [[A]], align 8
386 // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[I]])
387 // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[I]], [[A]]* [[X:%.*]])
390 // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[J]], [[A]]* [[X]])
391 // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[J]])
394 // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[J]])
395 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[I]])
398 // CHECK: define void @_ZN7Elision5test2Ev([[A]]* sret
400 // CHECK: call void @_ZN7Elision3fooEv()
401 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]])
402 // CHECK-NEXT: ret void
406 // CHECK: define void @_ZN7Elision5test3EiNS_1AE([[A]]* sret
407 A
test3(int v
, A x
) {
409 // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]])
410 // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET]], [[A]]* [[X:%.*]])
411 return (v
< 0 ? A() : x
);
413 // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET]], [[A]]* [[X]])
414 // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[RET]])
415 return (v
> 10 ? x
: A());
420 // CHECK: define void @_ZN7Elision5test4Ev()
422 // CHECK: [[X:%.*]] = alloca [[A]], align 8
423 // CHECK-NEXT: [[XS:%.*]] = alloca [2 x [[A]]], align 16
424 // CHECK-NEXT: [[I:%.*]] = alloca i64
426 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[X]])
429 // CHECK-NEXT: [[XS0:%.*]] = getelementptr inbounds [2 x [[A]]]* [[XS]], i32 0, i32 0
430 // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[XS0]])
431 // CHECK-NEXT: [[XS1:%.*]] = getelementptr inbounds [2 x [[A]]]* [[XS]], i32 0, i32 1
432 // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[XS1]], [[A]]* [[X]])
433 // CHECK-NEXT: [[XSB:%.*]] = bitcast [2 x [[A]]]* [[XS]] to [[A]]*
436 // CHECK-NEXT: store i64 2, i64* [[I]]
437 // CHECK-NEXT: br label
438 // CHECK: [[I0:%.*]] = load i64* [[I]]
439 // CHECK-NEXT: icmp ne i64 [[I0]], 0
441 // CHECK: [[I1:%.*]] = load i64* [[I]]
442 // CHECK-NEXT: [[I2:%.*]] = sub i64 [[I1]], 1
443 // CHECK-NEXT: [[XSI:%.*]] = getelementptr inbounds [[A]]* [[XSB]], i64 [[I2]]
444 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[XSI]])
445 // CHECK-NEXT: br label
447 // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[X]])
450 // rdar://problem/8433352
451 // CHECK: define void @_ZN7Elision5test5Ev([[A]]* sret
452 struct B
{ A a
; B(); };
454 // CHECK: [[AT0:%.*]] = alloca [[A]], align 8
455 // CHECK-NEXT: [[BT0:%.*]] = alloca [[B:%.*]], align 8
456 // CHECK-NEXT: [[X:%.*]] = alloca [[A]], align 8
457 // CHECK-NEXT: [[BT1:%.*]] = alloca [[B]], align 8
458 // CHECK-NEXT: [[BT2:%.*]] = alloca [[B]], align 8
460 // CHECK: call void @_ZN7Elision1BC1Ev([[B]]* [[BT0]])
461 // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT0]], i32 0, i32 0
462 // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[AT0]], [[A]]* [[AM]])
463 // CHECK-NEXT: call void @_ZN7Elision5takeAENS_1AE([[A]]* [[AT0]])
464 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[AT0]])
465 // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT0]])
468 // CHECK-NEXT: call void @_ZN7Elision1BC1Ev([[B]]* [[BT1]])
469 // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT1]], i32 0, i32 0
470 // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[X]], [[A]]* [[AM]])
471 // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT1]])
474 // CHECK-NEXT: call void @_ZN7Elision1BC1Ev([[B]]* [[BT2]])
475 // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT2]], i32 0, i32 0
476 // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET:%.*]], [[A]]* [[AM]])
477 // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT2]])
480 // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[X]])
483 // Reduced from webkit.
484 // CHECK: define void @_ZN7Elision5test6EPKNS_1CE([[C:%.*]]*
485 struct C
{ operator A() const; };
486 void test6(const C
*x
) {
487 // CHECK: [[T0:%.*]] = alloca [[A]], align 8
488 // CHECK: [[X:%.*]] = load [[C]]** {{%.*}}, align 8
489 // CHECK-NEXT: call void @_ZNK7Elision1CcvNS_1AEEv([[A]]* sret [[T0]], [[C]]* [[X]])
490 // CHECK-NEXT: call void @_ZNK7Elision1A3fooEv([[A]]* [[T0]])
491 // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T0]])
492 // CHECK-NEXT: ret void
498 struct A
{ A(int); ~A(); };
500 // CHECK: define void @_ZN6PR86233fooEb(
502 // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1
503 // CHECK-NEXT: [[LCONS:%.*]] = alloca i1
504 // CHECK-NEXT: [[RCONS:%.*]] = alloca i1
505 // CHECK-NEXT: store i1 false, i1* [[RCONS]]
506 // CHECK-NEXT: store i1 false, i1* [[LCONS]]
508 // CHECK: call void @_ZN6PR86231AC1Ei([[A]]* [[TMP]], i32 2)
509 // CHECK-NEXT: store i1 true, i1* [[LCONS]]
510 // CHECK-NEXT: br label
511 // CHECK: call void @_ZN6PR86231AC1Ei([[A]]* [[TMP]], i32 3)
512 // CHECK-NEXT: store i1 true, i1* [[RCONS]]
513 // CHECK-NEXT: br label
514 // CHECK: load i1* [[RCONS]]
516 // CHECK: call void @_ZN6PR86231AD1Ev([[A]]* [[TMP]])
517 // CHECK-NEXT: store i1 false, i1* [[RCONS]]
518 // CHECK-NEXT: br label
519 // CHECK: load i1* [[LCONS]]
521 // CHECK: call void @_ZN6PR86231AD1Ev([[A]]* [[TMP]])
522 // CHECK-NEXT: store i1 false, i1* [[LCONS]]
523 // CHECK-NEXT: br label