Author: Michael Buch Date: 2025-05-12T17:32:26+01:00 New Revision: 74a588464c133447b2d644cee7910084f4f57065
URL: https://github.com/llvm/llvm-project/commit/74a588464c133447b2d644cee7910084f4f57065 DIFF: https://github.com/llvm/llvm-project/commit/74a588464c133447b2d644cee7910084f4f57065.diff LOG: [lldb][TypeSystemClang][NFC] Use GetNumBaseClasses in TypeSystemClang::GetNumChildren (#139552) `TypeSystemClang::GetNumBaseClasses` does exactly the same base-class accounting that we were doing in GetNumChildren. So re-use it. Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index d24f3726b1d25..28081e8f6b965 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -5355,33 +5355,9 @@ TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type, assert(record_decl); const clang::CXXRecordDecl *cxx_record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(record_decl); - if (cxx_record_decl) { - if (omit_empty_base_classes) { - // Check each base classes to see if it or any of its base classes - // contain any fields. This can help limit the noise in variable - // views by not having to show base classes that contain no members. - clang::CXXRecordDecl::base_class_const_iterator base_class, - base_class_end; - for (base_class = cxx_record_decl->bases_begin(), - base_class_end = cxx_record_decl->bases_end(); - base_class != base_class_end; ++base_class) { - const clang::CXXRecordDecl *base_class_decl = - llvm::cast<clang::CXXRecordDecl>( - base_class->getType() - ->getAs<clang::RecordType>() - ->getDecl()); - - // Skip empty base classes - if (!TypeSystemClang::RecordHasFields(base_class_decl)) - continue; - num_children++; - } - } else { - // Include all base classes - num_children += cxx_record_decl->getNumBases(); - } - } + num_children += + GetNumBaseClasses(cxx_record_decl, omit_empty_base_classes); num_children += std::distance(record_decl->field_begin(), record_decl->field_end()); } else _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits