From 61cb1baab1616134ff77af7ac290ab8f97d6927f Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 10 Sep 2015 21:47:57 +1200 Subject: [PATCH] Add compiler option to keep mtwt tables This is so that the resolution results can be used after analysis, potentially for tool support --- src/librustc/session/config.rs | 2 ++ src/librustc_driver/driver.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index ad0eb4d53fe26..30f43baabba2f 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -601,6 +601,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "For every macro invocation, print its name and arguments"), enable_nonzeroing_move_hints: bool = (false, parse_bool, "Force nonzeroing move optimization on"), + keep_mtwt_tables: bool = (false, parse_bool, + "Don't clear the resolution tables after analysis"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index f3038624ac107..7d0f1b44d23c7 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -671,7 +671,9 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: Session, || resolve::resolve_crate(&sess, &ast_map, make_glob_map)); // Discard MTWT tables that aren't required past resolution. - syntax::ext::mtwt::clear_tables(); + if !sess.opts.debugging_opts.keep_mtwt_tables { + syntax::ext::mtwt::clear_tables(); + } let named_region_map = time(time_passes, "lifetime resolution", || middle::resolve_lifetime::krate(&sess, krate, &def_map));