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

Tom Natan llvmlistbot at llvm.org
Mon Jul 15 12:23:45 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:

As discussed offline, emitting an empty cases table also make sense since it makes it clearer that there are no cases.

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


More information about the Mlir-commits mailing list