[all-commits] [llvm/llvm-project] 12dba4: [mlir] Add metadata to Diagnostic. (#99398)

weiwei chen via All-commits all-commits at lists.llvm.org
Thu Jul 25 07:02:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12dba4d48461c571cb5bdb7c3ac6078b9a357a02
      https://github.com/llvm/llvm-project/commit/12dba4d48461c571cb5bdb7c3ac6078b9a357a02
  Author: weiwei chen <weiwei.chen at modular.com>
  Date:   2024-07-25 (Thu, 25 Jul 2024)

  Changed paths:
    M mlir/docs/Diagnostics.md
    M mlir/include/mlir/IR/Diagnostics.h
    A mlir/test/IR/diagnostic-handler-metadata.mlir
    M mlir/test/lib/IR/CMakeLists.txt
    A mlir/test/lib/IR/TestDiagnosticsMetadata.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir] Add metadata to Diagnostic. (#99398)

Add metadata to Diagnostic. 

Motivation: we have a use case where we want to do some filtering in our
customized Diagnostic Handler based on some customized info that is not
`location` or `severity` or `diagnostic arguments` that are member
variables of `Diagnostic`. Specifically, we want to add a unique ID to
the `Diagnostic` for the handler to filter in a compiler pass that emits
errors in async tasks with multithreading and the diagnostic handling is
associated to the task.

This patch adds a field of `metadata` to `mlir::Diagnostics` as a
general solution. `metadata` is of type `SmallVector<DiagnosticArgument,
0>` to save memory size and reuse existing `DiagnosticArgument` for
metadata type.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list