File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,8 @@ pub fn compile_input(sess: &Session,
225225 phase5_result) ;
226226 phase5_result?;
227227
228+ write:: cleanup_llvm ( & trans) ;
229+
228230 phase_6_link_output ( sess, & trans, & outputs) ;
229231
230232 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -616,11 +616,19 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
616616 }
617617 }
618618
619- llvm:: LLVMDisposeModule ( llmod) ;
620- llvm:: LLVMContextDispose ( llcx) ;
621619 llvm:: LLVMRustDisposeTargetMachine ( tm) ;
622620}
623621
622+
623+ pub fn cleanup_llvm ( trans : & CrateTranslation ) {
624+ for module in trans. modules . iter ( ) {
625+ unsafe {
626+ llvm:: LLVMDisposeModule ( module. llmod ) ;
627+ llvm:: LLVMContextDispose ( module. llcx ) ;
628+ }
629+ }
630+ }
631+
624632pub fn run_passes ( sess : & Session ,
625633 trans : & CrateTranslation ,
626634 output_types : & HashMap < OutputType , Option < PathBuf > > ,
You can’t perform that action at this time.
0 commit comments