clayborg added a comment.

A bit of history on laying out classes: layout used to be a problem before we 
were able to give all of the field offsets directly to clang to assist in 
laying out. The main issues were:

- #pragma pack directives are not in DWARF so we must use the 
DW_AT_data_member_location
- Some DWARF optimizations cause class definitions to be omitted and we can 
have a class A that inherits from class B but we have no real definition for 
class B, just a forward declaration. In this case we will create a class A that 
inherits from a class B that has nothing in it, but the field offsets will 
ensure we show all other instance variables of class A correctly. Furthermore, 
we have code that can detect when we have such a case and it can grab the right 
definition for class B when it is imported into another AST, such as when 
evaluating an expression. This will only happen if class B is in another shared 
library from class A, and if we do have debug info for class B.
- any other keywords or attributes such as [[no_unique_address]] that can 
affect layout that don't appear in DWARF.

It seems it would be a nice attribute to have add to DWARF in case the current 
solution affects things adversely.

I will let the expression parser experts comment on the viability of always 
setting "[[no_unique_address]]" on every field. Seems dangerous to me, but I 
will defer to expression experts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101237

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

Reply via email to