[serialization] Write substitution conformances as references when possible.

More importantly, when writing substitution conformances /within the same
module/, use an "incomplete" form of the NormalProtocolConformance layout
that doesn't include any of the substitutions or defaulted definitions.
This avoids a serialization cycle when the witness for a protocol itself
ends up conforming to the protocol.

I couldn't come up with a reduced test cases, but both cases filed by Dave
now work.

<rdar://problem/16468715>

Swift SVN r15912
This commit is contained in:
Jordan Rose
2014-04-04 01:17:55 +00:00
parent aa6aa72ba1
commit 646952defd
5 changed files with 126 additions and 80 deletions

View File

@@ -307,12 +307,12 @@ private:
/// If the record at the cursor is not a pattern, returns null.
Pattern *maybeReadPattern();
/// Read the underlying conformance for a specialized or inherited
/// protocol conformance.
/// Read a referenced conformance, such as the underlying conformance for a
/// specialized or inherited protocol conformance.
ProtocolConformance *
readUnderlyingConformance(ProtocolDecl *proto,
readReferencedConformance(ProtocolDecl *proto,
serialization::DeclID typeID,
serialization::IdentifierID moduleID,
serialization::ModuleID moduleID,
llvm::BitstreamCursor &Cursor);
GenericParamList *maybeGetOrReadGenericParams(serialization::DeclID contextID,