[serialization] Deserialize typealiases and builtin types.

This includes the reading half of BCRecordLayout metaprogramming, and
then a fairly straightforward deserialize-and-cache implementation in
ModuleFile. Once again, this is based on Clang's module implementation:
decls and types are referred to by an ID, which is used as an index into
an array, which contains offsets to the definitions of the decl/type in
the "decls-and-types" block in the serialized module.

In order to test the feature, the code is currently eagerly deserializing
all declarations. This will be partially fixed in the next commit.

Swift SVN r5324
This commit is contained in:
Jordan Rose
2013-05-25 01:34:56 +00:00
parent 9b712a2fe9
commit 76b19d53c4
6 changed files with 332 additions and 62 deletions

View File

@@ -169,13 +169,15 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
break;
}
if (loadedModuleFile)
LoadedModuleFiles.push_back(std::move(loadedModuleFile));
auto comp = new (Ctx.Allocate<Component>(1)) Component();
auto module = new (Ctx) SerializedModule(Ctx, *this, moduleID.first, comp,
loadedModuleFile.get());
if (loadedModuleFile) {
loadedModuleFile->associateWithModule(module);
LoadedModuleFiles.push_back(std::move(loadedModuleFile));
}
Ctx.LoadedModules[moduleID.first.str()] = module;
return module;
}