Add a Builtin.Borrow type.

This will represent the layout of a borrow of a value.
This commit is contained in:
Joe Groff
2025-11-03 17:54:51 -08:00
parent e6ea70720c
commit bc166d5a8c
39 changed files with 403 additions and 44 deletions

View File

@@ -5754,6 +5754,14 @@ public:
S.addTypeRef(ty->getElementType()));
}
void visitBuiltinBorrowType(BuiltinBorrowType *ty) {
using namespace decls_block;
unsigned abbrCode = S.DeclTypeAbbrCodes[BuiltinBorrowTypeLayout::Code];
BuiltinBorrowTypeLayout::emitRecord(
S.Out, S.ScratchRecord, abbrCode,
S.addTypeRef(ty->getReferentType()));
}
void visitSILTokenType(SILTokenType *ty) {
// This is serialized like a BuiltinType, even though it isn't one.
visitBuiltinTypeImpl(ty);
@@ -6464,6 +6472,7 @@ void Serializer::writeAllDeclsAndTypes() {
using namespace decls_block;
registerDeclTypeAbbr<BuiltinAliasTypeLayout>();
registerDeclTypeAbbr<BuiltinFixedArrayTypeLayout>();
registerDeclTypeAbbr<BuiltinBorrowTypeLayout>();
registerDeclTypeAbbr<TypeAliasTypeLayout>();
registerDeclTypeAbbr<GenericTypeParamDeclLayout>();
registerDeclTypeAbbr<AssociatedTypeDeclLayout>();