[mlir][ods] Support using custom directives as first optional group element
commit574e7596e5149c3319dea255b2c45e670ca4711b
authorMogball <jeff@modular.com>
Wed, 30 Aug 2023 23:57:09 +0000 (30 23:57 +0000)
committerMogball <jeff@modular.com>
Thu, 31 Aug 2023 03:20:54 +0000 (31 03:20 +0000)
treec1fb94a3d3821602884ac4c0d6f471cf57a50ca0
parent0d18c2d90f8f69e6517a8851b94c43be7b87575f
[mlir][ods] Support using custom directives as first optional group element

This adds support for using a custom directive as the first optional
group element. The first optional group element guards the parsing of
the rest of the optional group. This can be done for custom directives
by expecting the parse function to return an `OptionalParseResult`
instead of a `ParseResult`.

Depends on D159243

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D159244
mlir/test/mlir-tblgen/attr-or-type-format.td
mlir/test/mlir-tblgen/op-format-invalid.td
mlir/test/mlir-tblgen/op-format.td
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
mlir/tools/mlir-tblgen/FormatGen.cpp
mlir/tools/mlir-tblgen/OpFormatGen.cpp