Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump results of analysis phase as CSV (DXR support in Rust) #13222

Merged
merged 1 commit into from
Jun 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/librustc/driver/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ debugging_opts!(
LTO,
AST_JSON,
AST_JSON_NOEXPAND,
LS
LS,
SAVE_ANALYSIS
]
0
)
Expand Down Expand Up @@ -206,7 +207,9 @@ pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
("lto", "Perform LLVM link-time optimizations", LTO),
("ast-json", "Print the AST as JSON and halt", AST_JSON),
("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND),
("ls", "List the symbols defined by a library crate", LS))
("ls", "List the symbols defined by a library crate", LS),
("save-analysis", "Write syntax and type analysis information \
in addition to normal output", SAVE_ANALYSIS))
}

/// Declare a macro that will define all CodegenOptions fields and parsers all
Expand Down
12 changes: 12 additions & 0 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub fn compile_input(sess: Session,
if stop_after_phase_2(&sess) { return; }

let analysis = phase_3_run_analysis_passes(sess, &expanded_crate, ast_map);
phase_save_analysis(&analysis.ty_cx.sess, &expanded_crate, &analysis, outdir);
if stop_after_phase_3(&analysis.ty_cx.sess) { return; }
let (tcx, trans) = phase_4_translate_to_llvm(expanded_crate,
analysis, &outputs);
Expand Down Expand Up @@ -370,6 +371,17 @@ pub fn phase_3_run_analysis_passes(sess: Session,
}
}

pub fn phase_save_analysis(sess: &Session,
krate: &ast::Crate,
analysis: &CrateAnalysis,
odir: &Option<Path>) {
if (sess.opts.debugging_opts & config::SAVE_ANALYSIS) == 0 {
return;
}
time(sess.time_passes(), "save analysis", krate, |krate|
middle::save::process_crate(sess, krate, analysis, odir));
}

pub struct CrateTranslation {
pub context: ContextRef,
pub module: ModuleRef,
Expand Down
1 change: 1 addition & 0 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use syntax::{ast, codemap};
use std::os;
use std::cell::{Cell, RefCell};


pub struct Session {
pub targ_cfg: config::Config,
pub opts: config::Options,
Expand Down
1 change: 1 addition & 0 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub mod middle {
pub mod expr_use_visitor;
pub mod dependency_format;
pub mod weak_lang_items;
pub mod save;
}

pub mod front {
Expand Down
Loading