diff mbox

[07/11,PR,gdb/14441] gdb: dwarf2read: support DW_AT_rvalue_reference type

Message ID 1450661481-31178-8-git-send-email-artemiyv@acm.org
State New
Headers show

Commit Message

Artemiy Volkov Dec. 21, 2015, 1:31 a.m. UTC
Make gdb DWARF reader understand DW_AT_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).

./ChangeLog:

2015-12-19  Artemiy Volkov  <artemiyv@acm.org>

        * gdb/dwarf2read.c (process_die): Handle the
        DW_AT_rvalue_reference_type DIE.
        (read_tag_reference_type): Likewise.
        (read_type_die_1): Likewise.
---
 gdb/dwarf2read.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 5c3d42c..1735626 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8294,6 +8294,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;
 
@@ -14320,16 +14321,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.  */
@@ -14337,7 +14341,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)
     {
@@ -19114,7 +19118,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);