Skip to content

Commit

Permalink
Mir pretty print: Add cleanup comment
Browse files Browse the repository at this point in the history
I found it useful to add a comment indicating whether or not a
BasicBlock is a cleanup block or not. Hopefully you'll find it
useful too.
  • Loading branch information
diwic committed Sep 29, 2017
1 parent 17600c1 commit b167fc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_mir/util/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ pub fn write_basic_block(tcx: TyCtxt,
let data = &mir[block];

// Basic block label at the top.
writeln!(w, "{}{:?}: {{", INDENT, block)?;
let cleanup_text = if data.is_cleanup { " // cleanup" } else { "" };
let lbl = format!("{}{:?}: {{", INDENT, block);
writeln!(w, "{0:1$}{2}", lbl, ALIGN, cleanup_text)?;

// List of statements in the middle.
let mut current_location = Location { block: block, statement_index: 0 };
Expand Down

0 comments on commit b167fc0

Please sign in to comment.