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

Jacques Pienaar llvmlistbot at llvm.org
Mon Jul 15 11:14:26 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";
----------------
jpienaar wrote:

Would empty cases get flagged before here? (else we may just want to avoid emitting if there are no cases)

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


More information about the Mlir-commits mailing list