This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type
- From: Artemiy Volkov <artemiyv at acm dot org>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 22 Feb 2016 23:03:13 -0800
- Subject: Re: [PATCH v2 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type
- Authentication-results: sourceware.org; auth=none
- References: <1450661481-31178-1-git-send-email-artemiyv at acm dot org> <1453229609-20159-1-git-send-email-artemiyv at acm dot org> <1453229609-20159-2-git-send-email-artemiyv at acm dot org> <56C763C2 dot 8090207 at redhat dot com>
On Fri, Feb 19, 2016 at 10:49:38AM -0800, Keith Seitz wrote:
[snip]
> > /* * Instruction-space delimited type. This is for Harvard architectures
> > which have separate instruction and data address spaces (and perhaps
> > others).
> > @@ -767,6 +775,10 @@ struct type
> >
> > struct type *reference_type;
> >
> > + /* * A C++ rvalue reference type added in C++0x. */
> > +
> > + struct type *rvalue_reference_type;
> > +
>
> Why is this new field necessary? AFAICT, it is used exactly the same way
> as the reference_type field above it, and whether a reference type is an
> rvalue type is encoded into the type code.
Do you suggest keeping only the lvalue version of the reference type and
then adjust its type code from TYPE_CODE_REF to TYPE_CODE_RVALUE_REF on
lookup_rvalue_reference_type()? It seems somewhat hacky to me. E.g. how
would we be able to create a struct type for a complex type involving a
T&&, such as a typedef of it?
>
> > /* * Variant chain. This points to a type that differs from this
> > one only in qualifiers and length. Currently, the possible
> > qualifiers are const, volatile, code-space, data-space, and
> > @@ -1229,6 +1241,7 @@ extern void allocate_gnat_aux_type (struct type *);
> > #define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
> > #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
> > #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
> > +#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
> > #define TYPE_CHAIN(thistype) (thistype)->chain
> > /* * Note that if thistype is a TYPEDEF type, you have to call check_typedef.
> > But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
>
> If struct type.rvalue_reference_type is superfluous, this is unneeded.
>
> Keith
>