Skip to content

Commit 53d7d82

Browse files
committed
Swift SIL: add flag parameters to Builder.createBeginBorrow
1 parent 3641764 commit 53d7d82

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

SwiftCompilerSources/Sources/SIL/Builder.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,14 @@ public struct Builder {
205205
return notifyNew(bridged.createCopyValue(operand.bridged).getAs(CopyValueInst.self))
206206
}
207207

208-
public func createBeginBorrow(of value: Value) -> BeginBorrowInst {
209-
return notifyNew(bridged.createBeginBorrow(value.bridged).getAs(BeginBorrowInst.self))
208+
public func createBeginBorrow(
209+
of value: Value,
210+
isLexical: Bool = false,
211+
hasPointerEscape: Bool = false,
212+
isFromVarDecl: Bool = false
213+
) -> BeginBorrowInst {
214+
return notifyNew(bridged.createBeginBorrow(value.bridged,
215+
isLexical, hasPointerEscape, isFromVarDecl).getAs(BeginBorrowInst.self))
210216
}
211217

212218
public func createBorrowedFrom(borrowedValue: Value, enclosingValues: [Value]) -> BorrowedFromInst {

include/swift/SIL/SILBridging.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,10 @@ struct BridgedBuilder{
12211221
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createUnownedRelease(BridgedValue op) const;
12221222
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createFunctionRef(BridgedFunction function) const;
12231223
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createCopyValue(BridgedValue op) const;
1224-
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createBeginBorrow(BridgedValue op) const;
1224+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createBeginBorrow(BridgedValue op,
1225+
bool isLexical,
1226+
bool hasPointerEscape,
1227+
bool isFromVarDecl) const;
12251228
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createBorrowedFrom(BridgedValue borrowedValue,
12261229
BridgedValueArray enclosingValues) const;
12271230
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createEndBorrow(BridgedValue op) const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,8 +1942,14 @@ BridgedInstruction BridgedBuilder::createCopyValue(BridgedValue op) const {
19421942
return {unbridged().createCopyValue(regularLoc(), op.getSILValue())};
19431943
}
19441944

1945-
BridgedInstruction BridgedBuilder::createBeginBorrow(BridgedValue op) const {
1946-
return {unbridged().createBeginBorrow(regularLoc(), op.getSILValue())};
1945+
BridgedInstruction BridgedBuilder::createBeginBorrow(BridgedValue op,
1946+
bool isLexical,
1947+
bool hasPointerEscape,
1948+
bool isFromVarDecl) const {
1949+
return {unbridged().createBeginBorrow(regularLoc(), op.getSILValue(),
1950+
swift::IsLexical_t(isLexical),
1951+
swift::HasPointerEscape_t(hasPointerEscape),
1952+
swift::IsFromVarDecl_t(isFromVarDecl))};
19471953
}
19481954

19491955
BridgedInstruction BridgedBuilder::createBorrowedFrom(BridgedValue borrowedValue,

0 commit comments

Comments
 (0)