[SIL] add BasicBlock.singleSuccessor

This commit is contained in:
Andrew Trick
2023-12-14 00:18:03 -08:00
parent a396cc3c2a
commit 0ddf2a8514

View File

@@ -53,6 +53,10 @@ final public class BasicBlock : CustomStringConvertible, HasShortDescription, Eq
public var hasSinglePredecessor: Bool { singlePredecessor != nil }
public var singleSuccessor: BasicBlock? {
successors.count == 1 ? successors[0] : nil
}
/// The index of the basic block in its function.
/// This has O(n) complexity. Only use it for debugging
public var index: Int {