From: Ben Vanik Date: Wed, 29 May 2019 18:40:05 +0000 (-0700) Subject: [TableGen] Making printer support $cppClass substitution (similar to parser). X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa7ee31cbe0e20a694dacbe817111918e3adf198;p=platform%2Fupstream%2Fllvm.git [TableGen] Making printer support $cppClass substitution (similar to parser). -- PiperOrigin-RevId: 250534216 --- diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index ca8b27a..0d21d73 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -887,8 +887,10 @@ void OpEmitter::genPrinter() { return; auto &method = opClass.newMethod("void", "print", "OpAsmPrinter *p"); + FmtContext fctx; + fctx.addSubst("cppClass", opClass.getClassName()); auto printer = codeInit->getValue().ltrim().rtrim(" \t\v\f\r"); - method.body() << " " << printer; + method.body() << " " << tgfmt(printer, &fctx); } void OpEmitter::genVerifier() {