[PATCH] D59254: [RFC] Implementation of Clang randstruct

Connor Kuehl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 18:17:18 PDT 2019


connorkuehl added a comment.

In D59254#1429401 <https://reviews.llvm.org/D59254#1429401>, @jfb wrote:

> I find it easier to understand the code by looking at the tests. When you add tests, please make sure you test for:
>
> - Bit-fields
> - Zero-width bit-field


Hi JF,

Could you elaborate on what I should be testing for here regarding the zero-width bit-field? I'm not sure zero-width bit-fields are a concern since I think they're illegal. I just tried compiling a "hello world" program with a struct that has a zero width bit-field as one of its members and the compiler emitted an error pointing at it.

  error: named bit-field 'z' has zero width
          int z : 0;
              ^
  1 error generated.

For regular bit-fields the current implementation will keep adjacent bit-fields together and will preserve their original order but the overall group of adjacent bit-fields may relocate. My next revision will have a unit test describing and testing this behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59254





More information about the cfe-commits mailing list