[clang] [CIR] Upstream the CatchParamOp (PR #165110)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 27 13:51:17 PDT 2025


================
@@ -3096,6 +3096,23 @@ static mlir::ParseResult parseTryHandlerRegions(
   return mlir::success();
 }
 
+//===----------------------------------------------------------------------===//
+// CatchParamOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::CatchParamOp::verify() {
+  std::optional<cir::CatchParamKind> kind = getKind();
+  if (getExceptionPtr()) {
+    if (!kind || *kind != cir::CatchParamKind::Begin)
+      return emitOpError("needs 'begin' to work with exception pointer");
----------------
xlauko wrote:

Took me a while to get this error message. I parsed it as `begin` needs to work with exception pointer. Can we rewrite it to something like:
```suggestion
      return emitOpError("with exception pointer must be of `begin` kind");
```

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


More information about the cfe-commits mailing list