[clang] [CIR] Add verifier for CIR try op (PR #181419)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 12:57:22 PST 2026


================
@@ -3774,6 +3774,38 @@ mlir::ValueRange cir::TryOp::getSuccessorInputs(RegionSuccessor successor) {
                               : ValueRange();
 }
 
+LogicalResult cir::TryOp::verify() {
+  mlir::ArrayAttr handlerTypes = getHandlerTypes();
+  if (!handlerTypes) {
+    if (!getHandlerRegions().empty())
+      return emitOpError(
----------------
andykaylor wrote:

This error can't be tested because the parser won't let us get into this situation. It is possible to add regions without corresponding types in live code, so I think this needs to be here.

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


More information about the cfe-commits mailing list