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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits