This revision was automatically updated to reflect the committed changes. Closed by commit rG00e52cc4a8cc: [lldb] Take StringRef names in GetChildAtNamePath (NFC) (authored by kastiglione).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151813/new/ https://reviews.llvm.org/D151813 Files: lldb/include/lldb/Core/ValueObject.h lldb/source/Core/ValueObject.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
Index: lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ 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; Index: lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ 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<ConstString, 3> next_path; + llvm::SmallVector<llvm::StringRef, 3> 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: Index: lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ 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() Index: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp =================================================================== --- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ 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 {}; Index: lldb/source/Core/ValueObject.cpp =================================================================== --- lldb/source/Core/ValueObject.cpp +++ lldb/source/Core/ValueObject.cpp @@ -427,16 +427,13 @@ } lldb::ValueObjectSP -ValueObject::GetChildAtNamePath(llvm::ArrayRef<ConstString> names, - ConstString *name_of_error) { +ValueObject::GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names) { if (names.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (ConstString name : names) { + for (llvm::StringRef name : names) { root = root->GetChildMemberWithName(name, true); if (!root) { - if (name_of_error) - *name_of_error = name; return root; } } Index: lldb/include/lldb/Core/ValueObject.h =================================================================== --- lldb/include/lldb/Core/ValueObject.h +++ 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<ConstString> names, - ConstString *name_of_error = nullptr); + lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names); lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<std::pair<ConstString, bool>> names,
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits