File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
include/clang/CIR/Dialect/IR Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -898,6 +898,36 @@ def CIR_ContinueOp : CIR_Op<"continue", [Terminator]> {
898898 let hasLLVMLowering = false;
899899}
900900
901+ //===----------------------------------------------------------------------===//
902+ // Resume
903+ //===----------------------------------------------------------------------===//
904+
905+ def CIR_ResumeOp : CIR_Op<"resume", [
906+ ReturnLike, Terminator, HasParent<"cir::TryOp">
907+ ]> {
908+ let summary = "Resumes execution after not catching exceptions";
909+ let description = [{
910+ The `cir.resume` operation handles an uncaught exception scenario.
911+
912+ Used as the terminator of a `CatchUnwind` region of `cir.try`, where it
913+ does not receive any arguments (implied from the `cir.try` scope).
914+
915+ This operation is used only before the CFG flatterning pass.
916+
917+ Examples:
918+ ```mlir
919+ cir.try {
920+ cir.yield
921+ } unwind {
922+ cir.resume
923+ }
924+ ```
925+ }];
926+
927+ let assemblyFormat = "attr-dict";
928+ let hasLLVMLowering = false;
929+ }
930+
901931//===----------------------------------------------------------------------===//
902932// ScopeOp
903933//===----------------------------------------------------------------------===//
Original file line number Diff line number Diff line change @@ -81,4 +81,26 @@ cir.func dso_local @empty_try_block_with_catch_ist() {
8181// CHECK: cir.return
8282// CHECK: }
8383
84+ cir.func @empty_try_block_with_catch_unwind_contains_resume() {
85+ cir.scope {
86+ cir.try {
87+ cir.yield
88+ } unwind {
89+ cir.resume
90+ }
91+ }
92+ cir.return
93+ }
94+
95+ // CHECK: cir.func @empty_try_block_with_catch_unwind_contains_resume() {
96+ // CHECK: cir.scope {
97+ // CHECK: cir.try {
98+ // CHECK: cir.yield
99+ // CHECK: } unwind {
100+ // CHECK: cir.resume
101+ // CHECK: }
102+ // CHECK: }
103+ // CHECK: cir.return
104+ // CHECK: }
105+
84106}
You can’t perform that action at this time.
0 commit comments