[Mlir-commits] [mlir] [mlir] Add metadata to Diagnostic. (PR #99398)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 17 15:41:16 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: weiwei chen (weiweichen)

<details>
<summary>Changes</summary>

Add metadata to Diagnostic so that we can do some filtering downstream.

---
Full diff: https://github.com/llvm/llvm-project/pull/99398.diff


1 Files Affected:

- (modified) mlir/include/mlir/IR/Diagnostics.h (+6) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/99398


More information about the Mlir-commits mailing list