[clang] [llvm] [DebugInfo] Emit DW_AT_bit_size for _BitInt types and others (PR #164372)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 22 06:53:02 PDT 2025
OCHyams wrote:
Breaking out of the inline comments - I've realised this patch doesn't always give us the expected `byte_size`. E.g. For `_BitInt(23)` GCC gives us:
```
0x000000a1: DW_TAG_base_type
DW_AT_byte_size (0x04)
DW_AT_encoding (DW_ATE_signed)
DW_AT_bit_size (0x17)
DW_AT_name ("_BitInt(23)")
```
Whereas this patch gives us:
```
0x00000042: DW_TAG_base_type
DW_AT_name ("_BitInt")
DW_AT_encoding (DW_ATE_signed)
DW_AT_byte_size (0x03)
DW_AT_bit_size (0x17)
```
Notice Clang says it's 3 bytes (because it's just finding the next byte size that 0x17 bits fits into) whereas GCC says it's 4 bytes (which reflects the `sizeof` size).
It's probably cleanest to pass both byte_size and bit_size down from the front end. I'll have a go at that later/tomorrow if others agree.
https://github.com/llvm/llvm-project/pull/164372
More information about the llvm-commits
mailing list