[Serialization] Form protocol's inherited types based on deserialized protocols

This commit is contained in:
Pavel Yaskevich
2024-02-29 11:20:05 -08:00
parent 85179e022a
commit bf599b70f4
3 changed files with 31 additions and 16 deletions

View File

@@ -3214,6 +3214,21 @@ class DeclDeserializer {
decl.get<ExtensionDecl *>()->setInherited(inherited);
}
void handleInherited(ProtocolDecl *P,
ArrayRef<ProtocolDecl *> inherited) {
SmallVector<InheritedEntry, 2> inheritedTypes;
llvm::transform(inherited, std::back_inserter(inheritedTypes), [](auto *I) {
return InheritedEntry(TypeLoc::withoutLoc(I->getDeclaredInterfaceType()),
/*isUnchecked=*/false,
/*isRetroactive=*/false,
/*isPreconcurrency=*/false);
});
P->setInherited(ctx.AllocateCopy(inheritedTypes));
ctx.evaluator.cacheOutput(InheritedProtocolsRequest{P},
ctx.AllocateCopy(inherited));
}
public:
DeclDeserializer(ModuleFile &MF, Serialized<Decl *> &declOrOffset)
: MF(MF), ctx(MF.getContext()), declOrOffset(declOrOffset) {}
@@ -4499,8 +4514,8 @@ public:
SmallVector<ProtocolDecl *, 2> inherited;
if (!MF.readInheritedProtocols(inherited))
return MF.diagnoseFatal();
ctx.evaluator.cacheOutput(InheritedProtocolsRequest{proto},
ctx.AllocateCopy(inherited));
handleInherited(proto, inherited);
auto genericParams = MF.maybeReadGenericParams(DC);
assert(genericParams && "protocol with no generic parameters?");