[PATCH] D143347: [lldb][DWARF] Infer no_unique_address attribute

Pavel Kosov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 7 07:11:10 PDT 2023


kpdev42 added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:1483
+    // base with all fields having [[no_unique_address]] attribute.
+    for (auto it = base_classes.rbegin(); it != base_classes.rend(); ++it) {
+      clang::CXXRecordDecl *prev_base_decl =
----------------
kpdev42 wrote:
> Michael137 wrote:
> > Michael137 wrote:
> > > The main problem I still see with this is that if we have something like:
> > > ```
> > > struct A : C, B {
> > > 
> > > };
> > > ```
> > > 
> > > then we mark `C`'s fields as empty and leave `B` as is. This still leads to the same crash later on.
> > > 
> > > Perhaps we should mark we could check the size of the struct and decide based on that which one is the "empty" one
> > Interestingly there was a discussion on the DWARF mailing list about this some time ago: https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00880.html
> > 
> > There might be room to changing the emitted DWARF to make it easier to determine the empty structure. I will gauge opinions on this thread later today
> Unfortunately we cannot analyze record size, because it is always 1 for empty records, whether or not [[no_unique_address]] is used. However we still can analyze field offsets, I think. This what an updated patch does and it seems to handle more different cases
Yes, this will help a lot, however many people use older versions of clang compiler and also gcc. This fix might be useful for them so far


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143347



More information about the cfe-commits mailing list