Serialization: Simplify PackType serialization

This commit is contained in:
Slava Pestov
2023-04-13 15:25:58 -04:00
parent d98484050b
commit 651bfcb917
4 changed files with 18 additions and 37 deletions

View File

@@ -5004,14 +5004,14 @@ public:
void visitPackType(const PackType *packTy) {
using namespace decls_block;
unsigned abbrCode = S.DeclTypeAbbrCodes[PackTypeLayout::Code];
PackTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode);
abbrCode = S.DeclTypeAbbrCodes[PackTypeEltLayout::Code];
for (auto elt : packTy->getElementTypes()) {
PackTypeEltLayout::emitRecord(
S.Out, S.ScratchRecord, abbrCode,
S.addTypeRef(elt));
SmallVector<TypeID, 8> variableData;
for (auto elementType : packTy->getElementTypes()) {
variableData.push_back(S.addTypeRef(elementType));
}
PackTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
variableData);
}
void visitSILPackType(const SILPackType *packTy) {
@@ -5568,7 +5568,6 @@ void Serializer::writeAllDeclsAndTypes() {
registerDeclTypeAbbr<DynamicSelfTypeLayout>();
registerDeclTypeAbbr<PackExpansionTypeLayout>();
registerDeclTypeAbbr<PackTypeLayout>();
registerDeclTypeAbbr<PackTypeEltLayout>();
registerDeclTypeAbbr<ErrorFlagLayout>();
registerDeclTypeAbbr<ErrorTypeLayout>();