[Mlir-commits] [mlir] [MLIR][tblgen] Honor `-dialect` in `-gen-{attrdef, op, typedef, enum}-doc` (PR #182183)

Fabian Schuiki llvmlistbot at llvm.org
Thu Feb 19 11:06:45 PST 2026


================
@@ -569,34 +599,32 @@ static bool emitDialectDoc(const RecordKeeper &records, raw_ostream &os) {
       continue;
     opDocGroup[rec].summary = rec->getValueAsString("summary");
     opDocGroup[rec].description = rec->getValueAsString("description");
-    dialectOps.push_back(opDocGroup[rec]);
+    result.ops.push_back(opDocGroup[rec]);
   }
   for (const Record *def : typeDefDefs)
-    addIfInDialect(def, TypeDef(def), dialectTypeDefs);
+    addIfInDialect(def, TypeDef(def), result.typeDefs);
   for (const Record *def : typeDefs)
-    addIfInDialect(def, Type(def), dialectTypes);
-  dialectEnums.reserve(enumDefs.size());
+    addIfInDialect(def, Type(def), result.types);
+  result.enums.reserve(enumDefs.size());
   for (const Record *def : enumDefs)
-    addIfNotSeen(def, EnumInfo(def), dialectEnums);
+    addIfNotSeen(def, EnumInfo(def), result.enums);
 
   // Sort alphabetically ignorning dialect for ops and section name for
   // sections.
   // TODO: The sorting order could be revised, currently attempting to sort of
   // keep in alphabetical order.
-  llvm::sort(dialectOps, [](const OpDocGroup &lhs, const OpDocGroup &rhs) {
-    auto getDesc = [](const OpDocGroup &arg) -> StringRef {
-      if (!arg.summary.empty())
-        return arg.summary;
-      return arg.ops.front().getDef().getValueAsString("opName");
-    };
-    return getDesc(lhs).compare_insensitive(getDesc(rhs)) < 0;
-  });
+  if (!keepOpSourceOrder) {
----------------
fabianschuiki wrote:

Oh yeah, good point. Done 👍 

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


More information about the Mlir-commits mailing list