Examle:
struct test { char a; char b : 3; char c : 5; int d; int e : 27; };
Differential D151128
[clangd] Show size, offset and padding for bit fields on hover SR_team on May 22 2023, 11:24 AM. Authored by
Details Examle: struct test { char a; char b : 3; char c : 5; int d; int e : 27; };
Diff Detail Event TimelineComment Actions I do see the appeal of making this work for bitfields, but I think silently rounding offset/size/padding to whole bytes is pretty misleading. I don't see a great sweet-spot design, maybe you/others have ideas (or can explain why the rounding behavior in this patch is reasonable. Comment Actions We can store this fields in bits, and show in bytes on hover, when it's possible, and in bits, when showing in bytes impossible. Would such an implementation be good? This comment was removed by SR_team. Comment Actions Stores Offset, Size and Padding fields of HoverInfo in bits. When hover present bits converted to bytes, if possible. Examle: struct test { char a; char b : 3; char c : 5; int d; int e : 31; }; Comment Actions Sorry for the delay, I've been out on vacation. Behavior looks great and isn't too complicated :-)
Comment Actions
Land it for me, please. Name: SR_team, email: me@sr.team |
can you make this a separate (static) function rather than a lambda?
and the same for formatOffset()
(This is a long function as it is)