Skip to content

Commit b05f14c

Browse files
authored
Rollup merge of rust-lang#66761 - yuyoyuppe:rust_llvm_minor_fix, r=alexcrichton
Use LLVMDisposePassManager instead of raw delete in rustllvm LLVM has a dedicated API call which wraps the destructor invocation for the PassManager. Rust invokes it [otherwhere](https://github.com/rust-lang/rust/blob/d63b24ffcc48f44ef09e0369e6516d6f2dec3520/src/librustc_codegen_llvm/back/write.rs#L446-L447), but not in the `LLVMRustWriteOutputFile`. Since `LLVMDisposePassManager` might be extended to perform additional cleanup actions in the future, this change replaces raw destructor invocation with that API call.
2 parents a3a8ee0 + e846ea1 commit b05f14c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rustllvm/PassWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
580580
// Apparently `addPassesToEmitFile` adds a pointer to our on-the-stack output
581581
// stream (OS), so the only real safe place to delete this is here? Don't we
582582
// wish this was written in Rust?
583-
delete PM;
583+
LLVMDisposePassManager(PMR);
584584
return LLVMRustResult::Success;
585585
}
586586

0 commit comments

Comments
 (0)