mirror-llvm-project/mlir/tools
Maksim Levental 675fceb6a3
[mlir-tblgen] Render enum keyword alternatives in generated attr/type docs (#203677)
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 is 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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Federico Bruzzone <federico.bruzzone.i@gmail.com>
Co-authored-by: makslevental <m_levental@apple.com>
2026-06-15 12:33:03 -07:00
..
mlir-irdl-to-cpp [MLIR] Apply clang-tidy fixes for readability-container-size-empty in mlir-irdl-to-cpp.cpp (NFC) 2025-12-09 05:54:06 -08:00
mlir-linalg-ods-gen [NFC] Exactly one kind typo fixes, change defintions to definitions. (#174333) 2026-01-14 08:12:26 +00:00
mlir-lsp-server [LLVM][MLIR] Move LSP server support library from MLIR into LLVM (#157885) 2025-09-11 17:17:52 +00:00
mlir-opt Reland "[MLIR] Add IntegerDivisibilityAnalysis and InferIntDivisibilityOpInterface" (#198110) 2026-05-18 16:01:06 -04:00
mlir-parser-fuzzer
mlir-pdll [support] Use VFS in SourceMgr for loading includes (#162903) 2025-10-15 09:24:36 -07:00
mlir-pdll-lsp-server
mlir-query [mlir] Reland Move InitAll*** implementation into static library (#151150) 2025-07-29 18:15:33 +03:00
mlir-reduce [mlir] Reland Move InitAll*** implementation into static library (#151150) 2025-07-29 18:15:33 +03:00
mlir-rewrite [MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in mlir-rewrite.cpp (NFC) 2025-10-03 03:16:39 -07:00
mlir-runner [MLIR] Apply clang-tidy fixes for readability-identifier-naming in mlir-runner.cpp (NFC) 2025-08-29 00:21:45 -07:00
mlir-shlib
mlir-src-sharder [mlir] Use add_tablegen() for mlir-src-sharder to fix aarch64 cross-compile (#196202) 2026-05-12 20:27:28 +02:00
mlir-tblgen [mlir-tblgen] Render enum keyword alternatives in generated attr/type docs (#203677) 2026-06-15 12:33:03 -07:00
mlir-translate
tblgen-lsp-server
tblgen-to-irdl [mlir] fix the Disambiguate NoneType in OpDefinitionsGen (#172923) 2025-12-22 11:36:40 +01:00
CMakeLists.txt