Skip to content

Commit 3407ccd

Browse files
committed
[SIL] bridge Argument.isReborrow
1 parent d40fa08 commit 3407ccd

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

SwiftCompilerSources/Sources/SIL/Argument.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class Argument : Value, Hashable {
2828
public var index: Int {
2929
return parentBlock.arguments.firstIndex(of: self)!
3030
}
31+
32+
public var isReborrow: Bool { bridged.isReborrow() }
3133

3234
public static func ==(lhs: Argument, rhs: Argument) -> Bool {
3335
lhs === rhs
@@ -109,6 +111,12 @@ public struct Phi {
109111
incomingOperands.lazy.map { $0.value }
110112
}
111113

114+
public var isReborrow: Bool { value.isReborrow }
115+
116+
public var endsLifetime: Bool {
117+
value.ownership == .owned || value.isReborrow
118+
}
119+
112120
public static func ==(lhs: Phi, rhs: Phi) -> Bool {
113121
lhs.value === rhs.value
114122
}

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ struct BridgedArgument {
730730
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedBasicBlock getParent() const;
731731
BRIDGED_INLINE BridgedArgumentConvention getConvention() const;
732732
BRIDGED_INLINE bool isSelf() const;
733+
BRIDGED_INLINE bool isReborrow() const;
733734
};
734735

735736
struct OptionalBridgedArgument {

include/swift/SIL/SILBridgingImpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ bool BridgedArgument::isSelf() const {
368368
return fArg->isSelf();
369369
}
370370

371+
bool BridgedArgument::isReborrow() const {
372+
return getArgument()->isReborrow();
373+
}
374+
371375
//===----------------------------------------------------------------------===//
372376
// BridgedSubstitutionMap
373377
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)