[Mlir-commits] [mlir] [mlir][capi] make MLIR Pass C-API type safe (PR #121284)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Dec 29 07:18:23 PST 2024
SpriteOvO wrote:
> How does `ExternalPassCallbacks` construct?
See
https://github.com/llvm/llvm-project/blob/66dd7e63d8a1860c11f3b9acf011cad4e18f0195/mlir/test/CAPI/pass.c#L330-L336
> The `MlirExternalPass` is a struct that need to be construct from the C-API.
`MlirExternalPass` is an opaque struct defined here,
https://github.com/llvm/llvm-project/blob/6cbc64ed922cc69bc292d394ba5c681fa309f404/mlir/include/mlir-c/Pass.h#L44
you don't need to construct it, it will be an argument in your callback and you just use it as needed.
```c
void yourCallback(MlirOperation op, MlirExternalPass pass, void *userData) {
if (anyError) {
mlirExternalPassSignalFailure(pass);
}
}
```
https://github.com/llvm/llvm-project/pull/121284
More information about the Mlir-commits
mailing list