Skip to content

Commit 93c41c6

Browse files
committed
Swift SIL: add Builder.createUncheckedOwnershipConversion
1 parent 55d1e82 commit 93c41c6

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

SwiftCompilerSources/Sources/SIL/Builder.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ public struct Builder {
215215
return notifyNew(cast.getAs(UnconditionalCheckedCastAddrInst.self))
216216
}
217217

218+
public func createUncheckedOwnershipConversion(
219+
operand: Value, resultOwnership: Ownership
220+
) -> UncheckedOwnershipConversionInst {
221+
let uoc = bridged.createUncheckedOwnershipConversion(operand.bridged, resultOwnership._bridged)
222+
return notifyNew(uoc.getAs(UncheckedOwnershipConversionInst.self))
223+
}
224+
218225
public func createLoad(fromAddress: Value, ownership: LoadInst.LoadOwnership) -> LoadInst {
219226
let load = bridged.createLoad(fromAddress.bridged, ownership.rawValue)
220227
return notifyNew(load.getAs(LoadInst.self))

include/swift/SIL/SILBridging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,8 @@ struct BridgedBuilder{
11781178
BridgedInstruction::CastingIsolatedConformances isolatedConformances,
11791179
BridgedValue source, BridgedCanType sourceFormalType,
11801180
BridgedValue destination, BridgedCanType targetFormalType) const;
1181+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createUncheckedOwnershipConversion(
1182+
BridgedValue op, BridgedValue::Ownership ownership) const;
11811183
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createLoad(BridgedValue op, SwiftInt ownership) const;
11821184
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createLoadBorrow(BridgedValue op) const;
11831185
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction createBeginDeallocRef(BridgedValue reference,

include/swift/SIL/SILBridgingImpl.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,6 +2205,13 @@ BridgedInstruction BridgedBuilder::createLoad(BridgedValue op, SwiftInt ownershi
22052205
(swift::LoadOwnershipQualifier)ownership)};
22062206
}
22072207

2208+
2209+
BridgedInstruction BridgedBuilder::createUncheckedOwnershipConversion(BridgedValue op,
2210+
BridgedValue::Ownership ownership) const {
2211+
return {unbridged().createUncheckedOwnershipConversion(regularLoc(), op.getSILValue(),
2212+
BridgedValue::unbridge(ownership))};
2213+
}
2214+
22082215
BridgedInstruction BridgedBuilder::createLoadBorrow(BridgedValue op) const {
22092216
return {unbridged().createLoadBorrow(regularLoc(), op.getSILValue())};
22102217
}

0 commit comments

Comments
 (0)