Skip to content

Commit 6fff307

Browse files
authored
Merge pull request #62592 from gottesmm/pr-cbfd912fd4d58ff272d3f1fe4ceb8cf02589da9a
[sil] Add a new attribute called @closureCaptured to SILFunctionArguments that are closure capture arguments.
2 parents a2645b7 + 9e44011 commit 6fff307

36 files changed

+157
-137
lines changed

include/swift/SIL/SILArgument.h

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,21 @@ class SILPhiArgument : public SILArgument {
332332
class SILFunctionArgument : public SILArgument {
333333
friend class SILBasicBlock;
334334

335-
bool noImplicitCopy = false;
336-
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None;
335+
USE_SHARED_UINT32;
337336

338337
SILFunctionArgument(
339338
SILBasicBlock *parentBlock, SILType type,
340339
ValueOwnershipKind ownershipKind, const ValueDecl *decl = nullptr,
341340
bool isNoImplicitCopy = false,
342-
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None)
341+
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None,
342+
bool isCapture = false)
343343
: SILArgument(ValueKind::SILFunctionArgument, parentBlock, type,
344-
ownershipKind, decl),
345-
noImplicitCopy(isNoImplicitCopy),
346-
lifetimeAnnotation(lifetimeAnnotation) {}
344+
ownershipKind, decl) {
345+
sharedUInt32().SILFunctionArgument.noImplicitCopy = isNoImplicitCopy;
346+
sharedUInt32().SILFunctionArgument.lifetimeAnnotation = lifetimeAnnotation;
347+
sharedUInt32().SILFunctionArgument.closureCapture = isCapture;
348+
}
349+
347350
// A special constructor, only intended for use in
348351
// SILBasicBlock::replaceFunctionArg.
349352
explicit SILFunctionArgument(SILType type, ValueOwnershipKind ownershipKind,
@@ -352,16 +355,28 @@ class SILFunctionArgument : public SILArgument {
352355
}
353356

354357
public:
355-
bool isNoImplicitCopy() const { return noImplicitCopy; }
358+
bool isNoImplicitCopy() const {
359+
return sharedUInt32().SILFunctionArgument.noImplicitCopy;
360+
}
361+
362+
void setNoImplicitCopy(bool newValue) {
363+
sharedUInt32().SILFunctionArgument.noImplicitCopy = newValue;
364+
}
356365

357-
void setNoImplicitCopy(bool newValue) { noImplicitCopy = newValue; }
366+
bool isClosureCapture() const {
367+
return sharedUInt32().SILFunctionArgument.closureCapture;
368+
}
369+
void setClosureCapture(bool newValue) {
370+
sharedUInt32().SILFunctionArgument.closureCapture = newValue;
371+
}
358372

359373
LifetimeAnnotation getLifetimeAnnotation() const {
360-
return lifetimeAnnotation;
374+
return LifetimeAnnotation::Case(
375+
sharedUInt32().SILFunctionArgument.lifetimeAnnotation);
361376
}
362377

363378
void setLifetimeAnnotation(LifetimeAnnotation newValue) {
364-
lifetimeAnnotation = newValue;
379+
sharedUInt32().SILFunctionArgument.lifetimeAnnotation = newValue;
365380
}
366381

367382
Lifetime getLifetime() const {
@@ -390,6 +405,16 @@ class SILFunctionArgument : public SILArgument {
390405
return getArgumentConvention() == convention;
391406
}
392407

408+
/// Copy all flags stored in this->sharedUInt32() into arg.
409+
///
410+
/// By using this API, cloners can be sure they are updated for the addition
411+
/// of further flags.
412+
void copyFlags(SILFunctionArgument *arg) {
413+
setNoImplicitCopy(arg->isNoImplicitCopy());
414+
setLifetimeAnnotation(arg->getLifetimeAnnotation());
415+
setClosureCapture(arg->isClosureCapture());
416+
}
417+
393418
static bool classof(const SILInstruction *) = delete;
394419
static bool classof(const SILUndef *) = delete;
395420
static bool classof(SILNodePointer node) {

include/swift/SIL/SILNode.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ class alignas(8) SILNode :
267267
SHARED_FIELD(FloatLiteralInst, uint32_t numBits);
268268
SHARED_FIELD(StringLiteralInst, uint32_t length);
269269
SHARED_FIELD(PointerToAddressInst, uint32_t alignment);
270+
SHARED_FIELD(SILFunctionArgument, uint32_t noImplicitCopy : 1,
271+
lifetimeAnnotation : 2, closureCapture : 1);
270272

271-
// Do not use `_sharedUInt32_private` outside of SILNode.
273+
// Do not use `_sharedUInt32_private` outside of SILNode.
272274
} _sharedUInt32_private;
273275

274276
static_assert(sizeof(SharedUInt32Fields) == sizeof(uint32_t),

lib/SIL/IR/SILBasicBlock.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ void SILBasicBlock::cloneArgumentList(SILBasicBlock *Other) {
136136
for (auto *FuncArg : Other->getSILFunctionArguments()) {
137137
auto *NewArg =
138138
createFunctionArgument(FuncArg->getType(), FuncArg->getDecl());
139-
NewArg->setNoImplicitCopy(FuncArg->isNoImplicitCopy());
140-
NewArg->setLifetimeAnnotation(FuncArg->getLifetimeAnnotation());
139+
NewArg->copyFlags(FuncArg);
141140
}
142141
return;
143142
}

lib/SIL/IR/SILPrinter.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct SILValuePrinterInfo {
160160
Optional<ValueOwnershipKind> OwnershipKind;
161161
bool IsNoImplicitCopy = false;
162162
LifetimeAnnotation Lifetime = LifetimeAnnotation::None;
163+
bool IsCapture = false;
163164

164165
SILValuePrinterInfo(ID ValueID) : ValueID(ValueID), Type(), OwnershipKind() {}
165166
SILValuePrinterInfo(ID ValueID, SILType Type)
@@ -169,13 +170,15 @@ struct SILValuePrinterInfo {
169170
: ValueID(ValueID), Type(Type), OwnershipKind(OwnershipKind) {}
170171
SILValuePrinterInfo(ID ValueID, SILType Type,
171172
ValueOwnershipKind OwnershipKind, bool IsNoImplicitCopy,
172-
LifetimeAnnotation Lifetime)
173+
LifetimeAnnotation Lifetime, bool IsCapture)
173174
: ValueID(ValueID), Type(Type), OwnershipKind(OwnershipKind),
174-
IsNoImplicitCopy(IsNoImplicitCopy), Lifetime(Lifetime) {}
175+
IsNoImplicitCopy(IsNoImplicitCopy), Lifetime(Lifetime),
176+
IsCapture(IsCapture) {}
175177
SILValuePrinterInfo(ID ValueID, SILType Type, bool IsNoImplicitCopy,
176-
LifetimeAnnotation Lifetime)
178+
LifetimeAnnotation Lifetime, bool IsCapture)
177179
: ValueID(ValueID), Type(Type), OwnershipKind(),
178-
IsNoImplicitCopy(IsNoImplicitCopy), Lifetime(Lifetime) {}
180+
IsNoImplicitCopy(IsNoImplicitCopy), Lifetime(Lifetime),
181+
IsCapture(IsCapture) {}
179182
};
180183

181184
/// Return the fully qualified dotted path for DeclContext.
@@ -659,6 +662,8 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
659662
*this << "@_lexical ";
660663
break;
661664
}
665+
if (i.IsCapture)
666+
*this << "@closureCapture ";
662667
if (i.OwnershipKind && *i.OwnershipKind != OwnershipKind::None) {
663668
*this << "@" << i.OwnershipKind.value() << " ";
664669
}
@@ -693,14 +698,18 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
693698
}
694699
SILValuePrinterInfo getIDAndType(SILFunctionArgument *arg) {
695700
return {Ctx.getID(arg), arg->getType(), arg->isNoImplicitCopy(),
696-
arg->getLifetimeAnnotation()};
701+
arg->getLifetimeAnnotation(), arg->isClosureCapture()};
697702
}
698703
SILValuePrinterInfo getIDAndTypeAndOwnership(SILValue V) {
699704
return {Ctx.getID(V), V ? V->getType() : SILType(), V->getOwnershipKind()};
700705
}
701706
SILValuePrinterInfo getIDAndTypeAndOwnership(SILFunctionArgument *arg) {
702-
return {Ctx.getID(arg), arg->getType(), arg->getOwnershipKind(),
703-
arg->isNoImplicitCopy(), arg->getLifetimeAnnotation()};
707+
return {Ctx.getID(arg),
708+
arg->getType(),
709+
arg->getOwnershipKind(),
710+
arg->isNoImplicitCopy(),
711+
arg->getLifetimeAnnotation(),
712+
arg->isClosureCapture()};
704713
}
705714

706715
//===--------------------------------------------------------------------===//

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6495,16 +6495,20 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
64956495
return true;
64966496

64976497
bool foundNoImplicitCopy = false;
6498+
bool foundClosureCapture = false;
64986499
bool foundLexical = false;
64996500
bool foundEagerMove = false;
6500-
while (auto attributeName = parseOptionalAttribute(
6501-
{"noImplicitCopy", "_lexical", "_eagerMove"})) {
6501+
while (auto attributeName =
6502+
parseOptionalAttribute({"noImplicitCopy", "_lexical",
6503+
"_eagerMove", "closureCapture"})) {
65026504
if (*attributeName == "noImplicitCopy")
65036505
foundNoImplicitCopy = true;
65046506
else if (*attributeName == "_lexical")
65056507
foundLexical = true;
65066508
else if (*attributeName == "_eagerMove")
65076509
foundEagerMove = true;
6510+
else if (*attributeName == "closureCapture")
6511+
foundClosureCapture = true;
65086512
else {
65096513
llvm_unreachable("Unexpected attribute!");
65106514
}
@@ -6533,6 +6537,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
65336537
if (IsEntry) {
65346538
auto *fArg = BB->createFunctionArgument(Ty);
65356539
fArg->setNoImplicitCopy(foundNoImplicitCopy);
6540+
fArg->setClosureCapture(foundClosureCapture);
65366541
fArg->setLifetimeAnnotation(lifetime);
65376542
Arg = fArg;
65386543

lib/SILGen/SILGenBuilder.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,13 +436,15 @@ ManagedValue SILGenBuilder::createLoadCopy(SILLocation loc, ManagedValue v,
436436
static ManagedValue createInputFunctionArgument(
437437
SILGenBuilder &B, SILType type, SILLocation loc, ValueDecl *decl = nullptr,
438438
bool isNoImplicitCopy = false,
439-
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None) {
439+
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None,
440+
bool isClosureCapture = false) {
440441
auto &SGF = B.getSILGenFunction();
441442
SILFunction &F = B.getFunction();
442443
assert((F.isBare() || decl) &&
443444
"Function arguments of non-bare functions must have a decl");
444445
auto *arg = F.begin()->createFunctionArgument(type, decl);
445446
arg->setNoImplicitCopy(isNoImplicitCopy);
447+
arg->setClosureCapture(isClosureCapture);
446448
arg->setLifetimeAnnotation(lifetimeAnnotation);
447449
switch (arg->getArgumentConvention()) {
448450
case SILArgumentConvention::Indirect_In_Guaranteed:
@@ -477,9 +479,10 @@ static ManagedValue createInputFunctionArgument(
477479

478480
ManagedValue SILGenBuilder::createInputFunctionArgument(
479481
SILType type, ValueDecl *decl, bool isNoImplicitCopy,
480-
LifetimeAnnotation lifetimeAnnotation) {
482+
LifetimeAnnotation lifetimeAnnotation, bool isClosureCapture) {
481483
return ::createInputFunctionArgument(*this, type, SILLocation(decl), decl,
482-
isNoImplicitCopy, lifetimeAnnotation);
484+
isNoImplicitCopy, lifetimeAnnotation,
485+
isClosureCapture);
483486
}
484487

485488
ManagedValue

lib/SILGen/SILGenBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ class SILGenBuilder : public SILBuilder {
228228
/// function argument for an out parameter.
229229
ManagedValue createInputFunctionArgument(
230230
SILType type, ValueDecl *decl, bool isNoImplicitCopy = false,
231-
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None);
231+
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None,
232+
bool isClosureCapture = false);
232233

233234
/// Create a SILArgument for an input parameter. Uses \p loc to create any
234235
/// copies necessary. Asserts if used to create a function argument for an out

lib/SILGen/SILGenProlog.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,10 @@ static void emitCaptureArguments(SILGenFunction &SGF,
520520
auto &lowering = SGF.getTypeLowering(type);
521521
// Constant decls are captured by value.
522522
SILType ty = lowering.getLoweredType();
523-
ManagedValue val = ManagedValue::forUnmanaged(
524-
SGF.F.begin()->createFunctionArgument(ty, VD));
523+
auto *arg = SGF.F.begin()->createFunctionArgument(ty, VD);
524+
arg->setClosureCapture(true);
525+
526+
ManagedValue val = ManagedValue::forUnmanaged(arg);
525527

526528
// If the original variable was settable, then Sema will have treated the
527529
// VarDecl as an lvalue, even in the closure's use. As such, we need to
@@ -575,8 +577,9 @@ static void emitCaptureArguments(SILGenFunction &SGF,
575577
SGF.SGM.Types.getLoweredRValueType(TypeExpansionContext::minimal(),
576578
type),
577579
SGF.F.getGenericEnvironment(), /*mutable*/ true);
578-
SILValue box = SGF.F.begin()->createFunctionArgument(
580+
auto *box = SGF.F.begin()->createFunctionArgument(
579581
SILType::getPrimitiveObjectType(boxTy), VD);
582+
box->setClosureCapture(true);
580583
SILValue addr = SGF.B.createProjectBox(VD, box, 0);
581584
SGF.VarLocs[VD] = SILGenFunction::VarLoc::get(addr, box);
582585
SILDebugVariable DbgVar(VD->isLet(), ArgNo);
@@ -595,7 +598,9 @@ static void emitCaptureArguments(SILGenFunction &SGF,
595598
if (isInOut || SGF.SGM.M.useLoweredAddresses()) {
596599
ty = ty.getAddressType();
597600
}
598-
SILValue arg = SGF.F.begin()->createFunctionArgument(ty, VD);
601+
auto *fArg = SGF.F.begin()->createFunctionArgument(ty, VD);
602+
fArg->setClosureCapture(true);
603+
SILValue arg = SILValue(fArg);
599604
if (isInOut && (ty.isMoveOnly() && !ty.isMoveOnlyWrapped())) {
600605
arg = SGF.B.createMarkMustCheckInst(
601606
Loc, arg, MarkMustCheckInst::CheckKind::NoImplicitCopy);

lib/SILOptimizer/FunctionSignatureTransforms/ArgumentExplosionTransform.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ void FunctionSignatureTransform::ArgumentExplosionFinalizeOptimizedFunction() {
393393
auto *Argument =
394394
BB->insertFunctionArgument(ArgOffset, Node->getType(), OwnershipKind,
395395
BB->getArgument(OldArgIndex)->getDecl());
396-
Argument->setNoImplicitCopy(AD.Arg->isNoImplicitCopy());
397-
Argument->setLifetimeAnnotation(AD.Arg->getLifetimeAnnotation());
396+
Argument->copyFlags(AD.Arg);
398397
LeafValues.push_back(Argument);
399398
TransformDescriptor.AIM[TotalArgIndex - 1] = AD.Index;
400399
++ArgOffset;

lib/SILOptimizer/FunctionSignatureTransforms/ExistentialTransform.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ void ExistentialSpecializerCloner::cloneArguments(
165165
LoweredTy.getCategoryType(ArgDesc.Arg->getType().getCategory());
166166
auto *NewArg =
167167
ClonedEntryBB->createFunctionArgument(MappedTy, ArgDesc.Decl);
168-
NewArg->setNoImplicitCopy(ArgDesc.Arg->isNoImplicitCopy());
169-
NewArg->setLifetimeAnnotation(ArgDesc.Arg->getLifetimeAnnotation());
170-
NewArg->setOwnershipKind(ValueOwnershipKind(
171-
NewF, MappedTy, ArgDesc.Arg->getArgumentConvention()));
168+
NewArg->copyFlags(ArgDesc.Arg);
172169
entryArgs.push_back(NewArg);
173170
continue;
174171
}
@@ -182,8 +179,7 @@ void ExistentialSpecializerCloner::cloneArguments(
182179
GenericSILType, ArgDesc.Decl,
183180
ValueOwnershipKind(NewF, GenericSILType,
184181
ArgDesc.Arg->getArgumentConvention()));
185-
NewArg->setNoImplicitCopy(ArgDesc.Arg->isNoImplicitCopy());
186-
NewArg->setLifetimeAnnotation(ArgDesc.Arg->getLifetimeAnnotation());
182+
NewArg->copyFlags(ArgDesc.Arg);
187183
// Determine the Conformances.
188184
SILType ExistentialType = ArgDesc.Arg->getType().getObjectType();
189185
CanType OpenedType = NewArg->getType().getASTType();
@@ -408,8 +404,7 @@ void ExistentialTransform::populateThunkBody() {
408404
auto argumentType = ArgDesc.Arg->getType();
409405
auto *NewArg =
410406
ThunkBody->createFunctionArgument(argumentType, ArgDesc.Decl);
411-
NewArg->setNoImplicitCopy(ArgDesc.Arg->isNoImplicitCopy());
412-
NewArg->setLifetimeAnnotation(ArgDesc.Arg->getLifetimeAnnotation());
407+
NewArg->copyFlags(ArgDesc.Arg);
413408
}
414409

415410
/// Builder to add new instructions in the Thunk.

lib/SILOptimizer/FunctionSignatureTransforms/FunctionSignatureOpts.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,7 @@ void FunctionSignatureTransform::createFunctionSignatureOptimizedFunction() {
568568
for (auto &ArgDesc : TransformDescriptor.ArgumentDescList) {
569569
auto *NewArg =
570570
ThunkBody->createFunctionArgument(ArgDesc.Arg->getType(), ArgDesc.Decl);
571-
NewArg->setNoImplicitCopy(ArgDesc.Arg->isNoImplicitCopy());
572-
NewArg->setLifetimeAnnotation(ArgDesc.Arg->getLifetimeAnnotation());
571+
NewArg->copyFlags(ArgDesc.Arg);
573572
}
574573

575574
SILLocation Loc = RegularLocation::getAutoGeneratedLocation();

lib/SILOptimizer/IPO/CapturePropagation.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ void CapturePropagationCloner::cloneClosure(
199199

200200
auto *MappedValue = ClonedEntryBB->createFunctionArgument(
201201
remapType(Arg->getType()), Arg->getDecl());
202-
MappedValue->setNoImplicitCopy(
203-
cast<SILFunctionArgument>(Arg)->isNoImplicitCopy());
204-
MappedValue->setLifetimeAnnotation(
205-
cast<SILFunctionArgument>(Arg)->getLifetimeAnnotation());
202+
MappedValue->copyFlags(cast<SILFunctionArgument>(Arg));
206203
entryArgs.push_back(MappedValue);
207204
}
208205
assert(OrigEntryBB->args_size() - ArgIdx == PartialApplyArgs.size()

lib/SILOptimizer/IPO/ClosureSpecializer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,7 @@ void ClosureSpecCloner::populateCloned() {
808808
auto typeInContext = Cloned->getLoweredType(Arg->getType());
809809
auto *MappedValue =
810810
ClonedEntryBB->createFunctionArgument(typeInContext, Arg->getDecl());
811-
MappedValue->setNoImplicitCopy(
812-
cast<SILFunctionArgument>(Arg)->isNoImplicitCopy());
813-
MappedValue->setLifetimeAnnotation(
814-
cast<SILFunctionArgument>(Arg)->getLifetimeAnnotation());
811+
MappedValue->copyFlags(cast<SILFunctionArgument>(Arg));
815812
entryArgs.push_back(MappedValue);
816813
}
817814

lib/SILOptimizer/Mandatory/CapturePromotion.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,7 @@ void ClosureCloner::populateCloned() {
493493
// Simply create a new argument which copies the original argument
494494
auto *mappedValue = clonedEntryBB->createFunctionArgument(
495495
(*ai)->getType(), (*ai)->getDecl());
496-
mappedValue->setNoImplicitCopy(
497-
cast<SILFunctionArgument>(*ai)->isNoImplicitCopy());
498-
mappedValue->setLifetimeAnnotation(
499-
cast<SILFunctionArgument>(*ai)->getLifetimeAnnotation());
496+
mappedValue->copyFlags(cast<SILFunctionArgument>(*ai));
500497
entryArgs.push_back(mappedValue);
501498
continue;
502499
}
@@ -510,10 +507,7 @@ void ClosureCloner::populateCloned() {
510507
.getObjectType();
511508
auto *newArg =
512509
clonedEntryBB->createFunctionArgument(boxedTy, (*ai)->getDecl());
513-
newArg->setNoImplicitCopy(
514-
cast<SILFunctionArgument>(*ai)->isNoImplicitCopy());
515-
newArg->setLifetimeAnnotation(
516-
cast<SILFunctionArgument>(*ai)->getLifetimeAnnotation());
510+
newArg->copyFlags(cast<SILFunctionArgument>(*ai));
517511
SILValue mappedValue = newArg;
518512

519513
// If SIL ownership is enabled, we need to perform a borrow here if we have

lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,7 @@ PromotedParamCloner::populateCloned() {
801801
Cloned->getModule().Types, 0);
802802
auto *promotedArg =
803803
ClonedEntryBB->createFunctionArgument(promotedTy, (*I)->getDecl());
804-
promotedArg->setNoImplicitCopy(
805-
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
806-
promotedArg->setLifetimeAnnotation(
807-
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
804+
promotedArg->copyFlags(cast<SILFunctionArgument>(*I));
808805
OrigPromotedParameters.insert(*I);
809806

810807
NewPromotedArgs[ArgNo] = promotedArg;
@@ -819,10 +816,7 @@ PromotedParamCloner::populateCloned() {
819816
// Create a new argument which copies the original argument.
820817
auto *newArg = ClonedEntryBB->createFunctionArgument((*I)->getType(),
821818
(*I)->getDecl());
822-
newArg->setNoImplicitCopy(
823-
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
824-
newArg->setLifetimeAnnotation(
825-
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
819+
newArg->copyFlags(cast<SILFunctionArgument>(*I));
826820
entryArgs.push_back(newArg);
827821
}
828822
++ArgNo;

0 commit comments

Comments
 (0)