Skip to content

Commit 06c95cc

Browse files
committed
Add a mangling for completion block implementation functions.
1 parent 577f83a commit 06c95cc

File tree

6 files changed

+21
-1
lines changed

6 files changed

+21
-1
lines changed

docs/ABI/Mangling.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ types where the metadata itself has unknown layout.)
218218
global ::= global 'Tm' // merged function
219219
global ::= entity // some identifiable thing
220220
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
221+
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
222+
global ::= impl-function-type 'Tz' // objc-to-swift-async completion handler block implementation
221223
global ::= from-type to-type self-type generic-signature? 'Ty' // reabstraction thunk with dynamic 'Self' capture
222224
global ::= from-type to-type generic-signature? 'Tr' // obsolete mangling for reabstraction thunk
223225
global ::= entity generic-signature? type type* 'TK' // key path getter

include/swift/Demangling/DemangleNodes.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ CONTEXT_NODE(NativePinningMutableAddressor)
159159
NODE(NominalTypeDescriptor)
160160
NODE(NonObjCAttribute)
161161
NODE(Number)
162+
NODE(ObjCAsyncCompletionHandlerImpl)
162163
NODE(ObjCAttribute)
163164
NODE(ObjCBlock)
164165
NODE(EscapingObjCBlock)

lib/Demangling/Demangler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ NodePointer Demangler::popProtocolConformance() {
22442244
return Conf;
22452245
}
22462246

2247-
NodePointer Demangler::demangleThunkOrSpecialization() {
2247+
NodePointer Demangler::demangleThunkOrSpecialization() {
22482248
switch (char c = nextChar()) {
22492249
case 'c': return createWithChild(Node::Kind::CurryThunk, popNode(isEntity));
22502250
case 'j': return createWithChild(Node::Kind::DispatchThunk, popNode(isEntity));
@@ -2263,6 +2263,10 @@ NodePointer Demangler::demangleThunkOrSpecialization() {
22632263
NodePointer type = popNode(Node::Kind::Type);
22642264
return createWithChild(Node::Kind::CoroutineContinuationPrototype, type);
22652265
}
2266+
case 'z': {
2267+
NodePointer implType = popNode(Node::Kind::ImplFunctionType);
2268+
return createWithChild(Node::Kind::ObjCAsyncCompletionHandlerImpl, implType);
2269+
}
22662270
case 'V': {
22672271
NodePointer Base = popNode(isEntity);
22682272
NodePointer Derived = popNode(isEntity);

lib/Demangling/NodePrinter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ class NodePrinter {
439439
case Node::Kind::NominalTypeDescriptor:
440440
case Node::Kind::NonObjCAttribute:
441441
case Node::Kind::Number:
442+
case Node::Kind::ObjCAsyncCompletionHandlerImpl:
442443
case Node::Kind::ObjCAttribute:
443444
case Node::Kind::ObjCBlock:
444445
case Node::Kind::ObjCMetadataUpdateFunction:
@@ -2532,6 +2533,10 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
25322533
Printer << ')';
25332534
}
25342535
return nullptr;
2536+
case Node::Kind::ObjCAsyncCompletionHandlerImpl:
2537+
Printer << "@objc completion handler block implementation for ";
2538+
print(Node->getChild(0));
2539+
return nullptr;
25352540
}
25362541
printer_unreachable("bad node kind!");
25372542
}

lib/Demangling/OldRemangler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,6 +2166,9 @@ void Remangler::mangleGlobalVariableOnceFunction(Node *node) {
21662166
void Remangler::mangleGlobalVariableOnceDeclList(Node *node) {
21672167
unreachable("unsupported");
21682168
}
2169+
void Remangler::mangleObjCAsyncCompletionHandlerImpl(Node *node) {
2170+
unreachable("unsupported");
2171+
}
21692172

21702173
void Remangler::mangleCanonicalSpecializedGenericMetaclass(Node *node) {
21712174
Buffer << "MM";

lib/Demangling/Remangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,11 @@ void Remangler::mangleCoroutineContinuationPrototype(Node *node) {
805805
Buffer << "TC";
806806
}
807807

808+
void Remangler::mangleObjCAsyncCompletionHandlerImpl(Node *node) {
809+
mangleChildNodes(node);
810+
Buffer << "Tz";
811+
}
812+
808813
void Remangler::mangleDeallocator(Node *node) {
809814
mangleChildNodes(node);
810815
Buffer << "fD";

0 commit comments

Comments
 (0)