[clang] [llvm] [DebugInfo] Emit DW_AT_const_value for constexpr array static members (PR #182442)

Shivam Kunwar via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 23:29:51 PST 2026


phyBrackets wrote:

> Getting an idea of size increase would be useful. (_Possibly_ limiting it to types where it would otherwise be impossible to get to by debuggers (e.g., integrals/floats))

@Michael137 Thanks for the idea, I ran some size comparison, on a synthetic file with 4 constexpr array static members (char[6], int[10], unsigned char[3], short[4]), `debug_info` grows by 61 bytes, basically just the raw array content plus a few bytes of block-length encoding. On an actual LLVM source file (CommandLine.cpp), the diff is literally zero, no constexpr array static members, no cost.

```
Synthetic (4 constexpr arrays):
   +23%     +61    .debug_info
  +1.2%      +2    .debug_abbrev

Real file (llvm/lib/Support/CommandLine.cpp):
   [ = ]       0    TOTAL
```

So the cost is purely pay-for-what-you-use, just the raw byted of whatever arrays exist, and in practice I think most TU's won't have any constexpr array static members, so the impact across a real build should be negligible. 

And limiting to types where debuggers can't otherwise recover the value, that make sense. Let me know if you'd prefer that.

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


More information about the llvm-commits mailing list