[Mlir-commits] [mlir] [MLIR][Python] Support `has_trait` for operations (PR #188492)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Mar 25 21:22:40 PDT 2026
================
@@ -651,6 +651,10 @@ MlirContext mlirOperationGetContext(MlirOperation op) {
return wrap(unwrap(op)->getContext());
}
+bool mlirOperationHasTrait(MlirOperation op, MlirTypeID traitTypeID) {
+ return unwrap(op)->getName().hasTrait(unwrap(traitTypeID));
----------------
PragmaTwice wrote:
yah it's useful for traits and interfaces, you can check:
- [here](https://github.com/llvm/llvm-project/blob/main/mlir/lib/CAPI/IR/ExtensibleDialect.cpp#L21) for traits
- and [here](https://github.com/llvm/llvm-project/blob/main/mlir/lib/CAPI/Interfaces/Interfaces.cpp#L222) for interfaces
https://github.com/llvm/llvm-project/pull/188492
More information about the Mlir-commits
mailing list