[all-commits] [llvm/llvm-project] 3c162b: [LLDB][NativePDB] Add non-overlapping fields in ro...
nerix via All-commits
all-commits at lists.llvm.org
Wed Nov 5 10:08:05 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3c162ba247d30c9d8113e66fe5d96e24156ce797
https://github.com/llvm/llvm-project/commit/3c162ba247d30c9d8113e66fe5d96e24156ce797
Author: nerix <nerixdev at outlook.de>
Date: 2025-11-05 (Wed, 05 Nov 2025)
Changed paths:
M lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
M lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp
M lldb/unittests/SymbolFile/NativePDB/UdtRecordCompleterTests.cpp
Log Message:
-----------
[LLDB][NativePDB] Add non-overlapping fields in root struct (#166243)
When anonymous unions are used in a struct or vice versa, their fields
are merged into the parent record when using PDB. LLDB tries to recreate
the original definition of the record _with_ the anonymous
unions/structs.
For tagged unions (like `std::optional`) where the tag followed the
anonymous union, the result was suboptimal:
```cpp
// input:
struct Foo {
union {
Bar b;
char c;
};
bool tag;
};
// reconstructed:
struct Foo {
union {
Bar b;
struct {
char c;
bool tag;
};
};
};
```
Once the algorithm is in some nested union, it can't get out.
In the above case, we can get to the correct reconstructed record if we
always add fields that don't overlap others in the root struct. So when
we see `tag`, we'll see that it comes after all other fields, so it's
possible to add it in the root `Foo`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list