[PATCH] D74525: [mlir][DeclarativeParser] Add support for formatting enum attributes in the string form.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 17:34:43 PST 2020


rriddle added a comment.

In D74525#1875374 <https://reviews.llvm.org/D74525#1875374>, @flaub wrote:

> This is great! Would it be possible to parse keywords into enum attrs as well?
>
> Actually, what's the general feeling about using keywords vs strings for enum values? I think I prefer keywords a little more, it's less noisy and its distinguished from an actual string in the textual representation. Also, it seems like LLVM IR has 'keywords' (they aren't wrapped in quotes) for many enums.


I think we could, but we would need additional checks given that only a subset of enums can actually be represented with a keyword. BitEnums would be completely out, but that is to be expected. For the others we would need to check dynamically if the case value can be parsed in as a keyword. I say dynamically instead of statically because it would be really awful if you added a new enum case that wasn't conforming and then had to update all of your existing tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74525/new/

https://reviews.llvm.org/D74525





More information about the llvm-commits mailing list