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

Add new -Z dump-mir-spanview option #76074

Merged
merged 1 commit into from
Sep 2, 2020
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
1 change: 1 addition & 0 deletions compiler/rustc_mir/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod alignment;
pub mod collect_writes;
mod graphviz;
pub(crate) mod pretty;
pub(crate) mod spanview;

pub use self::aggregate::expand_aggregate;
pub use self::alignment::is_disaligned;
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_mir/src/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::io::{self, Write};
use std::path::{Path, PathBuf};

use super::graphviz::write_mir_fn_graphviz;
use super::spanview::write_mir_fn_spanview;
use crate::transform::MirSource;
use either::Either;
use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -147,6 +148,16 @@ fn dump_matched_mir_node<'tcx, F>(
write_mir_fn_graphviz(tcx, source.def_id(), body, false, &mut file)?;
};
}

if let Some(spanview) = tcx.sess.opts.debugging_opts.dump_mir_spanview {
let _: io::Result<()> = try {
let mut file =
create_dump_file(tcx, "html", pass_num, pass_name, disambiguator, source)?;
if source.def_id().is_local() {
write_mir_fn_spanview(tcx, source.def_id(), body, spanview, &mut file)?;
}
};
}
}

/// Returns the path to the filename where we should dump a given MIR.
Expand Down
Loading