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

David Majnemer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 19:12:27 PDT 2018


majnemer added a comment.

In https://reviews.llvm.org/D45174#1055125, @rsmith wrote:

> In https://reviews.llvm.org/D45174#1055048, @rsmith wrote:
>
> > 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.
>
>
> Yup, looks like:
>
>      if (!FoundBase) {
>   -    if (MDCUsesEBO && BaseDecl->isEmpty() &&
>   -        BaseLayout.getNonVirtualSize() == CharUnits::Zero()) {
>   +    if (MDCUsesEBO && BaseDecl->isEmpty()) {
>   +      assert(BaseLayout.getNonVirtualSize() == CharUnits::Zero());
>          BaseOffset = CharUnits::Zero();
>        } else {
>
>
> Zero test failures.


Yeah, I think this should be NFC for the MS ABI.



================
Comment at: ReleaseNotes.rst:68-72
+- Clang implements the proposed resolution of LWG issue 2358, along with the
+  `corresponding change to the Itanium C++ ABI
+  <https://github.com/itanium-cxx-abi/cxx-abi/pull/51>`_, which make classes
+  containing only unnamed non-zero-length bit-fields be considered non-empty.
+  This is an ABI break compared to prior Clang releases, but makes Clang
----------------
The "Clang" in the above paragraph has a lowercase "clang". I think we should choose a consistent capitalization.


Repository:
  rC Clang

https://reviews.llvm.org/D45174





More information about the cfe-commits mailing list