update gsgdt
This commit is contained in:
parent
5b049e107b
commit
a4e94ec9b8
4 changed files with 8 additions and 9 deletions
|
@ -1342,9 +1342,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gsgdt"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cb4a3313cdc3c65906272ddd8987c7291ff6df4b5c9997c1232b6acd1ceab24"
|
||||
checksum = "a0d876ce7262df96262a2a19531da6ff9a86048224d49580a585fc5c04617825"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
|
@ -10,7 +10,7 @@ doctest = false
|
|||
[dependencies]
|
||||
either = "1.5.0"
|
||||
rustc_graphviz = { path = "../rustc_graphviz" }
|
||||
gsgdt = "0.1.1"
|
||||
gsgdt = "0.1.2"
|
||||
itertools = "0.9"
|
||||
tracing = "0.1"
|
||||
polonius-engine = "0.12.0"
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
use gsgdt::{Edge, Graph, GraphKind, Node, NodeStyle};
|
||||
use gsgdt::{Edge, Graph, Node, NodeStyle};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
/// Convert an MIR function into a gsgdt Graph
|
||||
pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>, subgraph: bool) -> Graph {
|
||||
pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph {
|
||||
let def_id = body.source.def_id();
|
||||
let kind = if subgraph { GraphKind::Subgraph } else { GraphKind::Digraph };
|
||||
let def_name = graphviz_safe_def_name(def_id);
|
||||
let graph_name = format!("Mir_{}", def_name);
|
||||
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
|
||||
|
@ -33,7 +32,7 @@ pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>, subgrap
|
|||
}
|
||||
}
|
||||
|
||||
Graph::new(graph_name, kind, nodes, edges)
|
||||
Graph::new(graph_name, nodes, edges)
|
||||
}
|
||||
|
||||
fn bb_to_graph_node(block: BasicBlock, body: &Body<'_>, dark_mode: bool) -> Node {
|
||||
|
|
|
@ -60,14 +60,14 @@ where
|
|||
let mut label = String::from("");
|
||||
// FIXME: remove this unwrap
|
||||
write_graph_label(tcx, body, &mut label).unwrap();
|
||||
let g = mir_fn_to_generic_graph(tcx, body, subgraph);
|
||||
let g = mir_fn_to_generic_graph(tcx, body);
|
||||
let settings = GraphvizSettings {
|
||||
graph_attrs: Some(graph_attrs.join(" ")),
|
||||
node_attrs: Some(content_attrs.join(" ")),
|
||||
edge_attrs: Some(content_attrs.join(" ")),
|
||||
graph_label: Some(label),
|
||||
};
|
||||
g.to_dot(w, &settings)
|
||||
g.to_dot(w, &settings, subgraph)
|
||||
}
|
||||
|
||||
/// Write the graphviz DOT label for the overall graph. This is essentially a block of text that
|
||||
|
|
Loading…
Add table
Reference in a new issue