In the rustc driver, we pass the expanded, not the pre-expansion, AST to the post-analysis callback. We can also pass this to post-write-deps callback.

This commit is contained in:
Nick Cameron 2015-02-21 16:25:51 +13:00
parent 522d09dfec
commit 712a6870e9
2 changed files with 12 additions and 7 deletions

View File

@ -112,6 +112,7 @@ pub fn compile_input(sess: Session,
&sess,
outdir,
&ast_map,
&ast_map.krate(),
&id[..]));
let analysis = phase_3_run_analysis_passes(sess,
@ -287,11 +288,13 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
session: &'a Session,
out_dir: &'a Option<Path>,
ast_map: &'a ast_map::Map<'ast>,
expanded_crate: &'a ast::Crate,
crate_name: &'a str)
-> CompileState<'a, 'ast, 'tcx> {
CompileState {
crate_name: Some(crate_name),
ast_map: Some(ast_map),
expanded_crate: Some(expanded_crate),
.. CompileState::empty(input, session, out_dir)
}
}
@ -299,14 +302,14 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
fn state_after_analysis(input: &'a Input,
session: &'a Session,
out_dir: &'a Option<Path>,
krate: &'a ast::Crate,
expanded_crate: &'a ast::Crate,
analysis: &'a ty::CrateAnalysis<'tcx>,
tcx: &'a ty::ctxt<'tcx>)
-> CompileState<'a, 'ast, 'tcx> {
CompileState {
analysis: Some(analysis),
tcx: Some(tcx),
krate: Some(krate),
expanded_crate: Some(expanded_crate),
.. CompileState::empty(input, session, out_dir)
}
}

View File

@ -373,11 +373,13 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
if sess.opts.debugging_opts.save_analysis {
control.after_analysis.callback = box |state| {
time(state.session.time_passes(), "save analysis", state.krate.unwrap(), |krate|
save::process_crate(state.session,
krate,
state.analysis.unwrap(),
state.out_dir));
time(state.session.time_passes(),
"save analysis",
state.expanded_crate.unwrap(),
|krate| save::process_crate(state.session,
krate,
state.analysis.unwrap(),
state.out_dir));
};
control.make_glob_map = resolve::MakeGlobMap::Yes;
}