Skip to content

Commit 1dde278

Browse files
committed
[NFC] SIL: Find unreachable-terminated blocks.
Add a helper similar to findExitingBlocks.
1 parent 813e0a5 commit 1dde278

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,17 @@ class SILFunction
15651565
}
15661566
}
15671567

1568+
/// Populate \p output with every block terminated by an unreachable
1569+
/// instruction.
1570+
void visitUnreachableTerminatedBlocks(
1571+
llvm::function_ref<void(SILBasicBlock &)> visitor) const {
1572+
for (auto &block : const_cast<SILFunction &>(*this)) {
1573+
if (isa<UnreachableInst>(block.getTerminator())) {
1574+
visitor(block);
1575+
}
1576+
}
1577+
}
1578+
15681579
//===--------------------------------------------------------------------===//
15691580
// Argument Helper Methods
15701581
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)