1 // RUN: %clang_cc1 -no-enable-noundef-analysis %s -std=c++11 -O1 -DWITH_DTOR -triple x86_64 -emit-llvm -o - | FileCheck -check-prefix=CHECK-DTOR %s
2 // RUN: %clang_cc1 -no-enable-noundef-analysis %s -std=c++11 -O1 -triple x86_64 -emit-llvm -o - | FileCheck -check-prefix=CHECK-NO-DTOR %s
10 operator bool() const;
23 // CHECK-DTOR-LABEL: Test1
24 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
25 // CHECK-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR:[^ ]+]])
26 // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
27 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[VAR]])
28 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])
29 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
30 // CHECK-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR:[^ ]+]])
31 // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
32 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[VAR]])
33 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])
36 // CHECK-NO-DTOR-LABEL: Test1
37 // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
38 // CHECK-NO-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR:[^ ]+]])
39 // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
40 // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])
41 // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
42 // CHECK-NO-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR:[^ ]+]])
43 // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
44 // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])
57 // CHECK-DTOR-LABEL: Test2
58 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR1:.+]])
59 // CHECK-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR1:[^ ]+]])
60 // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
61 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR2:.+]])
62 // CHECK-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR2:[^ ]+]])
63 // CHECK-DTOR: call void @_Z3FooIRK1AEvOT_
64 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[VAR2]])
65 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR2]])
66 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[VAR1]])
67 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR1]])
70 // CHECK-NO-DTOR-LABEL: Test2
71 // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR1:.+]])
72 // CHECK-NO-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR1:[^ ]+]])
73 // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
74 // CHECK-NO-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR2:.+]])
75 // CHECK-NO-DTOR: call void @_ZN1AC1Ev(ptr nonnull {{[^,]*}} %[[VAR2:[^ ]+]])
76 // CHECK-NO-DTOR: call void @_Z3FooIRK1AEvOT_
77 // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR2]])
78 // CHECK-NO-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR1]])
87 // CHECK-DTOR-LABEL: Test3
88 // CHECK-DTOR: call void @llvm.lifetime.start
89 // CHECK-DTOR: call void @llvm.lifetime.start
92 // CHECK-DTOR: call void @llvm.lifetime.end
95 // CHECK-DTOR: call void @llvm.lifetime.end
98 // CHECK-DTOR: call void @llvm.lifetime.end
101 if (const A
&b
= A(a
)) {
109 // CHECK-DTOR-LABEL: Test4
110 // CHECK-DTOR: call void @llvm.lifetime.start
113 // CHECK-DTOR: call void @llvm.lifetime.end
117 for (const A
&a
= A
{}; a
;) {
123 // CHECK-DTOR-LABEL: Test5
124 // CHECK-DTOR: call void @llvm.lifetime.start
125 // CHECK-DTOR: call i32 @_Z3BazIiET_v()
127 // CHECK-DTOR: call void @_Z3FooIRKiEvOT_
129 // CHECK-DTOR: call void @llvm.lifetime.end
131 const int &a
= Baz
<int>();
137 // CHECK-DTOR-LABEL: Test6
138 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 {{[0-9]+}}, ptr nonnull %[[ADDR:.+]])
139 // CHECK-DTOR: call i32 @_Z3BazIiET_v()
141 // CHECK-DTOR: call void @_Z3FooIiEvOT_
142 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 {{[0-9]+}}, ptr nonnull %[[ADDR]])
143 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 {{[0-9]+}}, ptr nonnull %[[ADDR:.+]])
144 // CHECK-DTOR: call i32 @_Z3BazIiET_v()
146 // CHECK-DTOR: call void @_Z3FooIiEvOT_
147 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 {{[0-9]+}}, ptr nonnull %[[ADDR]])
154 // CHECK-DTOR-LABEL: Test7
155 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
156 // CHECK-DTOR: call void @_Z3BazI1AET_v({{.*}} %[[SLOT:[^ ]+]])
157 // CHECK-DTOR: call void @_Z3FooI1AEvOT_({{.*}} %[[SLOT]])
158 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[SLOT]])
159 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])
160 // CHECK-DTOR: call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %[[ADDR:.+]])
161 // CHECK-DTOR: call void @_Z3BazI1AET_v({{.*}} %[[SLOT:[^ ]+]])
162 // CHECK-DTOR: call void @_Z3FooI1AEvOT_({{.*}} %[[SLOT]])
163 // CHECK-DTOR: call void @_ZN1AD1Ev(ptr nonnull {{[^,]*}} %[[SLOT]])
164 // CHECK-DTOR: call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %[[ADDR]])