@@ -131,11 +131,13 @@ fn inject_libcore_reference(sess: session::session,
131
131
132
132
133
133
fn compile_input ( sess : session:: session , cfg : ast:: crate_cfg , input : str ,
134
- output : str ) {
134
+ output : option:: t < str > ) {
135
+
135
136
let time_passes = sess. get_opts ( ) . time_passes ;
136
137
let crate =
137
138
time ( time_passes, "parsing" , bind parse_input ( sess, cfg, input) ) ;
138
139
if sess. get_opts ( ) . parse_only { ret; }
140
+
139
141
crate =
140
142
time ( time_passes, "configuration" ,
141
143
bind front:: config:: strip_unconfigured_items ( crate ) ) ;
@@ -186,12 +188,26 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
186
188
time ( time_passes, "kind checking" ,
187
189
bind kind:: check_crate ( ty_cx, last_uses, crate ) ) ;
188
190
if sess. get_opts ( ) . no_trans { ret; }
191
+
192
+ let outputs = build_output_filenames ( input, output, sess) ;
193
+
189
194
let llmod =
190
195
time ( time_passes, "translation" ,
191
- bind trans:: trans_crate ( sess, crate , ty_cx, output, ast_map,
196
+ bind trans:: trans_crate ( sess, crate , ty_cx,
197
+ outputs. obj_filename , ast_map,
192
198
mut_map, copy_map, last_uses) ) ;
193
199
time ( time_passes, "LLVM passes" ,
194
- bind link:: write:: run_passes ( sess, llmod, output) ) ;
200
+ bind link:: write:: run_passes ( sess, llmod, outputs. obj_filename ) ) ;
201
+
202
+ let stop_after_codegen =
203
+ sess. get_opts ( ) . output_type != link:: output_type_exe ||
204
+ sess. get_opts ( ) . static && sess. building_library ( ) ;
205
+
206
+ if stop_after_codegen { ret; }
207
+
208
+ time ( time_passes, "Linking" ,
209
+ bind link:: link_binary ( sess, outputs. obj_filename ,
210
+ outputs. out_filename ) ) ;
195
211
}
196
212
197
213
fn pretty_print_input ( sess : session:: session , cfg : ast:: crate_cfg , input : str ,
@@ -604,19 +620,7 @@ fn main(args: [str]) {
604
620
ret;
605
621
}
606
622
607
- let outputs = build_output_filenames ( ifile, ofile, sess) ;
608
-
609
- let stop_after_codegen =
610
- sopts. output_type != link:: output_type_exe ||
611
- sopts. static && sess. building_library ( ) ;
612
-
613
- let temp_filename = outputs. obj_filename ;
614
-
615
- compile_input ( sess, cfg, ifile, temp_filename) ;
616
-
617
- if stop_after_codegen { ret; }
618
-
619
- link:: link_binary ( sess, temp_filename, outputs. out_filename ) ;
623
+ compile_input ( sess, cfg, ifile, ofile) ;
620
624
}
621
625
622
626
#[ cfg( test) ]
0 commit comments