On Mon, Oct 31, 2016 at 09:52:28AM -0400, Jason Merrill wrote: > On 10/14/2016 01:33 PM, Jakub Jelinek wrote: > >This also uses the infrastructure of the langhook patch I've sent earlier. > >It emits (if not strict dwarf) DW_AT_inline on explicit or implicit inline > >variables, and also tweaks dwarf2out so that for inline static data members > >we consider in-class declarations as definitions (emit DW_AT_linkage_name > >and no DW_AT_declaration) for them. > > Hmm, so there's no DW_TAG_variable for the inline static data member? That > seems problematic to me. The DWARF 3 convention that static data members > use DW_TAG_member seems rather misguided, since in fact they are variables. > Why did that change?
I had to bisect it, apparently it has been changed by myself in r145770, rationale in thread starting at https://gcc.gnu.org/ml/gcc-patches/2009-04/msg00039.html The current DWARF 5 wording is: "If the variable entry represents the defining declaration for a C++ static data member of a structure, class or union, the entry has a DW_AT_specification attribute, whose value is a reference to the debugging information entry representing the declaration of this data member. The referenced entry has the tag DW_TAG_member and will be a child of some class, structure or union type entry." on page 98 in DWARF5_Public_Review.pdf. And page 117 has in 5.7.6: "A data member (as opposed to a member function) is represented by a debugging information entry with the tag DW_TAG_member." So, using DW_TAG_variable as DW_TAG_{structure,class}_type children for the non-inline static data members would violate these two. C++17 is outside of the scope of DWARF5 I guess, so the question is to find out what do we want for those and agree on that with consumers and other producers. Incidentally, I've filed today a DWARF issue that Appendix A doesn't list for DW_TAG_member lots of attributes that are allowed for DW_TAG_variable and are useful for static data members. Some of them we want anyway, at least unless we agree on the non-inline static data members no longer be DW_TAG_member in the structure/class type and change the standard. In particular DW_AT_const_value and DW_AT_const_expr are desirable even for the static data members in C++98..14 (or non-inline ones in C++17). The rest, like DW_AT_linkage_name, DW_AT_location, etc. are generally more useful mainly for the inline ones. Jakub