Skip to content

Commit 18cc27d

Browse files
committed
[AST] Clear module lookup cache in SourceFile::addTopLevelDecl
Completion unfortunately relies on this to add a top-level decl after the lookup table has been built, make sure the decl gets added to it. We ought to fix completion to avoid needing to mutate the AST like this after-the-fact, but this should work around the issue for now.
1 parent de3e54a commit 18cc27d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/AST/Module.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,6 +3495,8 @@ void SourceFile::addTopLevelDecl(Decl *d) {
34953495
auto &ctx = getASTContext();
34963496
auto *mutableThis = const_cast<SourceFile *>(this);
34973497
ctx.evaluator.clearCachedOutput(ParseTopLevelDeclsRequest{mutableThis});
3498+
3499+
getParentModule()->clearLookupCache();
34983500
}
34993501

35003502
void SourceFile::prependTopLevelDecl(Decl *d) {

0 commit comments

Comments
 (0)