Skip to content

Commit

Permalink
Add a --no-analysis command line switch
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLord committed Dec 31, 2013
1 parent a7a9e48 commit cbe8c61
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/librustc/driver/driver.rs
Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/librustc/driver/session.rs
Expand Up @@ -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).
Expand Down Expand Up @@ -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),
Expand Down

5 comments on commit cbe8c61

@bors
Copy link
Contributor

@bors bors commented on cbe8c61 Dec 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at SiegeLord@cbe8c61

@bors
Copy link
Contributor

@bors bors commented on cbe8c61 Dec 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging SiegeLord/rust/early_deps = cbe8c61 into auto

@bors
Copy link
Contributor

@bors bors commented on cbe8c61 Dec 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SiegeLord/rust/early_deps = cbe8c61 merged ok, testing candidate = 8ec03b3

@bors
Copy link
Contributor

@bors bors commented on cbe8c61 Dec 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on cbe8c61 Dec 31, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 8ec03b3

Please sign in to comment.