[serialization] Fix a recursive-dependency bug caught by previous commit.

Constructors have their "implicit this" VarDecl specified at creation, but
the context for said VarDecl is the constructor itself. Add a new flag to
allow the deserialization of a VarDecl without setting a DeclContext.

Swift SVN r5747
This commit is contained in:
Jordan Rose
2013-06-21 17:52:08 +00:00
parent 5e0d3f15fc
commit d6801fe0fd
2 changed files with 16 additions and 8 deletions

View File

@@ -125,8 +125,18 @@ class ModuleFile {
/// Returns the decl context with the given ID, deserializing it if needed.
DeclContext *getDeclContext(serialization::DeclID DID);
/// Controls how a Decl is deserialized.
enum DeclDeserializationOptions {
/// Don't set the decl's context. It will be set by the caller instead.
///
/// This is useful for declarations that reference each other at
/// construction time.
SkipContext = 0x1
};
/// Returns the decl with the given ID, deserializing it if needed.
Decl *getDecl(serialization::DeclID DID);
Decl *getDecl(serialization::DeclID DID,
DeclDeserializationOptions opts = {});
/// Returns the type with the given ID, deserializing it if needed.
Type getType(serialization::TypeID TID);