Skip to content

Commit bfeb212

Browse files
committed
remove default value for the keepUnique argument of Builder.createEndCOWMutation
This avoids bugs because the default value false is sometimes not the right choice. NFC
1 parent d4b1172 commit bfeb212

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

SwiftCompilerSources/Sources/SIL/Builder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public struct Builder {
346346
return notifyNew(metatype.getAs(MetatypeInst.self))
347347
}
348348

349-
public func createEndCOWMutation(instance: Value, keepUnique: Bool = false) -> EndCOWMutationInst {
349+
public func createEndCOWMutation(instance: Value, keepUnique: Bool) -> EndCOWMutationInst {
350350
let endMutation = bridged.createEndCOWMutation(instance.bridged, keepUnique)
351351
return notifyNew(endMutation.getAs(EndCOWMutationInst.self))
352352
}

include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2287,7 +2287,7 @@ class SILBuilder {
22872287
Int1Ty, getFunction(), isNative));
22882288
}
22892289
EndCOWMutationInst *createEndCOWMutation(SILLocation Loc, SILValue operand,
2290-
bool keepUnique = false) {
2290+
bool keepUnique) {
22912291
return insert(new (getModule()) EndCOWMutationInst(getSILDebugLocation(Loc),
22922292
operand, keepUnique));
22932293
}

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ emitBuiltinEndCOWMutation(SILGenFunction &SGF,
10191019

10201020
SILValue refAddr = args[0].getValue();
10211021
auto ref = SGF.B.createLoad(loc, refAddr, LoadOwnershipQualifier::Take);
1022-
auto endRef = SGF.B.createEndCOWMutation(loc, ref);
1022+
auto endRef = SGF.B.createEndCOWMutation(loc, ref, /*keepUnique=*/ false);
10231023
SGF.B.createStore(loc, endRef, refAddr, StoreOwnershipQualifier::Init);
10241024
return ManagedValue::forObjectRValueWithoutOwnership(SGF.emitEmptyTuple(loc));
10251025
}

0 commit comments

Comments
 (0)