[Mlir-commits] [mlir] [MLIR] Implement remark emitting policies in MLIR (PR #161202)

Guray Ozen llvmlistbot at llvm.org
Tue Sep 30 03:45:17 PDT 2025


================
@@ -406,9 +429,15 @@ class RemarkEngine {
   /// main remark streamer.
   ~RemarkEngine();
 
+  /// Shutdown the remark engine. This will finalize the remark engine and
+  /// close the output file.
+  void shutdown();
----------------
grypp wrote:

> Can the MLIRContext destructor handle the finalization?

I tried, but it doesn’t work. If there were a destructor I could call there, that would be great.  

The problem is that during `~MLIRContext`, `RemarkEngine` needs to access `MLIRContext` to get location infor and use `mlir::emitRemark`. At that point, `DiagnosticEngine` has already erased its handler, so no handler is left.

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


More information about the Mlir-commits mailing list