[mlir][ods] Allow empty array ref parameter
authorJeff Niu <jeff@modular.com>
Wed, 14 Sep 2022 00:19:19 +0000 (17:19 -0700)
committerJeff Niu <jeff@modular.com>
Tue, 20 Sep 2022 18:07:56 +0000 (11:07 -0700)
commitdaedea39d182c7cac3cf9699ec1f58b471398c3b
tree7104a03315b7ea8885b3ecc6ffed604d021a97b9
parent4792f2ab214e2df7875d17d4258bd5eae733e825
[mlir][ods] Allow empty array ref parameter

This patch "fixes" a longstanding issue where the assembly format for
ArrayRefParameter could not handle an empty list. This is because there
was no way to generically optionally parse the first element of the
array. The only solution was to write a (relatively simple) custom parser.

This patch implements "empty" ArrayRefParameters by using
inverted optional groups and an optional ArrayRefParameter.

Depends on D133816

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D133819
mlir/include/mlir/IR/AttrTypeBase.td
mlir/test/IR/array-of-attr.mlir
mlir/test/lib/Dialect/Test/TestAttrDefs.td