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

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to