[Lldb-commits] [lldb] [LLDB] Fix GetIndexOfChildMemberWithName to handle anonymous structs. (PR #138487)

via lldb-commits lldb-commits at lists.llvm.org
Mon May 5 21:45:26 PDT 2025


cmtice wrote:

> I'm not intimately familiar with this code, but I am somewhat suspicious of implementation.
> 
> Adding the number of base classes to the result makes sense to me. What surprises me is that this should be done only for fields with anonymous types. Can you explain why should the index of a field depend on whether its type is anonymous or not?

I knew that I needed to add it for anonymous structs; I wasn't sure about other cases. I've tested it more now, and it seems good to add it in all cases, so I will do that.
> 
> I am also surprised by the hardcoding of `omit_empty_base_classes` to true in the `GetNumBaseClasses` call. All of the other calls in this function pass the value from the argument. Why should this one be special?

I knew that in the case of anonymous structs we did not want to count empty base classes; since this line was for anonymous structs, I hard-coded it to make sure.  Now that I've updated the code to always add the number of base classes, I'm removing that hard-coding.



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


More information about the lldb-commits mailing list