You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Payload-carrying) Swift enums are a challenging datastructure to
support in LLDB; this patch makes an attempt to clean up a problem
with the previous implementation, namely the dynamic nature of the
children of an enum, which has, in the past, lead to caching bugs when
displaying the children of enums. The new scheme is as follows:
- The static value of an enum is its discriminator (its case).
- An enum has no static children.
- The synthtic value of an enum is its projected case's payload.
- A synthetic child provider for all Swift enums provides synthetic
children, which are the children of the projected case's payload.
For example:
```
enum E {
case a
case b(Int, (Int, Int))
}
let a : E= .a
let b : E= .b(1, (2, 3))
```
The value of `a` is `.a`.
The value of `b` is `.b`.
The synthtic value of `b` is (1, (2, 3)).
The synthetic child 0 of `b` is 1.
The synthetic child 1 of `b` is (2, 3).
The number of (non-synthetic) children of `b` is 0.
The Swift Optional formatter behaves similarly.
Known Issues:
- SwiftRuntimeTypeVisitor does currently not visit the children of
Objective-C types; this also needs to get fixed, and is surfaced by
the new synthtic child providers in 1 test.
Implementation Notes:
This removes a lot of enum-handling code from SwiftLanguageRuntime;
simplifying the type visitor and dynamic type resolution, adn moves it
into the Enum/Optional synthetic frontends.
0 commit comments