[PATCH] D77293: [mlir][DeclarativeParser] Emit an error if a `:` follows an attribute with a non-constant type.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 12:28:43 PDT 2020


rriddle added a comment.

In D77293#1957405 <https://reviews.llvm.org/D77293#1957405>, @lattner wrote:

> Awesome, thank you River!  Is this also introducing TypedStrAttr as a new way to specify an attribute that cannot have a ": type" production in the parser?  Is there a way to spell that?


Not exactly, TypedStrAttr is intended to be a way to specify a StrAttr with a non-None type; given that NoneType is the overwhelmingly common case.

You can already use the `valueType` field, used here, to specify that an attribute has a static type and to print/parser without it. For example, if you have an I32Attr today it won't print/parse
the type because we can statically construct an I32 type from the builder. This revision uses that knowledge to check if the attribute parses the type or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77293





More information about the llvm-commits mailing list