Skip to content

Commit 2c0bfc5

Browse files
committed
[lldb] Lift GetIndexOfChildWithName into TypeSystemSwift base class
(cherry picked from commit 09f00a2)
1 parent afc4bd0 commit 2c0bfc5

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7379,21 +7379,6 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
73797379
return 0;
73807380
}
73817381

7382-
/// Get the index of the child of "clang_type" whose name matches. This
7383-
/// function doesn't descend into the children, but only looks one
7384-
/// level deep and name matches can include base class names.
7385-
uint32_t
7386-
SwiftASTContext::GetIndexOfChildWithName(opaque_compiler_type_t type,
7387-
const char *name,
7388-
bool omit_empty_base_classes) {
7389-
VALID_OR_RETURN(UINT32_MAX);
7390-
7391-
std::vector<uint32_t> child_indexes;
7392-
size_t num_child_indexes = GetIndexOfChildMemberWithName(
7393-
type, name, omit_empty_base_classes, child_indexes);
7394-
return num_child_indexes == 1 ? child_indexes.front() : UINT32_MAX;
7395-
}
7396-
73977382
size_t SwiftASTContext::GetNumTemplateArguments(opaque_compiler_type_t type) {
73987383
if (!type)
73997384
return 0;

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,6 @@ class SwiftASTContext : public TypeSystemSwift {
600600
bool &child_is_base_class, bool &child_is_deref_of_parent,
601601
ValueObject *valobj, uint64_t &language_flags) override;
602602

603-
// Lookup a child given a name. This function will match base class names
604-
// and member names in "clang_type" only, not descendants.
605-
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
606-
const char *name,
607-
bool omit_empty_base_classes) override;
608-
609603
// Lookup a child member given a name. This function will match member names
610604
// only and will descend into "clang_type" children in search for the first
611605
// member in this class, or any base class that matches "name".

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,16 @@ bool TypeSystemSwift::ShouldTreatScalarValueAsAddress(
101101
return Flags(GetTypeInfo(type, nullptr))
102102
.AnySet(eTypeInstanceIsPointer | eTypeIsReference);
103103
}
104+
105+
/// Get the index of the child of "clang_type" whose name matches. This function
106+
/// doesn't descend into the children, but only looks one level deep and name
107+
/// matches can include base class names.
108+
uint32_t
109+
TypeSystemSwift::GetIndexOfChildWithName(opaque_compiler_type_t type,
110+
const char *name,
111+
bool omit_empty_base_classes) {
112+
std::vector<uint32_t> child_indexes;
113+
size_t num_child_indexes = GetIndexOfChildMemberWithName(
114+
type, name, omit_empty_base_classes, child_indexes);
115+
return num_child_indexes == 1 ? child_indexes.front() : UINT32_MAX;
116+
}

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ class TypeSystemSwift : public TypeSystem {
242242
}
243243
bool
244244
ShouldTreatScalarValueAsAddress(lldb::opaque_compiler_type_t type) override;
245+
246+
/// Lookup a child given a name. This function will match base class names
247+
/// and member names in "clang_type" only, not descendants.
248+
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
249+
const char *name,
250+
bool omit_empty_base_classes) override;
251+
245252
/// \}
246253
protected:
247254
/// Used in the logs.

0 commit comments

Comments
 (0)