Allow the use of the $cppClass template variable in verifier code blocks.

PiperOrigin-RevId: 263378198
This commit is contained in:
Ben Vanik 2019-08-14 10:30:30 -07:00 committed by A. Unique TensorFlower
parent 4f10c9b1ce
commit ae9ec43e46
1 changed files with 7 additions and 3 deletions

View File

@ -1141,10 +1141,14 @@ void OpEmitter::genVerifier() {
genRegionVerifier(body);
if (hasCustomVerify)
body << codeInit->getValue() << "\n";
else
if (hasCustomVerify) {
FmtContext fctx;
fctx.addSubst("cppClass", opClass.getClassName());
auto printer = codeInit->getValue().ltrim().rtrim(" \t\v\f\r");
body << " " << tgfmt(printer, &fctx);
} else {
body << " return mlir::success();\n";
}
}
void OpEmitter::genOperandResultVerifier(OpMethodBody &body,