AST: Optimize TypeAliasType representation

This commit is contained in:
Slava Pestov
2024-11-26 13:31:08 -05:00
parent e1abaa540f
commit 302b163edc
13 changed files with 180 additions and 111 deletions

View File

@@ -5480,17 +5480,21 @@ public:
void visitTypeAliasType(const TypeAliasType *alias) {
using namespace decls_block;
const TypeAliasDecl *typeAlias = alias->getDecl();
auto underlyingType = typeAlias->getUnderlyingType();
SmallVector<TypeID, 8> genericArgIDs;
for (auto next : alias->getDirectGenericArgs())
genericArgIDs.push_back(S.addTypeRef(next));
unsigned abbrCode = S.DeclTypeAbbrCodes[TypeAliasTypeLayout::Code];
TypeAliasTypeLayout::emitRecord(
S.Out, S.ScratchRecord, abbrCode,
S.addDeclRef(typeAlias, /*allowTypeAliasXRef*/true),
S.addTypeRef(alias->getParent()),
S.addTypeRef(underlyingType),
S.addTypeRef(typeAlias->getUnderlyingType()),
S.addTypeRef(alias->getSinglyDesugaredType()),
S.addSubstitutionMapRef(alias->getSubstitutionMap()));
S.addTypeRef(alias->getParent()),
genericArgIDs);
}
template <typename Layout>