[serialization] Serialize import access paths, and only the TU's own imports.

Previously, a module contained references to every module listed in the
ASTContext. Now, we actually only encode the imports from the TU itself,
which allows us to include access paths for scoped imports.
This is necessary to implement proper name lookup shadowing rules.

Swift SVN r7013
This commit is contained in:
Jordan Rose
2013-08-07 22:56:41 +00:00
parent d3b31b8b72
commit 42a109674d
5 changed files with 58 additions and 37 deletions

View File

@@ -179,20 +179,21 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
loadedModuleFile->getDependencies().end(),
std::back_inserter(missing),
[](const ModuleFile::Dependency &dependency) {
return dependency.Mod == nullptr;
return !dependency.isLoaded();
});
// FIXME: only show module part of RawAccessPath
assert(!missing.empty() && "unknown missing dependency?");
if (missing.size() == 1) {
Ctx.Diags.diagnose(moduleID.second,
diag::serialization_missing_single_dependency,
missing.front().Name);
missing.front().RawAccessPath);
} else {
llvm::SmallString<64> missingNames;
missingNames += '\'';
interleave(missing,
[&](const ModuleFile::Dependency &next) {
missingNames += next.Name;
missingNames += next.RawAccessPath;
},
[&] { missingNames += "', '"; });
missingNames += '\'';