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,
225
225
phase5_result) ;
226
226
phase5_result?;
227
227
228
+ write:: cleanup_llvm ( & trans) ;
229
+
228
230
phase_6_link_output ( sess, & trans, & outputs) ;
229
231
230
232
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -616,11 +616,19 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
616
616
}
617
617
}
618
618
619
- llvm:: LLVMDisposeModule ( llmod) ;
620
- llvm:: LLVMContextDispose ( llcx) ;
621
619
llvm:: LLVMRustDisposeTargetMachine ( tm) ;
622
620
}
623
621
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
+
624
632
pub fn run_passes ( sess : & Session ,
625
633
trans : & CrateTranslation ,
626
634
output_types : & HashMap < OutputType , Option < PathBuf > > ,
You can’t perform that action at this time.
0 commit comments