dwblaikie wrote:

> 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 we want to catch that.

Which variable are you discussing here, `val1` or `val2`?

For `val1`, we could not emit the constant value and only emit the real 
definition (there's /some/ risk here - non-ODR uses (or otherwise optimized 
away uses) of the variable may mean that the object file that defines the 
variable won't be linked in - so we'd miss the constant value)
For `val2` the variable is effectively `inline` and doesn't have a home, so 
there's no one place that we can emit the `DW_TAG_variable` out-of-line 
definition... 

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

Reply via email to