mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
(De-)Serialize the protocols from which a protocol inherits.
Switch a few more clients from ::getInherited() to ::getProtocols(). The trajectory here is that ::getInherited() will turn into something only populated when we've parsed the inheritance clause, and that "the truth" will be getProtocols(). The former will cease being serialized once this is the case. Swift SVN r6661
This commit is contained in:
@@ -1023,10 +1023,12 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
IdentifierID nameID;
|
||||
DeclID contextID;
|
||||
bool isImplicit;
|
||||
unsigned numProtocols;
|
||||
ArrayRef<uint64_t> inheritedIDs;
|
||||
|
||||
decls_block::ProtocolLayout::readRecord(scratch, nameID, contextID,
|
||||
isImplicit, inheritedIDs);
|
||||
isImplicit, numProtocols,
|
||||
inheritedIDs);
|
||||
|
||||
DeclContext *DC;
|
||||
MutableArrayRef<TypeLoc> inherited;
|
||||
@@ -1037,7 +1039,7 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
if (declOrOffset.isComplete())
|
||||
break;
|
||||
|
||||
inherited = getTypes(inheritedIDs);
|
||||
inherited = getTypes(inheritedIDs.slice(numProtocols));
|
||||
}
|
||||
auto proto = new (ctx) ProtocolDecl(DC, SourceLoc(), SourceLoc(),
|
||||
getIdentifier(nameID), inherited);
|
||||
@@ -1050,6 +1052,13 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
if (isImplicit)
|
||||
proto->setImplicit();
|
||||
|
||||
// Deserialize the list of protocols.
|
||||
SmallVector<ProtocolDecl *, 4> protocols;
|
||||
for (auto protoID : inheritedIDs.slice(0, numProtocols)) {
|
||||
protocols.push_back(cast<ProtocolDecl>(getDecl(protoID)));
|
||||
}
|
||||
proto->setProtocols(ctx.AllocateCopy(protocols));
|
||||
|
||||
auto members = readMembers();
|
||||
assert(members.hasValue() && "could not read struct members");
|
||||
proto->setMembers(members.getValue(), SourceRange());
|
||||
|
||||
Reference in New Issue
Block a user