1
- // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -mconstructor-aliases -fclangir -emit-cir %s -o %t.cir
1
+ // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -Wno-unused-value - fcxx-exceptions -fexceptions -mconstructor-aliases -fclangir -emit-cir %s -o %t.cir
2
2
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3
- // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -mconstructor-aliases -fclangir -emit-llvm %s -o %t.ll
3
+ // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -DLLVM_IMPLEMENTED - fcxx-exceptions -fexceptions -mconstructor-aliases -fclangir -emit-llvm %s -o %t.ll
4
4
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
5
5
6
6
struct Vec {
@@ -19,6 +19,7 @@ void yo() {
19
19
}
20
20
21
21
// CIR-DAG: ![[VecTy:.*]] = !cir.struct<struct "Vec" {!cir.int<u, 8>}>
22
+ // CIR-DAG: ![[S1:.*]] = !cir.struct<struct "S1" {!cir.struct<struct "Vec" {!cir.int<u, 8>}>}>
22
23
23
24
// CIR: cir.scope {
24
25
// CIR: %[[VADDR:.*]] = cir.alloca ![[VecTy]], !cir.ptr<![[VecTy]]>, ["v", init]
@@ -58,4 +59,43 @@ void yo() {
58
59
// LLVM: br label %[[RET_BB:.*]],
59
60
60
61
// LLVM: [[RET_BB]]:
61
- // LLVM: ret void
62
+ // LLVM: ret void
63
+
64
+ #ifndef LLVM_IMPLEMENTED
65
+ struct S1 {
66
+ Vec v;
67
+ };
68
+
69
+ void yo2 () {
70
+ int r = 1 ;
71
+ try {
72
+ Vec v;
73
+ S1 ((Vec&&) v);
74
+ } catch (...) {
75
+ r++;
76
+ }
77
+ }
78
+ #endif
79
+
80
+ // CIR: cir.func @_Z3yo2v()
81
+ // CIR: cir.scope {
82
+ // CIR: cir.alloca ![[VecTy]]
83
+ // CIR: cir.try {
84
+ // CIR: cir.call exception @_ZN3VecC1Ev
85
+ // CIR: cir.scope {
86
+ // CIR: cir.alloca ![[S1:.*]], !cir.ptr<![[S1:.*]]>, ["agg.tmp.ensured"]
87
+ // CIR: cir.call exception @_ZN3VecC1EOS_
88
+ // CIR: cir.call @_ZN2S1D2Ev
89
+ // CIR: }
90
+ // CIR: cir.call @_ZN3VecD1Ev
91
+ // CIR: cir.yield
92
+ // CIR: } cleanup {
93
+ // CIR: cir.call @_ZN3VecD1Ev
94
+ // CIR: cir.yield
95
+ // CIR: } catch [type #cir.all {
96
+ // CIR: cir.catch_param -> !cir.ptr<!void>
97
+ // CIR: cir.yield
98
+ // CIR: }]
99
+ // CIR: }
100
+ // CIR: cir.return
101
+ // CIR: }
0 commit comments