[Mlir-commits] [mlir] [MLIR][ODS] Re-enable direct implementation of type interfaces with method bodies (PR #166335)
Mehdi Amini
llvmlistbot at llvm.org
Tue Nov 4 00:50:56 PST 2025
================
@@ -637,12 +637,15 @@ 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;
+ } else if (method.getDefaultImplementation() &&
+ !alwaysDeclared.count(method.getName())) {
genTraitMethodUsingDecl(trait, method);
continue;
+ } else {
+ emitTraitMethod(method);
}
----------------
joker-eph wrote:
```suggestion
if (method.getBody())
continue;
if (method.getDefaultImplementation() &&
!alwaysDeclared.count(method.getName())) {
genTraitMethodUsingDecl(trait, method);
continue;
}
emitTraitMethod(method);
```
Nit: No-else-after-return (/continue)
https://github.com/llvm/llvm-project/pull/166335
More information about the Mlir-commits
mailing list