On Sat, Feb 18, 2017 at 12:17 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Fri, Feb 17, 2017 at 09:37:09PM -0500, Jason Merrill wrote: >> On Fri, Feb 17, 2017 at 1:52 PM, Jakub Jelinek <ja...@redhat.com> wrote: >> > - && die->die_tag != DW_TAG_member) >> > + && die->die_tag != DW_TAG_member >> > + && (die->die_tag != DW_TAG_variable || !class_scope_p >> > (die->die_parent))) >> >> How about we only check class_scope_p (die->die_parent), and don't >> consider the TAG at all? DW_TAG_member should only appear at class >> scope. > > That wouldn't work, because that would avoid adding linkage attributes to > methods. I could use: > && (die->die_tag == DW_TAG_subprogram || !class_scope_p > (die->die_parent)) > (not 100% sure if some other tag than those can make it here) > or > && ((die->die_tag != DW_TAG_member || die->die_tag != DW_TAG_variable) > || !class_scope_p (die->die_parent)) > or just use > && (!VAR_P (decl) || !class_scope_p (die->die_parent)) > or similar. > >> > - if (old_die->die_tag == DW_TAG_member) >> > + if (old_die->die_tag == DW_TAG_member >> > + || (dwarf_version >= 5 && class_scope_p >> > (old_die->die_parent))) >> >> Likewise here. > > This spot probably can be changed as you wrote, it is in gen_variable_die, > so methods shouldn't appear there.
Hmm, let's think about the behavior we want here. I don't see any reason not to put AT_linkage_name on a member DW_TAG_variable; I think the old behavior avoided putting it on DW_TAG_member just because it isn't defined for DW_TAG_member. So it's not clear to me that we need any changes in add_linkage_name or its call site. Jason