mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 07:46:49 +00:00
[docs]: Add a note about using custom types with diagnostics (#73818)
This commit is contained in:
parent
a56fa161ab
commit
3d71e4166d
@ -119,6 +119,14 @@ op->emitError() << anotherOp;
|
||||
op->emitRemark() << anotherOp;
|
||||
```
|
||||
|
||||
To make a custom type compatible with Diagnostics, one must implement the
|
||||
following friend function.
|
||||
|
||||
```c++
|
||||
friend mlir::Diagnostic &operator<<(
|
||||
mlir::Diagnostic &diagnostic, const MyType &foo);
|
||||
```
|
||||
|
||||
### Attaching notes
|
||||
|
||||
Unlike many other compiler frameworks, notes in MLIR cannot be emitted directly.
|
||||
|
Loading…
x
Reference in New Issue
Block a user