@@ -417,6 +417,14 @@ pub fn stop_after_phase_1(sess: Session) -> bool {
417417 return false ;
418418}
419419
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+
420428pub fn stop_after_phase_5 ( sess : Session ) -> bool {
421429 if sess. opts . output_type != link:: output_type_exe {
422430 debug ! ( "not building executable, returning early from compile_input" ) ;
@@ -482,6 +490,8 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
482490
483491 write_out_deps ( sess, input, outputs, & expanded_crate) ;
484492
493+ if stop_after_phase_2 ( sess) { return ; }
494+
485495 let analysis = phase_3_run_analysis_passes ( sess, & expanded_crate) ;
486496 if stop_after_phase_3 ( sess) { return ; }
487497 let trans = phase_4_translate_to_llvm ( sess, expanded_crate,
@@ -697,6 +707,7 @@ pub fn build_session_options(binary: @str,
697707
698708 let parse_only = matches. opt_present ( "parse-only" ) ;
699709 let no_trans = matches. opt_present ( "no-trans" ) ;
710+ let no_analysis = matches. opt_present ( "no-analysis" ) ;
700711
701712 let lint_levels = [ lint:: allow, lint:: warn,
702713 lint:: deny, lint:: forbid] ;
@@ -850,6 +861,7 @@ pub fn build_session_options(binary: @str,
850861 test : test,
851862 parse_only : parse_only,
852863 no_trans : no_trans,
864+ no_analysis : no_analysis,
853865 debugging_opts : debugging_opts,
854866 android_cross_path : android_cross_path,
855867 write_dependency_info : write_dependency_info,
@@ -943,6 +955,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
943955 optflag ( "" , "ls" , "List the symbols defined by a library crate" ) ,
944956 optflag ( "" , "no-trans" ,
945957 "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") ,
946961 optflag ( "O" , "" , "Equivalent to --opt-level=2" ) ,
947962 optopt ( "o" , "" , "Write output to <filename>" , "FILENAME" ) ,
948963 optopt ( "" , "opt-level" ,
0 commit comments