From 9e4fddeadea70d2e9d04234b248ab119e5310630 Mon Sep 17 00:00:00 2001 From: Vadim Chugunov Date: Mon, 19 Aug 2013 15:21:30 -0700 Subject: [PATCH] Cleanup assembly source. --- src/librustc/driver/driver.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 4328bd36751..ca3247db669 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -343,16 +343,21 @@ pub fn phase_5_run_llvm_passes(sess: Session, (sess.opts.output_type == link::output_type_object || sess.opts.output_type == link::output_type_exe) { let output_type = link::output_type_assembly; - let obj_filename = outputs.obj_filename.with_filetype("s"); + let asm_filename = outputs.obj_filename.with_filetype("s"); time(sess.time_passes(), ~"LLVM passes", || link::write::run_passes(sess, trans.context, trans.module, output_type, - &obj_filename)); + &asm_filename)); - link::write::run_assembler(sess, &obj_filename, &outputs.obj_filename); + link::write::run_assembler(sess, &asm_filename, &outputs.obj_filename); + + // Remove assembly source unless --save-temps was specified + if !sess.opts.save_temps { + os::remove_file(&asm_filename); + } } else { time(sess.time_passes(), ~"LLVM passes", || link::write::run_passes(sess,