[Mlir-commits] [mlir] [MLIR][ODS] Allow operations to specify interfaces using the `HasParent` trait constraint (PR #66196)

Mehdi Amini llvmlistbot at llvm.org
Sat Sep 16 20:19:28 PDT 2023


joker-eph wrote:

@Mogball : it's not for a name comparison, it's for diagnostics. The verifier code in the traits looks like:

```
    static LogicalResult verifyTrait(Operation *op) {
      if (llvm::isa_and_nonnull<ParentOpTypes...>(op->getParentOp()))
        return success();

      return op->emitOpError()
             << "expects parent op "
             << (sizeof...(ParentOpTypes) != 1 ? "to be one of '" : "'")
             << llvm::ArrayRef({ParentOpTypes::getOperationName()...}) << "'";
    }
```



https://github.com/llvm/llvm-project/pull/66196


More information about the Mlir-commits mailing list