[mlir] ODS: require DefaultValuedAttr to be const-buildable
authorAlex Zinenko <zinenko@google.com>
Mon, 7 Feb 2022 09:27:07 +0000 (10:27 +0100)
committerAlex Zinenko <zinenko@google.com>
Tue, 8 Feb 2022 08:31:09 +0000 (09:31 +0100)
commit3df6cadec45ec3db8e31706bd7f5015fd2543695
tree34b54284d9f4ca44b4836012c4d905d037a8d2f2
parentec642ceebc1aacc8b16249df7734b8cf90ae2963
[mlir] ODS: require DefaultValuedAttr to be const-buildable

ODS provides a mechanism for defalut-valued attributes based on a wrapper
TableGen class that is recognized by mlir-tblgen. Such attributes, if not set
on the operaiton, can be construted on-the-fly in their getter given a constant
value. In order for this construction to work, the attribute specificaiton in
ODS must set the constBuilderCall field correctly. This has not been verified,
which could lead to invalid C++ code being generated by mlir-tblgen.

Closes #53588.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D119113
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp