[Lldb-commits] [PATCH] D156774: [lldb][DWARFASTParserClang] Resolve nested types when parsing structures

Vlad Serebrennikov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 20 07:01:09 PDT 2023


Endill added a comment.

In D156774#4601830 <https://reviews.llvm.org/D156774#4601830>, @Michael137 wrote:

> I think you may want to use `GetCompleteQualType` before iterating the DeclContext; that's how some of the other TypeSystemClang APIs do it. That will make sure we complete the type by the time we look for the enums.

I tried to incorporate this function into my version of `GetNumberOfMemberEnums`, but it didn't work out.

> E.g.,:
>
>   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);                                                                                           
>     return std::distance(EnumIt(record_decl->decls_begin()), EnumIt(record_decl->decls_end())); 
>   }                                                                                                                
>
> Will review it more thoroughly on tomorrow though

But your version actually works, returning 1! Thank you very much!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156774/new/

https://reviews.llvm.org/D156774



More information about the lldb-commits mailing list