Skip to content

Commit 0ddf2a8

Browse files
committed
[SIL] add BasicBlock.singleSuccessor
1 parent a396cc3 commit 0ddf2a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

SwiftCompilerSources/Sources/SIL/BasicBlock.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ final public class BasicBlock : CustomStringConvertible, HasShortDescription, Eq
5353

5454
public var hasSinglePredecessor: Bool { singlePredecessor != nil }
5555

56+
public var singleSuccessor: BasicBlock? {
57+
successors.count == 1 ? successors[0] : nil
58+
}
59+
5660
/// The index of the basic block in its function.
5761
/// This has O(n) complexity. Only use it for debugging
5862
public var index: Int {

0 commit comments

Comments
 (0)