restructure rustc options relating to incr. comp.
You can now pass `-Z incremental=dir` as well as saying `-Z query-dep-graph` if you want to enable queries for some other purpose. Accessor functions take the place of computed boolean flags.
This commit is contained in:
parent
943ec3bdfc
commit
fe47ca0d0b
|
@ -139,11 +139,9 @@ pub struct Options {
|
||||||
pub continue_parse_after_error: bool,
|
pub continue_parse_after_error: bool,
|
||||||
pub mir_opt_level: usize,
|
pub mir_opt_level: usize,
|
||||||
|
|
||||||
/// if true, build up the dep-graph
|
/// if Some, enable incremental compilation, using the given
|
||||||
pub build_dep_graph: bool,
|
/// directory to store intermediate results
|
||||||
|
pub incremental: Option<PathBuf>,
|
||||||
/// if true, -Z dump-dep-graph was passed to dump out the dep-graph
|
|
||||||
pub dump_dep_graph: bool,
|
|
||||||
|
|
||||||
pub no_analysis: bool,
|
pub no_analysis: bool,
|
||||||
pub debugging_opts: DebuggingOptions,
|
pub debugging_opts: DebuggingOptions,
|
||||||
|
@ -260,8 +258,7 @@ pub fn basic_options() -> Options {
|
||||||
treat_err_as_bug: false,
|
treat_err_as_bug: false,
|
||||||
continue_parse_after_error: false,
|
continue_parse_after_error: false,
|
||||||
mir_opt_level: 1,
|
mir_opt_level: 1,
|
||||||
build_dep_graph: false,
|
incremental: None,
|
||||||
dump_dep_graph: false,
|
|
||||||
no_analysis: false,
|
no_analysis: false,
|
||||||
debugging_opts: basic_debugging_options(),
|
debugging_opts: basic_debugging_options(),
|
||||||
prints: Vec::new(),
|
prints: Vec::new(),
|
||||||
|
@ -276,6 +273,15 @@ pub fn basic_options() -> Options {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Options {
|
||||||
|
/// True if there is a reason to build the dep graph.
|
||||||
|
pub fn build_dep_graph(&self) -> bool {
|
||||||
|
self.incremental.is_some() ||
|
||||||
|
self.debugging_opts.dump_dep_graph ||
|
||||||
|
self.debugging_opts.query_dep_graph
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The type of entry function, so
|
// The type of entry function, so
|
||||||
// users can have their own entry
|
// users can have their own entry
|
||||||
// functions that don't start a
|
// functions that don't start a
|
||||||
|
@ -635,10 +641,12 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
"treat all errors that occur as bugs"),
|
"treat all errors that occur as bugs"),
|
||||||
continue_parse_after_error: bool = (false, parse_bool,
|
continue_parse_after_error: bool = (false, parse_bool,
|
||||||
"attempt to recover from parse errors (experimental)"),
|
"attempt to recover from parse errors (experimental)"),
|
||||||
incr_comp: bool = (false, parse_bool,
|
incremental: Option<String> = (None, parse_opt_string,
|
||||||
"enable incremental compilation (experimental)"),
|
"enable incremental compilation (experimental)"),
|
||||||
dump_dep_graph: bool = (false, parse_bool,
|
dump_dep_graph: bool = (false, parse_bool,
|
||||||
"dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"),
|
"dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"),
|
||||||
|
query_dep_graph: bool = (false, parse_bool,
|
||||||
|
"enable queries of the dependency graph for regression testing"),
|
||||||
no_analysis: bool = (false, parse_bool,
|
no_analysis: bool = (false, parse_bool,
|
||||||
"parse and expand the source, but run no analysis"),
|
"parse and expand the source, but run no analysis"),
|
||||||
extra_plugins: Vec<String> = (Vec::new(), parse_list,
|
extra_plugins: Vec<String> = (Vec::new(), parse_list,
|
||||||
|
@ -1051,8 +1059,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
let treat_err_as_bug = debugging_opts.treat_err_as_bug;
|
let treat_err_as_bug = debugging_opts.treat_err_as_bug;
|
||||||
let continue_parse_after_error = debugging_opts.continue_parse_after_error;
|
let continue_parse_after_error = debugging_opts.continue_parse_after_error;
|
||||||
let mir_opt_level = debugging_opts.mir_opt_level.unwrap_or(1);
|
let mir_opt_level = debugging_opts.mir_opt_level.unwrap_or(1);
|
||||||
let incremental_compilation = debugging_opts.incr_comp;
|
|
||||||
let dump_dep_graph = debugging_opts.dump_dep_graph;
|
|
||||||
let no_analysis = debugging_opts.no_analysis;
|
let no_analysis = debugging_opts.no_analysis;
|
||||||
|
|
||||||
let mut output_types = HashMap::new();
|
let mut output_types = HashMap::new();
|
||||||
|
@ -1212,6 +1218,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
|
|
||||||
let crate_name = matches.opt_str("crate-name");
|
let crate_name = matches.opt_str("crate-name");
|
||||||
|
|
||||||
|
let incremental = debugging_opts.incremental.as_ref().map(|m| PathBuf::from(m));
|
||||||
|
|
||||||
Options {
|
Options {
|
||||||
crate_types: crate_types,
|
crate_types: crate_types,
|
||||||
gc: gc,
|
gc: gc,
|
||||||
|
@ -1231,8 +1239,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
treat_err_as_bug: treat_err_as_bug,
|
treat_err_as_bug: treat_err_as_bug,
|
||||||
continue_parse_after_error: continue_parse_after_error,
|
continue_parse_after_error: continue_parse_after_error,
|
||||||
mir_opt_level: mir_opt_level,
|
mir_opt_level: mir_opt_level,
|
||||||
build_dep_graph: incremental_compilation || dump_dep_graph,
|
incremental: incremental,
|
||||||
dump_dep_graph: dump_dep_graph,
|
|
||||||
no_analysis: no_analysis,
|
no_analysis: no_analysis,
|
||||||
debugging_opts: debugging_opts,
|
debugging_opts: debugging_opts,
|
||||||
prints: prints,
|
prints: prints,
|
||||||
|
|
|
@ -121,7 +121,7 @@ pub fn compile_input(sess: &Session,
|
||||||
let expanded_crate = assign_node_ids(sess, expanded_crate);
|
let expanded_crate = assign_node_ids(sess, expanded_crate);
|
||||||
// Lower ast -> hir.
|
// Lower ast -> hir.
|
||||||
let lcx = LoweringContext::new(sess, Some(&expanded_crate));
|
let lcx = LoweringContext::new(sess, Some(&expanded_crate));
|
||||||
let dep_graph = DepGraph::new(sess.opts.build_dep_graph);
|
let dep_graph = DepGraph::new(sess.opts.build_dep_graph());
|
||||||
let mut hir_forest = time(sess.time_passes(),
|
let mut hir_forest = time(sess.time_passes(),
|
||||||
"lowering ast -> hir",
|
"lowering ast -> hir",
|
||||||
|| hir_map::Forest::new(lower_crate(&lcx, &expanded_crate),
|
|| hir_map::Forest::new(lower_crate(&lcx, &expanded_crate),
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that when a trait impl changes, fns whose body uses that trait
|
// Test that when a trait impl changes, fns whose body uses that trait
|
||||||
// must also be recompiled.
|
// must also be recompiled.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that immediate callers have to change when callee changes, but
|
// Test that immediate callers have to change when callee changes, but
|
||||||
// not callers' callers.
|
// not callers' callers.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test cases where a changing struct appears in the signature of fns
|
// Test cases where a changing struct appears in the signature of fns
|
||||||
// and methods.
|
// and methods.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that adding an impl to a trait `Foo` DOES affect functions
|
// Test that adding an impl to a trait `Foo` DOES affect functions
|
||||||
// that only use `Bar` if they have methods in common.
|
// that only use `Bar` if they have methods in common.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that adding an impl to a trait `Foo` does not affect functions
|
// Test that adding an impl to a trait `Foo` does not affect functions
|
||||||
// that only use `Bar`, so long as they do not have methods in common.
|
// that only use `Bar`, so long as they do not have methods in common.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that when a trait impl changes, fns whose body uses that trait
|
// Test that when a trait impl changes, fns whose body uses that trait
|
||||||
// must also be recompiled.
|
// must also be recompiled.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// Test that two unrelated functions have no trans dependency.
|
// Test that two unrelated functions have no trans dependency.
|
||||||
|
|
||||||
// compile-flags: -Z incr-comp
|
// compile-flags: -Z query-dep-graph
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -239,7 +239,7 @@ fn compile_program(input: &str, sysroot: PathBuf)
|
||||||
|
|
||||||
let krate = driver::assign_node_ids(&sess, krate);
|
let krate = driver::assign_node_ids(&sess, krate);
|
||||||
let lcx = LoweringContext::new(&sess, Some(&krate));
|
let lcx = LoweringContext::new(&sess, Some(&krate));
|
||||||
let dep_graph = DepGraph::new(sess.opts.build_dep_graph);
|
let dep_graph = DepGraph::new(sess.opts.build_dep_graph());
|
||||||
let mut hir_forest = ast_map::Forest::new(lower_crate(&lcx, &krate), dep_graph);
|
let mut hir_forest = ast_map::Forest::new(lower_crate(&lcx, &krate), dep_graph);
|
||||||
let arenas = ty::CtxtArenas::new();
|
let arenas = ty::CtxtArenas::new();
|
||||||
let ast_map = driver::make_map(&sess, &mut hir_forest);
|
let ast_map = driver::make_map(&sess, &mut hir_forest);
|
||||||
|
|
Loading…
Reference in New Issue