[clang] [clang] Add clang::debug_info_type attribute for bitfields (PR #69104)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 15 10:37:39 PDT 2023


Endilll wrote:

> Does this issue not apply to other platforms?

As far as I understand, MS ABI forces compilers to insert padding between bitfields more often than Itanium. Probably because of that GCC and Clang are able to merge separate loads of bitfields into single load on Linux.

> I'd think maybe rather than adding an attribute to workaround MSVC's missing support - code could #ifdef in a way that's ABI compatible, maybe? (though I admit that's a subtle thing to get right & the cost for getting it wrong is significant)

It's technically possible to `#ifdef` this for Linux, but it's not going to work on Windows, because we have to show the compiler that bitfields have the same type (for Clang it's usually `unsigned`). Otherwise we get bad layouts and bad codegen, which is an unacceptable regression.

Even if we focus on Linux, I'd rather pay with lots of boilerplate in LLDB formatter (lower estimate is 4 lines per every single bitfield), than litter Clang headers with `#ifdef`s for the sake of debuggers.

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


More information about the cfe-commits mailing list