[lld] [lldb] [NFC] Address more bit-field storage sizes (PR #140493)

Oliver Hunt via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 11:51:06 PDT 2025


================
@@ -99,15 +99,15 @@ class InputChunk {
   // the beginning of the output section this chunk was assigned to.
   int32_t outSecOff = 0;
 
-  uint8_t sectionKind : 3;
+  uint32_t sectionKind : 3;
----------------
ojhunt wrote:

Unfortunately I can :(

The MS ABI only packs bit-fields if they have the same storage size, e.g.

```cpp
struct S {
   bool b: 1;
   int    i: 1
};
```

is 8 bytes.

It's a large part of why we use preferred_type and unsigned bit-fields instead of just enum bit-fields.

This PR is the continuing series of fixing the existing cases where the storage types are wrong (per MS :D), so we can then enable the warning for this behavior, so that we can then just start using enums without risking silently terrible padding with MSVC

https://github.com/llvm/llvm-project/pull/140493


More information about the llvm-commits mailing list