[Lldb-commits] [lldb] [lldb] Split ValueObject::CreateChildAtIndex into two functions (PR #94455)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 5 04:35:41 PDT 2024
================
@@ -488,66 +488,85 @@ void ValueObject::SetNumChildren(uint32_t num_children) {
m_children.SetChildrenCount(num_children);
}
-ValueObject *ValueObject::CreateChildAtIndex(size_t idx,
- bool synthetic_array_member,
- int32_t synthetic_index) {
- ValueObject *valobj = nullptr;
-
+ValueObject *ValueObject::CreateChildAtIndex(size_t idx) {
bool omit_empty_base_classes = true;
- bool ignore_array_bounds = synthetic_array_member;
- std::string child_name_str;
+ bool ignore_array_bounds = false;
+ std::string child_name;
uint32_t child_byte_size = 0;
int32_t child_byte_offset = 0;
uint32_t child_bitfield_bit_size = 0;
uint32_t child_bitfield_bit_offset = 0;
bool child_is_base_class = false;
bool child_is_deref_of_parent = false;
uint64_t language_flags = 0;
-
- const bool transparent_pointers = !synthetic_array_member;
+ const bool transparent_pointers = true;
ExecutionContext exe_ctx(GetExecutionContextRef());
auto child_compiler_type_or_err =
GetCompilerType().GetChildCompilerTypeAtIndex(
&exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
- ignore_array_bounds, child_name_str, child_byte_size,
- child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
+ ignore_array_bounds, child_name, child_byte_size, child_byte_offset,
+ child_bitfield_bit_size, child_bitfield_bit_offset,
child_is_base_class, child_is_deref_of_parent, this, language_flags);
- CompilerType child_compiler_type;
- if (!child_compiler_type_or_err)
+ if (!child_compiler_type_or_err || !child_compiler_type_or_err->IsValid()) {
LLDB_LOG_ERROR(GetLog(LLDBLog::Types),
child_compiler_type_or_err.takeError(),
"could not find child: {0}");
- else
- child_compiler_type = *child_compiler_type_or_err;
+ return nullptr;
+ }
+
+ return new ValueObjectChild(
+ *this, *child_compiler_type_or_err, ConstString(child_name),
+ child_byte_size, child_byte_offset, child_bitfield_bit_size,
+ child_bitfield_bit_offset, child_is_base_class, child_is_deref_of_parent,
+ eAddressTypeInvalid, language_flags);
+}
+
+ValueObject *ValueObject::CreateSyntheticArrayMember(size_t idx) {
+ bool omit_empty_base_classes = true;
+ bool ignore_array_bounds = true;
+ std::string child_name;
+ uint32_t child_byte_size = 0;
+ int32_t child_byte_offset = 0;
+ uint32_t child_bitfield_bit_size = 0;
+ uint32_t child_bitfield_bit_offset = 0;
+ bool child_is_base_class = false;
+ bool child_is_deref_of_parent = false;
+ uint64_t language_flags = 0;
+ const bool transparent_pointers = false;
- if (child_compiler_type) {
- if (synthetic_index)
- child_byte_offset += child_byte_size * synthetic_index;
+ ExecutionContext exe_ctx(GetExecutionContextRef());
- ConstString child_name;
- if (!child_name_str.empty())
- child_name.SetCString(child_name_str.c_str());
----------------
labath wrote:
It seems that one side effect of "simplifying" this is that the name of anonymous struct members changes from nullptr/None to "". None of lldb tests broke but this broke some (rather dodgy) downstream code of ours. I would be inclined to keep this change, as I don't think we can make a promise (and keep it) to preserve details like this.
https://github.com/llvm/llvm-project/pull/94455
More information about the lldb-commits
mailing list