[sil] Add a new attribute called @closureCaptured to SILFunctionArguments that are closure capture arguments.

I am adding this to make it easy to determine if a SILFunction that is not inout
aliasable is captured. This is useful when emitting certain types of
diagnostics like I need to emit with move only.
This commit is contained in:
Michael Gottesman
2022-12-14 14:03:52 -08:00
parent f735eda198
commit 9e44011e4d
36 changed files with 157 additions and 137 deletions

View File

@@ -801,10 +801,7 @@ PromotedParamCloner::populateCloned() {
Cloned->getModule().Types, 0);
auto *promotedArg =
ClonedEntryBB->createFunctionArgument(promotedTy, (*I)->getDecl());
promotedArg->setNoImplicitCopy(
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
promotedArg->setLifetimeAnnotation(
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
promotedArg->copyFlags(cast<SILFunctionArgument>(*I));
OrigPromotedParameters.insert(*I);
NewPromotedArgs[ArgNo] = promotedArg;
@@ -819,10 +816,7 @@ PromotedParamCloner::populateCloned() {
// Create a new argument which copies the original argument.
auto *newArg = ClonedEntryBB->createFunctionArgument((*I)->getType(),
(*I)->getDecl());
newArg->setNoImplicitCopy(
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
newArg->setLifetimeAnnotation(
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
newArg->copyFlags(cast<SILFunctionArgument>(*I));
entryArgs.push_back(newArg);
}
++ArgNo;