aboutsummaryrefslogtreecommitdiff
path: root/mlir/docs
diff options
context:
space:
mode:
authorJeremy Kun <2467754+j2kun@users.noreply.github.com>2024-02-08 11:06:43 -0800
committerGitHub <noreply@github.com>2024-02-08 11:06:43 -0800
commit3d71e4166de81bc3b86d127d9ac6607bda2b2755 (patch)
tree56416164f25d256f689e0dc103e33f380932cd1b /mlir/docs
parenta56fa161ab2617fa3aab3f91285fc757b6a8e09b (diff)
downloadllvm-3d71e4166de81bc3b86d127d9ac6607bda2b2755.zip
llvm-3d71e4166de81bc3b86d127d9ac6607bda2b2755.tar.gz
llvm-3d71e4166de81bc3b86d127d9ac6607bda2b2755.tar.bz2
[docs]: Add a note about using custom types with diagnostics (#73818)
Diffstat (limited to 'mlir/docs')
-rw-r--r--mlir/docs/Diagnostics.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/mlir/docs/Diagnostics.md b/mlir/docs/Diagnostics.md
index 9819843..82bc61d 100644
--- a/mlir/docs/Diagnostics.md
+++ b/mlir/docs/Diagnostics.md
@@ -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.