[mlir][ods] Fix ops with both attribute-sized operands and results

Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments
in a nested code block to avoid symbol collision.

Differential Revision: https://reviews.llvm.org/D80250
This commit is contained in:
Kuangyuan Chen 2020-05-19 20:24:28 -04:00 committed by Lei Zhang
parent 3a6ee4fefe
commit fb8204b210

View file

@ -1464,11 +1464,13 @@ void OpEmitter::genVerifier() {
auto &body = method.body();
const char *checkAttrSizedValueSegmentsCode = R"(
auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
if (numElements != {1}) {{
return emitOpError("'{0}' attribute for specifying {2} segments "
"must have {1} elements");
{
auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("{0}");
auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements();
if (numElements != {1}) {{
return emitOpError("'{0}' attribute for specifying {2} segments "
"must have {1} elements");
}
}
)";