Skip to content

Commit dccd6eb

Browse files
committed
[silgen] Change ManagedValue::copyInto to have same paramter order as ManagedValue::{forward,assign}Into.
ManagedValue::{forward,assign}Into both have the signature SILGenFunction &, SILLocation, SILValue. For some reason copyInto has SILLocation and SILValue swapped. This commit standardizes copyInto to match the others.
1 parent 6dd4d06 commit dccd6eb

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

lib/SILGen/ManagedValue.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ ManagedValue ManagedValue::formalAccessCopy(SILGenFunction &SGF,
5757

5858
/// Store a copy of this value with independent ownership into the given
5959
/// uninitialized address.
60-
void ManagedValue::copyInto(SILGenFunction &SGF, SILValue dest,
61-
SILLocation loc) {
60+
void ManagedValue::copyInto(SILGenFunction &SGF, SILLocation loc,
61+
SILValue dest) {
6262
auto &lowering = SGF.getTypeLowering(getType());
6363
if (lowering.isAddressOnly() && SGF.silConv.useLoweredAddresses()) {
6464
SGF.B.createCopyAddr(loc, getValue(), dest, IsNotTake, IsInitialization);

lib/SILGen/ManagedValue.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ class ManagedValue {
268268
/// formal evaluation scope.
269269
ManagedValue formalAccessCopy(SILGenFunction &SGF, SILLocation loc);
270270

271-
/// Store a copy of this value with independent ownership into the given
272-
/// uninitialized address.
273-
void copyInto(SILGenFunction &SGF, SILValue dest, SILLocation loc);
274-
275271
/// This is the same operation as 'copy', but works on +0 values that don't
276272
/// have cleanups. It returns a +1 value with one.
277273
ManagedValue copyUnmanaged(SILGenFunction &SGF, SILLocation loc);
@@ -333,7 +329,11 @@ class ManagedValue {
333329
/// \param loc - the AST location to associate with emitted instructions.
334330
/// \param address - the address to assign to.
335331
void assignInto(SILGenFunction &SGF, SILLocation loc, SILValue address);
336-
332+
333+
/// Store a copy of this value with independent ownership into the given
334+
/// uninitialized address.
335+
void copyInto(SILGenFunction &SGF, SILLocation loc, SILValue dest);
336+
337337
explicit operator bool() const {
338338
// "InContext" is not considered false.
339339
return bool(getValue()) || valueAndFlag.getInt();

lib/SILGen/SILGenDecl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ copyOrInitValueIntoSingleBuffer(SILGenFunction &SGF, SILLocation loc,
205205
assert(value.getValue() != destAddr && "copying in place?!");
206206
SILValue accessAddr =
207207
UnenforcedFormalAccess::enter(SGF, loc, destAddr, SILAccessKind::Modify);
208-
value.copyInto(SGF, accessAddr, loc);
208+
value.copyInto(SGF, loc, accessAddr);
209209
return;
210210
}
211211

@@ -627,7 +627,7 @@ class ReferenceStorageInitialization : public Initialization {
627627
if (isInit)
628628
value.forwardInto(SGF, loc, address);
629629
else
630-
value.copyInto(SGF, address, loc);
630+
value.copyInto(SGF, loc, address);
631631
}
632632

633633
void finishUninitialized(SILGenFunction &SGF) override {

lib/SILGen/SILGenLValue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ makeBaseConsumableMaterializedRValue(SILGenFunction &SGF,
18131813
if (!base.getType().isAddress() || isBorrowed) {
18141814
auto tmp = SGF.emitTemporaryAllocation(loc, base.getType());
18151815
if (isBorrowed)
1816-
base.copyInto(SGF, tmp, loc);
1816+
base.copyInto(SGF, loc, tmp);
18171817
else
18181818
base.forwardInto(SGF, loc, tmp);
18191819
return SGF.emitManagedBufferWithCleanup(tmp);

lib/SILGen/SILGenProlog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
199199
if (element.hasCleanup())
200200
element.forwardInto(SGF, loc, elementBuffer);
201201
else
202-
element.copyInto(SGF, elementBuffer, loc);
202+
element.copyInto(SGF, loc, elementBuffer);
203203
}
204204
return SGF.emitManagedRValueWithCleanup(buffer);
205205
}

0 commit comments

Comments
 (0)