Skip to content

Commit 430c7ab

Browse files
committed
[silgen] Add a helper called SILGenBuilder::emitCopyAddrOperation.
This works by emitting an object level copy_addr if an address type is loadable (that is using load [take] + store [init] instead of copy_addr).
1 parent 59c484e commit 430c7ab

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/SILGen/SILGenBuilder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,3 +1001,10 @@ ManagedValue SILGenBuilder::emitCopyValueOperation(SILLocation loc,
10011001
return value;
10021002
return SGF.emitManagedRValueWithCleanup(cvi);
10031003
}
1004+
1005+
void SILGenBuilder::emitCopyAddrOperation(SILLocation loc, SILValue srcAddr,
1006+
SILValue destAddr, IsTake_t isTake,
1007+
IsInitialization_t isInitialize) {
1008+
auto &lowering = getTypeLowering(srcAddr->getType());
1009+
lowering.emitCopyInto(*this, loc, srcAddr, destAddr, isTake, isInitialize);
1010+
}

lib/SILGen/SILGenBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ class SILGenBuilder : public SILBuilder {
449449

450450
using SILBuilder::emitCopyValueOperation;
451451
ManagedValue emitCopyValueOperation(SILLocation Loc, ManagedValue v);
452+
453+
void emitCopyAddrOperation(SILLocation loc, SILValue srcAddr,
454+
SILValue destAddr, IsTake_t isTake,
455+
IsInitialization_t isInitialize);
452456
};
453457

454458
} // namespace Lowering

0 commit comments

Comments
 (0)