[clang] [llvm] [DebugInfo] Emit DW_AT_const_value for constexpr array static members (PR #182442)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 07:36:56 PST 2026
Michael137 wrote:
> but I think DW_AT_const_value helps in cases where it doesn't for eg if the variable is never odr used, the linker can discard it entirely, and there would be no memory location to read, and remote debugging where reading target memory is expensive or unavailable.
`[[gnu::used]]` can prevent the deduplication if desired and expensive target memory reads I'm personally not sure is a strong argument for adding more debug-info. It'd be good to have at least a known use-case of the constant being optimized out by Clang in a way which makes inspecting it in the debugger not work. I'm not claiming that there are no cases like that, but it'd be at least a valid motivator.
Re. GCC compatibility. Yes compatibility is a good goal, but in my opinion not if that's the only goal.
And yea some DWARF consumers probably do care about debug-info size increase, so running `bloaty <clang object files after patch> -- <clang object files before patch>` would be helpful. But probably best to hold off until people think this is something worth pursuing
https://github.com/llvm/llvm-project/pull/182442
More information about the cfe-commits
mailing list