[Lldb-commits] [lldb] [clang] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 1 04:35:02 PDT 2023
Michael137 wrote:
> One question I have here: where will the DW_TAG_variable get emitted for these `constexpr`? For actual static member variables we emit a single DW_TAG_variable in the file that declares the global variable, but for `constexpr` we won't be able to do this will we? Will we end up emitting a new copy each time someone include the header file? In that case we might end up with many global variables being defined in a linked executable that includes this header file more than once?
That's true, if defined in a header, we'll emit a `DW_TAG_variable` for the constant in each compile unit the header is included in. GCC does do the right thing and only emit the definition DIE in a single CU. We should probably do the same. Though not sure at which level. Possibly the DWARF linker?
https://github.com/llvm/llvm-project/pull/70639
More information about the lldb-commits
mailing list