[PATCH] D144870: [Clang][DebugInfo] Emit zero size bitfields in the debug info to delimit bitfields in different allocation units.

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 17 07:04:54 PDT 2023


probinson added a comment.

Is it possible you need to look only at the immediately preceding field, and not iterate? For example,

  struct zero_bitfield {
    char a : 8;
    char : 0;
    char b : 8;
    char c : 8;
  };

If processing `b` sees the zero-length bitfield and does the needful, then when processing `c` it's sufficient to see that `b` is a preceding bitfield and know that the needful has been done.

I'm now also curious whether this ABI aspect affects non-bitfields. For example:

  struct non_adjacent_bitfields {
    char d;
    char : 0;
    char e;
    char f : 8;
  };

(1) Is `e` affected by the presence of the zero-length bitfield? (2) is `f` affected? (3) If the answers are "no" and "yes" then you do need to iterate looking for the zero-length bitfield, but otherwise I think it's sufficient to look only at the preceding field.

(Of course it's possible that finding the preceding field can be done only by iterating, but I'd hope that isn't necessary.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144870



More information about the cfe-commits mailing list