[Lldb-commits] [PATCH] D101237: [lldb] Fix [[no_unique_address]] and libstdc++ 11's std::unique_ptr

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 26 14:59:20 PDT 2021


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



More information about the lldb-commits mailing list