DWARF: add DW_AT_location for global decls with DECL_VALUE_EXPR
In GNAT, we materialize renamings that cannot be described in standard
DWARF as synthetic variables that describe how to fetch the renamed
object. Look for "___XR" in gcc/ada/exp_dbug.ads for more details about
this convention.
In order to have a location for these variables in the debug info (GDB
requires it not to discard the variable) but also to avoid allocating
runtime space for them, we make these variable hold a DECL_VALUE_EXPR
tree. However, since GCC 7, the DWARF back-end no longer generates a
DW_AT_location attribute for those. This patch is an attempt to restore
this attribute.
gcc/
* dwarf2out.c (dwarf2out_late_global_decl): Add locations for
symbols that hold a DECL_VALUE_EXPR.
gcc/testsuite/
* debug12.adb, debug12.ads: New testcase.
From-SVN: r248792