Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mlir/test/lib/Dialect/Test/TestTypeDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,11 @@ def TestMemrefType : Test_Type<"TestMemref",
}];
}

// Test implementation of an interface with methods specifying a
// method body
def TestBaseBody : Test_Type<"TestBaseBody",
[DeclareTypeInterfaceMethods<TestBaseTypeInterfacePrintTypeA>]> {
let mnemonic = "test_base_body";
}

#endif // TEST_TYPEDEFS
6 changes: 4 additions & 2 deletions mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,10 @@ void DefGen::emitTraitMethods(const InterfaceTrait &trait) {
for (auto &method : iface.getMethods()) {
// Don't declare if the method has a body. Or if the method has a default
// implementation and the def didn't request that it always be declared.
if (method.getBody() || (method.getDefaultImplementation() &&
!alwaysDeclared.count(method.getName()))) {
if (method.getBody())
continue;
if (method.getDefaultImplementation() &&
!alwaysDeclared.count(method.getName())) {
genTraitMethodUsingDecl(trait, method);
continue;
}
Expand Down