Skip to content

Commit 3aebfa9

Browse files
committed
SILBuilder: add a createFallThroughBlock convenience.
1 parent 1a9e134 commit 3aebfa9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,16 @@ class SILBuilder {
375375
/// continuation block.
376376
SILBasicBlock *splitBlockForFallthrough();
377377

378+
/// Convenience for creating a fall-through basic block on-the-fly without
379+
/// affecting the insertion point.
380+
SILBasicBlock *createFallthroughBlock(SILLocation loc,
381+
SILBasicBlock *targetBB) {
382+
auto *newBB = F->createBasicBlock();
383+
SILBuilder(newBB, this->getCurrentDebugScope(), this->getBuilderContext())
384+
.createBranch(loc, targetBB);
385+
return newBB;
386+
}
387+
378388
//===--------------------------------------------------------------------===//
379389
// SILInstruction Creation Methods
380390
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)