Skip to content

Commit e506928

Browse files
committed
SwiftCompilerSources: Add Operand.isScopeEndingUse.
1 parent ff21dde commit e506928

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SwiftCompilerSources/Sources/SIL/Operand.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ extension Operand {
192192
}
193193
}
194194

195+
extension Operand {
196+
/// A scope ending use is a consuming use for normal borrow scopes, but it also applies to intructions that end the
197+
/// scope of an address (end_access) or a token (end_apply, abort_apply),
198+
public var isScopeEndingUse: Bool {
199+
switch instruction {
200+
case is EndBorrowInst, is EndAccessInst, is EndApplyInst, is AbortApplyInst:
201+
return true
202+
default:
203+
return false
204+
}
205+
}
206+
}
207+
195208
extension OptionalBridgedOperand {
196209
init(bridged: BridgedOperand?) {
197210
self = OptionalBridgedOperand(op: bridged?.op)

0 commit comments

Comments
 (0)