Michael137 added a comment.

In D156774#4601767 <https://reviews.llvm.org/D156774#4601767>, @Endill wrote:

> In D156774#4601736 <https://reviews.llvm.org/D156774#4601736>, @Michael137 
> wrote:
>
>> What were your lldb commands when you tested this?
>
> `script import lldb; frame = lldb.thread.GetFrameAtIndex(0); 
> print(frame.variables[0].type.GetNumberOfMemberEnums())`
>
>> LLDB currently completes types lazily when it thinks it can. Does your new 
>> API still fail if you run `expr p` prior? (the idea is that that would 
>> trigger completion of the type and parse dwarf). If we dont ever call 
>> `GetFullCompilerType` on your type LLDB will never try to pull in the 
>> definition
>
> No amount of tinkering with `expr` makes `script 
> print(frame.variables[0].type.GetNumberOfMemberEnums())` output a non-zero 
> value.
> I tested this with the changes I uploaded here half an hour ago.



In D156774#4601767 <https://reviews.llvm.org/D156774#4601767>, @Endill wrote:

> In D156774#4601736 <https://reviews.llvm.org/D156774#4601736>, @Michael137 
> wrote:
>
>> What were your lldb commands when you tested this?
>
> `script import lldb; frame = lldb.thread.GetFrameAtIndex(0); 
> print(frame.variables[0].type.GetNumberOfMemberEnums())`
>
>> LLDB currently completes types lazily when it thinks it can. Does your new 
>> API still fail if you run `expr p` prior? (the idea is that that would 
>> trigger completion of the type and parse dwarf). If we dont ever call 
>> `GetFullCompilerType` on your type LLDB will never try to pull in the 
>> definition
>
> No amount of tinkering with `expr` makes `script 
> print(frame.variables[0].type.GetNumberOfMemberEnums())` output a non-zero 
> value.
> I tested this with the changes I uploaded here half an hour ago.

I think you may want to use `GetCompleteQualType` before iterating the 
DeclContext. That will make sure we complete the type by the time we look for 
the enums.

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


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