diff options
author | Felipe de Azevedo Piovezan <piovezan.fpi@gmail.com> | 2021-01-05 18:44:26 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2021-01-05 18:48:09 +0000 |
commit | 86d68e288585964546d6382ecf71dcce10d018b7 (patch) | |
tree | 230790da6e2d527a454cf7dace3e3d48236bd392 /clang/unittests/Frontend/CompilerInvocationTest.cpp | |
parent | 601636de98061b53242b598fc2354905c8efbfb8 (diff) | |
download | llvm-86d68e288585964546d6382ecf71dcce10d018b7.zip llvm-86d68e288585964546d6382ecf71dcce10d018b7.tar.gz llvm-86d68e288585964546d6382ecf71dcce10d018b7.tar.bz2 |
[mlir] Gen removeAttr methods with tablegen
If an operation defines an optional attribute (OptionalAttr or
UnitAttr), transformations may wish to remove these attributes while
maintaining invariants established by the operation. Currently, the only
way to do this is by calling `Operation::removeAttr("attrName")`, which
requires developers to know the exact name of the attribute used by
table-gen. Furthermore, if the attribute name changes, this won't be
detected at compile time. Instead, `removeAttr` would return an empty
attribute and no errors would be raised, unless the caller checks for
the returned value.
This patch adds table gen support for generating `remove<AttrName>Attr`
methods for OptionalAttributes defined by operations.
Implementation choice: to preserve camelCase for the method's name, the
first character of an attribute called `myAttr` is changed to upper case
in order to preserve the coding style, so the final method would be
called `removeMyAttr`.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93903
Diffstat (limited to 'clang/unittests/Frontend/CompilerInvocationTest.cpp')
0 files changed, 0 insertions, 0 deletions