[Mlir-commits] [mlir] Add support for enum doc gen (PR #98885)
Tom Natan
llvmlistbot at llvm.org
Mon Jul 15 11:26:29 PDT 2024
================
@@ -381,6 +381,39 @@ static void emitAttrOrTypeDefDoc(const RecordKeeper &recordKeeper,
emitAttrOrTypeDefDoc(AttrOrTypeDef(def), os);
}
+//===----------------------------------------------------------------------===//
+// Enum Documentation
+//===----------------------------------------------------------------------===//
+
+static void emitEnumDoc(const EnumAttr &def, raw_ostream &os) {
+ os << llvm::formatv("### {0}\n", def.getEnumClassName());
+
+ // Emit the summary if present.
+ if (!def.getSummary().empty())
+ os << "\n" << def.getSummary() << "\n";
+
+ // Emit case documentation.
+ std::vector<EnumAttrCase> cases = def.getAllCases();
+ os << "\n#### Cases:\n\n";
----------------
tomnatan30 wrote:
I changed to not emit the cases table if there are no cases, but IMO this shouldn't be allowed by MLIR, what's the point of an enum with no cases :)
Otherwise, we could also just emit an empty table like before.
wdyt?
https://github.com/llvm/llvm-project/pull/98885
More information about the Mlir-commits
mailing list