Skip to content

Commit c9e606b

Browse files
authored
[mlir] Improve doc in OpFormatGen.cpp (NFC) (#117564)
The comment is misleading because attributes do not have `elidePrintingDefaultValue` bit. It appears that `elidePrintingDefaultValue` was never merged upstream (see: https://reviews.llvm.org/D135398 ), but the comment was likely introduced by mistake in a later revision (https://reviews.llvm.org/D135993.).
1 parent b872c4c commit c9e606b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mlir/tools/mlir-tblgen/OpFormatGen.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,9 @@ static void genPropDictPrinter(OperationFormat &fmt, Operator &op,
20332033
for (const NamedAttribute *namedAttr : fmt.usedAttributes)
20342034
body << " elidedProps.push_back(\"" << namedAttr->name << "\");\n";
20352035

2036-
// Add code to check attributes for equality with the default value
2037-
// for attributes with the elidePrintingDefaultValue bit set.
2036+
// Add code to check attributes for equality with their default values.
2037+
// Default-valued attributes will not be printed when their value matches the
2038+
// default.
20382039
for (const NamedAttribute &namedAttr : op.getAttributes()) {
20392040
const Attribute &attr = namedAttr.attr;
20402041
if (!attr.isDerivedAttr() && attr.hasDefaultValue()) {
@@ -2080,8 +2081,10 @@ static void genAttrDictPrinter(OperationFormat &fmt, Operator &op,
20802081
body << " elidedAttrs.push_back(\"" << key << "\");\n";
20812082
for (const NamedAttribute *attr : fmt.usedAttributes)
20822083
body << " elidedAttrs.push_back(\"" << attr->name << "\");\n";
2083-
// Add code to check attributes for equality with the default value
2084-
// for attributes with the elidePrintingDefaultValue bit set.
2084+
2085+
// Add code to check attributes for equality with their default values.
2086+
// Default-valued attributes will not be printed when their value matches the
2087+
// default.
20852088
for (const NamedAttribute &namedAttr : op.getAttributes()) {
20862089
const Attribute &attr = namedAttr.attr;
20872090
if (!attr.isDerivedAttr() && attr.hasDefaultValue()) {

0 commit comments

Comments
 (0)