Skip to content

Commit dd399e9

Browse files
committed
Add CompilerType wrapper for GetDirectNestedTypeWithName
1 parent 80ba4f2 commit dd399e9

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ class CompilerType {
447447
bool omit_empty_base_classes,
448448
std::vector<uint32_t> &child_indexes) const;
449449

450+
CompilerType GetDirectNestedTypeWithName(llvm::StringRef name) const;
451+
450452
/// Return the number of template arguments the type has.
451453
/// If expand_pack is true, then variadic argument packs are automatically
452454
/// expanded to their supplied arguments. If it is false an argument pack

lldb/source/Symbol/CompilerType.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,15 @@ size_t CompilerType::GetIndexOfChildMemberWithName(
931931
return 0;
932932
}
933933

934+
CompilerType
935+
CompilerType::GetDirectNestedTypeWithName(llvm::StringRef name) const {
936+
if (IsValid() && !name.empty()) {
937+
if (auto type_system_sp = GetTypeSystem())
938+
return type_system_sp->GetDirectNestedTypeWithName(m_type, name);
939+
}
940+
return CompilerType();
941+
}
942+
934943
size_t CompilerType::GetNumTemplateArguments(bool expand_pack) const {
935944
if (IsValid()) {
936945
if (auto type_system_sp = GetTypeSystem())

lldb/source/Symbol/Type.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,9 +1176,8 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm,
11761176
CompilerType TypeImpl::FindDirectNestedType(llvm::StringRef name) {
11771177
if (name.empty())
11781178
return CompilerType();
1179-
auto type_system = GetTypeSystem(/*prefer_dynamic*/ false);
1180-
return type_system->GetDirectNestedTypeWithName(
1181-
m_static_type.GetOpaqueQualType(), name);
1179+
return GetCompilerType(/*prefer_dynamic=*/false)
1180+
.GetDirectNestedTypeWithName(name);
11821181
}
11831182

11841183
bool TypeMemberFunctionImpl::IsValid() {

0 commit comments

Comments
 (0)