[Sema] Evaluate SPI groups for all decls, not only public ones

Remove the fast path skipping evaluating SPI groups for non-public
decls. This knowledge is still required to allow the use of SPI types in
the signatures of `@usableFromInline` declarations and in internal
properties of structs in non library evolution compilation.

rdar://68530659
rdar://68527580
This commit is contained in:
Alexis Laferrière
2020-09-08 14:08:33 -07:00
parent 03adbe35da
commit cbb7228451
4 changed files with 37 additions and 16 deletions

View File

@@ -2049,10 +2049,8 @@ bool Decl::isSPI() const {
}
ArrayRef<Identifier> Decl::getSPIGroups() const {
if (auto vd = dyn_cast<ValueDecl>(this)) {
if (vd->getFormalAccess() < AccessLevel::Public)
return ArrayRef<Identifier>();
} else if (!isa<ExtensionDecl>(this))
if (!isa<ValueDecl>(this) &&
!isa<ExtensionDecl>(this))
return ArrayRef<Identifier>();
return evaluateOrDefault(getASTContext().evaluator,
@@ -2063,10 +2061,8 @@ ArrayRef<Identifier> Decl::getSPIGroups() const {
llvm::ArrayRef<Identifier>
SPIGroupsRequest::evaluate(Evaluator &evaluator, const Decl *decl) const {
// Applies only to public ValueDecls and ExtensionDecls.
if (auto vd = dyn_cast<ValueDecl>(decl))
assert(vd->getFormalAccess() >= AccessLevel::Public);
else
assert(isa<ExtensionDecl>(decl));
assert (isa<ValueDecl>(decl) ||
isa<ExtensionDecl>(decl));
// First, look for local attributes.
llvm::SetVector<Identifier> spiGroups;