[mlir][ods] Assert on static getAttrName methods
commitbea0b1a896f55684eff0d5dbbbb73327448f698a
authorJeff Niu <jeff@modular.com>
Tue, 11 Oct 2022 17:40:23 +0000 (11 10:40 -0700)
committerJeff Niu <jeff@modular.com>
Thu, 13 Oct 2022 00:56:14 +0000 (12 17:56 -0700)
tree0642d2301120dd90fc5b9409d1515ca36192f55d
parente936c3bb48c758ff4f490367d80db5a04170a9e8
[mlir][ods] Assert on static getAttrName methods

This patch makes ODS insert an assert when calling static `get*AttrName`
methods with a `OperationName` that the name is the same as the op's.
This prevents accidentally passing the wrong kind of name and getting an
erroneous attribute name.

Reviewed By: rriddle

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