Moved LLVM cleanup to after after_llvm phase

This commit is contained in:
Will Crichton 2016-06-30 16:32:13 -04:00
parent bbdbe99c7a
commit ce1146ac5f
2 changed files with 12 additions and 2 deletions

View File

@ -225,6 +225,8 @@ pub fn compile_input(sess: &Session,
phase5_result);
phase5_result?;
write::cleanup_llvm(&trans);
phase_6_link_output(sess, &trans, &outputs);
Ok(())

View File

@ -616,11 +616,19 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
}
}
llvm::LLVMDisposeModule(llmod);
llvm::LLVMContextDispose(llcx);
llvm::LLVMRustDisposeTargetMachine(tm);
}
pub fn cleanup_llvm(trans: &CrateTranslation) {
for module in trans.modules.iter() {
unsafe {
llvm::LLVMDisposeModule(module.llmod);
llvm::LLVMContextDispose(module.llcx);
}
}
}
pub fn run_passes(sess: &Session,
trans: &CrateTranslation,
output_types: &HashMap<OutputType, Option<PathBuf>>,