[serialization] Allow references to Clang-imported values.

This unfortunately duplicates the hack of directly referencing the Clang
module loader if a cross-reference points to the current module; ideally
we'd have some kind of module chain, but I'd settle for a refactoring of
the code to share with NameBinding.

Additionally, Clang nodes are not actually validated to be from the right
module, which could be problematic for extensions or any case of actual
name collision.

Swift SVN r6519
This commit is contained in:
Jordan Rose
2013-07-23 23:10:05 +00:00
parent 36138474d1
commit 6547b9790a
4 changed files with 23 additions and 12 deletions

View File

@@ -177,6 +177,9 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
auto module = new (Ctx) SerializedModule(Ctx, *this, moduleID.first, comp,
loadedModuleFile.get());
// Whether we succeed or fail, don't try to load this module again.
Ctx.LoadedModules[moduleID.first.str()] = module;
if (loadedModuleFile) {
bool success = loadedModuleFile->associateWithModule(module);
if (success) {
@@ -216,8 +219,6 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
}
}
// Whether we succeeded or failed, don't try to load this module again.
Ctx.LoadedModules[moduleID.first.str()] = module;
return module;
}