Skip to content

Commit a8eec59

Browse files
committed
Mangling: demangling/remangling of property behavior conformances
1 parent 947996c commit a8eec59

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

lib/Basic/Demangle.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3610,12 +3610,22 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
36103610
NodePointer child0 = pointer->getChild(0);
36113611
NodePointer child1 = pointer->getChild(1);
36123612
NodePointer child2 = pointer->getChild(2);
3613-
print(child0);
3614-
if (Options.DisplayProtocolConformances) {
3613+
if (pointer->getNumChildren() == 4) {
3614+
// TODO: check if this is correct
3615+
Printer << "property behavior storage of ";
3616+
print(child2);
3617+
Printer << " in ";
3618+
print(child0);
36153619
Printer << " : ";
36163620
print(child1);
3617-
Printer << " in ";
3618-
print(child2);
3621+
} else {
3622+
print(child0);
3623+
if (Options.DisplayProtocolConformances) {
3624+
Printer << " : ";
3625+
print(child1);
3626+
Printer << " in ";
3627+
print(child2);
3628+
}
36193629
}
36203630
return;
36213631
}

lib/Basic/Demangler.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,12 +1020,20 @@ NodePointer Demangler::popProtocolConformance() {
10201020
NodePointer Module = popModule();
10211021
NodePointer Proto = popProtocol();
10221022
NodePointer Type = popNode(Node::Kind::Type);
1023+
NodePointer Ident;
1024+
if (!Type) {
1025+
// Property behavior conformance
1026+
Ident = popNode(Node::Kind::Identifier);
1027+
Type = popNode(Node::Kind::Type);
1028+
}
10231029
if (GenSig) {
10241030
Type = createType(createWithChildren(Node::Kind::DependentGenericType,
10251031
GenSig, Type));
10261032
}
1027-
return createWithChildren(Node::Kind::ProtocolConformance,
1028-
Type, Proto, Module);
1033+
NodePointer Conf = createWithChildren(Node::Kind::ProtocolConformance,
1034+
Type, Proto, Module);
1035+
addChild(Conf, Ident);
1036+
return Conf;
10291037
}
10301038

10311039
NodePointer Demangler::demangleThunkOrSpecialization() {

lib/Basic/Remangler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,8 @@ void Remangler::mangleProtocolConformance(Node *node) {
13541354
Ty = Ty->getChild(1).get();
13551355
}
13561356
mangle(Ty);
1357+
if (node->getNumChildren() == 4)
1358+
mangleChildNode(node, 3);
13571359
manglePureProtocol(node->getChild(1).get());
13581360
mangleChildNode(node, 2);
13591361
if (GenSig)

0 commit comments

Comments
 (0)