This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Emit DWARF5 DW_AT_reference and DW_AT_rvalue_reference


On 10/24/2016 03:09 PM, Jakub Jelinek wrote:
On Mon, Oct 24, 2016 at 02:34:04PM -0400, Jason Merrill wrote:
On Mon, Oct 24, 2016 at 10:29 AM, Jakub Jelinek <jakub@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).

Yeah, I think that adding a langhook is the right way to go. The generic code clobbering C++ qualifiers is a frequent headache.

Jason



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]