================
@@ -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(
+ "handler regions must be empty when no handler types are present");
+ return success();
+ }
+
+ mlir::MutableArrayRef<mlir::Region> handlerRegions = getHandlerRegions();
+
+ // The parser and builder won't allow this to happen, but the loop below
+ // relies on the sizes being the same, so we check it here.
+ if (handlerRegions.size() != handlerTypes.size())
+ return emitOpError(
+ "number of handler regions and handler types must match");
----------------
andykaylor wrote:
As above, you can get here by calling `addRegion` on a try op, but you can't
get here via the parser.
https://github.com/llvm/llvm-project/pull/181419
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits