Skip to content

Commit 83754fa

Browse files
committed
Swift SIL: add Builder.createEndCOWMutation
1 parent 30ea104 commit 83754fa

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

SwiftCompilerSources/Sources/SIL/Builder.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,14 @@ public struct Builder {
309309
useConformancesOf.bridged)
310310
return notifyNew(initExistential.getAs(InitExistentialRefInst.self))
311311
}
312-
312+
313313
public func createMetatype(of type: Type, representation: swift.MetatypeRepresentation) -> MetatypeInst {
314314
let metatype = bridged.createMetatype(type.bridged, representation)
315315
return notifyNew(metatype.getAs(MetatypeInst.self))
316316
}
317+
318+
public func createEndCOWMutation(instance: Value, keepUnique: Bool = false) -> EndCOWMutationInst {
319+
let endMutation = bridged.createEndCOWMutation(instance.bridged, keepUnique)
320+
return notifyNew(endMutation.getAs(EndCOWMutationInst.self))
321+
}
317322
}

include/swift/SIL/SILBridging.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,11 @@ struct BridgedBuilder{
13641364
swift::SILType t = swift::SILType::getPrimitiveObjectType(swift::CanType(mt));
13651365
return {builder().createMetatype(regularLoc(), t)};
13661366
}
1367+
1368+
SWIFT_IMPORT_UNSAFE
1369+
BridgedInstruction createEndCOWMutation(BridgedValue instance, bool keepUnique) const {
1370+
return {builder().createEndCOWMutation(regularLoc(), instance.getSILValue(), keepUnique)};
1371+
}
13671372
};
13681373

13691374
// AST bridging

0 commit comments

Comments
 (0)