mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Name lookup: avoid even calling lookup code on Clang submodules.
This is a hack. We currently don't put anything in Clang submodules; they're just wrappers to track what is and isn't visible. All lookups happen through the top- level module. This commit adds a new API getImportedModulesForLookup, which is ONLY used by top-level name lookup and forAllVisibleModules. It is identical to getImportedModules for everything but ClangModuleUnits, which instead compute and cache a list of their transitively imported top-level modules. This speeds up building Foundation.swiftmodule with a release compiler by a bit more than 5%, and makes a previously lookup-bound test case compile a third faster than before. This is a hack. rdar://problem/20813240 Swift SVN r28598
This commit is contained in:
@@ -190,7 +190,7 @@ static void lookupInModule(Module *module, Module::AccessPathTy accessPath,
|
||||
if (!foundDecls || !canReturnEarly ||
|
||||
resolutionKind == ResolutionKind::Overloadable) {
|
||||
SmallVector<Module::ImportedModule, 8> reexports;
|
||||
module->getImportedModules(reexports, Module::ImportFilter::Public);
|
||||
module->getImportedModulesForLookup(reexports);
|
||||
reexports.append(extraImports.begin(), extraImports.end());
|
||||
|
||||
// Prefer scoped imports (import func Swift.max) to whole-module imports.
|
||||
|
||||
Reference in New Issue
Block a user