Skip to content

Commit c800402

Browse files
Dump graphviz dataflow results with flag
1 parent edbd7c8 commit c800402

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/librustc_mir/dataflow/framework/engine.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_span::symbol::{sym, Symbol};
1515

1616
use super::graphviz;
1717
use super::{Analysis, GenKillAnalysis, GenKillSet, Results};
18+
use crate::util::pretty::dump_enabled;
1819

1920
/// A solver for dataflow problems.
2021
pub struct Engine<'a, 'tcx, A>
@@ -400,12 +401,25 @@ where
400401
let attrs = match RustcMirAttrs::parse(tcx, def_id) {
401402
Ok(attrs) => attrs,
402403

403-
// Invalid `rustc_mir` attrs will be reported using `span_err`.
404+
// Invalid `rustc_mir` attrs are reported in `RustcMirAttrs::parse`
404405
Err(()) => return Ok(()),
405406
};
406407

407408
let path = match attrs.output_path(A::NAME) {
408409
Some(path) => path,
410+
411+
None if tcx.sess.opts.debugging_opts.dump_mir_dataflow
412+
&& dump_enabled(tcx, A::NAME, def_id) =>
413+
{
414+
let mut path = PathBuf::from(&tcx.sess.opts.debugging_opts.dump_mir_dir);
415+
416+
let item_name = ty::print::with_forced_impl_filename_line(|| {
417+
tcx.def_path(def_id).to_filename_friendly_no_crate()
418+
});
419+
path.push(format!("rustc.{}.{}.dot", item_name, A::NAME));
420+
path
421+
}
422+
409423
None => return Ok(()),
410424
};
411425

0 commit comments

Comments
 (0)