[PATCH] D157332: [clang] Make init for empty no_unique_address fields a no-op write

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 12:36:57 PDT 2023


efriedma added a comment.

You can't, in general, check whether a type is stored in a no_unique_address field.  Consider the following; the bad store is in the constructor S2, but the relevant no_unique_address attribute doesn't even show up until the definition of S3.

  struct S {};
  S f();
  struct S2 : public S { S2();};
  S2::S2() : S(f()) {}
  struct S3 { int x; [[no_unique_address]] S2 y; S3(); };
  S3::S3() : x(1), y() {}

So we have to suppress all stores of empty types, whether or not we see a no_unique_address attribute.

Given that, I don't think the isDummy field is necessary; the important part is just whether the type is empty, and you can derive that directly from the type itself.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157332



More information about the cfe-commits mailing list