[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 10 08:06:57 PDT 2023


Endilll wrote:

It should be noted that after calling `FindNestedType` and successfully finding `MaskAndShiftConstants` in the example above, the following routine in my fork reports that `PointerIntPairInfo` has 2 enums instead of 1:
```cpp
uint32_t TypeSystemClang::GetNumMemberEnums(lldb::opaque_compiler_type_t type) {
  using EnumIt = clang::DeclContext::specific_decl_iterator<clang::EnumDecl>;
  if (!type)
    return 0;

  clang::QualType qual_type = RemoveWrappingTypes(GetCanonicalQualType(type));
  if (GetCompleteQualType(&getASTContext(), qual_type)) {
    const clang::RecordType *record_type =
        llvm::cast<clang::RecordType>(qual_type.getTypePtr());
    const clang::RecordDecl *record_decl = record_type->getDecl();
    assert(record_decl);
    auto result = std::distance(EnumIt(record_decl->decls_begin()), EnumIt(record_decl->decls_end()));
    return result;
  }
  return 0;
}
```
It's also available here: https://github.com/Endilll/llvm-project/blob/fbad2d1fd8e9c67e4de8a196df0cd1d1788fa990/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L7080-L7095

https://github.com/llvm/llvm-project/pull/68705


More information about the lldb-commits mailing list