File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed
include/clang/CIR/Dialect/IR Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -5134,6 +5134,33 @@ def CIR_TryOp : CIR_Op<"try",[
51345134 let hasLLVMLowering = false;
51355135}
51365136
5137+ //===----------------------------------------------------------------------===//
5138+ // CatchParamOp
5139+ //===----------------------------------------------------------------------===//
5140+
5141+ def CIR_CatchParamOp : CIR_Op<"catch_param", [HasParent<"cir::TryOp">]> {
5142+ let summary = "Represents catch clause formal parameter";
5143+ let description = [{
5144+ The `cir.catch_param` operate in the catch regions of `cir.try`.
5145+
5146+ This operation is used only before the CFG flatterning pass.
5147+
5148+ Example:
5149+
5150+ ```mlir
5151+ %exception = cir.catch_param -> !cir.ptr<!void>
5152+ ```
5153+ }];
5154+
5155+ let results = (outs Optional<CIR_AnyType>:$param);
5156+ let assemblyFormat = [{
5157+ (`:` qualified(type($param))^)?
5158+ attr-dict
5159+ }];
5160+
5161+ let hasLLVMLowering = false;
5162+ }
5163+
51375164//===----------------------------------------------------------------------===//
51385165// Exception related: EhInflightOp
51395166//===----------------------------------------------------------------------===//
Original file line number Diff line number Diff line change 1+ // RUN: cir-opt %s --verify-roundtrip | FileCheck %s
2+
3+ !s32i = !cir.int<s, 32>
4+ !void = !cir.void
5+
6+ module {
7+
8+ cir.func @catch_param_inside_catch() {
9+ cir.scope {
10+ cir.try {
11+ cir.yield
12+ } catch all {
13+ cir.catch_param : !cir.ptr<!void>
14+ cir.yield
15+ }
16+ }
17+ cir.return
18+ }
19+
20+ // CHECK: cir.func @catch_param_inside_catch() {
21+ // CHECK: cir.scope {
22+ // CHECK: cir.try {
23+ // CHECK: cir.yield
24+ // CHECK: } catch all {
25+ // CHECK: cir.catch_param : !cir.ptr<!void>
26+ // CHECK: cir.yield
27+ // CHECK: }
28+ // CHECK: }
29+ // CHECK: cir.return
30+ // CHECK: }
31+
32+ }
You can’t perform that action at this time.
0 commit comments