annotate clang/test/CXX/special/class.copy/implicit-move-def.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // FIXME: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-ASSIGN %s
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-CTOR %s
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // construct
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 struct E {
anatofuz
parents:
diff changeset
8 E();
anatofuz
parents:
diff changeset
9 E(E&&);
anatofuz
parents:
diff changeset
10 };
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 struct F {
anatofuz
parents:
diff changeset
13 F();
anatofuz
parents:
diff changeset
14 F(F&&);
anatofuz
parents:
diff changeset
15 };
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 struct G {
anatofuz
parents:
diff changeset
18 E e;
anatofuz
parents:
diff changeset
19 };
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 struct H : G {
anatofuz
parents:
diff changeset
22 F l;
anatofuz
parents:
diff changeset
23 E m;
anatofuz
parents:
diff changeset
24 F ar[2];
anatofuz
parents:
diff changeset
25 };
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 void f() {
anatofuz
parents:
diff changeset
28 H s;
anatofuz
parents:
diff changeset
29 // CHECK: call void @_ZN1HC1EOS_
anatofuz
parents:
diff changeset
30 H t(static_cast<H&&>(s));
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 // assign
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 struct A {
anatofuz
parents:
diff changeset
37 A &operator =(A&&);
anatofuz
parents:
diff changeset
38 };
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 struct B {
anatofuz
parents:
diff changeset
41 B &operator =(B&&);
anatofuz
parents:
diff changeset
42 };
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 struct C {
anatofuz
parents:
diff changeset
45 A a;
anatofuz
parents:
diff changeset
46 };
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 struct D : C {
anatofuz
parents:
diff changeset
49 A a;
anatofuz
parents:
diff changeset
50 B b;
anatofuz
parents:
diff changeset
51 A ar[2];
anatofuz
parents:
diff changeset
52 };
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 void g() {
anatofuz
parents:
diff changeset
55 D d;
anatofuz
parents:
diff changeset
56 // CHECK: call {{.*}} @_ZN1DaSEOS_
anatofuz
parents:
diff changeset
57 d = D();
anatofuz
parents:
diff changeset
58 }
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 // PR10822
anatofuz
parents:
diff changeset
61 struct I {
anatofuz
parents:
diff changeset
62 unsigned var[1];
anatofuz
parents:
diff changeset
63 };
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 // CHECK: define void @_Z1hv() nounwind {
anatofuz
parents:
diff changeset
66 void h() {
anatofuz
parents:
diff changeset
67 I i;
anatofuz
parents:
diff changeset
68 // CHECK: call void @llvm.memcpy.
anatofuz
parents:
diff changeset
69 i = I();
anatofuz
parents:
diff changeset
70 // CHECK-NEXT: ret void
anatofuz
parents:
diff changeset
71 }
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 // PR10860
anatofuz
parents:
diff changeset
74 struct Empty { };
anatofuz
parents:
diff changeset
75 struct VirtualWithEmptyBase : Empty {
anatofuz
parents:
diff changeset
76 virtual void f();
anatofuz
parents:
diff changeset
77 };
anatofuz
parents:
diff changeset
78
anatofuz
parents:
diff changeset
79 // CHECK: define void @_Z25move_VirtualWithEmptyBaseR20VirtualWithEmptyBaseS0_
anatofuz
parents:
diff changeset
80 void move_VirtualWithEmptyBase(VirtualWithEmptyBase &x, VirtualWithEmptyBase &y) {
anatofuz
parents:
diff changeset
81 // CHECK: call {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
anatofuz
parents:
diff changeset
82 x = static_cast<VirtualWithEmptyBase&&>(y);
anatofuz
parents:
diff changeset
83 // CHECK-NEXT: ret void
anatofuz
parents:
diff changeset
84 }
anatofuz
parents:
diff changeset
85
anatofuz
parents:
diff changeset
86 // move assignment ops
anatofuz
parents:
diff changeset
87
anatofuz
parents:
diff changeset
88 // CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_
anatofuz
parents:
diff changeset
89 // CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_
anatofuz
parents:
diff changeset
90 // CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
anatofuz
parents:
diff changeset
91 // CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_
anatofuz
parents:
diff changeset
92 // array loop
anatofuz
parents:
diff changeset
93 // CHECK-ASSIGN: br i1
anatofuz
parents:
diff changeset
94 // CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
anatofuz
parents:
diff changeset
95
anatofuz
parents:
diff changeset
96 // VirtualWithEmptyBase move assignment operatpr
anatofuz
parents:
diff changeset
97 // CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
anatofuz
parents:
diff changeset
98 // CHECK-ASSIGN: store
anatofuz
parents:
diff changeset
99 // CHECK-ASSIGN-NEXT: store
anatofuz
parents:
diff changeset
100 // CHECK-ASSIGN-NOT: call
anatofuz
parents:
diff changeset
101 // CHECK-ASSIGN: ret
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 // CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_
anatofuz
parents:
diff changeset
104 // CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
anatofuz
parents:
diff changeset
105
anatofuz
parents:
diff changeset
106 // move ctors
anatofuz
parents:
diff changeset
107
anatofuz
parents:
diff changeset
108 // CHECK-CTOR: define linkonce_odr {{.*}} @_ZN1HC2EOS_
anatofuz
parents:
diff changeset
109 // CHECK-CTOR: call {{.*}} @_ZN1GC2EOS_
anatofuz
parents:
diff changeset
110 // CHECK-CTOR: call {{.*}} @_ZN1FC1EOS_
anatofuz
parents:
diff changeset
111 // CHECK-CTOR: call {{.*}} @_ZN1EC1EOS_
anatofuz
parents:
diff changeset
112 // array loop
anatofuz
parents:
diff changeset
113 // CHECK-CTOR: call {{.*}} @_ZN1FC1EOS_
anatofuz
parents:
diff changeset
114 // CHECK-CTOR: br i1
anatofuz
parents:
diff changeset
115
anatofuz
parents:
diff changeset
116 // CHECK-CTOR: define linkonce_odr {{.*}} @_ZN1GC2EOS_
anatofuz
parents:
diff changeset
117 // CHECK-CTOR: call {{.*}} @_ZN1EC1EOS_