Skip to content

[lldb] Change how valobj of indirect Swift value types in C++ are ext… #7582

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
Oct 5, 2023
Merged
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
17 changes: 8 additions & 9 deletions lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,26 +1082,25 @@ SwiftLanguage::GetHardcodedSynthetics() {

casted_to_swift->SetName(ConstString("Swift_Type"));

ValueObjectSP target_valobj;
SyntheticChildrenSP synth_sp;
if (should_wrap_in_ptr) {
// If we have a pointer to a Swift value type, dereference it.
// If we have a pointer to a Swift value type, dereference the pointer
// and present those as the contents instead.
auto children = lldb_private::formatters::swift::
ExtractChildrenFromSwiftPointerValueObject(casted_to_swift);

if (children.empty())
return nullptr;

// The pointer should only have one child: the pointee.
assert(children.size() == 1 &&
"Unexpected size for pointer's children!");
target_valobj = children[0];

synth_sp = SyntheticChildrenSP(new ValueObjectWrapperSyntheticChildren(
children[0], SyntheticChildren::Flags()));
} else {
target_valobj = casted_to_swift;
synth_sp = SyntheticChildrenSP(new ValueObjectWrapperSyntheticChildren(
casted_to_swift, SyntheticChildren::Flags()));
}

SyntheticChildrenSP synth_sp =
SyntheticChildrenSP(new ValueObjectWrapperSyntheticChildren(
target_valobj, SyntheticChildren::Flags()));
return synth_sp;
});
g_formatters.push_back([](lldb_private::ValueObject &valobj,
Expand Down