rustc_mir: track inlined callees in SourceScopeData.

This commit is contained in:
Eduard-Mihai Burtescu
2020-02-08 21:31:09 +02:00
parent 708fc0b692
commit 6bc5eafbce
41 changed files with 124 additions and 74 deletions

View File

@@ -548,8 +548,23 @@ fn write_scope_tree(
};
for &child in children {
assert_eq!(body.source_scopes[child].parent_scope, Some(parent));
writeln!(w, "{0:1$}scope {2} {{", "", indent, child.index())?;
let child_data = &body.source_scopes[child];
assert_eq!(child_data.parent_scope, Some(parent));
if let Some((callee, callsite_span)) = child_data.inlined {
let indented_header =
format!("{0:1$}scope {2} (inlined {3}) {{", "", indent, child.index(), callee);
writeln!(
w,
"{0:1$} // at {2}",
indented_header,
ALIGN,
tcx.sess.source_map().span_to_string(callsite_span),
)?;
} else {
writeln!(w, "{0:1$}scope {2} {{", "", indent, child.index())?;
}
write_scope_tree(tcx, body, scope_tree, w, child, depth + 1)?;
writeln!(w, "{0:1$}}}", "", depth * INDENT.len())?;
}