[clang] [CIR] Introduce loop cleanup regions (PR #210212)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 17 14:01:32 PDT 2026
================
@@ -0,0 +1,81 @@
+// RUN: cir-opt %s -verify-diagnostics -split-input-file
+
+!s32i = !cir.int<s, 32>
+
+cir.func private @dtor(!cir.ptr<!s32i>)
+
+cir.func @while_cleanup_missing_kind(%cond : !cir.bool, %s : !cir.ptr<!s32i>) {
+ cir.while {
+ cir.condition(%cond)
+ } do {
+ cir.yield
+ // expected-error @below {{expected valid keyword or string}}
+ // expected-error @below {{failed to parse CIR_CleanupKindAttr}}
----------------
andykaylor wrote:
I'd prefer to leave this as is. @erichkeane has been pushing back against custom print/parse when we can avoid them (and I think he's right to do so). The error already points you to the missing attribute type. The possible keywords here will change (we'll be adding lifetime soon), and it's slightly different than the set used in CleanupScopeOp (which unlike the loops accepts "eh"). In fact, "eh" will parse cleanly here but be rejected by the verifier.
I was a little surprised that the standard MLIR enum attribute parser didn't have a better error message. Maybe it will some day.
https://github.com/llvm/llvm-project/pull/210212
More information about the cfe-commits
mailing list