-
Notifications
You must be signed in to change notification settings - Fork 342
[lldb][swift] Fix GetParentIfClosure for Struct/Enum constructors #10922
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
base: swift/release/6.2
Are you sure you want to change the base?
[lldb][swift] Fix GetParentIfClosure for Struct/Enum constructors #10922
Conversation
We had a `class` called `MY_STRUCT`.
There are two possible variants of constructors: allocating (Kind::Allocator) and initializing (Kind::Constructor). When mangling a closure, the "context" is arbitrarily chosen to be the initializing variant. As such, we need to check both when looking for the parent of a closure. If both exist, `Kind::Constructor` is the one containing user code, so it is always checked first. rdar://154309468
@swift-ci test please |
return !sc_list.IsEmpty(); | ||
} | ||
|
||
// There are two possible variants of constructors: allocating (Kind::Allocator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// There are two possible variants of constructors: allocating (Kind::Allocator) | |
/// There are two possible variants of constructors: allocating (Kind::Allocator) |
// As per swift/lib/Demangling/Demangler.cpp, Kind::Constructor is | ||
// expected to end in `c` and `Kind::Allocator` to end in `C`. This is a | ||
// cheap way to avoid recreating the mangled tree from scratch. | ||
if (ctor_kind_mangled_name.back() == 'c') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already do so many demangle operations when resolving types that I would rather demangle again here rather than hardcode details of the mangling scheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so much about demangling again, it's about reconstructing the entire demangle tree.
There is no "node.setKind", we are forced to rebuild everything, and I don't think there are any convenient APIs today to do this
init(input: [Int]) { | ||
let find_me = "hello" | ||
let _ = input.map { | ||
return $0 // break_ctor_enum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write this as
print("break_ctor_enum")
return $0
for more breakpoint stability
Uh oh!
There was an error while loading. Please reload this page.