[serialization] Record nominal types in the module table ASAP.

Deserializing a nominal decl often ends up referring to the nominal's type,
so if we're /already/ serializing the type, we should finish that as soon
as we have a decl. Accomplish this by adding a callback that is called
right after a nominal decl is recorded in the module's decl table, so that
the type can be immediately recorded as well.

Swift SVN r6227
This commit is contained in:
Jordan Rose
2013-07-12 23:29:45 +00:00
parent c8cb4d82b7
commit 4db68ed617
2 changed files with 66 additions and 17 deletions

View File

@@ -188,8 +188,17 @@ private:
DeclContext *getDeclContext(serialization::DeclID DID);
/// Returns the decl with the given ID, deserializing it if needed.
///
/// \param DID The ID for the decl within this module.
/// \param ForcedContext Optional override for the decl context of certain
/// kinds of decls, used to avoid re-entrant
/// deserialization.
/// \param DidRecord Optional callback, called when certain kinds of decls
/// have been recorded in the decl table but not necessarily
/// completed.
Decl *getDecl(serialization::DeclID DID,
Optional<DeclContext *> ForcedContext = {});
Optional<DeclContext *> ForcedContext = {},
Optional<std::function<void(Decl*)>> DidRecord = {});
/// Returns the type with the given ID, deserializing it if needed.
Type getType(serialization::TypeID TID);