Fix offset calculation routines in padding checker to avoid assertion errors described in the following issue: https://bugs.llvm.org/show_bug.cgi?id=50426.
The fields that are subojbects of zero size, marked with [[no_unique_address]] or empty bitfields will be excluded from the padding calculation routines.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This looks correct, thanks!
I think there are some weird rules with respect to [[no_unique_address]] on two consecutive fields when there's only one other field in the structure, eg.
struct S { char c; [[no_unique_address]] Empty e1, e2; };
will have a size of two bytes according to https://en.cppreference.com/w/cpp/language/attributes/no_unique_address.
It's probably worth a test case to see if we still calculate padding correctly in such cases but I don't insist.
Comment Actions
Added two tests that check whether we still calculate padding correctly for structs with [[no_unique_address]] on two consecutive fields