Skip to content

Commit 72ed4fc

Browse files
committed
Reflect whitelisted status via color in graphviz dot files
This makes it so that whitelisted items and edges outgoing from them are black, while non-whitelisted items and their edges are gray.
1 parent 641bb12 commit 72ed4fc

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/ir/dot.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ where
3232
let mut err: Option<io::Result<_>> = None;
3333

3434
for (id, item) in ctx.items() {
35+
let is_whitelisted = ctx.whitelisted_items().contains(id);
36+
3537
try!(writeln!(
3638
&mut dot_file,
37-
r#"{} [fontname="courier", label=< <table border="0" align="left">"#,
38-
id.as_usize()
39+
r#"{} [fontname="courier", color={}, label=< <table border="0" align="left">"#,
40+
id.as_usize(),
41+
if is_whitelisted {
42+
"black"
43+
} else {
44+
"gray"
45+
}
3946
));
4047
try!(item.dot_attributes(ctx, &mut dot_file));
4148
try!(writeln!(&mut dot_file, r#"</table> >];"#));
@@ -49,10 +56,15 @@ where
4956

5057
match writeln!(
5158
&mut dot_file,
52-
"{} -> {} [label={:?}];",
59+
"{} -> {} [label={:?}, color={}];",
5360
id.as_usize(),
5461
sub_id.as_usize(),
55-
edge_kind
62+
edge_kind,
63+
if is_whitelisted {
64+
"black"
65+
} else {
66+
"gray"
67+
}
5668
) {
5769
Ok(_) => {}
5870
Err(e) => err = Some(Err(e)),
@@ -69,7 +81,7 @@ where
6981
for child in module.children() {
7082
try!(writeln!(
7183
&mut dot_file,
72-
"{} -> {} [style=dotted]",
84+
"{} -> {} [style=dotted, color=gray]",
7385
item.id().as_usize(),
7486
child.as_usize()
7587
));

0 commit comments

Comments
 (0)