Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ struct CallEndCatch final : EHScopeStack::Cleanup {
// here. For CIR, just let it pass since the cleanup is going
// to be emitted on a later pass when lowering the catch region.
// CGF.EmitRuntimeCallOrTryCall(getEndCatchFn(CGF.CGM));
CGF.getBuilder().create<cir::YieldOp>(*CGF.currSrcLoc);
if (!CGF.getBuilder().getBlock()->mightHaveTerminator())
CGF.getBuilder().create<cir::YieldOp>(*CGF.currSrcLoc);
}
};
} // namespace
Expand Down
25 changes: 24 additions & 1 deletion clang/test/CIR/CodeGen/try-catch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,27 @@ unsigned long long tc4() {
}

return z;
}
}

struct S {
S() {};
int a;
};

// CHECK: cir.func @_Z3tc5v()
void tc5() {
try {
S s;
} catch (...) {
tc5();
}
}

// CHECK: cir.try {
// CHECK: cir.call exception @_ZN1SC2Ev({{.*}}) : (!cir.ptr<!ty_S>) -> ()
// CHECK: cir.yield
// CHECK: } catch [type #cir.all {
// CHECK: {{.*}} = cir.catch_param -> !cir.ptr<!void>
// CHECK: cir.call exception @_Z3tc5v() : () -> ()
// CHECK: cir.yield
// CHECK: }]