[clang] [CIR] Introduce cir.construct_catch_param (PR #195283)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 09:13:55 PDT 2026


================
@@ -4138,7 +4138,15 @@ LogicalResult cir::TryOp::verify() {
     if (mlir::isa<cir::UnwindAttr>(typeAttr))
       continue;
 
-    if (entryBlock.empty() || !mlir::isa<cir::BeginCatchOp>(entryBlock.front()))
+    // A catch handler region must start with cir.begin_catch, optionally
+    // preceded by a single cir.construct_catch_param that performs any
+    // pre-begin_catch initialization for the catch parameter.
+    if (entryBlock.empty())
+      return emitOpError("catch handler region must not be empty");
+    mlir::Operation *firstOp = &entryBlock.front();
+    if (mlir::isa<cir::ConstructCatchParamOp>(firstOp))
----------------
erichkeane wrote:

```suggestion
    if (mlir::isa_and_present<cir::ConstructCatchParamOp>(firstOp))
```

https://github.com/llvm/llvm-project/pull/195283


More information about the cfe-commits mailing list