Skip to content

Commit 5eacbfd

Browse files
committed
[DefaultOverrides] Mangling.
1 parent 9a9c2ff commit 5eacbfd

File tree

7 files changed

+22
-1
lines changed

7 files changed

+22
-1
lines changed

docs/ABI/Mangling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ types where the metadata itself has unknown layout.)
239239
global ::= global 'Twb' // back deployment thunk
240240
global ::= global 'TwB' // back deployment fallback function
241241
global ::= global 'Twc' // coro function pointer of a function
242+
global ::= global 'Twd' // default override of a function
242243
global ::= entity entity 'TV' // vtable override thunk, derived followed by base
243244
global ::= type label-list? 'D' // type mangling for the debugger with label list for function types.
244245
global ::= type 'TC' // continuation prototype (not actually used for real symbols)

include/swift/Demangling/DemangleNodes.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ NODE(Integer)
411411
NODE(NegativeInteger)
412412
NODE(DependentGenericParamValueMarker)
413413
NODE(CoroFunctionPointer)
414+
NODE(DefaultOverride)
414415

415416
#undef CONTEXT_NODE
416417
#undef NODE

lib/Demangling/Demangler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ bool swift::Demangle::isFunctionAttr(Node::Kind kind) {
156156
case Node::Kind::BackDeploymentFallback:
157157
case Node::Kind::HasSymbolQuery:
158158
case Node::Kind::CoroFunctionPointer:
159+
case Node::Kind::DefaultOverride:
159160
return true;
160161
default:
161162
return false;
@@ -3142,6 +3143,8 @@ NodePointer Demangler::demangleThunkOrSpecialization() {
31423143
case 'B': return createNode(Node::Kind::BackDeploymentFallback);
31433144
case 'c':
31443145
return createNode(Node::Kind::CoroFunctionPointer);
3146+
case 'd':
3147+
return createNode(Node::Kind::DefaultOverride);
31453148
case 'S': return createNode(Node::Kind::HasSymbolQuery);
31463149
default:
31473150
return nullptr;

lib/Demangling/NodePrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ class NodePrinter {
660660
case Node::Kind::DependentGenericInverseConformanceRequirement:
661661
case Node::Kind::DependentGenericParamValueMarker:
662662
case Node::Kind::CoroFunctionPointer:
663+
case Node::Kind::DefaultOverride:
663664
return false;
664665
}
665666
printer_unreachable("bad node kind");
@@ -3494,6 +3495,9 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
34943495
case Node::Kind::CoroFunctionPointer:
34953496
Printer << "coro function pointer to ";
34963497
return nullptr;
3498+
case Node::Kind::DefaultOverride:
3499+
Printer << "default override of ";
3500+
return nullptr;
34973501
}
34983502

34993503
printer_unreachable("bad node kind!");

lib/Demangling/OldRemangler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,11 @@ ManglingError Remangler::mangleCoroFunctionPointer(Node *node, unsigned depth) {
12031203
return ManglingError::Success;
12041204
}
12051205

1206+
ManglingError Remangler::mangleDefaultOverride(Node *node, unsigned depth) {
1207+
Buffer << "Twd";
1208+
return ManglingError::Success;
1209+
}
1210+
12061211
ManglingError Remangler::mangleDeallocator(Node *node, EntityContext &ctx,
12071212
unsigned depth) {
12081213
return mangleSimpleEntity(node, 'F', "D", ctx, depth + 1);

lib/Demangling/Remangler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,11 @@ ManglingError Remangler::mangleCoroFunctionPointer(Node *node, unsigned depth) {
10561056
return ManglingError::Success;
10571057
}
10581058

1059+
ManglingError Remangler::mangleDefaultOverride(Node *node, unsigned depth) {
1060+
Buffer << "Twd";
1061+
return ManglingError::Success;
1062+
}
1063+
10591064
ManglingError Remangler::mangleDependentAssociatedTypeRef(Node *node,
10601065
unsigned depth) {
10611066
RETURN_IF_ERROR(mangleIdentifier(node->getFirstChild(), depth));
@@ -1842,6 +1847,7 @@ ManglingError Remangler::mangleGlobal(Node *node, unsigned depth) {
18421847
case Node::Kind::BackDeploymentFallback:
18431848
case Node::Kind::HasSymbolQuery:
18441849
case Node::Kind::CoroFunctionPointer:
1850+
case Node::Kind::DefaultOverride:
18451851
mangleInReverseOrder = true;
18461852
break;
18471853
default:

test/Demangle/Inputs/manglings.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,10 @@ $s7ToolKit10TypedValueOACs5Error_pIgHTnTrzo_A2CsAD_pIegHiTrzr_TR ---> {T:} reabs
489489
$s16sending_mangling16NonSendableKlassCACIegTiTr_A2CIegTxTo_TR ---> {T:} reabstraction thunk helper from @escaping @callee_guaranteed (@in sending sending_mangling.NonSendableKlass) -> sending (@out sending_mangling.NonSendableKlass) to @escaping @callee_guaranteed (@owned sending sending_mangling.NonSendableKlass) -> sending (@owned sending_mangling.NonSendableKlass)
490490
$s3red7MyActorC3runyxxyYaKYCXEYaKlFZ ---> static red.MyActor.run<A>(@execution(caller) () async throws -> A) async throws -> A
491491
$s5thing1PP1sAA1SVvxTwc ---> coro function pointer to thing.P.s.modify2 : thing.S
492-
493492
_$s15raw_identifiers0020foospace_liaADEDGcjayyF ---> raw_identifiers.`foo space`() -> ()
494493
_$s15raw_identifiers0018_3times_pgaIGJCFbhayyF ---> raw_identifiers.`3 times`() -> ()
495494
_$s15raw_identifiers0019test_yeaIIBCEapkagayyF ---> raw_identifiers.`test +`() -> ()
496495
_$s15raw_identifiers0020pathfoo_yuEHaaCiJskayyF ---> raw_identifiers.`path://foo`() -> ()
497496
_$s15raw_identifiers10FontWeightO009_100_FpEpdyyFZ ---> static raw_identifiers.FontWeight.`100`() -> ()
497+
$s7Library1BC1iSivxTwd ---> default override of Library.B.i.modify2 : Swift.Int
498+
$s7Library1BC1iSivxTwdTwc ---> coro function pointer to default override of Library.B.i.modify2 : Swift.Int

0 commit comments

Comments
 (0)