[mlir][ods] Format: allow anchors in the else elements
authorJeff Niu <jeff@modular.com>
Tue, 13 Sep 2022 22:08:39 +0000 (15:08 -0700)
committerJeff Niu <jeff@modular.com>
Tue, 20 Sep 2022 18:07:50 +0000 (11:07 -0700)
commit95a33b455d74b8c0c112ad499c071117361dd403
treee0bdff9a6f7b785d7140ed3a641b4a930df0e051
parent52a479de607d2e03ccdd221ac8d4c6422a3f0703
[mlir][ods] Format: allow anchors in the else elements

This patch changes optional groups to allow anchors in the 'else'
element group. When printing, the optional condition is inverted to
decide which group to print. This is useful for parsing concrete
optional elements that don't have a `parseOptional*` method or some
other way to test whether it's present.

Depends on D133805

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D133812
mlir/docs/AttributesAndTypes.md
mlir/docs/OpDefinitions.md
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/lib/Dialect/Test/TestTypeDefs.td
mlir/test/mlir-tblgen/attr-or-type-format.td
mlir/test/mlir-tblgen/op-format.mlir
mlir/test/mlir-tblgen/op-format.td
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
mlir/tools/mlir-tblgen/FormatGen.cpp
mlir/tools/mlir-tblgen/FormatGen.h
mlir/tools/mlir-tblgen/OpFormatGen.cpp