File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,7 @@ CIRGenFunction::emitCXXTryStmtUnderScope(const CXXTryStmt &S) {
382382 enterCXXTryStmt (S, tryOp);
383383 // Emit the body for the `try {}` part.
384384 {
385+ mlir::OpBuilder::InsertionGuard guard (getBuilder ());
385386 CIRGenFunction::LexicalScope tryBodyScope{
386387 *this , loc, getBuilder ().getInsertionBlock ()};
387388 if (emitStmt (S.getTryBlock (), /* useCurrentScope=*/ true ).failed ())
Original file line number Diff line number Diff line change @@ -149,3 +149,22 @@ void tc6() {
149149// CHECK: cir.yield
150150// CHECK: }
151151// CHECK: }
152+
153+ // CHECK: cir.func @_Z3tc7v()
154+ void tc7 () {
155+ int r = 1 ;
156+ try {
157+ ++r;
158+ return ;
159+ } catch (...) {
160+ }
161+ }
162+
163+ // CHECK: cir.scope {
164+ // CHECK: cir.try {
165+ // CHECK: %[[V2:.*]] = cir.load {{.*}} : !cir.ptr<!s32i>, !s32i
166+ // CHECK: %[[V3:.*]] = cir.unary(inc, %[[V2]]) : !s32i, !s32i
167+ // CHECK: cir.store %[[V3]], {{.*}} : !s32i, !cir.ptr<!s32i>
168+ // CHECK: cir.return
169+ // CHECK: }
170+ // CHECK: }
You can’t perform that action at this time.
0 commit comments