https://gcc.gnu.org/g:1ca7a12807a7fa0d9c27a5c8c45fa99ac9e7e027

commit r15-2238-g1ca7a12807a7fa0d9c27a5c8c45fa99ac9e7e027
Author: Mark Harmstone <m...@harmstone.com>
Date:   Sat Jul 20 20:18:14 2024 +0100

    Output CodeView type information for rvalue references
    
    Translates DW_TAG_rvalue_reference_type DIEs into LF_POINTER types.
    
    gcc/
            * dwarf2codeview.cc (get_type_num_reference_type): Handle rvalue 
refs.
            (get_type_num_array_type): Add DW_TAG_rvalue_reference_type to 
switch.
            (get_type_num): Handle DW_TAG_rvalue_reference_type DIEs.
            * dwarf2codeview.h (CV_PTR_MODE_RVREF): Define.

Diff:
---
 gcc/dwarf2codeview.cc | 15 ++++++++++-----
 gcc/dwarf2codeview.h  |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index 23175204acd3..b16c6960f63e 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -2293,11 +2293,11 @@ get_type_num_pointer_type (dw_die_ref type, bool 
in_struct)
   return ct->num;
 }
 
-/* Process a DW_TAG_reference_type DIE, add a new LF_POINTER type, and return
-   its number.  */
+/* Process a DW_TAG_reference_type or DW_TAG_rvalue_reference_type DIE, add a
+   new LF_POINTER type, and return its number.  */
 
 static uint32_t
-get_type_num_reference_type (dw_die_ref type, bool in_struct)
+get_type_num_reference_type (dw_die_ref type, bool in_struct, bool rvref)
 {
   uint32_t base_type_num, byte_size;
   dw_die_ref base_type;
@@ -2318,7 +2318,7 @@ get_type_num_reference_type (dw_die_ref type, bool 
in_struct)
   ct->next = NULL;
   ct->kind = LF_POINTER;
   ct->lf_pointer.base_type = base_type_num;
-  ct->lf_pointer.attributes = CV_PTR_MODE_LVREF;
+  ct->lf_pointer.attributes = rvref ? CV_PTR_MODE_RVREF : CV_PTR_MODE_LVREF;
 
   if (byte_size == 4)
     ct->lf_pointer.attributes |= CV_PTR_NEAR32;
@@ -3064,6 +3064,7 @@ get_type_num_array_type (dw_die_ref type, bool in_struct)
        case DW_TAG_union_type:
        case DW_TAG_pointer_type:
        case DW_TAG_reference_type:
+       case DW_TAG_rvalue_reference_type:
          size = get_AT_unsigned (t, DW_AT_byte_size);
          break;
 
@@ -3192,7 +3193,11 @@ get_type_num (dw_die_ref type, bool in_struct, bool 
no_fwd_ref)
       break;
 
     case DW_TAG_reference_type:
-      num = get_type_num_reference_type (type, in_struct);
+      num = get_type_num_reference_type (type, in_struct, false);
+      break;
+
+    case DW_TAG_rvalue_reference_type:
+      num = get_type_num_reference_type (type, in_struct, true);
       break;
 
     case DW_TAG_const_type:
diff --git a/gcc/dwarf2codeview.h b/gcc/dwarf2codeview.h
index 7d4e3ab1db43..8ede1b295294 100644
--- a/gcc/dwarf2codeview.h
+++ b/gcc/dwarf2codeview.h
@@ -56,6 +56,7 @@ along with GCC; see the file COPYING3.  If not see
 #define CV_PTR_NEAR32          0x0a
 #define CV_PTR_64              0x0c
 #define CV_PTR_MODE_LVREF      0x20
+#define CV_PTR_MODE_RVREF      0x80
 
 /* LF_MODIFIER values.  */
 #define MOD_const              0x1

Reply via email to