Add a --no-analysis command line switch

This commit is contained in:
SiegeLord 2013-12-26 17:39:36 -05:00
parent a7a9e488a4
commit cbe8c61fed
2 changed files with 17 additions and 0 deletions

View File

@ -417,6 +417,14 @@ pub fn stop_after_phase_1(sess: Session) -> bool {
return false;
}
pub fn stop_after_phase_2(sess: Session) -> bool {
if sess.opts.no_analysis {
debug!("invoked with --no-analysis, returning early from compile_input");
return true;
}
return false;
}
pub fn stop_after_phase_5(sess: Session) -> bool {
if sess.opts.output_type != link::output_type_exe {
debug!("not building executable, returning early from compile_input");
@ -482,6 +490,8 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
write_out_deps(sess, input, outputs, &expanded_crate);
if stop_after_phase_2(sess) { return; }
let analysis = phase_3_run_analysis_passes(sess, &expanded_crate);
if stop_after_phase_3(sess) { return; }
let trans = phase_4_translate_to_llvm(sess, expanded_crate,
@ -697,6 +707,7 @@ pub fn build_session_options(binary: @str,
let parse_only = matches.opt_present("parse-only");
let no_trans = matches.opt_present("no-trans");
let no_analysis = matches.opt_present("no-analysis");
let lint_levels = [lint::allow, lint::warn,
lint::deny, lint::forbid];
@ -850,6 +861,7 @@ pub fn build_session_options(binary: @str,
test: test,
parse_only: parse_only,
no_trans: no_trans,
no_analysis: no_analysis,
debugging_opts: debugging_opts,
android_cross_path: android_cross_path,
write_dependency_info: write_dependency_info,
@ -943,6 +955,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
optflag("", "ls", "List the symbols defined by a library crate"),
optflag("", "no-trans",
"Run all passes except translation; no output"),
optflag("", "no-analysis",
"Parse and expand the output, but run no analysis or produce \
output"),
optflag("O", "", "Equivalent to --opt-level=2"),
optopt("o", "", "Write output to <filename>", "FILENAME"),
optopt("", "opt-level",

View File

@ -167,6 +167,7 @@ pub struct options {
test: bool,
parse_only: bool,
no_trans: bool,
no_analysis: bool,
debugging_opts: uint,
android_cross_path: Option<~str>,
/// Whether to write dependency files. It's (enabled, optional filename).
@ -398,6 +399,7 @@ pub fn basic_options() -> @options {
test: false,
parse_only: false,
no_trans: false,
no_analysis: false,
debugging_opts: 0u,
android_cross_path: None,
write_dependency_info: (false, None),