================
@@ -79,6 +79,35 @@ struct CIRRecordLowering final {
cir::ArrayType::get(cirGenTypes.convertTypeForMem(field->getType()),
0),
cir::RecordMemberKind::BitField);
}
+
+ /// An access unit can be narrower than the types its bit-fields were
+ /// declared with. In `struct { int a : 4; int b : 11; int c : 17; }` all
+ /// three share one 4-byte unit, but `c` is declared `int`, so the declared
+ /// data runs 15 bits past the unit:
+ ///
+ /// |-a-|----b-----|-------c--------|
+ /// |--------- 4-byte unit ---------|--- extent ---|
+ /// |------ c declared as int ------|
+ /// 0 4 15 32 47 bits
----------------
andykaylor wrote:
I don't understand this example. Since a, b, and c, all fit within a single
32-bit integer, there is no need for c to extend beyond the 32 bits. Why are we
recording anything here?
https://github.com/llvm/llvm-project/pull/220069
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits