diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -480,8 +480,7 @@ size_t *index_of_error = nullptr); // this will always create the children if necessary - lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef names, - ConstString *name_of_error = nullptr); + lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef names); lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef> names, diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -427,16 +427,13 @@ } lldb::ValueObjectSP -ValueObject::GetChildAtNamePath(llvm::ArrayRef names, - ConstString *name_of_error) { +ValueObject::GetChildAtNamePath(llvm::ArrayRef names) { if (names.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (ConstString name : names) { + for (auto name : names) { root = root->GetChildMemberWithName(name, true); if (!root) { - if (name_of_error) - *name_of_error = name; return root; } } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -153,10 +153,10 @@ if (!valobj_sp) return false; ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("__ptr_", true)); - ValueObjectSP count_sp(valobj_sp->GetChildAtNamePath( - {ConstString("__cntrl_"), ConstString("__shared_owners_")})); - ValueObjectSP weakcount_sp(valobj_sp->GetChildAtNamePath( - {ConstString("__cntrl_"), ConstString("__shared_weak_owners_")})); + ValueObjectSP count_sp( + valobj_sp->GetChildAtNamePath({"__cntrl_", "__shared_owners_"})); + ValueObjectSP weakcount_sp( + valobj_sp->GetChildAtNamePath({"__cntrl_", "__shared_weak_owners_"})); if (!ptr_sp) return false; @@ -810,8 +810,7 @@ return {}; ValueObjectSP is_long = short_sp->GetChildMemberWithName("__is_long_", true); - ValueObjectSP size_sp = - short_sp->GetChildAtNamePath({ConstString("__size_")}); + ValueObjectSP size_sp = short_sp->GetChildMemberWithName("__size_", true); if (!size_sp) return {}; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -241,9 +241,6 @@ } bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() { - static ConstString g_tree_("__tree_"); - static ConstString g_pair3("__pair3_"); - if (m_element_type.IsValid()) return true; m_element_type.Clear(); @@ -257,7 +254,7 @@ m_element_type = deref->GetCompilerType(); return true; } - deref = m_backend.GetChildAtNamePath({g_tree_, g_pair3}); + deref = m_backend.GetChildAtNamePath({"__tree_", "__pair3_"}); if (!deref) return false; m_element_type = deref->GetCompilerType() diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -112,8 +112,7 @@ ValueObjectSP hash_sp = node_sp->GetChildMemberWithName("__hash_", true); if (!hash_sp || !value_sp) { if (!m_element_type) { - auto p1_sp = m_backend.GetChildAtNamePath({ConstString("__table_"), - ConstString("__p1_")}); + auto p1_sp = m_backend.GetChildAtNamePath({"__table_", "__p1_"}); if (!p1_sp) return nullptr; @@ -199,21 +198,19 @@ ValueObjectSP p2_sp = table_sp->GetChildMemberWithName("__p2_", true); ValueObjectSP num_elements_sp = nullptr; - llvm::SmallVector next_path; + llvm::SmallVector next_path; switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) { case 1: // Assume a pre llvm r300140 __compressed_pair implementation: num_elements_sp = p2_sp->GetChildMemberWithName("__first_", true); - next_path.append({ConstString("__p1_"), ConstString("__first_"), - ConstString("__next_")}); + next_path.append({"__p1_", "__first_", "__next_"}); break; case 2: { // Assume a post llvm r300140 __compressed_pair implementation: ValueObjectSP first_elem_parent = p2_sp->GetChildAtIndex(0, true); num_elements_sp = first_elem_parent->GetChildMemberWithName("__value_", true); - next_path.append({ConstString("__p1_"), ConstString("__value_"), - ConstString("__next_")}); + next_path.append({"__p1_", "__value_", "__next_"}); break; } default: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -437,9 +437,8 @@ if (!ptr_sp) return false; - ValueObjectSP usecount_sp(valobj_sp->GetChildAtNamePath( - {ConstString("_M_refcount"), ConstString("_M_pi"), - ConstString("_M_use_count")})); + ValueObjectSP usecount_sp( + valobj_sp->GetChildAtNamePath({"_M_refcount", "_M_pi", "_M_use_count"})); if (!usecount_sp) return false;