[AST] Accept SynthesizedFileUnit in populateMemberCache

The differentiation and actor logics insert SynthesizedFileUnit in
SourceFile modules. Accepting these file units in populateMemberCache
allow to cache all the top-level decls of source file modules.
This commit is contained in:
Alexis Laferrière
2021-08-06 09:56:32 -07:00
parent 577886408b
commit 6fd9102b45

View File

@@ -276,8 +276,11 @@ void SourceLookupCache::populateMemberCache(const ModuleDecl &Mod) {
"populate-module-class-member-cache");
for (const FileUnit *file : Mod.getFiles()) {
auto &SF = *cast<SourceFile>(file);
addToMemberCache(SF.getTopLevelDecls());
assert(isa<SourceFile>(file) ||
isa<SynthesizedFileUnit>(file));
SmallVector<Decl *, 8> decls;
file->getTopLevelDecls(decls);
addToMemberCache(decls);
}
MemberCachePopulated = true;