Debian Codegraph @

clang/test/CodeGenObjCXX/nrvo.mm

raw
1 // RUN: %clang_cc1 -emit-llvm -o - -fblocks %s -O1 -fno-inline-functions -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s
2
3 // PR10835
4 struct X {
5 X();
6 X(const X&);
7 ~X();
8 };
9
10 @interface NRVO
11 @end
12
13 @implementation NRVO
14 // CHECK: define internal void @"\01-[NRVO getNRVO]"
15 - (X)getNRVO {
16 X x;
17 // CHECK: call void @_ZN1XC1Ev
18 // CHECK-NEXT: ret void
19 return x;
20 }
21 @end
22
23 X blocksNRVO() {
24 return ^{
25 // With the optimizer enabled, the DeadArgElim pass is able to
26 // mark the block litteral address argument as unused and later the
27 // related block_litteral global variable is removed.
28 // This allows to promote this call to a fastcc call.
29 // CHECK-LABEL: define internal fastcc void @___Z10blocksNRVOv_block_invoke
30 X x;
31 // CHECK: call void @_ZN1XC1Ev
32 // CHECK-NEXT: ret void
33 return x;
34 }() ;
35 }
36