Sema: Inherit SPI groups when synthesizing modify accessor.

Resolves rdar://108069565
This commit is contained in:
Allan Shortlidge
2023-05-01 00:05:59 -07:00
parent 9c68aaac2d
commit aef5e42457
5 changed files with 60 additions and 4 deletions

View File

@@ -1494,3 +1494,15 @@ bool swift::addNonIsolatedToSynthesized(NominalTypeDecl *nominal,
value->getAttrs().add(new (ctx) NonisolatedAttr(/*isImplicit=*/true));
return true;
}
void swift::applyInferredSPIAccessControlAttr(Decl *decl,
const Decl *inferredFromDecl,
ASTContext &ctx) {
auto spiGroups = inferredFromDecl->getSPIGroups();
if (spiGroups.empty())
return;
auto spiAttr =
SPIAccessControlAttr::create(ctx, SourceLoc(), SourceRange(), spiGroups);
decl->getAttrs().add(spiAttr);
}