[Mlir-commits] [mlir] [mlir][ODS] Allow a space-only separator for bit enums (PR #237149)

Henrich Lauko llvmlistbot at llvm.org
Mon Nov 2 03:48:04 PST 2026


xlauko wrote:

> Why is this PR so large? I'd expect that adding a new separator to a list of existing separators would be a one-line change more or less.

@matthias-springer The problem was a space separator has no token to consume. `|` and `,` go through `parseOptionalVerticalBar` and `parseOptionalComma`, but with spaces the loop has to stop at the first token that isn’t a case keyword. That means a separate `FieldParser` body, a different loop in the op-format enum parser, and symbolize splitting on spaces. 

It also creates a new ambiguity. A literal that spells one of the cases, like `$flags` nsw``, gets eaten by the enum parser, so I extended the adjacent-literal check to reject it. That’s most of the OpFormatGen diff. The `EnumInfo` helpers replace a separator `StringSwitch` that was copied in two generators and a trim() == "," check repeated in three more. I can move this refactor into its own NFC PR if it makes this easier to review.

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


More information about the Mlir-commits mailing list