[AST] Drop ProtocolDecl's "inherited protocols" list.

The list of directly inherited protocols of a ProtocolDecl is already
encoded in the requirement signature, as conformance constraints where
the subject is Self. Gather the list from there rather than separately
computing/storing the list of "inherited protocols".
This commit is contained in:
Doug Gregor
2017-02-20 09:30:36 -08:00
parent 63b122c1f6
commit 042e6510c3
26 changed files with 94 additions and 118 deletions

View File

@@ -3000,14 +3000,12 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
bool isImplicit, isClassBounded, isObjC;
GenericEnvironmentID genericEnvID;
uint8_t rawAccessLevel;
unsigned numProtocols;
ArrayRef<uint64_t> rawProtocolAndInheritedIDs;
ArrayRef<uint64_t> rawInheritedIDs;
decls_block::ProtocolLayout::readRecord(scratch, nameID, contextID,
isImplicit, isClassBounded, isObjC,
genericEnvID, rawAccessLevel,
numProtocols,
rawProtocolAndInheritedIDs);
rawInheritedIDs);
auto DC = getDeclContext(contextID);
if (declOrOffset.isComplete())
@@ -3030,14 +3028,7 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
assert(genericParams && "protocol with no generic parameters?");
proto->setGenericParams(genericParams);
auto protocols = ctx.Allocate<ProtocolDecl *>(numProtocols);
for_each(protocols, rawProtocolAndInheritedIDs.slice(0, numProtocols),
[this](ProtocolDecl *&p, uint64_t rawID) {
p = cast<ProtocolDecl>(getDecl(rawID));
});
proto->setInheritedProtocols(protocols);
handleInherited(proto, rawProtocolAndInheritedIDs.slice(numProtocols));
handleInherited(proto, rawInheritedIDs);
configureGenericEnvironment(proto, genericEnvID);