[Mlir-commits] [mlir] [mlir] Add metadata to Diagnostic. (PR #99398)
weiwei chen
llvmlistbot at llvm.org
Wed Jul 17 15:40:43 PDT 2024
https://github.com/weiweichen created https://github.com/llvm/llvm-project/pull/99398
Add metadata to Diagnostic so that we can do some filtering downstream.
>From 662546872cd5f539bd932838c5f1edcda08d4091 Mon Sep 17 00:00:00 2001
From: Weiwei Chen <weiwei.chen at modular.com>
Date: Wed, 17 Jul 2024 18:00:05 -0400
Subject: [PATCH] Add metadat to Diagnostic.
---
mlir/include/mlir/IR/Diagnostics.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mlir/include/mlir/IR/Diagnostics.h b/mlir/include/mlir/IR/Diagnostics.h
index bb2e1bb183e9b..1ef902ae5439c 100644
--- a/mlir/include/mlir/IR/Diagnostics.h
+++ b/mlir/include/mlir/IR/Diagnostics.h
@@ -271,6 +271,9 @@ class Diagnostic {
return failure();
}
+ /// Returns the current list of diagnostic metadata.
+ SmallVector<DiagnosticArgument, 1>& getMetaData() { return metadata; }
+
private:
Diagnostic(const Diagnostic &rhs) = delete;
Diagnostic &operator=(const Diagnostic &rhs) = delete;
@@ -290,6 +293,9 @@ class Diagnostic {
/// A list of attached notes.
NoteVector notes;
+
+ /// A list of metadata attached to this Diagnostic.
+ SmallVector<DiagnosticArgument, 1> metadata;
};
inline raw_ostream &operator<<(raw_ostream &os, const Diagnostic &diag) {
More information about the Mlir-commits
mailing list