[mlir][ods] Custom builder with no params
authorJacques Pienaar <jpienaar@google.com>
Wed, 23 Sep 2020 14:50:45 +0000 (07:50 -0700)
committerJacques Pienaar <jpienaar@google.com>
Wed, 23 Sep 2020 15:11:13 +0000 (08:11 -0700)
Incorrect generation of custom build method without any params.

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

index 58a1b33..f89547d 100644 (file)
@@ -1191,8 +1191,9 @@ void OpEmitter::genBuilder() {
         std::string paramStr =
             skipParamGen ? params.str()
                          : llvm::formatv("::mlir::OpBuilder &{0}, "
-                                         "::mlir::OperationState &{1}, {2}",
-                                         builder, builderOpState, params)
+                                         "::mlir::OperationState &{1}{2}{3}",
+                                         builder, builderOpState,
+                                         params.empty() ? "" : ", ", params)
                                .str();
         auto *method =
             opClass.addMethodAndPrune("void", "build", properties, paramStr);