Convert lvalue reference type check to general reference type check
authorArtemiy Volkov <artemiyv@acm.org>
Mon, 20 Mar 2017 20:47:54 +0000 (13:47 -0700)
committerKeith Seitz <keiths@redhat.com>
Mon, 20 Mar 2017 20:47:54 +0000 (13:47 -0700)
In almost all contexts (except for overload resolution rules and expression
semantics), lvalue and rvalue references are equivalent. That means that in all
but these cases we can replace a TYPE_CODE_REF check to a TYPE_IS_REFERENCE
check and, for switch statements, add a case label for a rvalue reference type
next to a case label for an lvalue reference type. This patch does exactly
that.

gdb/ChangeLog

PR gdb/14441
* aarch64-tdep.c (aarch64_type_align)
(aarch64_extract_return_value, aarch64_store_return_value): Change
lvalue reference type checks to general reference type checks.
* amd64-tdep.c (amd64_classify): Likewise.
* amd64-windows-tdep.c (amd64_windows_passed_by_integer_register):
Likewise.
* arm-tdep.c (arm_type_align, arm_extract_return_value)
(arm_store_return_value): Likewise.
* ax-gdb.c (gen_fetch, gen_cast): Likewise.
* c-typeprint.c (c_print_type): Likewise.
* c-varobj.c (adjust_value_for_child_access, c_value_of_variable)
(cplus_number_of_children, cplus_describe_child): Likewise.
* compile/compile-c-symbols.c (generate_vla_size): Likewise.
* completer.c (expression_completer): Likewise.
* cp-support.c (make_symbol_overload_list_adl_namespace):
Likewise.
* darwin-nat-info.c (info_mach_region_command): Likewise.
* dwarf2loc.c (entry_data_value_coerce_ref)
(value_of_dwarf_reg_entry): Likewise.
* eval.c (ptrmath_type_p, evaluate_subexp_standard)
(evaluate_subexp_for_address, evaluate_subexp_for_sizeof):
Likewise.
* findvar.c (extract_typed_address, store_typed_address):
Likewise.
* gdbtypes.c (rank_one_type): Likewise.
* hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise.
* infcall.c (value_arg_coerce): Likewise.
* language.c (pointer_type): Likewise.
* m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer):
Likewise.
* m88k-tdep.c (m88k_integral_or_pointer_p): Likewise.
* mn10300-tdep.c (mn10300_type_align): Likewise.
* msp430-tdep.c (msp430_push_dummy_call): Likewise.
* ppc-sysv-tdep.c (do_ppc_sysv_return_value)
(ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value):
Likewise.
* printcmd.c (print_formatted, x_command): Likewise.
* python/py-type.c (typy_get_composite, typy_template_argument):
Likewise.
* python/py-value.c (valpy_referenced_value)
(valpy_get_dynamic_type, value_has_field): Likewise.
* s390-linux-tdep.c (s390_function_arg_integer): Likewise.
* sparc-tdep.c (sparc_integral_or_pointer_p): Likewise.
* sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise.
* spu-tdep.c (spu_scalar_value_p): Likewise.
* symtab.c (lookup_symbol_aux): Likewise.
* typeprint.c (whatis_exp, print_type_scalar): Likewise.
* valarith.c (binop_types_user_defined_p, unop_user_defined_p):
Likewise.
* valops.c (value_cast_pointers, value_cast)
(value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp)
(value_struct_elt, value_struct_elt_bitpos)
(value_find_oload_method_list, find_overload_match)
(value_rtti_indirect_type): Likewise.
* valprint.c (val_print_scalar_type_p, generic_val_print):
Likewise.
* value.c (value_actual_type, value_as_address, unpack_long)
(pack_long, pack_unsigned_long, coerce_ref_if_computed)
(coerce_ref): Likewise.
* varobj.c (varobj_get_value_type): Likewise.

37 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/amd64-tdep.c
gdb/amd64-windows-tdep.c
gdb/arm-tdep.c
gdb/ax-gdb.c
gdb/c-varobj.c
gdb/compile/compile-c-symbols.c
gdb/completer.c
gdb/cp-support.c
gdb/darwin-nat-info.c
gdb/dwarf2loc.c
gdb/eval.c
gdb/findvar.c
gdb/gdbtypes.c
gdb/hppa-tdep.c
gdb/infcall.c
gdb/language.c
gdb/m32c-tdep.c
gdb/m88k-tdep.c
gdb/mn10300-tdep.c
gdb/msp430-tdep.c
gdb/ppc-sysv-tdep.c
gdb/printcmd.c
gdb/python/py-type.c
gdb/python/py-value.c
gdb/s390-linux-tdep.c
gdb/sparc-tdep.c
gdb/sparc64-tdep.c
gdb/spu-tdep.c
gdb/symtab.c
gdb/typeprint.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c
gdb/value.c
gdb/varobj.c

index dfedc83e4a479514df44c8e4640b23e1da3babd6..c5ebe6f6a7c536f46fb76a1b81ec02b207d09d44 100644 (file)
@@ -1,3 +1,67 @@
+2017-03-20  Artemiy Volkov  <artemiyv@acm.org>
+
+       PR gdb/14441
+       * aarch64-tdep.c (aarch64_type_align)
+       (aarch64_extract_return_value, aarch64_store_return_value): Change
+       lvalue reference type checks to general reference type checks.
+       * amd64-tdep.c (amd64_classify): Likewise.
+       * amd64-windows-tdep.c (amd64_windows_passed_by_integer_register):
+       Likewise.
+       * arm-tdep.c (arm_type_align, arm_extract_return_value)
+       (arm_store_return_value): Likewise.
+       * ax-gdb.c (gen_fetch, gen_cast): Likewise.
+       * c-typeprint.c (c_print_type): Likewise.
+       * c-varobj.c (adjust_value_for_child_access, c_value_of_variable)
+       (cplus_number_of_children, cplus_describe_child): Likewise.
+       * compile/compile-c-symbols.c (generate_vla_size): Likewise.
+       * completer.c (expression_completer): Likewise.
+       * cp-support.c (make_symbol_overload_list_adl_namespace):
+       Likewise.
+       * darwin-nat-info.c (info_mach_region_command): Likewise.
+       * dwarf2loc.c (entry_data_value_coerce_ref)
+       (value_of_dwarf_reg_entry): Likewise.
+       * eval.c (ptrmath_type_p, evaluate_subexp_standard)
+       (evaluate_subexp_for_address, evaluate_subexp_for_sizeof):
+       Likewise.
+       * findvar.c (extract_typed_address, store_typed_address):
+       Likewise.
+       * gdbtypes.c (rank_one_type): Likewise.
+       * hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise.
+       * infcall.c (value_arg_coerce): Likewise.
+       * language.c (pointer_type): Likewise.
+       * m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer):
+       Likewise.
+       * m88k-tdep.c (m88k_integral_or_pointer_p): Likewise.
+       * mn10300-tdep.c (mn10300_type_align): Likewise.
+       * msp430-tdep.c (msp430_push_dummy_call): Likewise.
+       * ppc-sysv-tdep.c (do_ppc_sysv_return_value)
+       (ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value):
+       Likewise.
+       * printcmd.c (print_formatted, x_command): Likewise.
+       * python/py-type.c (typy_get_composite, typy_template_argument):
+       Likewise.
+       * python/py-value.c (valpy_referenced_value)
+       (valpy_get_dynamic_type, value_has_field): Likewise.
+       * s390-linux-tdep.c (s390_function_arg_integer): Likewise.
+       * sparc-tdep.c (sparc_integral_or_pointer_p): Likewise.
+       * sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise.
+       * spu-tdep.c (spu_scalar_value_p): Likewise.
+       * symtab.c (lookup_symbol_aux): Likewise.
+       * typeprint.c (whatis_exp, print_type_scalar): Likewise.
+       * valarith.c (binop_types_user_defined_p, unop_user_defined_p):
+       Likewise.
+       * valops.c (value_cast_pointers, value_cast)
+       (value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp)
+       (value_struct_elt, value_struct_elt_bitpos)
+       (value_find_oload_method_list, find_overload_match)
+       (value_rtti_indirect_type): Likewise.
+       * valprint.c (val_print_scalar_type_p, generic_val_print):
+       Likewise.
+       * value.c (value_actual_type, value_as_address, unpack_long)
+       (pack_long, pack_unsigned_long, coerce_ref_if_computed)
+       (coerce_ref): Likewise.
+       * varobj.c (varobj_get_value_type): Likewise.
+
 2017-03-20  Artemiy Volkov  <artemiyv@acm.org>
 
        PR gdb/14441
index 801c03d5a0b5d205dc967cb0d53e299ea95eaa8f..e7d0844c76207eaf61a03128dfacb4e0fe4a14d5 100644 (file)
@@ -1096,6 +1096,7 @@ aarch64_type_align (struct type *t)
     case TYPE_CODE_RANGE:
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_CHAR:
     case TYPE_CODE_BOOL:
       return TYPE_LENGTH (t);
@@ -1805,7 +1806,7 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
           || TYPE_CODE (type) == TYPE_CODE_CHAR
           || TYPE_CODE (type) == TYPE_CODE_BOOL
           || TYPE_CODE (type) == TYPE_CODE_PTR
-          || TYPE_CODE (type) == TYPE_CODE_REF
+          || TYPE_IS_REFERENCE (type)
           || TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
       /* If the the type is a plain integer, then the access is
@@ -1943,7 +1944,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
           || TYPE_CODE (type) == TYPE_CODE_CHAR
           || TYPE_CODE (type) == TYPE_CODE_BOOL
           || TYPE_CODE (type) == TYPE_CODE_PTR
-          || TYPE_CODE (type) == TYPE_CODE_REF
+          || TYPE_IS_REFERENCE (type)
           || TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
       if (TYPE_LENGTH (type) <= X_REGISTER_SIZE)
index 98710fedc74534041ed9bcbca1b54c45e50aca94..9ff7dfc5134f123b1924623356b40e3bb3e57905 100644 (file)
@@ -679,7 +679,7 @@ amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
   if ((code == TYPE_CODE_INT || code == TYPE_CODE_ENUM
        || code == TYPE_CODE_BOOL || code == TYPE_CODE_RANGE
        || code == TYPE_CODE_CHAR
-       || code == TYPE_CODE_PTR || code == TYPE_CODE_REF)
+       || code == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
       && (len == 1 || len == 2 || len == 4 || len == 8))
     theclass[0] = AMD64_INTEGER;
 
index 73844a1f8f7198e638331f7f91840b30efb41630..f1acdb9bec2cb1d7a794af4b3b37490fb82bfb1d 100644 (file)
@@ -56,6 +56,7 @@ amd64_windows_passed_by_integer_register (struct type *type)
       case TYPE_CODE_CHAR:
       case TYPE_CODE_PTR:
       case TYPE_CODE_REF:
+      case TYPE_CODE_RVALUE_REF:
       case TYPE_CODE_STRUCT:
       case TYPE_CODE_UNION:
        return (TYPE_LENGTH (type) == 1
index 98d8e0e5bbe0fd02ad93c6b14988f258a560f434..09f7b3a635a98a948c077c31c687d5211fcec542 100644 (file)
@@ -3391,6 +3391,7 @@ arm_type_align (struct type *t)
     case TYPE_CODE_SET:
     case TYPE_CODE_RANGE:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_CHAR:
     case TYPE_CODE_BOOL:
       return TYPE_LENGTH (t);
@@ -7987,7 +7988,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
           || TYPE_CODE (type) == TYPE_CODE_CHAR
           || TYPE_CODE (type) == TYPE_CODE_BOOL
           || TYPE_CODE (type) == TYPE_CODE_PTR
-          || TYPE_CODE (type) == TYPE_CODE_REF
+          || TYPE_IS_REFERENCE (type)
           || TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
       /* If the type is a plain integer, then the access is
@@ -8192,7 +8193,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
           || TYPE_CODE (type) == TYPE_CODE_CHAR
           || TYPE_CODE (type) == TYPE_CODE_BOOL
           || TYPE_CODE (type) == TYPE_CODE_PTR
-          || TYPE_CODE (type) == TYPE_CODE_REF
+          || TYPE_IS_REFERENCE (type)
           || TYPE_CODE (type) == TYPE_CODE_ENUM)
     {
       if (TYPE_LENGTH (type) <= 4)
index 3587b5d392cbe3583876ac79da189706a0cc2e8a..01099f5abaff4dd5f7a21cc06c43dce362525887 100644 (file)
@@ -491,6 +491,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
     {
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_ENUM:
     case TYPE_CODE_INT:
     case TYPE_CODE_CHAR:
@@ -1000,6 +1001,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
     {
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       /* It's implementation-defined, and I'll bet this is what GCC
          does.  */
       break;
index 01d52ce2a9ac8a1c4e207ea980e94be65ce97eaa..a5793e58639c18bbb5963aa094791972af457300 100644 (file)
@@ -78,7 +78,7 @@ adjust_value_for_child_access (struct value **value,
      to us, is already supposed to be
      reference-stripped.  */
 
-  gdb_assert (TYPE_CODE (*type) != TYPE_CODE_REF);
+  gdb_assert (!TYPE_IS_REFERENCE (*type));
 
   /* Pointers to structures are treated just like
      structures when accessing children.  Don't
@@ -488,7 +488,7 @@ c_value_of_variable (const struct varobj *var,
   struct type *type = get_type (var);
 
   /* Strip top-level references.  */
-  while (TYPE_CODE (type) == TYPE_CODE_REF)
+  while (TYPE_IS_REFERENCE (type))
     type = check_typedef (TYPE_TARGET_TYPE (type));
 
   switch (TYPE_CODE (type))
@@ -580,7 +580,7 @@ cplus_number_of_children (const struct varobj *var)
       if (opts.objectprint)
         {
           value = var->value;
-          lookup_actual_type = (TYPE_CODE (var->type) == TYPE_CODE_REF
+          lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
                                || TYPE_CODE (var->type) == TYPE_CODE_PTR);
         }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
@@ -617,7 +617,7 @@ cplus_number_of_children (const struct varobj *var)
          const struct varobj *parent = var->parent;
 
          value = parent->value;
-         lookup_actual_type = (TYPE_CODE (parent->type) == TYPE_CODE_REF
+         lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
                                || TYPE_CODE (parent->type) == TYPE_CODE_PTR);
         }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
@@ -722,7 +722,7 @@ cplus_describe_child (const struct varobj *parent, int index,
 
   var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent;
   if (opts.objectprint)
-    lookup_actual_type = (TYPE_CODE (var->type) == TYPE_CODE_REF
+    lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
                          || TYPE_CODE (var->type) == TYPE_CODE_PTR);
   value = var->value;
   type = varobj_get_value_type (var);
index 9282cfc02515447f8c4ea67848c8d06b4512bbbd..15e1d6de8c484bf51df3901a8de21a9dcd45728f 100644 (file)
@@ -593,7 +593,7 @@ generate_vla_size (struct compile_c_instance *compiler,
 {
   type = check_typedef (type);
 
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     type = check_typedef (TYPE_TARGET_TYPE (type));
 
   switch (TYPE_CODE (type))
index c22800f1f0d9216ec57e97c75e8395bc21eae143..45adc627dc44419647e35e3d07e410948fafb0a2 100644 (file)
@@ -611,8 +611,7 @@ expression_completer (struct cmd_list_element *ignore,
       for (;;)
        {
          type = check_typedef (type);
-         if (TYPE_CODE (type) != TYPE_CODE_PTR
-             && TYPE_CODE (type) != TYPE_CODE_REF)
+         if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
            break;
          type = TYPE_TARGET_TYPE (type);
        }
index b1b96c8f0577ba21b99c5133ca923aa881abb927..5704466c923bd3800a913c3cd040805e1b487929 100644 (file)
@@ -1242,7 +1242,7 @@ make_symbol_overload_list_adl_namespace (struct type *type,
   int i, prefix_len;
 
   while (TYPE_CODE (type) == TYPE_CODE_PTR
-        || TYPE_CODE (type) == TYPE_CODE_REF
+        || TYPE_IS_REFERENCE (type)
          || TYPE_CODE (type) == TYPE_CODE_ARRAY
          || TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
     {
index 1c54a44ab42e386234eb02853b5136884c75f5d0..91bc5b3d542821171a3b0fa7af5ccc1fde7b40cf 100644 (file)
@@ -731,7 +731,7 @@ info_mach_region_command (char *exp, int from_tty)
 
   expression_up expr = parse_expression (exp);
   val = evaluate_expression (expr.get ());
-  if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (value_type (val)))
     {
       val = value_ind (val);
     }
index bc7665f61e38ea541b3efe9cdf6d16165cae3133..93c45a7191d20a9428e4a117367797530921a783 100644 (file)
@@ -1348,7 +1348,7 @@ entry_data_value_coerce_ref (const struct value *value)
   struct type *checked_type = check_typedef (value_type (value));
   struct value *target_val;
 
-  if (TYPE_CODE (checked_type) != TYPE_CODE_REF)
+  if (!TYPE_IS_REFERENCE (checked_type))
     return NULL;
 
   target_val = (struct value *) value_computed_closure (value);
@@ -1423,7 +1423,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
      TYPE_CODE_REF with non-entry data value would give current value - not the
      entry value.  */
 
-  if (TYPE_CODE (checked_type) != TYPE_CODE_REF
+  if (!TYPE_IS_REFERENCE (checked_type)
       || TYPE_TARGET_TYPE (checked_type) == NULL)
     return outer_val;
 
index 61d8d195b18452642620b1db27f8740f05125bc3..2a39774cfd979e303c6ddaede28e6f1f01a7b328 100644 (file)
@@ -620,7 +620,7 @@ static int
 ptrmath_type_p (const struct language_defn *lang, struct type *type)
 {
   type = check_typedef (type);
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     type = TYPE_TARGET_TYPE (type);
 
   switch (TYPE_CODE (type))
@@ -2491,7 +2491,7 @@ evaluate_subexp_standard (struct type *expect_type,
        {
          type = check_typedef (value_type (arg1));
          if (TYPE_CODE (type) == TYPE_CODE_PTR
-             || TYPE_CODE (type) == TYPE_CODE_REF
+             || TYPE_IS_REFERENCE (type)
          /* In C you can dereference an array to get the 1st elt.  */
              || TYPE_CODE (type) == TYPE_CODE_ARRAY
            )
@@ -2769,7 +2769,7 @@ evaluate_subexp_standard (struct type *expect_type,
            {
              struct type *type = value_type (result);
 
-             if (TYPE_CODE (check_typedef (type)) != TYPE_CODE_REF)
+             if (!TYPE_IS_REFERENCE (type))
                {
                  type = lookup_lvalue_reference_type (type);
                  result = allocate_value (type);
@@ -2872,7 +2872,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
 
       /* C++: The "address" of a reference should yield the address
        * of the object pointed to.  Let value_addr() deal with it.  */
-      if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_REF)
+      if (TYPE_IS_REFERENCE (SYMBOL_TYPE (var)))
        goto default_case;
 
       (*pos) += 4;
@@ -2911,7 +2911,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
        {
          struct type *type = check_typedef (value_type (x));
 
-         if (TYPE_CODE (type) == TYPE_CODE_REF)
+         if (TYPE_IS_REFERENCE (type))
            return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
                               not_lval);
          else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
@@ -3001,7 +3001,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
       val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
       type = check_typedef (value_type (val));
       if (TYPE_CODE (type) != TYPE_CODE_PTR
-         && TYPE_CODE (type) != TYPE_CODE_REF
+         && !TYPE_IS_REFERENCE (type)
          && TYPE_CODE (type) != TYPE_CODE_ARRAY)
        error (_("Attempt to take contents of a non-pointer value."));
       type = TYPE_TARGET_TYPE (type);
@@ -3073,7 +3073,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
      the size of the referenced type."  */
   type = check_typedef (type);
   if (exp->language_defn->la_language == language_cplus
-      && TYPE_CODE (type) == TYPE_CODE_REF)
+      && (TYPE_IS_REFERENCE (type)))
     type = check_typedef (TYPE_TARGET_TYPE (type));
   return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
 }
index 80c709a9861f329dc940eb1c298eee063ac810f8..ed4d5c1266c9de069981b306bc8229ae5fb02350 100644 (file)
@@ -169,8 +169,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
 CORE_ADDR
 extract_typed_address (const gdb_byte *buf, struct type *type)
 {
-  if (TYPE_CODE (type) != TYPE_CODE_PTR
-      && TYPE_CODE (type) != TYPE_CODE_REF)
+  if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
     internal_error (__FILE__, __LINE__,
                    _("extract_typed_address: "
                    "type is not a pointer or reference"));
@@ -242,8 +241,7 @@ store_unsigned_integer (gdb_byte *addr, int len,
 void
 store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
 {
-  if (TYPE_CODE (type) != TYPE_CODE_PTR
-      && TYPE_CODE (type) != TYPE_CODE_REF)
+  if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
     internal_error (__FILE__, __LINE__,
                    _("store_typed_address: "
                    "type is not a pointer or reference"));
index 60cef682aa4127cb82a93b59be9a86c97fe6bf61..defc00d34e54110f3709d6177b2c11dacbb0dd8b 100644 (file)
@@ -3622,10 +3622,11 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
 
   /* See through references, since we can almost make non-references
      references.  */
-  if (TYPE_CODE (arg) == TYPE_CODE_REF)
+
+  if (TYPE_IS_REFERENCE (arg))
     return (sum_ranks (rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL),
                        REFERENCE_CONVERSION_BADNESS));
-  if (TYPE_CODE (parm) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (parm))
     return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL),
                        REFERENCE_CONVERSION_BADNESS));
   if (overload_debug)
index c0ac6aeb21ea9dbfa4b66bd3738b9ef66a787599..a5053c6868d541c9c2a80dce122bf035c1f6ba86 100644 (file)
@@ -895,6 +895,7 @@ hppa64_integral_or_pointer_p (const struct type *type)
       }
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       return (TYPE_LENGTH (type) == 8);
     default:
       break;
index 713738ee8b64126e2f7ac7a2aa988b773e05feef..38335a799627c491826c41f3191cead06a223243 100644 (file)
@@ -157,10 +157,11 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       {
        struct value *new_value;
 
-       if (TYPE_CODE (arg_type) == TYPE_CODE_REF)
+       if (TYPE_IS_REFERENCE (arg_type))
          return value_cast_pointers (type, arg, 0);
 
        /* Cast the value to the reference's target type, and then
index 31c5c591ab754b3d51d40895fd8a61eac8b0e91e..119c07ecb67599876a0d0463833c6bb114b20473 100644 (file)
@@ -409,8 +409,7 @@ language_info (int quietly)
 int
 pointer_type (struct type *type)
 {
-  return TYPE_CODE (type) == TYPE_CODE_PTR ||
-    TYPE_CODE (type) == TYPE_CODE_REF;
+  return TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
 }
 
 \f
index d08b2633a1e36319c11718a3cbcad9000b2080f9..737637299f7c60fdda9ef0ebbf1916989a55eb88 100644 (file)
@@ -2011,7 +2011,7 @@ m32c_reg_arg_type (struct type *type)
   return (code == TYPE_CODE_INT
          || code == TYPE_CODE_ENUM
          || code == TYPE_CODE_PTR
-         || code == TYPE_CODE_REF
+         || TYPE_IS_REFERENCE (type)
          || code == TYPE_CODE_BOOL
          || code == TYPE_CODE_CHAR);
 }
@@ -2433,8 +2433,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   enum type_code target_code;
-  gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
-             TYPE_CODE (type) == TYPE_CODE_REF);
+  gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
 
   target_code = TYPE_CODE (TYPE_TARGET_TYPE (type));
 
@@ -2513,8 +2512,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
   CORE_ADDR ptr;
   enum type_code target_code;
 
-  gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
-             TYPE_CODE (type) == TYPE_CODE_REF);
+  gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
 
   ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
 
index fb7cf8bc844d33059b0c24c7f5760a256d13e2de..6ae95901b349ce1e1942411c074f100274919d42 100644 (file)
@@ -161,6 +161,7 @@ m88k_integral_or_pointer_p (const struct type *type)
       return 1;
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       {
        /* Allow only 32-bit pointers.  */
        return (TYPE_LENGTH (type) == 4);
index 5f5d5ca87b811d66da272036a515210cf2f17134..38356e541d19d072fbb39da4e46b20b6b0f4e1bf 100644 (file)
@@ -96,6 +96,7 @@ mn10300_type_align (struct type *type)
     case TYPE_CODE_FLT:
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       return TYPE_LENGTH (type);
 
     case TYPE_CODE_COMPLEX:
index 6297b58f756153fd72239f607a6de11e84d2006a..75329dfcc5ed94fff19639db4db21dd0874d0e96 100644 (file)
@@ -760,7 +760,7 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
                  if (code_model == MSP_LARGE_CODE_MODEL
                      && (TYPE_CODE (arg_type) == TYPE_CODE_PTR
-                         || TYPE_CODE (arg_type) == TYPE_CODE_REF
+                         || TYPE_IS_REFERENCE (arg_type)
                          || TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
                          || TYPE_CODE (arg_type) == TYPE_CODE_UNION))
                    {
index ecae6363e3ae0a388bc5294aade5590c4b432d18..c1778f2ef06dfee18f0631e32477a201e8d67dbf 100644 (file)
@@ -806,7 +806,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
            || TYPE_CODE (type) == TYPE_CODE_CHAR
            || TYPE_CODE (type) == TYPE_CODE_BOOL
            || TYPE_CODE (type) == TYPE_CODE_PTR
-           || TYPE_CODE (type) == TYPE_CODE_REF
+           || TYPE_IS_REFERENCE (type)
            || TYPE_CODE (type) == TYPE_CODE_ENUM)
           && TYPE_LENGTH (type) <= tdep->wordsize)
     {
@@ -1494,7 +1494,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
            || TYPE_CODE (type) == TYPE_CODE_BOOL
            || TYPE_CODE (type) == TYPE_CODE_CHAR
            || TYPE_CODE (type) == TYPE_CODE_PTR
-           || TYPE_CODE (type) == TYPE_CODE_REF)
+           || TYPE_IS_REFERENCE (type))
           && TYPE_LENGTH (type) <= tdep->wordsize)
     {
       ULONGEST word = 0;
@@ -2000,8 +2000,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 
   /* All pointers live in r3.  */
-  if (TYPE_CODE (valtype) == TYPE_CODE_PTR
-      || TYPE_CODE (valtype) == TYPE_CODE_REF)
+  if (TYPE_CODE (valtype) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (valtype))
     {
       int regnum = tdep->ppc_gp0_regnum + 3;
 
index dab4f53b373662de170f8c52ae105673491ada3b..e4a35a7b40d8fe0542f63f0973d598e71d8b308f 100644 (file)
@@ -1691,7 +1691,7 @@ x_command (char *exp, int from_tty)
       if (from_tty)
        *exp = 0;
       val = evaluate_expression (expr.get ());
-      if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
+      if (TYPE_IS_REFERENCE (value_type (val)))
        val = coerce_ref (val);
       /* In rvalue contexts, such as this, functions are coerced into
          pointers to functions.  This makes "x/i main" work.  */
index c063d2c4438ad44dfec34b0c04dbd8f396353570..f0710061f748779d6b0150b4b9a89d1ef5a734bc 100644 (file)
@@ -460,8 +460,7 @@ typy_get_composite (struct type *type)
        }
       END_CATCH
 
-      if (TYPE_CODE (type) != TYPE_CODE_PTR
-         && TYPE_CODE (type) != TYPE_CODE_REF)
+      if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
        break;
       type = TYPE_TARGET_TYPE (type);
     }
@@ -921,7 +920,7 @@ typy_template_argument (PyObject *self, PyObject *args)
   TRY
     {
       type = check_typedef (type);
-      if (TYPE_CODE (type) == TYPE_CODE_REF)
+      if (TYPE_IS_REFERENCE (type))
        type = check_typedef (TYPE_TARGET_TYPE (type));
     }
   CATCH (except, RETURN_MASK_ALL)
index fc42197b5013eab66162323878bcc3d9c52ba33d..bb42e8b88e65486ca2b3e38fef5e4cc18d5e9321 100644 (file)
@@ -217,6 +217,7 @@ valpy_referenced_value (PyObject *self, PyObject *args)
           res_val = value_ind (self_val);
           break;
         case TYPE_CODE_REF:
+        case TYPE_CODE_RVALUE_REF:
           res_val = coerce_ref (self_val);
           break;
         default:
@@ -363,8 +364,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
       type = value_type (val);
       type = check_typedef (type);
 
-      if (((TYPE_CODE (type) == TYPE_CODE_PTR)
-          || (TYPE_CODE (type) == TYPE_CODE_REF))
+      if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
          && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
        {
          struct value *target;
@@ -1054,7 +1054,7 @@ enum valpy_opcode
 
 /* If TYPE is a reference, return the target; otherwise return TYPE.  */
 #define STRIP_REFERENCE(TYPE) \
-  ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
+  (TYPE_IS_REFERENCE (TYPE) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
 
 /* Helper for valpy_binop.  Returns a value object which is the result
    of applying the operation specified by OPCODE to the given
index 2af2c7a3139d18a2d0e106be2cbe0bfacbe491ab..55129d81f4c5cb0dc634ff83b8ba6a8a92209b00 100644 (file)
@@ -3104,7 +3104,7 @@ s390_function_arg_integer (struct type *type)
       || code == TYPE_CODE_CHAR
       || code == TYPE_CODE_BOOL
       || code == TYPE_CODE_PTR
-      || code == TYPE_CODE_REF)
+      || TYPE_IS_REFERENCE (type))
     return 1;
 
   return ((code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT)
index b605da7cbaf7d0d5db7b74731905a4fef86842aa..d346aec5f9cd5628d3c47023654f678398c897f1 100644 (file)
@@ -227,6 +227,7 @@ sparc_integral_or_pointer_p (const struct type *type)
       return (len == 1 || len == 2 || len == 4 || len == 8);
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       /* Allow either 32-bit or 64-bit pointers.  */
       return (len == 4 || len == 8);
     default:
index 43beffb4b3a226a90ea4cdc817e3f22415e8a823..fae41ef5daf1a6cadde5e165e1dda8d58ba6ea02 100644 (file)
@@ -68,6 +68,7 @@ sparc64_integral_or_pointer_p (const struct type *type)
       return 1;
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       {
        int len = TYPE_LENGTH (type);
        gdb_assert (len == 8);
index 70d7f6fa44ef0aebb8cb0c82616c07ce47485448..cd8b64d53952f2802b6618f6223bcc84189872df 100644 (file)
@@ -1339,6 +1339,7 @@ spu_scalar_value_p (struct type *type)
     case TYPE_CODE_BOOL:
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       return TYPE_LENGTH (type) <= 16;
 
     default:
index c0fd0fd4d5b2143be71a443e94577acd808c7fce..cc2f4001e0db43309edbde25dbb138f3fe2a7ee5 100644 (file)
@@ -1989,8 +1989,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
          /* I'm not really sure that type of this can ever
             be typedefed; just be safe.  */
          t = check_typedef (t);
-         if (TYPE_CODE (t) == TYPE_CODE_PTR
-             || TYPE_CODE (t) == TYPE_CODE_REF)
+         if (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
            t = TYPE_TARGET_TYPE (t);
 
          if (TYPE_CODE (t) != TYPE_CODE_STRUCT
index a22c6fba340d5b1347c4053c9aba8858abb7adff..fc687d3fd50a10008931f6dd9883b38cb6f8597f 100644 (file)
@@ -453,8 +453,7 @@ whatis_exp (char *exp, int show)
   get_user_print_options (&opts);
   if (opts.objectprint)
     {
-      if (((TYPE_CODE (type) == TYPE_CODE_PTR)
-          || (TYPE_CODE (type) == TYPE_CODE_REF))
+      if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
          && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
         real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
       else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
@@ -571,6 +570,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
     case TYPE_CODE_METHODPTR:
     case TYPE_CODE_METHOD:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_NAMESPACE:
       error (_("internal error: unhandled type in print_type_scalar"));
       break;
index 72982624d576782cd1098e19a06a9f2c334977cf..985233c557901ccf1c43acf076a85939a0436469 100644 (file)
@@ -232,11 +232,11 @@ binop_types_user_defined_p (enum exp_opcode op,
     return 0;
 
   type1 = check_typedef (type1);
-  if (TYPE_CODE (type1) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type1))
     type1 = check_typedef (TYPE_TARGET_TYPE (type1));
 
   type2 = check_typedef (type2);
-  if (TYPE_CODE (type2) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type2))
     type2 = check_typedef (TYPE_TARGET_TYPE (type2));
 
   return (TYPE_CODE (type1) == TYPE_CODE_STRUCT
@@ -270,7 +270,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
   if (op == UNOP_ADDR)
     return 0;
   type1 = check_typedef (value_type (arg1));
-  if (TYPE_CODE (type1) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type1))
     type1 = check_typedef (TYPE_TARGET_TYPE (type1));
   return TYPE_CODE (type1) == TYPE_CODE_STRUCT;
 }
index 21f4008b9017f5fe080aa7b05995d376cbd91fd0..93ae6cf807627124949c59a33a2f95b1be5c29f2 100644 (file)
@@ -318,7 +318,7 @@ value_cast_pointers (struct type *type, struct value *arg2,
     {
       struct value *v2;
 
-      if (TYPE_CODE (type2) == TYPE_CODE_REF)
+      if (TYPE_IS_REFERENCE (type2))
        v2 = coerce_ref (arg2);
       else
        v2 = value_ind (arg2);
@@ -361,24 +361,20 @@ value_cast (struct type *type, struct value *arg2)
   if (value_type (arg2) == type)
     return arg2;
 
-  code1 = TYPE_CODE (check_typedef (type));
-
   /* Check if we are casting struct reference to struct reference.  */
-  if (code1 == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (check_typedef (type)))
     {
       /* We dereference type; then we recurse and finally
          we generate value of the given reference.  Nothing wrong with 
         that.  */
       struct type *t1 = check_typedef (type);
       struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
-      struct value *val =  value_cast (dereftype, arg2);
+      struct value *val = value_cast (dereftype, arg2);
 
       return value_ref (val, TYPE_CODE (t1));
     }
 
-  code2 = TYPE_CODE (check_typedef (value_type (arg2)));
-
-  if (code2 == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (check_typedef (value_type (arg2))))
     /* We deref the value and then do the cast.  */
     return value_cast (type, coerce_ref (arg2)); 
 
@@ -389,7 +385,7 @@ value_cast (struct type *type, struct value *arg2)
 
   /* You can't cast to a reference type.  See value_cast_pointers
      instead.  */
-  gdb_assert (code1 != TYPE_CODE_REF);
+  gdb_assert (!TYPE_IS_REFERENCE (type));
 
   /* A cast to an undetermined-length array_type, such as 
      (TYPE [])OBJECT, is treated like a cast to (TYPE [N])OBJECT,
@@ -592,8 +588,8 @@ value_reinterpret_cast (struct type *type, struct value *arg)
   dest_type = type;
 
   /* If we are casting to a reference type, transform
-     reinterpret_cast<T&>(V) to *reinterpret_cast<T*>(&V).  */
-  if (TYPE_CODE (real_type) == TYPE_CODE_REF)
+     reinterpret_cast<T&[&]>(V) to *reinterpret_cast<T*>(&V).  */
+  if (TYPE_IS_REFERENCE (real_type))
     {
       is_ref = 1;
       arg = value_addr (arg);
@@ -733,10 +729,10 @@ value_dynamic_cast (struct type *type, struct value *arg)
   struct type *class_type, *rtti_type;
   struct value *result, *tem, *original_arg = arg;
   CORE_ADDR addr;
-  int is_ref = TYPE_CODE (resolved_type) == TYPE_CODE_REF;
+  int is_ref = TYPE_IS_REFERENCE (resolved_type);
 
   if (TYPE_CODE (resolved_type) != TYPE_CODE_PTR
-      && TYPE_CODE (resolved_type) != TYPE_CODE_REF)
+      && !TYPE_IS_REFERENCE (resolved_type))
     error (_("Argument to dynamic_cast must be a pointer or reference type"));
   if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID
       && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT)
@@ -1478,7 +1474,7 @@ value_addr (struct value *arg1)
   struct value *arg2;
   struct type *type = check_typedef (value_type (arg1));
 
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     {
       if (value_bits_synthetic_pointer (arg1, value_embedded_offset (arg1),
          TARGET_CHAR_BIT * TYPE_LENGTH (type)))
@@ -1744,7 +1740,7 @@ typecmp (int staticp, int varargs, int nargs,
       tt1 = check_typedef (t1[i].type);
       tt2 = check_typedef (value_type (t2[i]));
 
-      if (TYPE_CODE (tt1) == TYPE_CODE_REF
+      if (TYPE_IS_REFERENCE (tt1)
          /* We should be doing hairy argument matching, as below.  */
          && (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1)))
              == TYPE_CODE (tt2)))
@@ -1762,14 +1758,13 @@ typecmp (int staticp, int varargs, int nargs,
         char *>, and properly access map["hello"], because the
         argument to [] will be a reference to a pointer to a char,
         and the argument will be a pointer to a char.  */
-      while (TYPE_CODE(tt1) == TYPE_CODE_REF
-            || TYPE_CODE (tt1) == TYPE_CODE_PTR)
+      while (TYPE_IS_REFERENCE (tt1) || TYPE_CODE (tt1) == TYPE_CODE_PTR)
        {
          tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) );
        }
       while (TYPE_CODE(tt2) == TYPE_CODE_ARRAY
             || TYPE_CODE(tt2) == TYPE_CODE_PTR
-            || TYPE_CODE(tt2) == TYPE_CODE_REF)
+            || TYPE_IS_REFERENCE (tt2))
        {
          tt2 = check_typedef (TYPE_TARGET_TYPE(tt2));
        }
@@ -2161,7 +2156,7 @@ value_struct_elt (struct value **argp, struct value **args,
 
   /* Follow pointers until we get to a non-pointer.  */
 
-  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
+  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
     {
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
@@ -2248,7 +2243,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
 
   t = check_typedef (value_type (*argp));
 
-  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
+  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
     {
       *argp = value_ind (*argp);
       if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
@@ -2409,7 +2404,7 @@ value_find_oload_method_list (struct value **argp, const char *method,
   t = check_typedef (value_type (*argp));
 
   /* Code snarfed from value_struct_elt.  */
-  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_CODE (t) == TYPE_CODE_REF)
+  while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
     {
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
@@ -2818,7 +2813,7 @@ find_overload_match (struct value **args, int nargs,
 
       if (TYPE_CODE (temp_type) != TYPE_CODE_PTR
          && (TYPE_CODE (objtype) == TYPE_CODE_PTR
-             || TYPE_CODE (objtype) == TYPE_CODE_REF))
+             || TYPE_IS_REFERENCE (objtype)))
        {
          temp = value_addr (temp);
        }
@@ -3614,7 +3609,7 @@ value_rtti_indirect_type (struct value *v, int *full,
 
   type = value_type (v);
   type = check_typedef (type);
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     target = coerce_ref (v);
   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
@@ -3647,8 +3642,8 @@ value_rtti_indirect_type (struct value *v, int *full,
       target_type = value_type (target);
       real_type = make_cv_type (TYPE_CONST (target_type),
                                TYPE_VOLATILE (target_type), real_type, NULL);
-      if (TYPE_CODE (type) == TYPE_CODE_REF)
-        real_type = lookup_lvalue_reference_type (real_type);
+      if (TYPE_IS_REFERENCE (type))
+        real_type = lookup_reference_type (real_type, TYPE_CODE (type));
       else if (TYPE_CODE (type) == TYPE_CODE_PTR)
         real_type = lookup_pointer_type (real_type);
       else
index 529f9a5058d1f286f2ed94b6e34d5c0c62ad8ada..6937dab7c63117ccaa2d130e23fa2eb4696c46fc 100644 (file)
@@ -281,7 +281,7 @@ int
 val_print_scalar_type_p (struct type *type)
 {
   type = check_typedef (type);
-  while (TYPE_CODE (type) == TYPE_CODE_REF)
+  while (TYPE_IS_REFERENCE (type))
     {
       type = TYPE_TARGET_TYPE (type);
       type = check_typedef (type);
@@ -536,7 +536,7 @@ get_value_addr_contents (struct value *deref_val)
     }
 }
 
-/* generic_val_print helper for TYPE_CODE_REF.  */
+/* generic_val_print helper for TYPE_CODE_{RVALUE_,}REF.  */
 
 static void
 generic_val_print_ref (struct type *type,
@@ -960,6 +960,7 @@ generic_val_print (struct type *type,
       break;
 
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       generic_val_print_ref (type, embedded_offset, stream, recurse,
                             original_value, options);
       break;
index 8c3b3f6d71fc92378af33e1e6a3c15bfbe019657..be01f0fe34cf4a4fcfbea6bc08844f74ad368e95 100644 (file)
@@ -1205,8 +1205,7 @@ value_actual_type (struct value *value, int resolve_simple_types,
     {
       /* If result's target type is TYPE_CODE_STRUCT, proceed to
         fetch its rtti type.  */
-      if ((TYPE_CODE (result) == TYPE_CODE_PTR
-          || TYPE_CODE (result) == TYPE_CODE_REF)
+      if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
          && TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result)))
             == TYPE_CODE_STRUCT
          && !value_optimized_out (value))
@@ -2883,7 +2882,7 @@ value_as_address (struct value *val)
      ABI-specific code is a more reasonable place to handle it.  */
 
   if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
-      && TYPE_CODE (value_type (val)) != TYPE_CODE_REF
+      && !TYPE_IS_REFERENCE (value_type (val))
       && gdbarch_integer_to_address_p (gdbarch))
     return gdbarch_integer_to_address (gdbarch, value_type (val),
                                       value_contents (val));
@@ -2940,6 +2939,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
 
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
          whether we want this to be true eventually.  */
       return extract_typed_address (valaddr, type);
@@ -3546,6 +3546,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
       break;
 
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_PTR:
       store_typed_address (buf, type, (CORE_ADDR) num);
       break;
@@ -3582,6 +3583,7 @@ pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
       break;
 
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_PTR:
       store_typed_address (buf, type, (CORE_ADDR) num);
       break;
@@ -3812,7 +3814,7 @@ coerce_ref_if_computed (const struct value *arg)
 {
   const struct lval_funcs *funcs;
 
-  if (TYPE_CODE (check_typedef (value_type (arg))) != TYPE_CODE_REF)
+  if (!TYPE_IS_REFERENCE (check_typedef (value_type (arg))))
     return NULL;
 
   if (value_lval_const (arg) != lval_computed)
@@ -3854,7 +3856,7 @@ coerce_ref (struct value *arg)
   if (retval)
     return retval;
 
-  if (TYPE_CODE (value_type_arg_tmp) != TYPE_CODE_REF)
+  if (!TYPE_IS_REFERENCE (value_type_arg_tmp))
     return arg;
 
   enc_type = check_typedef (value_enclosing_type (arg));
index 173abf39938ed2a970c81fcbd4271a460f5757c1..f5d1cbf011ebbe91df755bf653fe1735a28f4e81 100644 (file)
@@ -2136,7 +2136,7 @@ varobj_get_value_type (const struct varobj *var)
 
   type = check_typedef (type);
 
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     type = get_target_type (type);
 
   type = check_typedef (type);
This page took 0.069735 seconds and 4 git commands to generate.