[Sema] SPI info on a wrapped property should propagate to the backing storage

This commit is contained in:
Alexis Laferrière
2020-07-15 13:15:26 -07:00
parent 7573a640ed
commit 47e4e29362
2 changed files with 49 additions and 1 deletions

View File

@@ -2053,7 +2053,15 @@ SPIGroupsRequest::evaluate(Evaluator &evaluator, const Decl *decl) const {
for (auto spi : attr->getSPIGroups())
spiGroups.insert(spi);
auto &ctx = decl->getASTContext();
// Backing storage for a wrapped property gets the SPI groups from the
// original property.
if (auto varDecl = dyn_cast<VarDecl>(decl))
if (auto originalDecl = varDecl->getOriginalWrappedProperty()) {
auto originalSPIs = originalDecl->getSPIGroups();
spiGroups.insert(originalSPIs.begin(), originalSPIs.end());
}
// If there is no local SPI information, look at the context.
if (spiGroups.empty()) {
// Then in the extended nominal type.
@@ -2073,6 +2081,7 @@ SPIGroupsRequest::evaluate(Evaluator &evaluator, const Decl *decl) const {
}
}
auto &ctx = decl->getASTContext();
return ctx.AllocateCopy(spiGroups.getArrayRef());
}