Skip to content

Conversation

@felipepiovezan
Copy link

@felipepiovezan felipepiovezan commented Dec 18, 2025

When computing the name of the parent function of a closure, LLDB takes the demangled parent function Node and replaces it on the top level "Global" demangle node. However, this logic was faulty in two ways:

  1. A misplaced return made the "replace logic" only look at the fist child of the Global node.
  2. The new Global node was inheriting all children from the original Global node, which is wrong.

For example, an async closure inside a non-async function would have this demangle tree:

Global
    <Async Attributes>
    <Explicit Closure>
        <Parent Function>

By replacing the Explicit Closure with Parent Function, we were creating another async function. The solution is to just create the Global node from scratch, dropping most other nodes it may have had. This begs the question of which other nodes could be there as a sibling of the closure in the tree; given how none of the existing tests failed with this patch, it seems safe to assume any such nodes are not too important (until proven otherwise).

rdar://162788289

…ctions

When computing the name of the parent function of a closure, LLDB takes
the demangled parent function Node and replaces it on the top level
"Global" demangle node. However, this logic was faulty in two ways:

1. A misplaced return made the "replace logic" only look at the fist
   child of the Global node.
2. The new Global node was inheriting _all_ children from the original
   Global node, which is wrong.

For example, an async closure inside a non-async function would have
this demangle tree:

```
Global
    <Async Attributes>
    <Explicit Closure>
        <Parent Function>
```

By replacing the `Explicit Closure` with `Parent Function`, we were
creating another async function. The solution is to just create the
Global node from scratch, dropping most other nodes it may have had.
This begs the question of which other nodes could be there as a sibling
of the closure in the tree; given how none of the existing tests failed
with this patch, it seems safe to assume any such nodes are not too
important (until proven otherwise).
@felipepiovezan felipepiovezan requested a review from a team as a code owner December 18, 2025 15:18
@felipepiovezan
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit a24a64c into swiftlang:swift/release/6.3 Dec 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants