[PATCH] D104097: [analyzer] Fix calculating offset for fields with an empty type

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 14 21:13:03 PDT 2021


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

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.


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

https://reviews.llvm.org/D104097



More information about the cfe-commits mailing list