[Mlir-commits] [mlir] Add support for enum doc gen (PR #98885)

Jacques Pienaar llvmlistbot at llvm.org
Mon Jul 15 11:11:40 PDT 2024


================
@@ -495,21 +535,30 @@ static bool emitDialectDoc(const RecordKeeper &recordKeeper, raw_ostream &os) {
       recordKeeper.getAllDerivedDefinitionsIfDefined("TypeDef");
   std::vector<Record *> attrDefDefs =
       recordKeeper.getAllDerivedDefinitionsIfDefined("AttrDef");
+  std::vector<Record *> enumDefs =
+      recordKeeper.getAllDerivedDefinitionsIfDefined("EnumAttrInfo");
 
   std::vector<Attribute> dialectAttrs;
   std::vector<AttrDef> dialectAttrDefs;
   std::vector<OpDocGroup> dialectOps;
   std::vector<Type> dialectTypes;
   std::vector<TypeDef> dialectTypeDefs;
+  std::vector<EnumAttr> dialectEnums;
 
   llvm::SmallDenseSet<Record *> seen;
-  auto addIfInDialect = [&](llvm::Record *record, const auto &def, auto &vec) {
-    if (seen.insert(record).second && def.getDialect() == *dialect) {
+  auto addIfNotSeen = [&](llvm::Record *record, const auto &def, auto &vec) {
+    if (seen.insert(record).second) {
       vec.push_back(def);
       return true;
     }
     return false;
   };
+  auto addIfInDialect = [&](llvm::Record *record, const auto &def, auto &vec) {
+    if (def.getDialect() == *dialect) {
----------------
jpienaar wrote:

return def.getDialect() == \*dialect && addIfNotSeen(record, def, vec) ?

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


More information about the Mlir-commits mailing list