@@ -121,7 +121,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
121
121
let time_passes = sess. get_opts ( ) . time_passes ;
122
122
let crate =
123
123
time ( time_passes, "parsing" , bind parse_input ( sess, cfg, input) ) ;
124
- if sess. get_opts ( ) . output_type == link :: output_type_none { ret; }
124
+ if sess. get_opts ( ) . parse_only { ret; }
125
125
crate =
126
126
time ( time_passes, "configuration" ,
127
127
bind front:: config:: strip_unconfigured_items ( crate ) ) ;
@@ -158,6 +158,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
158
158
bind middle:: alias:: check_crate ( ty_cx, crate ) ) ;
159
159
time[ ( ) ] ( time_passes, "kind checking" ,
160
160
bind kind:: check_crate ( ty_cx, crate ) ) ;
161
+ if sess. get_opts ( ) . no_trans { ret; }
161
162
let llmod =
162
163
time[ llvm:: llvm:: ModuleRef ] ( time_passes, "translation" ,
163
164
bind trans:: trans_crate ( sess, crate ,
@@ -258,6 +259,7 @@ options:
258
259
--noverify suppress LLVM verification step (slight speedup)
259
260
--depend print dependencies, in makefile-rule form
260
261
--parse-only parse only; do not compile, assemble, or link
262
+ --no-trans run all passes except translation; no output
261
263
-g produce debug info
262
264
--OptLevel= optimize with possible levels 0-3
263
265
-O equivalent to --OptLevel=2
@@ -330,8 +332,11 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)
330
332
let lsp_vec = getopts:: opt_strs( match , "L" ) ;
331
333
for lsp: str in lsp_vec { library_search_paths += ~[ lsp] ; }
332
334
335
+ let parse_only = opt_present ( match , "parse-only" ) ;
336
+ let no_trans = opt_present ( match , "no-trans" ) ;
337
+
333
338
let output_type =
334
- if opt_present ( match , "parse-only" ) {
339
+ if parse_only || no_trans {
335
340
link:: output_type_none
336
341
} else if ( opt_present ( match , "S" ) ) {
337
342
link:: output_type_assembly
@@ -392,7 +397,9 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)
392
397
sysroot : sysroot ,
393
398
cfg : cfg ,
394
399
test : test ,
395
- dps : dps } ;
400
+ dps : dps ,
401
+ parse_only : parse_only ,
402
+ no_trans : no_trans } ;
396
403
ret sopts;
397
404
}
398
405
@@ -418,6 +425,7 @@ fn opts() -> vec[getopts::opt] {
418
425
ret [ optflag ( "h" ) , optflag ( "help" ) , optflag ( "v" ) , optflag ( "version" ) ,
419
426
optflag ( "glue" ) , optflag ( "emit-llvm" ) , optflagopt ( "pretty" ) ,
420
427
optflagopt ( "expand" ) , optflag ( "ls" ) , optflag ( "parse-only" ) ,
428
+ optflag ( "no-trans" ) ,
421
429
optflag ( "O" ) , optopt ( "OptLevel" ) , optmulti ( "L" ) , optflag ( "S" ) ,
422
430
optflag ( "c" ) , optopt ( "o" ) , optflag ( "g" ) , optflag ( "save-temps" ) ,
423
431
optopt ( "sysroot" ) , optflag ( "stats" ) , optflag ( "time-passes" ) ,
@@ -510,7 +518,7 @@ fn main(args: vec[str]) {
510
518
vec:: pop[ str] ( parts) ;
511
519
saved_out_filename = parts. ( 0 ) ;
512
520
alt sopts. output_type {
513
- link:: output_type_none. { parts += [ "pp " ] ; }
521
+ link:: output_type_none. { parts += [ "none " ] ; }
514
522
link:: output_type_bitcode. { parts += [ "bc" ] ; }
515
523
link:: output_type_assembly. { parts += [ "s" ] ; }
516
524
0 commit comments