Use the list of extensions of a nominal type for name lookup into that type.

This replaces the obscure, inefficient lookup into extensions with
something more straightforward: walk all of the known extensions
(available as a simple list), then eliminate any declarations that
have been shadowed by other declarations. The shadowing rules still
need to consider the module re-export DAG, but we'll leave that for
later.

As part of this, keep track of the last time we loaded extensions for
a given nominal type. If the list of extensions is out-of-date with
respect to the global generation count (which tracks resolved module
imports), ask the modules to load any additional extensions. Only the
Clang module importer can currently load extensions in this manner.


Swift SVN r5223
This commit is contained in:
Doug Gregor
2013-05-20 18:06:51 +00:00
parent a4ce448280
commit 8114ce16f8
15 changed files with 287 additions and 84 deletions

View File

@@ -171,6 +171,7 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
ModuleStatus err = ModuleFile::load(std::move(inputFile), loadedModuleFile);
switch (err) {
case ModuleStatus::Valid:
Ctx.bumpGeneration();
llvm_unreachable("non-fallback modules not supported yet!");
case ModuleStatus::FallBackToTranslationUnit:
result = makeTU(Ctx, moduleID, loadedModuleFile->getInputSourcePaths());
@@ -182,3 +183,9 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
return result;
}
void SerializedModuleLoader::loadExtensions(NominalTypeDecl *nominal,
unsigned previousGeneration) {
// FIXME: Look for extensions of the given nominal type within the
// serialized module.
}