Skip to content

Commit

Permalink
Add convenience function for detecting cyclic CFGs
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Sep 23, 2019
1 parent 4fd9b99 commit c9e4816
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ impl<'tcx> Body<'tcx> {
dominators(self)
}

/// Returns `true` if a cycle exists in the control-flow graph that is reachable from the
/// `START_BLOCK`.
pub fn is_cfg_cyclic(&self) -> bool {
graph::is_cyclic(self)
}

#[inline]
pub fn local_kind(&self, local: Local) -> LocalKind {
let index = local.as_usize();
Expand Down

0 comments on commit c9e4816

Please sign in to comment.