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. Jakub