xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/nrvo.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -emit-llvm -o - -fblocks %s -O1 -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc// PR10835 / <rdar://problem/10050178>
4*f4a2713aSLionel Sambucstruct X {
5*f4a2713aSLionel Sambuc  X();
6*f4a2713aSLionel Sambuc  X(const X&);
7*f4a2713aSLionel Sambuc  ~X();
8*f4a2713aSLionel Sambuc};
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface NRVO
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@implementation NRVO
14*f4a2713aSLionel Sambuc// CHECK: define internal void @"\01-[NRVO getNRVO]"
15*f4a2713aSLionel Sambuc- (X)getNRVO {
16*f4a2713aSLionel Sambuc  X x;
17*f4a2713aSLionel Sambuc  // CHECK: tail call void @_ZN1XC1Ev
18*f4a2713aSLionel Sambuc  // CHECK-NEXT: ret void
19*f4a2713aSLionel Sambuc  return x;
20*f4a2713aSLionel Sambuc}
21*f4a2713aSLionel Sambuc@end
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel SambucX blocksNRVO() {
24*f4a2713aSLionel Sambuc  return ^{
25*f4a2713aSLionel Sambuc    // CHECK-LABEL: define internal void @___Z10blocksNRVOv_block_invoke
26*f4a2713aSLionel Sambuc    X x;
27*f4a2713aSLionel Sambuc    // CHECK: tail call void @_ZN1XC1Ev
28*f4a2713aSLionel Sambuc    // CHECK-NEXT: ret void
29*f4a2713aSLionel Sambuc    return x;
30*f4a2713aSLionel Sambuc  }() ;
31*f4a2713aSLionel Sambuc}
32*f4a2713aSLionel Sambuc
33