save-analsysis: add save-analysis-api CLI flag
This commit is contained in:
parent
2c01bb8851
commit
cbafc5758b
3 changed files with 15 additions and 4 deletions
|
|
@ -848,9 +848,13 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
ls: bool = (false, parse_bool, [UNTRACKED],
|
||||
"list the symbols defined by a library crate"),
|
||||
save_analysis: bool = (false, parse_bool, [UNTRACKED],
|
||||
"write syntax and type analysis (in JSON format) information in addition to normal output"),
|
||||
"write syntax and type analysis (in JSON format) information, \
|
||||
addition to normal output"),
|
||||
save_analysis_csv: bool = (false, parse_bool, [UNTRACKED],
|
||||
"write syntax and type analysis (in CSV format) information in addition to normal output"),
|
||||
"write syntax and type analysis (in CSV format) information, in addition to normal output"),
|
||||
save_analysis_api: bool = (false, parse_bool, [UNTRACKED],
|
||||
"write syntax and type analysis information for opaque libraries (in JSON format), \
|
||||
in addition to normal output"),
|
||||
print_move_fragments: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print out move-fragment data for every fn"),
|
||||
flowgraph_print_loans: bool = (false, parse_bool, [UNTRACKED],
|
||||
|
|
@ -2359,6 +2363,8 @@ mod tests {
|
|||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.save_analysis_csv = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.save_analysis_api = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.print_move_fragments = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.flowgraph_print_loans = true;
|
||||
|
|
|
|||
|
|
@ -555,7 +555,8 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
|
|||
|
||||
fn save_analysis(sess: &Session) -> bool {
|
||||
sess.opts.debugging_opts.save_analysis ||
|
||||
sess.opts.debugging_opts.save_analysis_csv
|
||||
sess.opts.debugging_opts.save_analysis_csv ||
|
||||
sess.opts.debugging_opts.save_analysis_api
|
||||
}
|
||||
|
||||
fn save_analysis_format(sess: &Session) -> save::Format {
|
||||
|
|
@ -563,6 +564,8 @@ fn save_analysis_format(sess: &Session) -> save::Format {
|
|||
save::Format::Json
|
||||
} else if sess.opts.debugging_opts.save_analysis_csv {
|
||||
save::Format::Csv
|
||||
} else if sess.opts.debugging_opts.save_analysis_api {
|
||||
save::Format::JsonApi
|
||||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -727,13 +727,14 @@ impl Visitor for PathCollector {
|
|||
pub enum Format {
|
||||
Csv,
|
||||
Json,
|
||||
JsonApi,
|
||||
}
|
||||
|
||||
impl Format {
|
||||
fn extension(&self) -> &'static str {
|
||||
match *self {
|
||||
Format::Csv => ".csv",
|
||||
Format::Json => ".json",
|
||||
Format::Json | Format::JsonApi => ".json",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -803,6 +804,7 @@ pub fn process_crate<'l, 'tcx>(tcx: TyCtxt<'l, 'tcx, 'tcx>,
|
|||
match format {
|
||||
Format::Csv => dump!(CsvDumper::new(output)),
|
||||
Format::Json => dump!(JsonDumper::new(output)),
|
||||
Format::JsonApi => /* TODO */ dump!(JsonDumper::new(output)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue