Skip to content

Commit 7137d88

Browse files
committed
add note about custom types with diagnostics
1 parent 754b93e commit 7137d88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir/docs/Diagnostics.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ op->emitError() << anotherOp;
119119
op->emitRemark() << anotherOp;
120120
```
121121

122+
To make a custom type compatible with Diagnostics, one must implement the
123+
following friend function.
124+
125+
```c++
126+
friend mlir::Diagnostic &operator<<(
127+
mlir::Diagnostic &diagnostic, const MyType &foo);
128+
```
129+
122130
### Attaching notes
123131

124132
Unlike many other compiler frameworks, notes in MLIR cannot be emitted directly.

0 commit comments

Comments
 (0)