Skip to content

Commit 6b3a739

Browse files
authored
Merge pull request #17402 from adrian-prantl/archetypes-removal
2 parents 1beed09 + 630596d commit 6b3a739

File tree

2 files changed

+2
-44
lines changed

2 files changed

+2
-44
lines changed

docs/ABI/Mangling.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ Types
467467

468468
assoc-type-list ::= assoc-type-name '_' assoc-type-name*
469469

470-
archetype ::= context 'Qq' INDEX // archetype+context (DWARF only)
471470
archetype ::= associated-type
472471

473472
associated-type ::= substitution

lib/AST/ASTMangler.cpp

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -886,49 +886,8 @@ void ASTMangler::appendType(Type type) {
886886
return appendImplFunctionType(cast<SILFunctionType>(tybase));
887887

888888
// type ::= archetype
889-
case TypeKind::Archetype: {
890-
auto *archetype = cast<ArchetypeType>(tybase);
891-
892-
assert(false && DWARFMangling && "Cannot mangle free-standing archetypes");
893-
894-
// Mangle the associated type of a parent archetype.
895-
if (auto parent = archetype->getParent()) {
896-
assert(archetype->getAssocType()
897-
&& "child archetype has no associated type?!");
898-
899-
if (tryMangleSubstitution(archetype))
900-
return;
901-
appendType(parent);
902-
appendIdentifier(archetype->getName().str());
903-
appendOperator("Qa");
904-
addSubstitution(archetype);
905-
return;
906-
}
907-
908-
// archetype ::= 'Q' <index> # archetype with depth=0, index=N
909-
// archetype ::= 'Qd' <index> <index> # archetype with depth=M+1, index=N
910-
// Mangle generic parameter archetypes.
911-
912-
// Find the archetype information.
913-
const DeclContext *DC = DeclCtx;
914-
auto GTPT = archetype->getInterfaceType()->castTo<GenericTypeParamType>();
915-
916-
// The DWARF output created by Swift is intentionally flat,
917-
// therefore archetypes are emitted with their DeclContext if
918-
// they appear at the top level of a type.
919-
DWARFMangling = false;
920-
while (DC && DC->isGenericContext()) {
921-
if (DC->isInnermostContextGeneric() &&
922-
DC->getGenericParamsOfContext()->getDepth() == GTPT->getDepth())
923-
break;
924-
DC = DC->getParent();
925-
}
926-
assert(DC && "no decl context for archetype found");
927-
if (!DC) return;
928-
appendContext(DC);
929-
DWARFMangling = true;
930-
return appendOperator("Qq", Index(GTPT->getIndex()));
931-
}
889+
case TypeKind::Archetype:
890+
llvm_unreachable("Cannot mangle free-standing archetypes");
932891

933892
case TypeKind::DynamicSelf: {
934893
auto dynamicSelf = cast<DynamicSelfType>(tybase);

0 commit comments

Comments
 (0)