[Mlir-commits] [mlir] [mlir-tblgen] Fix bug in emitEnumDoc (PR #118131)
Malte Dehling
llvmlistbot at llvm.org
Fri Nov 29 12:39:47 PST 2024
https://github.com/mdehling created https://github.com/llvm/llvm-project/pull/118131
Fixes a crash (assertion failure) in `mlir-tblgen -emit-enum-doc` caused by calling `EnumAttr()` for the wrong type of `Record *`: `EnumAttr` rather than `EnumAttrInfo` as asserted.
Compare the corresponding line in `emitDialectDoc()`:
https://github.com/llvm/llvm-project/blob/0ad6be1927f89cef09aa5d0fb244873f687997c9/mlir/tools/mlir-tblgen/OpDocGen.cpp#L532
>From ba516ee2c00c7d99e0de28fd75715a0f9afff115 Mon Sep 17 00:00:00 2001
From: Malte Dehling <m.dehling at samsung.com>
Date: Fri, 29 Nov 2024 12:15:36 -0800
Subject: [PATCH] [mlir-tblgen] Fix bug in emitEnumDoc
Fixes a crash (assertion failure) in `mlir-tblgen -emit-enum-doc` caused
by calling `EnumAttr()` for the wrong type of `Record *`: `EnumAttr`
rather than `EnumAttrInfo` as asserted.
---
mlir/tools/mlir-tblgen/OpDocGen.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp
index d499c78a5cf44d..1c394f5680a5c9 100644
--- a/mlir/tools/mlir-tblgen/OpDocGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp
@@ -409,7 +409,7 @@ static void emitEnumDoc(const EnumAttr &def, raw_ostream &os) {
static void emitEnumDoc(const RecordKeeper &records, raw_ostream &os) {
os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
- for (const Record *def : records.getAllDerivedDefinitions("EnumAttr"))
+ for (const Record *def : records.getAllDerivedDefinitions("EnumAttrInfo"))
emitEnumDoc(EnumAttr(def), os);
}
More information about the Mlir-commits
mailing list