Swift: mangle opened archetype and fix global actor

This commit is contained in:
Paolo Tranquilli
2023-03-21 15:57:21 +01:00
parent 0aed7d56c2
commit dfbc248e78
2 changed files with 14 additions and 1 deletions

View File

@@ -212,10 +212,14 @@ SwiftMangledName SwiftMangler::visitAnyFunctionType(const swift::AnyFunctionType
if (type->isNoEscape()) {
ret << "_noescape";
}
if (type->hasGlobalActor()) {
ret << "_actor" << dispatcher.fetchLabel(type->getGlobalActor());
}
// TODO: see if this needs to be used in identifying types, if not it needs to be removed from
// type printing
assert(type->hasExtInfo() && "type must have ext info");
auto convention = type->getExtInfo().getSILRepresentation();
auto info = type->getExtInfo();
auto convention = info.getSILRepresentation();
if (convention != swift::SILFunctionTypeRepresentation::Thick) {
ret << "_convention" << static_cast<unsigned>(convention);
}
@@ -321,6 +325,14 @@ SwiftMangledName SwiftMangler::visitOpaqueTypeArchetypeType(
return ret;
}
SwiftMangledName SwiftMangler::visitOpenedArchetypeType(const swift::OpenedArchetypeType* type) {
auto ret = visitArchetypeType(type);
llvm::SmallVector<char> uuid;
type->getOpenedExistentialID().toString(uuid);
ret << std::string_view(uuid.data(), uuid.size());
return ret;
}
SwiftMangledName SwiftMangler::visitProtocolCompositionType(
const swift::ProtocolCompositionType* type) {
auto ret = initMangled(type);

View File

@@ -82,6 +82,7 @@ class SwiftMangler : private swift::TypeVisitor<SwiftMangler, SwiftMangledName>,
SwiftMangledName visitTypeAliasType(const swift::TypeAliasType* type);
SwiftMangledName visitArchetypeType(const swift::ArchetypeType* type);
SwiftMangledName visitOpaqueTypeArchetypeType(const swift::OpaqueTypeArchetypeType* type);
SwiftMangledName visitOpenedArchetypeType(const swift::OpenedArchetypeType* type);
SwiftMangledName visitProtocolCompositionType(const swift::ProtocolCompositionType* type);
SwiftMangledName visitParenType(const swift::ParenType* type);
SwiftMangledName visitLValueType(const swift::LValueType* type);