[lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 14:51:51 PDT 2023


avl-llvm wrote:

> > Or maybe we can include the DW_AT_const_value in both places?
> 
> The ask to drop the constant off of the declaration comes from the DWARFParallelLinker work where it was causing non-deterministic output. But @dwblaikie @avl-llvm will know more about that

I do not have a strong opinion which variant is better : 1) remove DW_AT_const_value from DW_TAG_member and put DW_AT_const_value into newly created DW_TAG_variable(which does not have a location). or 2) always put  DW_AT_const_value in DW_TAG_member.

The problem which parallel DWARFLinker met is that DW_TAG_member from one compilation unit has DW_AT_const_value while the same DW_TAG_member from another compilation unit does not have DW_AT_const_value - https://github.com/llvm/llvm-project/pull/68721#issuecomment-1763409701.

If there is a solution when we could always put DW_AT_const_value into the DW_TAG_member (so that DW_TAG_member from different compile units have DW_AT_const_value) - then that would be also a good solution(and we would not need to create additional variable.)

Both solutions 1) and 2) are good for parallel DWARFLinker if they result in equal DWARF in different compile units.

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


More information about the cfe-commits mailing list