Skip to content

Commit

Permalink
update gsgdt
Browse files Browse the repository at this point in the history
  • Loading branch information
vn-ki committed Nov 9, 2020
1 parent 5b049e1 commit a4e94ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Expand Up @@ -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",
]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/Cargo.toml
Expand Up @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_mir/src/util/generic_graph.rs
@@ -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;
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/util/graphviz.rs
Expand Up @@ -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
Expand Down

0 comments on commit a4e94ec

Please sign in to comment.