From 7a46377dbfedbd688ed8d4f27efab544d50b9a76 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 15 Mar 2017 15:29:22 -0700 Subject: Add edge labels to our graphviz output This adds the `EdgeKind` as a label to edges in the graphviz IR dump output. This is useful for understanding why something is referenced by another thing. --- src/ir/dot.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ir/dot.rs b/src/ir/dot.rs index e7e1f47b..7472dd8e 100644 --- a/src/ir/dot.rs +++ b/src/ir/dot.rs @@ -36,15 +36,16 @@ pub fn write_dot_file

(ctx: &BindgenContext, path: P) -> io::Result<()> try!(writeln!(&mut dot_file, r#" >];"#)); item.trace(ctx, - &mut |sub_id: ItemId, _edge_kind| { + &mut |sub_id: ItemId, edge_kind| { if err.is_some() { return; } match writeln!(&mut dot_file, - "{} -> {};", + "{} -> {} [label={:?}];", id.as_usize(), - sub_id.as_usize()) { + sub_id.as_usize(), + edge_kind) { Ok(_) => {} Err(e) => err = Some(Err(e)), } -- cgit v1.2.3