llvm-project
bd6c6fa2 - [mlir-tblgen] Render enum keyword alternatives in generated attr/type docs

Commit
60 days ago
[mlir-tblgen] Render enum keyword alternatives in generated attr/type docs When mlir-tblgen generates documentation for AttrDefs/TypeDefs that have EnumParameter fields, it previously rendered the raw C++ type (e.g. `::mlir::ns::MyEnum`) in the syntax block. This was unhelpful for users who need to know the valid keyword values. This patch: 1. Adds an `EnumInfo enum = enumInfo;` field to the `EnumParameter` TableGen class, persisting the enum record for tooling to inspect. 2. Modifies `emitAttrOrTypeDefAssemblyFormat` in OpDocGen.cpp to detect EnumParameter fields and render their cases as backtick-quoted alternatives (e.g. `` `read` | `read_write` ``). 3. Adds a test case to gen-dialect-doc.td verifying the new behavior. Before: #my_dialect.my_attr< int32_t, # index ::mlir::ns::MyEnum, # access > After: #my_dialect.my_attr< int32_t, # index `read` | `read_write`, # access > Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Committer
Parents
Loading