[Serialization] Delay all actions in the same module together. (#8123)

Back in December DougG added code to delay the formation of generic
environments until all declarations from a particular module had been
deserialized, to avoid circular dependencies caused by too-eager
deserialization of protocol members. This worked great for fully-built
modules, but still had some problems with module merging, the phase of
multi-file compilation where the "partial" swiftmodules that
correspond to each source file in a target are loaded and remitted as
a single swiftmodule. Fix this by picking one of the partial
swiftmodules as the representative one for delayed actions, and wait
until deserialization is complete for /all/ of the serialized ASTs in
the same target to form the generic environments.

rdar://problem/30984417
This commit is contained in:
Jordan Rose
2017-03-16 15:22:06 -07:00
committed by GitHub
parent e78445b437
commit a8e4e72270
10 changed files with 62 additions and 19 deletions

View File

@@ -1279,7 +1279,11 @@ Status ModuleFile::associateWithFileContext(FileUnit *file,
return getStatus();
}
ModuleFile::~ModuleFile() = default;
ModuleFile::~ModuleFile() {
assert(DelayedGenericEnvironments.empty() &&
"either finishPendingActions() was never called, or someone forgot "
"to use getModuleFileForDelayedActions()");
}
void ModuleFile::lookupValue(DeclName name,
SmallVectorImpl<ValueDecl*> &results) {