[PATCH] D45174: non-zero-length bit-fields should make a class non-empty

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 16:35:42 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D45174#1054936, @rnk wrote:

> I've convinced myself that this is NFC for MS record layout because this is the only place we use RD->isEmpty() that matters:
>
>   if (!FoundBase) {
>     if (MDCUsesEBO && BaseDecl->isEmpty() &&
>         BaseLayout.getNonVirtualSize() == CharUnits::Zero()) {
>       BaseOffset = CharUnits::Zero();
>     } else {
>       // Otherwise, lay the base out at the end of the MDC.
>       BaseOffset = Size = Size.alignTo(Info.Alignment);
>     }
>   }
>   
>
> In particular, that `getNonVirtualSize()` check returns false when unnamed bitfields get involved.


I wonder if we can delete the `getNonVirtualSize()` check now -- I don't see any way that an empty class can have a nonzero nvsize except by this nonempty anonymous bit-fields situation.


Repository:
  rC Clang

https://reviews.llvm.org/D45174





More information about the cfe-commits mailing list