diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index a29b67dc9e47..d59ee30410db 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -678,12 +678,6 @@ public: lldb::ValueObjectSP GetSyntheticArrayMember (size_t index, bool can_create); - lldb::ValueObjectSP - GetSyntheticArrayMemberFromPointer (size_t index, bool can_create); - - lldb::ValueObjectSP - GetSyntheticArrayMemberFromArray (size_t index, bool can_create); - lldb::ValueObjectSP GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create); diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index e383f4ca9194..1b29f6c8f7e1 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -969,14 +969,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool child_sp = value_sp->GetChildAtIndex (idx, can_create); if (can_create_synthetic && !child_sp) { - if (value_sp->IsPointerType()) - { - child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create); - } - else if (value_sp->IsArrayType()) - { - child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create); - } + child_sp = value_sp->GetSyntheticArrayMember(idx, can_create); } } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 231f4972c278..f1af96a7624f 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2090,52 +2090,6 @@ ValueObject::IsObjCNil () return canReadValue && isZero; } -ValueObjectSP -ValueObject::GetSyntheticArrayMember (size_t index, bool can_create) -{ - const uint32_t type_info = GetTypeInfo (); - if (type_info & eTypeIsArray) - return GetSyntheticArrayMemberFromArray(index, can_create); - - if (type_info & eTypeIsPointer) - return GetSyntheticArrayMemberFromPointer(index, can_create); - - return ValueObjectSP(); - -} - -ValueObjectSP -ValueObject::GetSyntheticArrayMemberFromPointer (size_t index, bool can_create) -{ - ValueObjectSP synthetic_child_sp; - if (IsPointerType ()) - { - char index_str[64]; - snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index); - ConstString index_const_str(index_str); - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. - synthetic_child_sp = GetSyntheticChild (index_const_str); - if (!synthetic_child_sp) - { - ValueObject *synthetic_child; - // We haven't made a synthetic array member for INDEX yet, so - // lets make one and cache it for any future reference. - synthetic_child = CreateChildAtIndex(0, true, index); - - // Cache the value if we got one back... - if (synthetic_child) - { - AddSyntheticChild(index_const_str, synthetic_child); - synthetic_child_sp = synthetic_child->GetSP(); - synthetic_child_sp->SetName(ConstString(index_str)); - synthetic_child_sp->m_is_array_item_for_pointer = true; - } - } - } - return synthetic_child_sp; -} - // This allows you to create an array member using and index // that doesn't not fall in the normal bounds of the array. // Many times structure can be defined as: @@ -2148,10 +2102,10 @@ ValueObject::GetSyntheticArrayMemberFromPointer (size_t index, bool can_create) // there are more items in "item_array". ValueObjectSP -ValueObject::GetSyntheticArrayMemberFromArray (size_t index, bool can_create) +ValueObject::GetSyntheticArrayMember (size_t index, bool can_create) { ValueObjectSP synthetic_child_sp; - if (IsArrayType ()) + if (IsPointerType () || IsArrayType()) { char index_str[64]; snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index); @@ -2165,7 +2119,7 @@ ValueObject::GetSyntheticArrayMemberFromArray (size_t index, bool can_create) // We haven't made a synthetic array member for INDEX yet, so // lets make one and cache it for any future reference. synthetic_child = CreateChildAtIndex(0, true, index); - + // Cache the value if we got one back... if (synthetic_child) { @@ -3024,7 +2978,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr, { ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true); if (!child_valobj_sp) - child_valobj_sp = root->GetSyntheticArrayMemberFromArray(index, true); + child_valobj_sp = root->GetSyntheticArrayMember(index, true); if (!child_valobj_sp) if (root->HasSyntheticValue() && root->GetSyntheticValue()->GetNumChildren() > index) child_valobj_sp = root->GetSyntheticValue()->GetChildAtIndex(index, true); @@ -3073,7 +3027,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr, root = root->GetSyntheticValue()->GetChildAtIndex(index, true); } else - root = root->GetSyntheticArrayMemberFromPointer(index, true); + root = root->GetSyntheticArrayMember(index, true); if (!root.get()) { *first_unparsed = expression_cstr; @@ -3416,7 +3370,7 @@ ValueObject::ExpandArraySliceExpression(const char* expression_cstr, } else { - root = root->GetSyntheticArrayMemberFromPointer(index, true); + root = root->GetSyntheticArrayMember(index, true); if (!root.get()) { *first_unparsed = expression_cstr; diff --git a/lldb/source/DataFormatters/NSIndexPath.cpp b/lldb/source/DataFormatters/NSIndexPath.cpp index ee9583ef4cc1..6932211f29d1 100644 --- a/lldb/source/DataFormatters/NSIndexPath.cpp +++ b/lldb/source/DataFormatters/NSIndexPath.cpp @@ -278,7 +278,7 @@ protected: { if (m_indexes) { - ValueObjectSP index_sp(m_indexes->GetSyntheticArrayMemberFromPointer(idx, true)); + ValueObjectSP index_sp(m_indexes->GetSyntheticArrayMember(idx, true)); return index_sp; } return nullptr; diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 9a610a5da109..d6f2dfd75f55 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -920,7 +920,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, } else { - child_valobj_sp = valobj_sp->GetSyntheticArrayMemberFromPointer (child_index, true); + child_valobj_sp = valobj_sp->GetSyntheticArrayMember (child_index, true); if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false);