mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-06 01:19:28 +00:00
[lldb] Take StringRef name in GetIndexOfChildWithName (NFC)
As with D151615, which changed `GetIndexOfChildMemberWithName` to take a `StringRef` instead of a `ConstString`, this change does the same for `GetIndexOfChildWithName`. Differential Revision: https://reviews.llvm.org/D151811
This commit is contained in:
parent
45307f1b0d
commit
5dae706259
@ -490,7 +490,7 @@ public:
|
||||
virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
|
||||
bool can_create);
|
||||
|
||||
virtual size_t GetIndexOfChildWithName(ConstString name);
|
||||
virtual size_t GetIndexOfChildWithName(llvm::StringRef name);
|
||||
|
||||
size_t GetNumChildren(uint32_t max = UINT32_MAX);
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
|
||||
bool can_create) override;
|
||||
|
||||
size_t GetIndexOfChildWithName(ConstString name) override;
|
||||
size_t GetIndexOfChildWithName(llvm::StringRef name) override;
|
||||
|
||||
protected:
|
||||
bool UpdateValue() override;
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,
|
||||
bool can_create) override;
|
||||
|
||||
size_t GetIndexOfChildWithName(ConstString name) override;
|
||||
size_t GetIndexOfChildWithName(llvm::StringRef name) override;
|
||||
|
||||
lldb::ValueObjectSP
|
||||
GetDynamicValue(lldb::DynamicValueType valueType) override;
|
||||
|
@ -387,7 +387,7 @@ public:
|
||||
|
||||
/// Lookup a child given a name. This function will match base class names and
|
||||
/// member member names in "clang_type" only, not descendants.
|
||||
uint32_t GetIndexOfChildWithName(const char *name,
|
||||
uint32_t GetIndexOfChildWithName(llvm::StringRef name,
|
||||
bool omit_empty_base_classes) const;
|
||||
|
||||
/// Lookup a child member given a name. This function will match member names
|
||||
|
@ -348,7 +348,7 @@ public:
|
||||
// Lookup a child given a name. This function will match base class names and
|
||||
// member member names in "clang_type" only, not descendants.
|
||||
virtual uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
const char *name,
|
||||
llvm::StringRef name,
|
||||
bool omit_empty_base_classes) = 0;
|
||||
|
||||
// Lookup a child member given a name. This function will match member names
|
||||
|
@ -687,7 +687,7 @@ uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
|
||||
ValueLocker locker;
|
||||
lldb::ValueObjectSP value_sp(GetSP(locker));
|
||||
if (value_sp) {
|
||||
idx = value_sp->GetIndexOfChildWithName(ConstString(name));
|
||||
idx = value_sp->GetIndexOfChildWithName(name);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
@ -460,9 +460,9 @@ lldb::ValueObjectSP ValueObject::GetChildAtNamePath(
|
||||
return root;
|
||||
}
|
||||
|
||||
size_t ValueObject::GetIndexOfChildWithName(ConstString name) {
|
||||
size_t ValueObject::GetIndexOfChildWithName(llvm::StringRef name) {
|
||||
bool omit_empty_base_classes = true;
|
||||
return GetCompilerType().GetIndexOfChildWithName(name.GetCString(),
|
||||
return GetCompilerType().GetIndexOfChildWithName(name,
|
||||
omit_empty_base_classes);
|
||||
}
|
||||
|
||||
|
@ -142,11 +142,9 @@ ValueObjectRegisterSet::GetChildMemberWithName(llvm::StringRef name,
|
||||
return ValueObjectSP();
|
||||
}
|
||||
|
||||
size_t
|
||||
ValueObjectRegisterSet::GetIndexOfChildWithName(ConstString name) {
|
||||
size_t ValueObjectRegisterSet::GetIndexOfChildWithName(llvm::StringRef name) {
|
||||
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)
|
||||
return reg_info->kinds[eRegisterKindLLDB];
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "lldb/Core/ValueObject.h"
|
||||
#include "lldb/DataFormatters/TypeSynthetic.h"
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/LLDBLog.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
@ -318,9 +319,11 @@ ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
|
||||
return GetChildAtIndex(index, can_create);
|
||||
}
|
||||
|
||||
size_t ValueObjectSynthetic::GetIndexOfChildWithName(ConstString name) {
|
||||
size_t ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) {
|
||||
UpdateValueIfNeeded();
|
||||
|
||||
ConstString name(name_ref);
|
||||
|
||||
uint32_t found_index = UINT32_MAX;
|
||||
bool did_find;
|
||||
{
|
||||
|
@ -793,7 +793,7 @@ ExtractLibcxxStringInfo(ValueObject &valobj) {
|
||||
if (!l)
|
||||
return {};
|
||||
|
||||
StringLayout layout = l->GetIndexOfChildWithName(ConstString("__data_")) == 0
|
||||
StringLayout layout = l->GetIndexOfChildWithName("__data_") == 0
|
||||
? StringLayout::DSC
|
||||
: StringLayout::CSD;
|
||||
|
||||
|
@ -6966,9 +6966,9 @@ size_t TypeSystemClang::GetIndexOfChildMemberWithName(
|
||||
|
||||
uint32_t
|
||||
TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
const char *name,
|
||||
llvm::StringRef name,
|
||||
bool omit_empty_base_classes) {
|
||||
if (type && name && name[0]) {
|
||||
if (type && !name.empty()) {
|
||||
clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
|
||||
|
||||
const clang::Type::TypeClass type_class = qual_type->getTypeClass();
|
||||
@ -7013,11 +7013,10 @@ TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
|
||||
// Try and find a field that matches NAME
|
||||
clang::RecordDecl::field_iterator field, field_end;
|
||||
llvm::StringRef name_sref(name);
|
||||
for (field = record_decl->field_begin(),
|
||||
field_end = record_decl->field_end();
|
||||
field != field_end; ++field, ++child_idx) {
|
||||
if (field->getName().equals(name_sref))
|
||||
if (field->getName().equals(name))
|
||||
return child_idx;
|
||||
}
|
||||
}
|
||||
@ -7026,7 +7025,6 @@ TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
case clang::Type::ObjCObject:
|
||||
case clang::Type::ObjCInterface:
|
||||
if (GetCompleteType(type)) {
|
||||
llvm::StringRef name_sref(name);
|
||||
const clang::ObjCObjectType *objc_class_type =
|
||||
llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
|
||||
assert(objc_class_type);
|
||||
@ -7045,7 +7043,7 @@ TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
ivar_pos != ivar_end; ++ivar_pos, ++child_idx) {
|
||||
const clang::ObjCIvarDecl *ivar_decl = *ivar_pos;
|
||||
|
||||
if (ivar_decl->getName().equals(name_sref)) {
|
||||
if (ivar_decl->getName().equals(name)) {
|
||||
if ((!omit_empty_base_classes && superclass_interface_decl) ||
|
||||
(omit_empty_base_classes &&
|
||||
ObjCDeclHasIVars(superclass_interface_decl, true)))
|
||||
@ -7056,7 +7054,7 @@ TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
}
|
||||
|
||||
if (superclass_interface_decl) {
|
||||
if (superclass_interface_decl->getName().equals(name_sref))
|
||||
if (superclass_interface_decl->getName().equals(name))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ public:
|
||||
// Lookup a child given a name. This function will match base class names and
|
||||
// member member names in "clang_type" only, not descendants.
|
||||
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
|
||||
const char *name,
|
||||
llvm::StringRef name,
|
||||
bool omit_empty_base_classes) override;
|
||||
|
||||
// Lookup a child member given a name. This function will match member names
|
||||
|
@ -810,12 +810,12 @@ bool CompilerType::IsMeaninglessWithoutDynamicResolution() const {
|
||||
// matches can include base class names.
|
||||
|
||||
uint32_t
|
||||
CompilerType::GetIndexOfChildWithName(const char *name,
|
||||
CompilerType::GetIndexOfChildWithName(llvm::StringRef name,
|
||||
bool omit_empty_base_classes) const {
|
||||
if (IsValid() && name && name[0]) {
|
||||
if (IsValid() && !name.empty()) {
|
||||
if (auto type_system_sp = GetTypeSystem())
|
||||
return type_system_sp->GetIndexOfChildWithName(m_type, name,
|
||||
omit_empty_base_classes);
|
||||
omit_empty_base_classes);
|
||||
}
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user