1
Fork 0

Dump graphviz dataflow results with flag

This commit is contained in:
Dylan MacKenzie 2020-03-28 14:09:12 -07:00
parent edbd7c8602
commit c8004027ba

View file

@ -15,6 +15,7 @@ use rustc_span::symbol::{sym, Symbol};
use super::graphviz; use super::graphviz;
use super::{Analysis, GenKillAnalysis, GenKillSet, Results}; use super::{Analysis, GenKillAnalysis, GenKillSet, Results};
use crate::util::pretty::dump_enabled;
/// A solver for dataflow problems. /// A solver for dataflow problems.
pub struct Engine<'a, 'tcx, A> pub struct Engine<'a, 'tcx, A>
@ -400,12 +401,25 @@ where
let attrs = match RustcMirAttrs::parse(tcx, def_id) { let attrs = match RustcMirAttrs::parse(tcx, def_id) {
Ok(attrs) => attrs, Ok(attrs) => attrs,
// Invalid `rustc_mir` attrs will be reported using `span_err`. // Invalid `rustc_mir` attrs are reported in `RustcMirAttrs::parse`
Err(()) => return Ok(()), Err(()) => return Ok(()),
}; };
let path = match attrs.output_path(A::NAME) { let path = match attrs.output_path(A::NAME) {
Some(path) => path, Some(path) => path,
None if tcx.sess.opts.debugging_opts.dump_mir_dataflow
&& dump_enabled(tcx, A::NAME, def_id) =>
{
let mut path = PathBuf::from(&tcx.sess.opts.debugging_opts.dump_mir_dir);
let item_name = ty::print::with_forced_impl_filename_line(|| {
tcx.def_path(def_id).to_filename_friendly_no_crate()
});
path.push(format!("rustc.{}.{}.dot", item_name, A::NAME));
path
}
None => return Ok(()), None => return Ok(()),
}; };