Skip to content

Commit 1ac9159

Browse files
committed
[Remangler] Fix remangling of items in static bound generic function context
If you had a type alias (for instance) with its context set to a static bound generic function, the generic arguments were remangled in the wrong place because Node::Kind::Static wasn't handled properly in a couple of functions. Fix that. rdar://82870372
1 parent 94f4aca commit 1ac9159

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

lib/Demangling/Demangler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ bool Demangle::nodeConsumesGenericArgs(Node *node) {
16691669
case Node::Kind::Initializer:
16701670
case Node::Kind::PropertyWrapperBackingInitializer:
16711671
case Node::Kind::PropertyWrapperInitFromProjectedValue:
1672+
case Node::Kind::Static:
16721673
return false;
16731674
default:
16741675
return true;

lib/Demangling/Remangler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ ManglingError Remangler::mangleGenericArgs(Node *node, char &Separator,
568568
case Node::Kind::Initializer:
569569
case Node::Kind::PropertyWrapperBackingInitializer:
570570
case Node::Kind::PropertyWrapperInitFromProjectedValue:
571+
case Node::Kind::Static:
571572
if (!fullSubstitutionMap)
572573
break;
573574

@@ -3419,6 +3420,7 @@ bool Demangle::isSpecialized(Node *node) {
34193420
case Node::Kind::ModifyAccessor:
34203421
case Node::Kind::UnsafeAddressor:
34213422
case Node::Kind::UnsafeMutableAddressor:
3423+
case Node::Kind::Static:
34223424
assert(node->getNumChildren() > 0);
34233425
return node->getNumChildren() > 0 && isSpecialized(node->getChild(0));
34243426

@@ -3455,6 +3457,7 @@ ManglingErrorOr<NodePointer> Demangle::getUnspecialized(Node *node,
34553457
case Node::Kind::PropertyWrapperBackingInitializer:
34563458
case Node::Kind::PropertyWrapperInitFromProjectedValue:
34573459
case Node::Kind::DefaultArgumentInitializer:
3460+
case Node::Kind::Static:
34583461
NumToCopy = node->getNumChildren();
34593462
LLVM_FALLTHROUGH;
34603463
case Node::Kind::Structure:

test/Demangle/Inputs/manglings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,4 @@ $s1t10globalFuncyyAA7MyActorCYiF ---> t.globalFunc(isolated t.MyActor) -> ()
415415
$sSIxip6foobarP ---> foobar in Swift.DefaultIndices.subscript : A
416416
$s13__lldb_expr_110$10016c2d8yXZ1B10$10016c2e0LLC ---> __lldb_expr_1.(unknown context at $10016c2d8).(B in $10016c2e0)
417417
$s__TJO ---> $s__TJO
418+
$s6Foobar7Vector2VAASdRszlE10simdMatrix5scale6rotate9translateSo0C10_double3x3aACySdG_SdAJtFZ0D4TypeL_aySd__GD ---> MatrixType #1 in static (extension in Foobar):Foobar.Vector2<Swift.Double><A where A == Swift.Double>.simdMatrix(scale: Foobar.Vector2<Swift.Double>, rotate: Swift.Double, translate: Foobar.Vector2<Swift.Double>) -> __C.simd_double3x3

0 commit comments

Comments
 (0)