`GetChildMemberWithName` does not need a `ConstString`. This change makes the function
take a `StringRef` instead, which alleviates the need for callers to construct a
`ConstString`. I don't expect this change to improve performance, only ergonomics.
This is in support of Alex's effort to replace `ConstString` where appropriate.
There are related `ValueObject` functions that can also be changed, if this is accepted.
Differential Revision: https://reviews.llvm.org/D151615
GetChildAtNamePath(llvm::ArrayRef<std::pair<ConstString, bool>> names,
ConstString *name_of_error = nullptr);
- virtual lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
bool can_create);
virtual size_t GetIndexOfChildWithName(ConstString name);
ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
int32_t synthetic_index) override;
- lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
bool can_create) override;
size_t GetIndexOfChildWithName(ConstString name) override;
lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create) override;
- lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
bool can_create) override;
size_t GetIndexOfChildWithName(ConstString name) override;
LLDB_INSTRUMENT_VA(this, name, use_dynamic_value);
lldb::ValueObjectSP child_sp;
- const ConstString str_name(name);
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp) {
- child_sp = value_sp->GetChildMemberWithName(str_name, true);
+ child_sp = value_sp->GetChildMemberWithName(name, true);
}
SBValue sb_value;
omit_empty_base_classes);
}
-ValueObjectSP ValueObject::GetChildMemberWithName(ConstString name,
+ValueObjectSP ValueObject::GetChildMemberWithName(llvm::StringRef name,
bool can_create) {
// We may need to update our value if we are dynamic.
if (IsPossibleDynamicType())
const size_t num_child_indexes =
GetCompilerType().GetIndexOfChildMemberWithName(
- name.GetCString(), omit_empty_base_classes, child_indexes);
+ name.str().data(), omit_empty_base_classes, child_indexes);
if (num_child_indexes == 0)
return nullptr;
}
} else if (HasSyntheticValue()) {
- m_deref_valobj =
- GetSyntheticValue()
- ->GetChildMemberWithName(ConstString("$$dereference$$"), true)
- .get();
+ m_deref_valobj = GetSyntheticValue()
+ ->GetChildMemberWithName("$$dereference$$", true)
+ .get();
} else if (IsSynthetic()) {
- m_deref_valobj =
- GetChildMemberWithName(ConstString("$$dereference$$"), true).get();
+ m_deref_valobj = GetChildMemberWithName("$$dereference$$", true).get();
}
if (m_deref_valobj) {
}
lldb::ValueObjectSP
-ValueObjectRegisterSet::GetChildMemberWithName(ConstString name,
+ValueObjectRegisterSet::GetChildMemberWithName(llvm::StringRef name,
bool can_create) {
ValueObject *valobj = nullptr;
if (m_reg_ctx_sp && m_reg_set) {
- const RegisterInfo *reg_info =
- m_reg_ctx_sp->GetRegisterInfoByName(name.GetStringRef());
+ const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoByName(name);
if (reg_info != nullptr)
valobj = new ValueObjectRegister(*this, m_reg_ctx_sp, reg_info);
}
}
lldb::ValueObjectSP
-ValueObjectSynthetic::GetChildMemberWithName(ConstString name,
+ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
bool can_create) {
UpdateValueIfNeeded();
- uint32_t index = GetIndexOfChildWithName(name);
+ uint32_t index = GetIndexOfChildWithName(ConstString(name));
if (index == UINT32_MAX)
return lldb::ValueObjectSP();
assert(frame);
if (auto thisValSP = frame->FindVariable(ConstString("this")))
- if (auto thisThisValSP =
- thisValSP->GetChildMemberWithName(ConstString("this"), true))
+ if (auto thisThisValSP = thisValSP->GetChildMemberWithName("this", true))
return thisThisValSP;
return nullptr;
assert(frame);
if (auto this_val_sp = frame->FindVariable(ConstString("this")))
- if (this_val_sp->GetChildMemberWithName(ConstString("this"), true))
+ if (this_val_sp->GetChildMemberWithName("this", true))
return this_val_sp;
return nullptr;
// We're inside a C++ class method. This could potentially be an unnamed
// lambda structure. If the lambda captured a "this", that should be
// the object pointer.
- if (auto thisChildSP =
- valobj_sp->GetChildMemberWithName(ConstString("this"), true)) {
+ if (auto thisChildSP = valobj_sp->GetChildMemberWithName("this", true)) {
valobj_sp = thisChildSP;
}
ValueObjectSP engaged_sp;
if (m_stdlib == StdLib::LibCxx)
- engaged_sp =
- m_backend.GetChildMemberWithName(ConstString("__engaged_"), true);
+ engaged_sp = m_backend.GetChildMemberWithName("__engaged_", true);
else if (m_stdlib == StdLib::LibStdcpp)
- engaged_sp =
- m_backend.GetChildMemberWithName(ConstString("_M_payload"), true)
- ->GetChildMemberWithName(ConstString("_M_engaged"), true);
+ engaged_sp = m_backend.GetChildMemberWithName("_M_payload", true)
+ ->GetChildMemberWithName("_M_engaged", true);
if (!engaged_sp)
return false;
// Currently because it is part of an anonymous union
// GetChildMemberWithName() does not peer through and find it unless we are
// at the parent itself. We can obtain the parent through __engaged_.
- val_sp = m_backend.GetChildMemberWithName(ConstString("__engaged_"), true)
+ val_sp = m_backend.GetChildMemberWithName("__engaged_", true)
->GetParent()
->GetChildAtIndex(0, true)
- ->GetChildMemberWithName(ConstString("__val_"), true);
+ ->GetChildMemberWithName("__val_", true);
else if (m_stdlib == StdLib::LibStdcpp) {
- val_sp = m_backend.GetChildMemberWithName(ConstString("_M_payload"), true)
- ->GetChildMemberWithName(ConstString("_M_payload"), true);
+ val_sp = m_backend.GetChildMemberWithName("_M_payload", true)
+ ->GetChildMemberWithName("_M_payload", true);
// In some implementations, _M_value contains the underlying value of an
// optional, and in other versions, it's in the payload member.
- ValueObjectSP candidate =
- val_sp->GetChildMemberWithName(ConstString("_M_value"), true);
+ ValueObjectSP candidate = val_sp->GetChildMemberWithName("_M_value", true);
if (candidate)
val_sp = candidate;
}
ValueObjectSP value;
ValueObjectSP first_child = pair.GetChildAtIndex(0, true);
if (first_child)
- value = first_child->GetChildMemberWithName(ConstString("__value_"), true);
+ value = first_child->GetChildMemberWithName("__value_", true);
if (!value) {
// pre-r300140 member name
- value = pair.GetChildMemberWithName(ConstString("__first_"), true);
+ value = pair.GetChildMemberWithName("__first_", true);
}
return value;
}
if (pair.GetNumChildren() > 1) {
ValueObjectSP second_child = pair.GetChildAtIndex(1, true);
if (second_child) {
- value =
- second_child->GetChildMemberWithName(ConstString("__value_"), true);
+ value = second_child->GetChildMemberWithName("__value_", true);
}
}
if (!value) {
// pre-r300140 member name
- value = pair.GetChildMemberWithName(ConstString("__second_"), true);
+ value = pair.GetChildMemberWithName("__second_", true);
}
return value;
}
// An optional either contains a value or not, the member __engaged_ is
// a bool flag, it is true if the optional has a value and false otherwise.
ValueObjectSP engaged_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__engaged_"), true));
+ valobj_sp->GetChildMemberWithName("__engaged_", true));
if (!engaged_sp)
return false;
ValueObjectSP valobj_sp(valobj.GetNonSyntheticValue());
if (!valobj_sp)
return false;
- ValueObjectSP ptr_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true));
+ 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(
if (!valobj_sp)
return false;
- ValueObjectSP ptr_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true));
+ ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("__ptr_", true));
if (!ptr_sp)
return false;
if (!valobj_sp)
return false;
- static ConstString g_i_("__i_");
-
// this must be a ValueObject* because it is a child of the ValueObject we
// are producing children for it if were a ValueObjectSP, we would end up
// with a loop (iterator -> synthetic -> child -> parent == iterator) and
nullptr)
.get();
if (m_pair_ptr) {
- auto __i_(valobj_sp->GetChildMemberWithName(g_i_, true));
+ auto __i_(valobj_sp->GetChildMemberWithName("__i_", true));
if (!__i_) {
m_pair_ptr = nullptr;
return false;
.get();
if (m_iter_ptr) {
- auto iter_child(
- valobj_sp->GetChildMemberWithName(ConstString("__i_"), true));
+ auto iter_child(valobj_sp->GetChildMemberWithName("__i_", true));
if (!iter_child) {
m_iter_ptr = nullptr;
return false;
return lldb::ValueObjectSP();
if (idx == 0)
- return valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true);
+ return valobj_sp->GetChildMemberWithName("__ptr_", true);
if (idx == 1) {
- if (auto ptr_sp =
- valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true)) {
+ if (auto ptr_sp = valobj_sp->GetChildMemberWithName("__ptr_", true)) {
Status status;
auto value_sp = ptr_sp->Dereference(status);
if (status.Success()) {
return false;
lldb::ValueObjectSP cntrl_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__cntrl_"), true));
+ valobj_sp->GetChildMemberWithName("__cntrl_", true));
m_cntrl = cntrl_sp.get(); // need to store the raw pointer to avoid a circular
// dependency
if (!valobj_sp)
return false;
- ValueObjectSP ptr_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true));
+ ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("__ptr_", true));
if (!ptr_sp)
return false;
static std::optional<std::pair<uint64_t, ValueObjectSP>>
ExtractLibcxxStringInfo(ValueObject &valobj) {
ValueObjectSP valobj_r_sp =
- valobj.GetChildMemberWithName(ConstString("__r_"), /*can_create=*/true);
+ valobj.GetChildMemberWithName("__r_", /*can_create=*/true);
if (!valobj_r_sp || !valobj_r_sp->GetError().Success())
return {};
if (!valobj_r_base_sp)
return {};
- ValueObjectSP valobj_rep_sp = valobj_r_base_sp->GetChildMemberWithName(
- ConstString("__value_"), /*can_create=*/true);
+ ValueObjectSP valobj_rep_sp =
+ valobj_r_base_sp->GetChildMemberWithName("__value_", /*can_create=*/true);
if (!valobj_rep_sp)
return {};
- ValueObjectSP l = valobj_rep_sp->GetChildMemberWithName(ConstString("__l"),
+ ValueObjectSP l = valobj_rep_sp->GetChildMemberWithName("__l",
/*can_create=*/true);
if (!l)
return {};
uint64_t size;
uint64_t size_mode_value = 0;
- ValueObjectSP short_sp = valobj_rep_sp->GetChildMemberWithName(
- ConstString("__s"), /*can_create=*/true);
+ ValueObjectSP short_sp =
+ valobj_rep_sp->GetChildMemberWithName("__s", /*can_create=*/true);
if (!short_sp)
return {};
- ValueObjectSP is_long =
- short_sp->GetChildMemberWithName(ConstString("__is_long_"), true);
+ ValueObjectSP is_long = short_sp->GetChildMemberWithName("__is_long_", true);
ValueObjectSP size_sp =
short_sp->GetChildAtNamePath({ConstString("__size_")});
if (!size_sp)
if (short_mode) {
ValueObjectSP location_sp =
- short_sp->GetChildMemberWithName(ConstString("__data_"), true);
+ short_sp->GetChildMemberWithName("__data_", true);
if (using_bitmasks)
size = (layout == StringLayout::DSC) ? size_mode_value
: ((size_mode_value >> 1) % 256);
// we can use the layout_decider object as the data pointer
ValueObjectSP location_sp =
- l->GetChildMemberWithName(ConstString("__data_"), /*can_create=*/true);
+ l->GetChildMemberWithName("__data_", /*can_create=*/true);
ValueObjectSP size_vo =
- l->GetChildMemberWithName(ConstString("__size_"), /*can_create=*/true);
+ l->GetChildMemberWithName("__size_", /*can_create=*/true);
ValueObjectSP capacity_vo =
- l->GetChildMemberWithName(ConstString("__cap_"), /*can_create=*/true);
+ l->GetChildMemberWithName("__cap_", /*can_create=*/true);
if (!size_vo || !location_sp || !capacity_vo)
return {};
size = size_vo->GetValueAsUnsigned(LLDB_INVALID_OFFSET);
if (!non_sythetic)
return {};
- ValueObjectSP member__a_ =
- non_sythetic->GetChildMemberWithName(ConstString("__a_"), true);
+ ValueObjectSP member__a_ = non_sythetic->GetChildMemberWithName("__a_", true);
if (!member__a_)
return {};
ValueObjectSP member__a_value =
- member__a_->GetChildMemberWithName(ConstString("__a_value"), true);
+ member__a_->GetChildMemberWithName("__a_value", true);
if (!member__a_value)
return member__a_;
size_t lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
CalculateNumChildren() {
- static ConstString g_size_("__size_");
m_num_elements = 0;
- ValueObjectSP size_sp(m_backend.GetChildMemberWithName(g_size_, true));
+ ValueObjectSP size_sp(m_backend.GetChildMemberWithName("__size_", true));
if (size_sp)
m_num_elements = size_sp->GetValueAsUnsigned(0);
return m_num_elements;
bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::
Update() {
- static ConstString g_begin_("__begin_");
-
m_start = nullptr;
m_num_elements = 0;
m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) {
m_element_size = *size;
// Store raw pointers or end up with a circular dependency.
- m_start = m_backend.GetChildMemberWithName(g_begin_, true).get();
+ m_start = m_backend.GetChildMemberWithName("__begin_", true).get();
}
return false;
: m_entry_sp(entry ? entry->GetSP() : ValueObjectSP()) {}
ListEntry next() {
- static ConstString g_next("__next_");
-
if (!m_entry_sp)
return ListEntry();
- return ListEntry(m_entry_sp->GetChildMemberWithName(g_next, true));
+ return ListEntry(m_entry_sp->GetChildMemberWithName("__next_", true));
}
ListEntry prev() {
- static ConstString g_prev("__prev_");
-
if (!m_entry_sp)
return ListEntry();
- return ListEntry(m_entry_sp->GetChildMemberWithName(g_prev, true));
+ return ListEntry(m_entry_sp->GetChildMemberWithName("__prev_", true));
}
uint64_t value() const {
return false;
ValueObjectSP impl_sp(
- m_backend.GetChildMemberWithName(ConstString("__before_begin_"), true));
+ m_backend.GetChildMemberWithName("__before_begin_", true));
if (!impl_sp)
return false;
impl_sp = GetFirstValueOfLibCXXCompressedPair(*impl_sp);
if (!impl_sp)
return false;
- m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
+ m_head = impl_sp->GetChildMemberWithName("__next_", true).get();
return false;
}
if (!m_head || !m_tail || m_node_address == 0)
return 0;
ValueObjectSP size_alloc(
- m_backend.GetChildMemberWithName(ConstString("__size_alloc_"), true));
+ m_backend.GetChildMemberWithName("__size_alloc_", true));
if (size_alloc) {
ValueObjectSP value = GetFirstValueOfLibCXXCompressedPair(*size_alloc);
if (value) {
m_node_address = backend_addr->GetValueAsUnsigned(0);
if (!m_node_address || m_node_address == LLDB_INVALID_ADDRESS)
return false;
- ValueObjectSP impl_sp(
- m_backend.GetChildMemberWithName(ConstString("__end_"), true));
+ ValueObjectSP impl_sp(m_backend.GetChildMemberWithName("__end_", true));
if (!impl_sp)
return false;
- m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
- m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get();
+ m_head = impl_sp->GetChildMemberWithName("__next_", true).get();
+ m_tail = impl_sp->GetChildMemberWithName("__prev_", true).get();
return false;
}
size_t lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
CalculateNumChildren() {
- static ConstString g_pair3_("__pair3_");
- static ConstString g_first_("__first_");
- static ConstString g_value_("__value_");
-
if (m_count != UINT32_MAX)
return m_count;
if (m_tree == nullptr)
return 0;
- ValueObjectSP m_item(m_tree->GetChildMemberWithName(g_pair3_, true));
+ ValueObjectSP m_item(m_tree->GetChildMemberWithName("__pair3_", true));
if (!m_item)
return 0;
switch (m_item->GetCompilerType().GetNumDirectBaseClasses()) {
case 1:
// Assume a pre llvm r300140 __compressed_pair implementation:
- m_item = m_item->GetChildMemberWithName(g_first_, true);
+ m_item = m_item->GetChildMemberWithName("__first_", true);
break;
case 2: {
// Assume a post llvm r300140 __compressed_pair implementation:
ValueObjectSP first_elem_parent = m_item->GetChildAtIndex(0, true);
- m_item = first_elem_parent->GetChildMemberWithName(g_value_, true);
+ m_item = first_elem_parent->GetChildMemberWithName("__value_", true);
break;
}
default:
}
bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() {
- static ConstString g_value_("__value_");
static ConstString g_tree_("__tree_");
static ConstString g_pair3("__pair3_");
deref = m_root_node->Dereference(error);
if (!deref || error.Fail())
return false;
- deref = deref->GetChildMemberWithName(g_value_, true);
+ deref = deref->GetChildMemberWithName("__value_", true);
if (deref) {
m_element_type = deref->GetCompilerType();
return true;
size_t idx) {
static ConstString g_cc_("__cc_"), g_cc("__cc");
static ConstString g_nc("__nc");
- static ConstString g_value_("__value_");
if (idx >= CalculateNumChildren())
return lldb::ValueObjectSP();
return lldb::ValueObjectSP();
}
GetValueOffset(iterated_sp);
- auto child_sp = iterated_sp->GetChildMemberWithName(g_value_, true);
+ auto child_sp = iterated_sp->GetChildMemberWithName("__value_", true);
if (child_sp)
iterated_sp = child_sp;
else
}
bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update() {
- static ConstString g_tree_("__tree_");
- static ConstString g_begin_node_("__begin_node_");
m_count = UINT32_MAX;
m_tree = m_root_node = nullptr;
m_iterators.clear();
- m_tree = m_backend.GetChildMemberWithName(g_tree_, true).get();
+ m_tree = m_backend.GetChildMemberWithName("__tree_", true).get();
if (!m_tree)
return false;
- m_root_node = m_tree->GetChildMemberWithName(g_begin_node_, true).get();
+ m_root_node = m_tree->GetChildMemberWithName("__begin_node_", true).get();
return false;
}
bool QueueFrontEnd::Update() {
m_container_sp = nullptr;
- ValueObjectSP c_sp = m_backend.GetChildMemberWithName(ConstString("c"), true);
+ ValueObjectSP c_sp = m_backend.GetChildMemberWithName("c", true);
if (!c_sp)
return false;
m_container_sp = c_sp->GetSyntheticValue().get();
m_base = nullptr;
ValueObjectSP base_sp;
- base_sp = m_backend.GetChildMemberWithName(ConstString("__base_"), true);
+ base_sp = m_backend.GetChildMemberWithName("__base_", true);
if (!base_sp) {
// Pre r304382 name of the base element.
- base_sp = m_backend.GetChildMemberWithName(ConstString("base_"), true);
+ base_sp = m_backend.GetChildMemberWithName("base_", true);
}
if (!base_sp)
return false;
if (!node_sp || error.Fail())
return lldb::ValueObjectSP();
- ValueObjectSP value_sp =
- node_sp->GetChildMemberWithName(ConstString("__value_"), true);
- ValueObjectSP hash_sp =
- node_sp->GetChildMemberWithName(ConstString("__hash_"), true);
+ ValueObjectSP value_sp = node_sp->GetChildMemberWithName("__value_", true);
+ 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_"),
switch (p1_sp->GetCompilerType().GetNumDirectBaseClasses()) {
case 1:
// Assume a pre llvm r300140 __compressed_pair implementation:
- first_sp = p1_sp->GetChildMemberWithName(ConstString("__first_"),
- true);
+ first_sp = p1_sp->GetChildMemberWithName("__first_", true);
break;
case 2: {
// Assume a post llvm r300140 __compressed_pair implementation:
ValueObjectSP first_elem_parent_sp =
p1_sp->GetChildAtIndex(0, true);
- first_sp = p1_sp->GetChildMemberWithName(ConstString("__value_"),
- true);
+ first_sp = p1_sp->GetChildMemberWithName("__value_", true);
break;
}
default:
if (!m_node_type)
return nullptr;
node_sp = node_sp->Cast(m_node_type);
- value_sp = node_sp->GetChildMemberWithName(ConstString("__value_"), true);
- hash_sp = node_sp->GetChildMemberWithName(ConstString("__hash_"), true);
+ value_sp = node_sp->GetChildMemberWithName("__value_", true);
+ hash_sp = node_sp->GetChildMemberWithName("__hash_", true);
if (!value_sp || !hash_sp)
return nullptr;
}
m_elements_cache.push_back(
{value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
- m_next_element =
- node_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
+ m_next_element = node_sp->GetChildMemberWithName("__next_", true).get();
if (!m_next_element || m_next_element->GetValueAsUnsigned(0) == 0)
m_next_element = nullptr;
}
m_num_elements = 0;
m_next_element = nullptr;
m_elements_cache.clear();
- ValueObjectSP table_sp =
- m_backend.GetChildMemberWithName(ConstString("__table_"), true);
+ ValueObjectSP table_sp = m_backend.GetChildMemberWithName("__table_", true);
if (!table_sp)
return false;
- ValueObjectSP p2_sp = table_sp->GetChildMemberWithName(
- ConstString("__p2_"), true);
+ ValueObjectSP p2_sp = table_sp->GetChildMemberWithName("__p2_", true);
ValueObjectSP num_elements_sp = nullptr;
llvm::SmallVector<ConstString, 3> next_path;
switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) {
case 1:
// Assume a pre llvm r300140 __compressed_pair implementation:
- num_elements_sp = p2_sp->GetChildMemberWithName(
- ConstString("__first_"), true);
+ num_elements_sp = p2_sp->GetChildMemberWithName("__first_", true);
next_path.append({ConstString("__p1_"), ConstString("__first_"),
ConstString("__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(
- ConstString("__value_"), true);
+ num_elements_sp =
+ first_elem_parent->GetChildMemberWithName("__value_", true);
next_path.append({ConstString("__p1_"), ConstString("__value_"),
ConstString("__next_")});
break;
LibcxxVariantIndexValidity
LibcxxVariantGetIndexValidity(ValueObjectSP &impl_sp) {
- ValueObjectSP index_sp(
- impl_sp->GetChildMemberWithName(ConstString("__index"), true));
+ ValueObjectSP index_sp(impl_sp->GetChildMemberWithName("__index", true));
if (!index_sp)
return LibcxxVariantIndexValidity::Invalid;
}
std::optional<uint64_t> LibcxxVariantIndexValue(ValueObjectSP &impl_sp) {
- ValueObjectSP index_sp(
- impl_sp->GetChildMemberWithName(ConstString("__index"), true));
+ ValueObjectSP index_sp(impl_sp->GetChildMemberWithName("__index", true));
if (!index_sp)
return {};
}
ValueObjectSP LibcxxVariantGetNthHead(ValueObjectSP &impl_sp, uint64_t index) {
- ValueObjectSP data_sp(
- impl_sp->GetChildMemberWithName(ConstString("__data"), true));
+ ValueObjectSP data_sp(impl_sp->GetChildMemberWithName("__data", true));
if (!data_sp)
return ValueObjectSP{};
ValueObjectSP current_level = data_sp;
for (uint64_t n = index; n != 0; --n) {
ValueObjectSP tail_sp(
- current_level->GetChildMemberWithName(ConstString("__tail"), true));
+ current_level->GetChildMemberWithName("__tail", true));
if (!tail_sp)
return ValueObjectSP{};
current_level = tail_sp;
}
- return current_level->GetChildMemberWithName(ConstString("__head"), true);
+ return current_level->GetChildMemberWithName("__head", true);
}
} // namespace
if (!template_type)
return {};
- ValueObjectSP head_value(
- nth_head->GetChildMemberWithName(ConstString("__value"), true));
+ ValueObjectSP head_value(nth_head->GetChildMemberWithName("__value", true));
if (!head_value)
return {};
bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
m_start = m_finish = nullptr;
ValueObjectSP data_type_finder_sp(
- m_backend.GetChildMemberWithName(ConstString("__end_cap_"), true));
+ m_backend.GetChildMemberWithName("__end_cap_", true));
if (!data_type_finder_sp)
return false;
switch (data_type_finder_sp->GetCompilerType().GetNumDirectBaseClasses()) {
case 1:
// Assume a pre llvm r300140 __compressed_pair implementation:
- data_type_finder_sp = data_type_finder_sp->GetChildMemberWithName(
- ConstString("__first_"), true);
+ data_type_finder_sp =
+ data_type_finder_sp->GetChildMemberWithName("__first_", true);
break;
case 2: {
// Assume a post llvm r300140 __compressed_pair implementation:
ValueObjectSP first_elem_parent_sp =
data_type_finder_sp->GetChildAtIndex(0, true);
- data_type_finder_sp = first_elem_parent_sp->GetChildMemberWithName(
- ConstString("__value_"), true);
+ data_type_finder_sp =
+ first_elem_parent_sp->GetChildMemberWithName("__value_", true);
break;
}
default:
if (m_element_size > 0) {
// store raw pointers or end up with a circular dependency
- m_start =
- m_backend.GetChildMemberWithName(ConstString("__begin_"), true).get();
- m_finish =
- m_backend.GetChildMemberWithName(ConstString("__end_"), true).get();
+ m_start = m_backend.GetChildMemberWithName("__begin_", true).get();
+ m_finish = m_backend.GetChildMemberWithName("__end_", true).get();
}
}
return false;
if (!valobj_sp)
return false;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- ValueObjectSP size_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__size_"), true));
+ ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName("__size_", true));
if (!size_sp)
return false;
m_count = size_sp->GetValueAsUnsigned(0);
if (!m_count)
return true;
- ValueObjectSP begin_sp(
- valobj_sp->GetChildMemberWithName(ConstString("__begin_"), true));
+ ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName("__begin_", true));
if (!begin_sp) {
m_count = 0;
return false;
return false;
m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
- ValueObjectSP _M_node_sp(
- valobj_sp->GetChildMemberWithName(ConstString("_M_node"), true));
+ ValueObjectSP _M_node_sp(valobj_sp->GetChildMemberWithName("_M_node", true));
if (!_M_node_sp)
return false;
if (!valobj_sp)
return false;
- auto ptr_obj_sp = valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
+ auto ptr_obj_sp = valobj_sp->GetChildMemberWithName("_M_ptr", true);
if (!ptr_obj_sp)
return false;
if (!valobj_sp)
return false;
- ValueObjectSP ptr_sp(
- valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true));
+ ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName("_M_ptr", true));
if (!ptr_sp)
return false;
next_child_sp = child_sp;
} else if (name_str.startswith("std::_Head_base<")) {
ValueObjectSP value_sp =
- child_sp->GetChildMemberWithName(ConstString("_M_head_impl"), true);
+ child_sp->GetChildMemberWithName("_M_head_impl", true);
if (value_sp) {
StreamString name;
name.Printf("[%zd]", m_members.size());
if (!valobj_sp)
return nullptr;
- ValueObjectSP obj_child_sp =
- valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+ ValueObjectSP obj_child_sp = valobj_sp->GetChildMemberWithName("_M_t", true);
if (!obj_child_sp)
return nullptr;
ValueObjectSP obj_subchild_sp =
- obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+ obj_child_sp->GetChildMemberWithName("_M_t", true);
// if there is a _M_t subchild, the tuple is found in the obj_subchild_sp
// (for libstdc++ 6.0.23).
// we will obtain the name from this pointer.
// 5) a free function. A pointer to the function will stored after the vtable
// we will obtain the name from this pointer.
- ValueObjectSP member_f_(
- valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
+ ValueObjectSP member_f_(valobj_sp->GetChildMemberWithName("__f_", true));
if (member_f_) {
ValueObjectSP sub_member_f_(
- member_f_->GetChildMemberWithName(ConstString("__f_"), true));
+ member_f_->GetChildMemberWithName("__f_", true));
if (sub_member_f_)
member_f_ = sub_member_f_;
ThreadSP AppleObjCRuntime::GetBacktraceThreadFromException(
lldb::ValueObjectSP exception_sp) {
ValueObjectSP reserved_dict =
- exception_sp->GetChildMemberWithName(ConstString("reserved"), true);
+ exception_sp->GetChildMemberWithName("reserved", true);
if (!reserved_dict)
return FailExceptionParsing("Failed to get 'reserved' member.");
if (!return_addresses)
return FailExceptionParsing("Failed to get return addresses.");
- auto frames_value =
- return_addresses->GetChildMemberWithName(ConstString("_frames"), true);
+ auto frames_value = return_addresses->GetChildMemberWithName("_frames", true);
if (!frames_value)
return FailExceptionParsing("Failed to get frames_value.");
addr_t frames_addr = frames_value->GetValueAsUnsigned(0);
- auto count_value =
- return_addresses->GetChildMemberWithName(ConstString("_cnt"), true);
+ auto count_value = return_addresses->GetChildMemberWithName("_cnt", true);
if (!count_value)
return FailExceptionParsing("Failed to get count_value.");
size_t count = count_value->GetValueAsUnsigned(0);
- auto ignore_value =
- return_addresses->GetChildMemberWithName(ConstString("_ignore"), true);
+ auto ignore_value = return_addresses->GetChildMemberWithName("_ignore", true);
if (!ignore_value)
return FailExceptionParsing("Failed to get ignore_value.");
size_t ignore = ignore_value->GetValueAsUnsigned(0);