]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenObjCXX/property-dot-copy-elision.mm
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / test / CodeGenObjCXX / property-dot-copy-elision.mm
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -std=c++1z -fobjc-arc -o - %s | FileCheck %s
2
3 struct S0 {
4   ~S0();
5   id f;
6 };
7
8 struct S1 {
9   S1();
10   ~S1();
11   S1(S0);
12   id f;
13 };
14
15 @interface C
16 @property S1 f;
17 @end
18 @implementation C
19 @end
20
21 // CHECK-LABEL: define void @_Z5test0P1C(
22 // CHECK: %{{.*}} = alloca %
23 // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_S1:.*]], align
24 // CHECK: %[[AGG_TMP_1:.*]] = alloca %[[STRUCT_S0:.*]], align
25 // CHECK: call void @_ZN2S0C1Ev(%[[STRUCT_S0]]* %[[AGG_TMP_1]])
26 // CHECK: call void @_ZN2S1C1E2S0(%[[STRUCT_S1]]* %[[AGG_TMP]], %[[STRUCT_S0]]* %[[AGG_TMP_1]])
27 // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %[[STRUCT_S1]]*)*)(i8* %{{.*}}, i8* %{{.*}}, %[[STRUCT_S1]]* %[[AGG_TMP]])
28
29 void test0(C *c) {
30   c.f = S0();
31 }
32
33 // CHECK: define void @_Z5test1P1C(
34 // CHECK: %{{.*}} = alloca %
35 // CHECK: %[[TEMP_LVALUE:.*]] = alloca %[[STRUCT_S1:.*]], align
36 // CHECK: call void @_ZN2S1C1Ev(%[[STRUCT_S1]]* %[[TEMP_LVALUE]])
37 // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %[[STRUCT_S1]]*)*)(i8* %{{.*}}, i8* %{{.*}}, %[[STRUCT_S1]]* %[[TEMP_LVALUE]])
38
39 void test1(C *c) {
40   c.f = S1();
41 }