Skip to content

Commit 37d8109

Browse files
committed
Add a getter for the default of a Switch
1 parent cd0e4a9 commit 37d8109

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/LLVM/Switch.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ public struct Switch: IRValue {
1919
LLVMAddCase(llvm, value.asLLVM(), block.asLLVM())
2020
}
2121

22+
/// Retrieves the basic block the flow of control reaches should a
23+
/// value not match any of the cases in the branch table.
24+
var defaultDestination: BasicBlock {
25+
return BasicBlock(llvm: LLVMGetSwitchDefaultDest(self.llvm))
26+
}
27+
2228
/// Retrieves the underlying LLVM value object.
2329
public func asLLVM() -> LLVMValueRef {
2430
return llvm

0 commit comments

Comments
 (0)