On Mon, Oct 24, 2016 at 02:34:04PM -0400, Jason Merrill wrote:
> On Mon, Oct 24, 2016 at 10:29 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> > This is another addition in DWARF5.  The patch emits these attributes
> > only for DW_TAG_subprogram for non-static ref-qualified member functions.
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> OK.

Thanks, committed.

> > We really should emit it also for DW_TAG_subroutine_type for PMF types,
> > the problem is that for FUNCTION_TYPE/METHOD_TYPE, dwarf2out.c uses
> > type_main_variant and get_qualified_type, neither of them understand
> > ref-qualifies.  I think we'd need to change get_qualified_type to use
> > some lang-hook which for C++ would also check the ref qualifiers, and then
> > for these two avoid type_main_variant and instead use get_qualified_type
> > to get the non-const/volatile/restrict etc. qualified one (and only then
> > we can use the decl_dwarf_attribute langhook to ask the FE whether the
> > attribute should be emitted).  Does that make sense, or do you have another
> > approach?
> 
> Can we pull out the ref-qualifier before we clobber the qualifiers on the 
> type?

We could handle it like "reverse" flag, basically replace bool reverse with
int that would hold bitmask of the flags, but I really don't understand how
the reverse flag works right now, I don't see how it can work reliably when
we use and rely on equate_type_number_to_die/lookup_type_die mechanism where
we store just a single DIE for each type.  We either equate it to a type
with DW_AT_endianity present, or not, and then the rest of the lookups will
be just random.  I'm afraid to make it work reliably we'd need to somehow
store both the "reverse" and "!reverse" DIEs for each type DIE, and
similarly for the & and && flags.

Or by changing get_qualified_die (in particular check_base_type) to use a
langhook, we could at least for DW_AT_{reference,rvalue_reference} just use
equate_type_number_to_die/lookup_type_die reliably (DW_AT_endianity issue
remains).

        Jakub

Reply via email to