Skip to content

Commit 6fd9102

Browse files
committed
[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.
1 parent 5778864 commit 6fd9102

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/AST/Module.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,11 @@ void SourceLookupCache::populateMemberCache(const ModuleDecl &Mod) {
276276
"populate-module-class-member-cache");
277277

278278
for (const FileUnit *file : Mod.getFiles()) {
279-
auto &SF = *cast<SourceFile>(file);
280-
addToMemberCache(SF.getTopLevelDecls());
279+
assert(isa<SourceFile>(file) ||
280+
isa<SynthesizedFileUnit>(file));
281+
SmallVector<Decl *, 8> decls;
282+
file->getTopLevelDecls(decls);
283+
addToMemberCache(decls);
281284
}
282285

283286
MemberCachePopulated = true;

0 commit comments

Comments
 (0)