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

Juan Manuel Martinez CaamaƱo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 07:29:44 PDT 2023


jmmartinez added a comment.

In D144870#4202121 <https://reviews.llvm.org/D144870#4202121>, @probinson wrote:

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

Sadly, this is the case. `field_iterator` and the underlying `decl_iterator` used to implement it are forward iterators.

However, your comment made me realize that we could forward the `elements` array from `CGDebugInfoCollectRecordNormalFields`  which contains the already created debug-info for the previous fields. By using this array I could get pretty much the same effect. What do you think?

In D144870#4202121 <https://reviews.llvm.org/D144870#4202121>, @probinson wrote:

>   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.

(1) and (2): They do not get affected by the precense of the annonymous bitfield. Only sequences of bitfields get "squashed" in the same integer.


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