Skip to content

Commit 0555de5

Browse files
committed
Sema: Remove a couple of calls to clearLookupCache()
Tests seem to pass without these. Two calls still remain, in ModuleDecl::addFiles() and removeFiles(). It will take a bit more refactoring to eliminate those.
1 parent c4203dd commit 0555de5

File tree

4 files changed

+0
-23
lines changed

4 files changed

+0
-23
lines changed

include/swift/AST/SourceFile.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,6 @@ class SourceFile final : public FileUnit {
257257

258258
bool isImportedImplementationOnly(const ModuleDecl *module) const;
259259

260-
/// This is a hack for 'main' file parsing and the integrated REPL.
261-
///
262-
/// FIXME: Refactor main file parsing to not pump the parser incrementally.
263-
/// FIXME: Remove the integrated REPL.
264-
void clearLookupCache();
265-
266260
void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const;
267261
const SmallVectorImpl<ValueDecl *> &getCachedVisibleDecls() const;
268262

lib/AST/Module.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,17 +1597,6 @@ void ModuleDecl::clearLookupCache() {
15971597
Cache.reset();
15981598
}
15991599

1600-
void SourceFile::clearLookupCache() {
1601-
getParentModule()->clearLookupCache();
1602-
1603-
if (!Cache)
1604-
return;
1605-
1606-
// Abandon any current cache. We'll rebuild it on demand.
1607-
Cache->invalidate();
1608-
Cache.reset();
1609-
}
1610-
16111600
void
16121601
SourceFile::cacheVisibleDecls(SmallVectorImpl<ValueDecl*> &&globals) const {
16131602
SmallVectorImpl<ValueDecl*> &cached = getCache().AllVisibleValues;

lib/Sema/NameBinding.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,6 @@ void swift::performNameBinding(SourceFile &SF) {
407407
return;
408408
}
409409

410-
// Reset the name lookup cache so we find new decls.
411-
// FIXME: This is inefficient.
412-
SF.clearLookupCache();
413-
414410
NameBinder Binder(SF);
415411

416412
SmallVector<SourceFile::ImportedModuleDesc, 8> ImportedModules;

lib/Sema/TypeCheckREPL.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,4 @@ void TypeChecker::processREPLTopLevel(SourceFile &SF) {
496496

497497
TypeChecker::contextualizeTopLevelCode(TLCD);
498498
}
499-
500-
SF.clearLookupCache();
501499
}

0 commit comments

Comments
 (0)