[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CXX / except / except.spec / p14-ir.cpp
blob48d0669ec641e0c22f6b7173dee16328225ba583
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
3 // Copy constructor
4 struct X0 {
5 X0();
6 X0(const X0 &) throw();
7 X0(X0 &);
8 };
10 struct X1 {
11 X1();
12 X1(const X1 &) throw();
15 struct X2 : X1 {
16 X2();
18 struct X3 : X0, X1 {
19 X3();
22 struct X4 {
23 X4(X4 &) throw();
26 struct X5 : X0, X4 { };
28 void test(X2 x2, X3 x3, X5 x5) {
29 // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr
30 // CHECK: call void @_ZN2X2C2ERKS_({{.*}}) [[NUW:#[0-9]+]]
31 // CHECK-NEXT: ret void
32 // CHECK-NEXT: }
33 X2 x2a(x2);
34 // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr
35 // CHECK: call void @_ZN2X3C2ERKS_({{.*}}) [[NUW]]
36 // CHECK-NEXT: ret void
37 // CHECK-NEXT: }
38 X3 x3a(x3);
39 // CHECK: define linkonce_odr void @_ZN2X5C1ERS_({{.*}}) unnamed_addr
40 // CHECK-NOT: call void @__cxa_call_unexpected
41 // CHECK: ret void
42 X5 x5a(x5);
45 // Default constructor
46 struct X6 {
47 X6() throw();
50 struct X7 {
51 X7();
54 struct X8 : X6 { };
55 struct X9 : X6, X7 { };
57 void test() {
58 // CHECK: define linkonce_odr void @_ZN2X8C1Ev(ptr {{[^,]*}} %this) unnamed_addr
59 // CHECK: call void @_ZN2X8C2Ev({{.*}}) [[NUW]]
60 // CHECK-NEXT: ret void
61 X8();
63 // CHECK: define linkonce_odr void @_ZN2X9C1Ev(ptr {{[^,]*}} %this) unnamed_addr
64 // FIXME: check that this is the end of the line here:
65 // CHECK: call void @_ZN2X9C2Ev({{.*}})
66 // CHECK-NEXT: ret void
67 X9();
69 // CHECK: define linkonce_odr void @_ZN2X8C2Ev(ptr {{[^,]*}} %this) unnamed_addr
70 // CHECK: call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
71 // CHECK-NEXT: ret void
73 // CHECK: define linkonce_odr void @_ZN2X9C2Ev(ptr {{[^,]*}} %this) unnamed_addr
74 // CHECK: call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
75 // FIXME: and here:
76 // CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
77 // CHECK: ret void
80 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }