about summary refs log tree commit diff
path: root/compiler/rustc_llvm
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2025-09-24 16:53:17 -0700
committerJosh Stone <jistone@redhat.com>2025-09-24 16:53:17 -0700
commitfe440ec934995e499360dc05ae485f1ccbd0e694 (patch)
treeddffd7c125859931d44b13a8d7d3b309fb12172a /compiler/rustc_llvm
parent42cf78f762ecad22de89d914904887afc073278f (diff)
downloadrust-fe440ec934995e499360dc05ae485f1ccbd0e694.tar.gz
rust-fe440ec934995e499360dc05ae485f1ccbd0e694.zip
llvm: add a destructor to call releaseSerializer
Diffstat (limited to 'compiler/rustc_llvm')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index ef85ce153b8..9953f5e1731 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1685,6 +1685,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
           RemarkStreamer(std::move(RemarkStreamer)),
           LlvmRemarkStreamer(std::move(LlvmRemarkStreamer)) {}
 
+#if LLVM_VERSION_GE(22, 0)
+    ~RustDiagnosticHandler() {
+      if (RemarkStreamer) {
+        RemarkStreamer->releaseSerializer();
+      }
+    }
+#endif
+
     virtual bool handleDiagnostics(const DiagnosticInfo &DI) override {
       // If this diagnostic is one of the optimization remark kinds, we can
       // check if it's enabled before emitting it. This can avoid many