Skip to content

Commit fe440ec

Browse files
committed
llvm: add a destructor to call releaseSerializer
1 parent 42cf78f commit fe440ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
16851685
RemarkStreamer(std::move(RemarkStreamer)),
16861686
LlvmRemarkStreamer(std::move(LlvmRemarkStreamer)) {}
16871687

1688+
#if LLVM_VERSION_GE(22, 0)
1689+
~RustDiagnosticHandler() {
1690+
if (RemarkStreamer) {
1691+
RemarkStreamer->releaseSerializer();
1692+
}
1693+
}
1694+
#endif
1695+
16881696
virtual bool handleDiagnostics(const DiagnosticInfo &DI) override {
16891697
// If this diagnostic is one of the optimization remark kinds, we can
16901698
// check if it's enabled before emitting it. This can avoid many

0 commit comments

Comments
 (0)