Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9d0b91

Browse files
authored
Merge pull request swiftlang#2259 from apple/lldb-Lift-GetIndexOfChildWithName-into-TypeSystemSwift-base-class-5.4
[lldb] Lift GetIndexOfChildWithName into TypeSystemSwift base class
2 parents 2a12a45 + 596ec47 commit f9d0b91

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

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

-15
Original file line numberDiff line numberDiff line change
@@ -7442,21 +7442,6 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
74427442
return 0;
74437443
}
74447444

7445-
/// Get the index of the child of "clang_type" whose name matches. This
7446-
/// function doesn't descend into the children, but only looks one
7447-
/// level deep and name matches can include base class names.
7448-
uint32_t
7449-
SwiftASTContext::GetIndexOfChildWithName(opaque_compiler_type_t type,
7450-
const char *name,
7451-
bool omit_empty_base_classes) {
7452-
VALID_OR_RETURN(UINT32_MAX);
7453-
7454-
std::vector<uint32_t> child_indexes;
7455-
size_t num_child_indexes = GetIndexOfChildMemberWithName(
7456-
type, name, omit_empty_base_classes, child_indexes);
7457-
return num_child_indexes == 1 ? child_indexes.front() : UINT32_MAX;
7458-
}
7459-
74607445
size_t SwiftASTContext::GetNumTemplateArguments(opaque_compiler_type_t type) {
74617446
if (!type)
74627447
return 0;

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

-6
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,6 @@ class SwiftASTContext : public TypeSystemSwift {
602602
bool &child_is_base_class, bool &child_is_deref_of_parent,
603603
ValueObject *valobj, uint64_t &language_flags) override;
604604

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

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

+10
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,13 @@ bool TypeSystemSwift::ShouldTreatScalarValueAsAddress(
101101
return Flags(GetTypeInfo(type, nullptr))
102102
.AnySet(eTypeInstanceIsPointer | eTypeIsReference);
103103
}
104+
105+
uint32_t
106+
TypeSystemSwift::GetIndexOfChildWithName(opaque_compiler_type_t type,
107+
const char *name,
108+
bool omit_empty_base_classes) {
109+
std::vector<uint32_t> child_indexes;
110+
size_t num_child_indexes = GetIndexOfChildMemberWithName(
111+
type, name, omit_empty_base_classes, child_indexes);
112+
return num_child_indexes == 1 ? child_indexes.front() : UINT32_MAX;
113+
}

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

+7
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 \p 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.

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

-7
Original file line numberDiff line numberDiff line change
@@ -2364,13 +2364,6 @@ CompilerType TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
23642364
ast_child_is_deref_of_parent, valobj, ast_language_flags));
23652365
}
23662366

2367-
uint32_t
2368-
TypeSystemSwiftTypeRef::GetIndexOfChildWithName(opaque_compiler_type_t type,
2369-
const char *name,
2370-
bool omit_empty_base_classes) {
2371-
return m_swift_ast_context->GetIndexOfChildWithName(
2372-
ReconstructType(type), name, omit_empty_base_classes);
2373-
}
23742367
size_t TypeSystemSwiftTypeRef::GetIndexOfChildMemberWithName(
23752368
opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes,
23762369
std::vector<uint32_t> &child_indexes) {

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

-3
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ class TypeSystemSwiftTypeRef : public TypeSystemSwift {
165165
uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
166166
bool &child_is_base_class, bool &child_is_deref_of_parent,
167167
ValueObject *valobj, uint64_t &language_flags) override;
168-
uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
169-
const char *name,
170-
bool omit_empty_base_classes) override;
171168
size_t
172169
GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
173170
const char *name, bool omit_empty_base_classes,

0 commit comments

Comments
 (0)