This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v6 07/11] Support DW_TAG_rvalue_reference type
- From: Keith Seitz <keiths at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 10 Mar 2017 12:04:42 -0800
- Subject: [PATCH v6 07/11] Support DW_TAG_rvalue_reference type
- Authentication-results: sourceware.org; auth=none
- References: <1489176286-27973-1-git-send-email-keiths@redhat.com>
Make gdb DWARF reader understand the DW_TAG_rvalue_reference type tag. Handling
of this tag is done in the existing read_tag_reference_type() function, to
which we add a new parameter representing the kind of reference type
(lvalue vs rvalue).
There are no changes to this patch from v5.
gdb/ChangeLog
PR gdb/14441
From Artemiy Volkov <artemiyv@acm.org>
* dwarf2read.c (process_die, read_type_die_1): Handle the
DW_TAG_rvalue_reference_type DIE.
(read_tag_reference_type): Add new parameter "refcode".
---
gdb/ChangeLog | 8 ++++++++
gdb/dwarf2read.c | 15 +++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 50fd34a..b95ea9e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -2,6 +2,14 @@
PR gdb/14441
From Artemiy Volkov <artemiyv@acm.org>
+ * dwarf2read.c (process_die, read_type_die_1): Handle the
+ DW_TAG_rvalue_reference_type DIE.
+ (read_tag_reference_type): Add new parameter "refcode".
+
+2017-MM-DD Keith Seitz <keiths@redhat.com>
+
+ PR gdb/14441
+ From Artemiy Volkov <artemiyv@acm.org>
* c-typeprint.c (c_print_type, c_type_print_varspec_prefix)
(c_type_print_modifier, c_type_print_varspec_suffix)
(c_type_print_base): Support printing rvalue reference types.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f3a8cc6..834dbc0 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8388,6 +8388,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_pointer_type:
case DW_TAG_ptr_to_member_type:
case DW_TAG_reference_type:
+ case DW_TAG_rvalue_reference_type:
case DW_TAG_string_type:
break;
@@ -14567,16 +14568,19 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, type, cu);
}
-/* Extract all information from a DW_TAG_reference_type DIE and add to
+/* Extract all information from a DW_TAG_{rvalue_,}reference_type DIE and add to
the user defined type vector. */
static struct type *
-read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu)
+read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu,
+ enum type_code refcode)
{
struct comp_unit_head *cu_header = &cu->header;
struct type *type, *target_type;
struct attribute *attr;
+ gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
+
target_type = die_type (die, cu);
/* The die_type call above may have already set the type for this DIE. */
@@ -14584,7 +14588,7 @@ read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu)
if (type)
return type;
- type = lookup_lvalue_reference_type (target_type);
+ type = lookup_reference_type (target_type, refcode);
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr)
{
@@ -19620,7 +19624,10 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
this_type = read_tag_ptr_to_member_type (die, cu);
break;
case DW_TAG_reference_type:
- this_type = read_tag_reference_type (die, cu);
+ this_type = read_tag_reference_type (die, cu, TYPE_CODE_REF);
+ break;
+ case DW_TAG_rvalue_reference_type:
+ this_type = read_tag_reference_type (die, cu, TYPE_CODE_RVALUE_REF);
break;
case DW_TAG_const_type:
this_type = read_tag_const_type (die, cu);
--
2.1.0