Skip to content

[6.2][Demangle] Implement missing Node::Kind::OutlinedInitializeWithTakeNoValueWitness #82066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/ABI/Mangling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ with a differentiable function used for differentiable programming.
global ::= generic-signature? type 'WOe' // Outlined consume
global ::= generic-signature? type 'WOr' // Outlined retain
global ::= generic-signature? type 'WOs' // Outlined release
global ::= generic-signature? type 'WOB' // Outlined initializeWithTake, not using value witness
global ::= generic-signature? type 'WOb' // Outlined initializeWithTake
global ::= generic-signature? type 'WOc' // Outlined initializeWithCopy
global ::= generic-signature? type 'WOC' // Outlined initializeWithCopy, not using value witness
Expand Down
1 change: 1 addition & 0 deletions include/swift/Demangling/DemangleNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ NODE(AsyncRemoved)
// Added in Swift 5.TBD
NODE(ObjectiveCProtocolSymbolicReference)

NODE(OutlinedInitializeWithTakeNoValueWitness)
NODE(OutlinedInitializeWithCopyNoValueWitness)
NODE(OutlinedAssignWithTakeNoValueWitness)
NODE(OutlinedAssignWithCopyNoValueWitness)
Expand Down
9 changes: 9 additions & 0 deletions lib/Demangling/Demangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3646,6 +3646,15 @@ NodePointer Demangler::demangleWitness() {
}
case 'O': {
switch (nextChar()) {
case 'B': {
if (auto sig = popNode(Node::Kind::DependentGenericSignature))
return createWithChildren(
Node::Kind::OutlinedInitializeWithTakeNoValueWitness,
popNode(Node::Kind::Type), sig);
return createWithChild(
Node::Kind::OutlinedInitializeWithTakeNoValueWitness,
popNode(Node::Kind::Type));
}
case 'C': {
if (auto sig = popNode(Node::Kind::DependentGenericSignature))
return createWithChildren(Node::Kind::OutlinedInitializeWithCopyNoValueWitness,
Expand Down
2 changes: 2 additions & 0 deletions lib/Demangling/NodePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ class NodePrinter {
case Node::Kind::OutlinedRetain:
case Node::Kind::OutlinedRelease:
case Node::Kind::OutlinedInitializeWithTake:
case Node::Kind::OutlinedInitializeWithTakeNoValueWitness:
case Node::Kind::OutlinedInitializeWithCopy:
case Node::Kind::OutlinedAssignWithTake:
case Node::Kind::OutlinedAssignWithCopy:
Expand Down Expand Up @@ -1517,6 +1518,7 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
print(Node->getChild(0), depth + 1);
return nullptr;
case Node::Kind::OutlinedInitializeWithTake:
case Node::Kind::OutlinedInitializeWithTakeNoValueWitness:
Printer << "outlined init with take of ";
print(Node->getChild(0), depth + 1);
return nullptr;
Expand Down
7 changes: 7 additions & 0 deletions lib/Demangling/OldRemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,13 @@ ManglingError Remangler::mangleOutlinedDestroy(Node *node, unsigned depth) {
Buffer << "Wh";
return mangleSingleChildNode(node, depth + 1);
}

ManglingError
Remangler::mangleOutlinedInitializeWithTakeNoValueWitness(Node *node,
unsigned depth) {
return MANGLING_ERROR(ManglingError::UnsupportedNodeKind, node);
}

ManglingError Remangler::mangleOutlinedInitializeWithCopyNoValueWitness(Node *node,
unsigned depth) {
return MANGLING_ERROR(ManglingError::UnsupportedNodeKind, node);
Expand Down
8 changes: 8 additions & 0 deletions lib/Demangling/Remangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3576,6 +3576,14 @@ ManglingError Remangler::mangleOutlinedInitializeWithTake(Node *node,
return ManglingError::Success;
}

ManglingError
Remangler::mangleOutlinedInitializeWithTakeNoValueWitness(Node *node,
unsigned depth) {
RETURN_IF_ERROR(mangleChildNodes(node, depth + 1));
Buffer << "WOB";
return ManglingError::Success;
}

ManglingError Remangler::mangleOutlinedInitializeWithCopy(Node *node,
unsigned depth) {
RETURN_IF_ERROR(mangleChildNodes(node, depth + 1));
Expand Down
2 changes: 2 additions & 0 deletions test/Demangle/Inputs/manglings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ _T0SqWOC ---> outlined init with copy of Swift.Optional
_T0SqWOD ---> outlined assign with take of Swift.Optional
_T0SqWOF ---> outlined assign with copy of Swift.Optional
_T0SqWOH ---> outlined destroy of Swift.Optional
_T0SqWOB ---> outlined init with take of Swift.Optional
_T0SqWOb ---> outlined init with take of Swift.Optional
_T03nix6testitSaySiGyFTv_ ---> outlined variable #0 of nix.testit() -> [Swift.Int]
_T03nix6testitSaySiGyFTv_r ---> outlined read-only object #0 of nix.testit() -> [Swift.Int]
_T03nix6testitSaySiGyFTv0_ ---> outlined variable #1 of nix.testit() -> [Swift.Int]
Expand Down