From: Alex Zinenko Date: Wed, 16 Jun 2021 10:12:36 +0000 (+0200) Subject: [mlir] ODS: temporarily disbale external model in presence of extra class declarations X-Git-Tag: llvmorg-14-init~3837 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61cf7c72587fd4a9f10ea6c68d67847adf780d11;p=platform%2Fupstream%2Fllvm.git [mlir] ODS: temporarily disbale external model in presence of extra class declarations Default implementations of interfaces may rely on extra class declarations, which aren't currently generated in the external model, that in turn may rely on functions defined in the main Attribute/Type class, which wouldn't be available on the external model. --- diff --git a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp index 3fdaf6d..d4b4cd1 100644 --- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp +++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp @@ -241,10 +241,17 @@ void InterfaceGenerator::emitModelDecl(Interface &interface) { os << " };\n"; } - // Emit the template for the external model. os << " template\n"; os << " class ExternalModel : public FallbackModel {\n"; + + // Emit the template for the external model if there are no extra class + // declarations. + if (interface.getExtraClassDeclaration()) { + os << " };\n"; + return; + } + os << " public:\n"; // Emit declarations for methods that have default implementations. Other @@ -338,6 +345,9 @@ void InterfaceGenerator::emitModelMethodsDef(Interface &interface) { } // Emit default implementations for the external model. + if (interface.getExtraClassDeclaration()) + return; + for (auto &method : interface.getMethods()) { if (!method.getDefaultImplementation()) continue;