Skip to content

Commit deccb33

Browse files
authored
Merge pull request swiftlang#37998 from al45tair/problem/63678171
[Demangler] Fix OldRemangler to cope with Type nodes
2 parents 6d54625 + 226c36e commit deccb33

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Demangling/OldRemangler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,9 @@ void Remangler::mangleAnyNominalType(Node *node, EntityContext &ctx,
19291929
}
19301930

19311931
switch (node->getKind()) {
1932+
case Node::Kind::Type:
1933+
mangleAnyNominalType(node->getChild(0), ctx);
1934+
break;
19321935
case Node::Kind::OtherNominalType:
19331936
// Mangle unknown type kinds as structures since we can't change the old
19341937
// mangling. Give the mangling an artificial "private discriminator" so that
@@ -1975,6 +1978,9 @@ void Remangler::mangleNominalType(Node *node, char kind, EntityContext &ctx,
19751978
unsigned depth,
19761979
StringRef artificialPrivateDiscriminator) {
19771980
SubstitutionEntry entry;
1981+
if (node->getKind() == Node::Kind::Type) {
1982+
node = node->getChild(0);
1983+
}
19781984
if (trySubstitution(node, entry)) return;
19791985
mangleNamedEntity(node, kind, "", ctx, depth + 1,
19801986
artificialPrivateDiscriminator);

test/Demangle/remangle.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ RUN: diff %t.input %t.output
99
// CHECK: Swift.(Mystruct in _7B40D7ED6632C2BEA2CA3BFFD57E3435)
1010
RUN: swift-demangle -remangle-objc-rt '$ss8Mystruct33_7B40D7ED6632C2BEA2CA3BFFD57E3435LLV' | %FileCheck %s
1111

12+
// CHECK-OLD2: Swift.Int.related decl 'B' for protocol self-conformance descriptor for Swift.IteratorProtocol
13+
RUN: swift-demangle -remangle-objc-rt '$sSiStMSLB_p' | %FileCheck -check-prefix CHECK-OLD2 %s
14+
1215
// CHECK-OLD3: Swift.related decl 'H' for partial apply forwarder
1316
RUN: swift-demangle -remangle-objc-rt '$ssTALHP' | %FileCheck -check-prefix CHECK-OLD3 %s
1417

0 commit comments

Comments
 (0)