[clang] [CIR] Reject a record redefined with a different body (PR #230547)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 00:26:39 PDT 2026


================
@@ -326,9 +326,17 @@ Type StructType::parse(mlir::AsmParser &parser) {
                                   is_class, kindsRef);
     if (!type)
       return {};
-    if (auto structTy = mlir::dyn_cast<StructType>(type))
-      if (structTy.isIncomplete())
+    if (auto structTy = mlir::dyn_cast<StructType>(type)) {
+      if (structTy.isIncomplete()) {
         structTy.complete(membersRef, packed, kindsRef);
+      } else if (structTy.getMembers() != membersRef ||
----------------
steffenlarsen wrote:

I dug a little deeper and it seems like we can just use `mutate`, which has roughly the same check surface and thus about the same risk, but at least the risk will be concentrated into the same surface. Additionally, that function will also do `complete` for us.

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


More information about the cfe-commits mailing list