@@ -417,6 +417,14 @@ pub fn stop_after_phase_1(sess: Session) -> bool {
417
417
return false ;
418
418
}
419
419
420
+ pub fn stop_after_phase_2 ( sess : Session ) -> bool {
421
+ if sess. opts . no_analysis {
422
+ debug ! ( "invoked with --no-analysis, returning early from compile_input" ) ;
423
+ return true ;
424
+ }
425
+ return false ;
426
+ }
427
+
420
428
pub fn stop_after_phase_5 ( sess : Session ) -> bool {
421
429
if sess. opts . output_type != link:: output_type_exe {
422
430
debug ! ( "not building executable, returning early from compile_input" ) ;
@@ -482,6 +490,8 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
482
490
483
491
write_out_deps ( sess, input, outputs, & expanded_crate) ;
484
492
493
+ if stop_after_phase_2 ( sess) { return ; }
494
+
485
495
let analysis = phase_3_run_analysis_passes ( sess, & expanded_crate) ;
486
496
if stop_after_phase_3 ( sess) { return ; }
487
497
let trans = phase_4_translate_to_llvm ( sess, expanded_crate,
@@ -697,6 +707,7 @@ pub fn build_session_options(binary: @str,
697
707
698
708
let parse_only = matches. opt_present ( "parse-only" ) ;
699
709
let no_trans = matches. opt_present ( "no-trans" ) ;
710
+ let no_analysis = matches. opt_present ( "no-analysis" ) ;
700
711
701
712
let lint_levels = [ lint:: allow, lint:: warn,
702
713
lint:: deny, lint:: forbid] ;
@@ -850,6 +861,7 @@ pub fn build_session_options(binary: @str,
850
861
test : test,
851
862
parse_only : parse_only,
852
863
no_trans : no_trans,
864
+ no_analysis : no_analysis,
853
865
debugging_opts : debugging_opts,
854
866
android_cross_path : android_cross_path,
855
867
write_dependency_info : write_dependency_info,
@@ -943,6 +955,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
943
955
optflag ( "" , "ls" , "List the symbols defined by a library crate" ) ,
944
956
optflag ( "" , "no-trans" ,
945
957
"Run all passes except translation; no output" ) ,
958
+ optflag ( "" , "no-analysis" ,
959
+ "Parse and expand the output, but run no analysis or produce \
960
+ output") ,
946
961
optflag ( "O" , "" , "Equivalent to --opt-level=2" ) ,
947
962
optopt ( "o" , "" , "Write output to <filename>" , "FILENAME" ) ,
948
963
optopt ( "" , "opt-level" ,
0 commit comments