public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Turn value_type into method
@ 2023-02-13 22:27 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-02-13 22:27 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d0c9791728caa0d3b3270a997c7fd97919976c97

commit d0c9791728caa0d3b3270a997c7fd97919976c97
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jan 31 07:52:09 2023 -0700

    Turn value_type into method
    
    This changes value_type to be a method of value.  Much of this patch
    was written by script.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/aarch64-tdep.c           |   6 +-
 gdb/ada-exp.h                |   4 +-
 gdb/ada-exp.y                |   4 +-
 gdb/ada-lang.c               | 302 +++++++++++++++++++++----------------------
 gdb/ada-tasks.c              |   4 +-
 gdb/ada-valprint.c           |  34 ++---
 gdb/ada-varobj.c             |  12 +-
 gdb/alpha-tdep.c             |   2 +-
 gdb/amd64-tdep.c             |  10 +-
 gdb/amd64-windows-tdep.c     |  10 +-
 gdb/arc-tdep.c               |   4 +-
 gdb/arm-tdep.c               |   6 +-
 gdb/avr-tdep.c               |   2 +-
 gdb/ax-gdb.c                 |   8 +-
 gdb/breakpoint.c             |  14 +-
 gdb/c-exp.h                  |   2 +-
 gdb/c-lang.c                 |   2 +-
 gdb/c-valprint.c             |  18 +--
 gdb/c-varobj.c               |   2 +-
 gdb/cli/cli-cmds.c           |   2 +-
 gdb/cli/cli-dump.c           |   4 +-
 gdb/cli/cli-utils.c          |   4 +-
 gdb/cp-abi.c                 |   2 +-
 gdb/cp-valprint.c            |   6 +-
 gdb/cris-tdep.c              |   2 +-
 gdb/csky-tdep.c              |   2 +-
 gdb/d-valprint.c             |   4 +-
 gdb/darwin-nat-info.c        |   2 +-
 gdb/dtrace-probe.c           |   2 +-
 gdb/dwarf2/expr.c            |  76 +++++------
 gdb/dwarf2/loc.c             |   2 +-
 gdb/eval.c                   | 138 ++++++++++----------
 gdb/expop.h                  |  12 +-
 gdb/f-lang.c                 | 114 ++++++++--------
 gdb/f-valprint.c             |   2 +-
 gdb/findcmd.c                |   2 +-
 gdb/findvar.c                |   4 +-
 gdb/frame.c                  |   4 +-
 gdb/frv-tdep.c               |   4 +-
 gdb/gdbtypes.c               |   6 +-
 gdb/gdbtypes.h               |   2 +-
 gdb/gnu-v2-abi.c             |  12 +-
 gdb/gnu-v3-abi.c             |  26 ++--
 gdb/go-valprint.c            |   2 +-
 gdb/guile/scm-math.c         |  10 +-
 gdb/guile/scm-pretty-print.c |   2 +-
 gdb/guile/scm-value.c        |  22 ++--
 gdb/h8300-tdep.c             |   4 +-
 gdb/hppa-tdep.c              |   4 +-
 gdb/i386-tdep.c              |   6 +-
 gdb/i386-windows-tdep.c      |   2 +-
 gdb/ia64-tdep.c              |   4 +-
 gdb/infcall.c                |   6 +-
 gdb/infcmd.c                 |   4 +-
 gdb/infrun.c                 |   8 +-
 gdb/iq2000-tdep.c            |   4 +-
 gdb/linespec.c               |   2 +-
 gdb/lm32-tdep.c              |   2 +-
 gdb/loongarch-tdep.c         |   4 +-
 gdb/m2-lang.c                |  10 +-
 gdb/m2-valprint.c            |   6 +-
 gdb/m32c-tdep.c              |   4 +-
 gdb/m32r-tdep.c              |   4 +-
 gdb/m68hc11-tdep.c           |   4 +-
 gdb/mep-tdep.c               |   6 +-
 gdb/mi/mi-cmd-stack.c        |   4 +-
 gdb/mi/mi-main.c             |   4 +-
 gdb/mips-tdep.c              |  16 +--
 gdb/mn10300-tdep.c           |   8 +-
 gdb/msp430-tdep.c            |   4 +-
 gdb/nds32-tdep.c             |   6 +-
 gdb/nios2-tdep.c             |   4 +-
 gdb/opencl-lang.c            |  50 +++----
 gdb/or1k-tdep.c              |   8 +-
 gdb/p-exp.y                  |   6 +-
 gdb/p-valprint.c             |  14 +-
 gdb/ppc-linux-nat.c          |   4 +-
 gdb/ppc-sysv-tdep.c          |  16 +--
 gdb/printcmd.c               |  44 +++----
 gdb/python/py-framefilter.c  |   8 +-
 gdb/python/py-inferior.c     |   2 +-
 gdb/python/py-prettyprint.c  |   2 +-
 gdb/python/py-unwind.c       |   8 +-
 gdb/python/py-value.c        |  34 ++---
 gdb/python/py-xmethods.c     |   4 +-
 gdb/regcache.c               |   2 +-
 gdb/riscv-tdep.c             |   8 +-
 gdb/rs6000-aix-tdep.c        |   6 +-
 gdb/rs6000-lynx178-tdep.c    |   6 +-
 gdb/rust-lang.c              |  56 ++++----
 gdb/rx-tdep.c                |   4 +-
 gdb/s390-tdep.c              |   4 +-
 gdb/sh-tdep.c                |  14 +-
 gdb/sparc-tdep.c             |   4 +-
 gdb/sparc64-tdep.c           |   4 +-
 gdb/stack.c                  |  12 +-
 gdb/tic6x-tdep.c             |   6 +-
 gdb/typeprint.c              |   6 +-
 gdb/v850-tdep.c              |  10 +-
 gdb/valarith.c               |  96 +++++++-------
 gdb/valops.c                 | 126 +++++++++---------
 gdb/valprint.c               |  30 ++---
 gdb/value.c                  |  97 +++++++-------
 gdb/value.h                  |   9 +-
 gdb/varobj.c                 |  12 +-
 gdb/windows-tdep.c           |   2 +-
 gdb/xtensa-tdep.c            |   4 +-
 107 files changed, 880 insertions(+), 884 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index ea93e9ad0d2..058d5bfce85 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1800,7 +1800,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
 	    continue;
 
 	  struct value *field = value_primitive_field (arg, 0, i, arg_type);
-	  struct type *field_type = check_typedef (value_type (field));
+	  struct type *field_type = check_typedef (field->type ());
 
 	  if (!pass_in_v_vfp_candidate (gdbarch, regcache, info, field_type,
 					field))
@@ -1875,7 +1875,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *arg_type, *fundamental_type;
       int len, elements;
 
-      arg_type = check_typedef (value_type (arg));
+      arg_type = check_typedef (arg->type ());
       len = arg_type->length ();
 
       /* If arg can be passed in v registers as per the AAPCS64, then do so if
@@ -2767,7 +2767,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
 
   if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID)
     mark_value_bytes_unavailable (result_value, 0,
-				  value_type (result_value)->length ());
+				  result_value->type ()->length ());
   else
     memcpy (value_contents_raw (result_value).data (), reg_buf, regsize);
 
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 36ac3aaddb7..7e59267192a 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -249,7 +249,7 @@ public:
 		   enum noside noside) override
   {
     value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
-    value *arg2 = std::get<2> (m_storage)->evaluate (value_type (arg1),
+    value *arg2 = std::get<2> (m_storage)->evaluate (arg1->type (),
 						     exp, noside);
     return ada_equal_binop (expect_type, exp, noside, std::get<0> (m_storage),
 			    arg1, arg2);
@@ -275,7 +275,7 @@ public:
     value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
     value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
     value *result = eval_op_binary (expect_type, exp, noside, OP, lhs, rhs);
-    return value_cast (value_type (lhs), result);
+    return value_cast (lhs->type (), result);
   }
 
   enum exp_opcode opcode () const override
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 2f466e4de0a..5436585b73b 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -303,7 +303,7 @@ ada_funcall (int nargs)
       struct value *callee_v = callee->evaluate (nullptr,
 						 pstate->expout.get (),
 						 EVAL_AVOID_SIDE_EFFECTS);
-      callee_t = ada_check_typedef (value_type (callee_v));
+      callee_t = ada_check_typedef (callee_v->type ());
       array_arity = ada_array_arity (callee_t);
     }
 
@@ -503,7 +503,7 @@ exp1	:	exp
 			    = lhs->evaluate (nullptr, pstate->expout.get (),
 					     EVAL_AVOID_SIDE_EFFECTS);
 			  rhs = resolve (std::move (rhs), true,
-					 value_type (lhs_val));
+					 lhs_val->type ());
 			  pstate->push_new<ada_assign_operation>
 			    (std::move (lhs), std::move (rhs));
 			}
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3cd6f73f36f..da49149c56d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -549,7 +549,7 @@ static struct value *
 coerce_unspec_val_to_type (struct value *val, struct type *type)
 {
   type = ada_check_typedef (type);
-  if (value_type (val) == type)
+  if (val->type () == type)
     return val;
   else
     {
@@ -560,7 +560,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
       else if (value_lazy (val)
 	       /* Be careful not to make a lazy not_lval value.  */
 	       || (VALUE_LVAL (val) != not_lval
-		   && type->length () > value_type (val)->length ()))
+		   && type->length () > val->type ()->length ()))
 	result = allocate_value_lazy (type);
       else
 	{
@@ -754,7 +754,7 @@ get_base_type (struct type *type)
 struct value *
 ada_get_decoded_value (struct value *value)
 {
-  struct type *type = ada_check_typedef (value_type (value));
+  struct type *type = ada_check_typedef (value->type ());
 
   if (ada_is_array_descriptor_type (type)
       || (ada_is_constrained_packed_array_type (type)
@@ -1756,7 +1756,7 @@ thin_descriptor_type (struct type *type)
 static struct value *
 thin_data_pntr (struct value *val)
 {
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
   struct type *data_type = desc_data_target_type (thin_descriptor_type (type));
 
   data_type = lookup_pointer_type (data_type);
@@ -1813,7 +1813,7 @@ desc_bounds_type (struct type *type)
 static struct value *
 desc_bounds (struct value *arr)
 {
-  struct type *type = ada_check_typedef (value_type (arr));
+  struct type *type = ada_check_typedef (arr->type ());
 
   if (is_thin_pntr (type))
     {
@@ -1841,7 +1841,7 @@ desc_bounds (struct value *arr)
     {
       struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
 					       _("Bad GNAT array descriptor"));
-      struct type *p_bounds_type = value_type (p_bounds);
+      struct type *p_bounds_type = p_bounds->type ();
 
       if (p_bounds_type
 	  && p_bounds_type->code () == TYPE_CODE_PTR)
@@ -1916,7 +1916,7 @@ desc_data_target_type (struct type *type)
 static struct value *
 desc_data (struct value *arr)
 {
-  struct type *type = value_type (arr);
+  struct type *type = arr->type ();
 
   if (is_thin_pntr (type))
     return thin_data_pntr (arr);
@@ -2105,20 +2105,20 @@ ada_is_bogus_array_descriptor (struct type *type)
 static struct type *
 ada_type_of_array (struct value *arr, int bounds)
 {
-  if (ada_is_constrained_packed_array_type (value_type (arr)))
-    return decode_constrained_packed_array_type (value_type (arr));
+  if (ada_is_constrained_packed_array_type (arr->type ()))
+    return decode_constrained_packed_array_type (arr->type ());
 
-  if (!ada_is_array_descriptor_type (value_type (arr)))
-    return value_type (arr);
+  if (!ada_is_array_descriptor_type (arr->type ()))
+    return arr->type ();
 
   if (!bounds)
     {
       struct type *array_type =
-	ada_check_typedef (desc_data_target_type (value_type (arr)));
+	ada_check_typedef (desc_data_target_type (arr->type ()));
 
-      if (ada_is_unconstrained_packed_array_type (value_type (arr)))
+      if (ada_is_unconstrained_packed_array_type (arr->type ()))
 	TYPE_FIELD_BITSIZE (array_type, 0) =
-	  decode_packed_array_bitsize (value_type (arr));
+	  decode_packed_array_bitsize (arr->type ());
       
       return array_type;
     }
@@ -2128,29 +2128,29 @@ ada_type_of_array (struct value *arr, int bounds)
       int arity;
       struct value *descriptor;
 
-      elt_type = ada_array_element_type (value_type (arr), -1);
-      arity = ada_array_arity (value_type (arr));
+      elt_type = ada_array_element_type (arr->type (), -1);
+      arity = ada_array_arity (arr->type ());
 
       if (elt_type == NULL || arity == 0)
-	return ada_check_typedef (value_type (arr));
+	return ada_check_typedef (arr->type ());
 
       descriptor = desc_bounds (arr);
       if (value_as_long (descriptor) == 0)
 	return NULL;
       while (arity > 0)
 	{
-	  struct type *range_type = alloc_type_copy (value_type (arr));
-	  struct type *array_type = alloc_type_copy (value_type (arr));
+	  struct type *range_type = alloc_type_copy (arr->type ());
+	  struct type *array_type = alloc_type_copy (arr->type ());
 	  struct value *low = desc_one_bound (descriptor, arity, 0);
 	  struct value *high = desc_one_bound (descriptor, arity, 1);
 
 	  arity -= 1;
-	  create_static_range_type (range_type, value_type (low),
+	  create_static_range_type (range_type, low->type (),
 				    longest_to_int (value_as_long (low)),
 				    longest_to_int (value_as_long (high)));
 	  elt_type = create_array_type (array_type, elt_type, range_type);
 
-	  if (ada_is_unconstrained_packed_array_type (value_type (arr)))
+	  if (ada_is_unconstrained_packed_array_type (arr->type ()))
 	    {
 	      /* We need to store the element packed bitsize, as well as
 		 recompute the array size, because it was previously
@@ -2159,7 +2159,7 @@ ada_type_of_array (struct value *arr, int bounds)
 	      LONGEST hi = value_as_long (high);
 
 	      TYPE_FIELD_BITSIZE (elt_type, 0) =
-		decode_packed_array_bitsize (value_type (arr));
+		decode_packed_array_bitsize (arr->type ());
 	      /* If the array has no element, then the size is already
 		 zero, and does not need to be recomputed.  */
 	      if (lo < hi)
@@ -2184,7 +2184,7 @@ ada_type_of_array (struct value *arr, int bounds)
 struct value *
 ada_coerce_to_simple_array_ptr (struct value *arr)
 {
-  if (ada_is_array_descriptor_type (value_type (arr)))
+  if (ada_is_array_descriptor_type (arr->type ()))
     {
       struct type *arrType = ada_type_of_array (arr, 1);
 
@@ -2192,7 +2192,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr)
 	return NULL;
       return value_cast (arrType, value_copy (desc_data (arr)));
     }
-  else if (ada_is_constrained_packed_array_type (value_type (arr)))
+  else if (ada_is_constrained_packed_array_type (arr->type ()))
     return decode_constrained_packed_array (arr);
   else
     return arr;
@@ -2205,7 +2205,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr)
 struct value *
 ada_coerce_to_simple_array (struct value *arr)
 {
-  if (ada_is_array_descriptor_type (value_type (arr)))
+  if (ada_is_array_descriptor_type (arr->type ()))
     {
       struct value *arrVal = ada_coerce_to_simple_array_ptr (arr);
 
@@ -2213,7 +2213,7 @@ ada_coerce_to_simple_array (struct value *arr)
 	error (_("Bounds unavailable for null array pointer."));
       return value_ind (arrVal);
     }
-  else if (ada_is_constrained_packed_array_type (value_type (arr)))
+  else if (ada_is_constrained_packed_array_type (arr->type ()))
     return decode_constrained_packed_array (arr);
   else
     return arr;
@@ -2501,10 +2501,10 @@ decode_constrained_packed_array (struct value *arr)
      and "value_ind" routines to perform the dereferencing, as opposed
      to using "ada_coerce_ref" or "ada_value_ind".  */
   arr = coerce_ref (arr);
-  if (ada_check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
+  if (ada_check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
     arr = value_ind (arr);
 
-  type = decode_constrained_packed_array_type (value_type (arr));
+  type = decode_constrained_packed_array_type (arr->type ());
   if (type == NULL)
     {
       error (_("can't unpack array"));
@@ -2523,8 +2523,8 @@ decode_constrained_packed_array (struct value *arr)
   type = resolve_dynamic_type (type, view, address);
   recursively_update_array_bitsize (type);
 
-  if (type_byte_order (value_type (arr)) == BFD_ENDIAN_BIG
-      && ada_is_modular_type (value_type (arr)))
+  if (type_byte_order (arr->type ()) == BFD_ENDIAN_BIG
+      && ada_is_modular_type (arr->type ()))
     {
        /* This is a (right-justified) modular type representing a packed
 	  array with no wrapper.  In order to interpret the value through
@@ -2533,14 +2533,14 @@ decode_constrained_packed_array (struct value *arr)
       int bit_size, bit_pos;
       ULONGEST mod;
 
-      mod = ada_modulus (value_type (arr)) - 1;
+      mod = ada_modulus (arr->type ()) - 1;
       bit_size = 0;
       while (mod > 0)
 	{
 	  bit_size += 1;
 	  mod >>= 1;
 	}
-      bit_pos = HOST_CHAR_BIT * value_type (arr)->length () - bit_size;
+      bit_pos = HOST_CHAR_BIT * arr->type ()->length () - bit_size;
       arr = ada_value_primitive_packed_val (arr, NULL,
 					    bit_pos / HOST_CHAR_BIT,
 					    bit_pos % HOST_CHAR_BIT,
@@ -2566,7 +2566,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
 
   bits = 0;
   elt_total_bit_offset = 0;
-  elt_type = ada_check_typedef (value_type (arr));
+  elt_type = ada_check_typedef (arr->type ());
   for (i = 0; i < arity; i += 1)
     {
       if (elt_type->code () != TYPE_CODE_ARRAY
@@ -2877,15 +2877,15 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
 static struct value *
 ada_value_assign (struct value *toval, struct value *fromval)
 {
-  struct type *type = value_type (toval);
+  struct type *type = toval->type ();
   int bits = value_bitsize (toval);
 
   toval = ada_coerce_ref (toval);
   fromval = ada_coerce_ref (fromval);
 
-  if (ada_is_direct_array_type (value_type (toval)))
+  if (ada_is_direct_array_type (toval->type ()))
     toval = ada_coerce_to_simple_array (toval);
-  if (ada_is_direct_array_type (value_type (fromval)))
+  if (ada_is_direct_array_type (fromval->type ()))
     fromval = ada_coerce_to_simple_array (fromval);
 
   if (!deprecated_value_modifiable (toval))
@@ -2909,11 +2909,11 @@ ada_value_assign (struct value *toval, struct value *fromval)
       read_memory (to_addr, buffer, len);
       from_size = value_bitsize (fromval);
       if (from_size == 0)
-	from_size = value_type (fromval)->length () * TARGET_CHAR_BIT;
+	from_size = fromval->type ()->length () * TARGET_CHAR_BIT;
 
       const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
       ULONGEST from_offset = 0;
-      if (is_big_endian && is_scalar_type (value_type (fromval)))
+      if (is_big_endian && is_scalar_type (fromval->type ()))
 	from_offset = from_size - bits;
       copy_bitwise (buffer, value_bitpos (toval),
 		    value_contents (fromval).data (), from_offset,
@@ -2954,20 +2954,20 @@ value_assign_to_component (struct value *container, struct value *component,
     value_bitpos (component) - value_bitpos (container);
   int bits;
 
-  val = value_cast (value_type (component), val);
+  val = value_cast (component->type (), val);
 
   if (value_bitsize (component) == 0)
-    bits = TARGET_CHAR_BIT * value_type (component)->length ();
+    bits = TARGET_CHAR_BIT * component->type ()->length ();
   else
     bits = value_bitsize (component);
 
-  if (type_byte_order (value_type (container)) == BFD_ENDIAN_BIG)
+  if (type_byte_order (container->type ()) == BFD_ENDIAN_BIG)
     {
       int src_offset;
 
-      if (is_scalar_type (check_typedef (value_type (component))))
+      if (is_scalar_type (check_typedef (component->type ())))
 	src_offset
-	  = value_type (component)->length () * TARGET_CHAR_BIT - bits;
+	  = component->type ()->length () * TARGET_CHAR_BIT - bits;
       else
 	src_offset = 0;
       copy_bitwise ((value_contents_writeable (container).data ()
@@ -3004,7 +3004,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
 
   elt = ada_coerce_to_simple_array (arr);
 
-  elt_type = ada_check_typedef (value_type (elt));
+  elt_type = ada_check_typedef (elt->type ());
   if (elt_type->code () == TYPE_CODE_ARRAY
       && TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
     return value_subscript_packed (elt, arity, ind);
@@ -3019,7 +3019,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
       elt = value_subscript (elt, pos_atr (ind[k]));
 
       if (ada_is_access_to_unconstrained_array (saved_elt_type)
-	  && value_type (elt)->code () != TYPE_CODE_TYPEDEF)
+	  && elt->type ()->code () != TYPE_CODE_TYPEDEF)
 	{
 	  /* The element is a typedef to an unconstrained array,
 	     except that the value_subscript call stripped the
@@ -3036,7 +3036,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
 	  deprecated_set_value_type (elt, saved_elt_type);
 	}
 
-      elt_type = ada_check_typedef (value_type (elt));
+      elt_type = ada_check_typedef (elt->type ());
     }
 
   return elt;
@@ -3124,7 +3124,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
 static struct value *
 ada_value_slice (struct value *array, int low, int high)
 {
-  struct type *type = ada_check_typedef (value_type (array));
+  struct type *type = ada_check_typedef (array->type ());
   struct type *base_index_type = type->index_type ()->target_type ();
   struct type *index_type
     = create_static_range_type (NULL, type->index_type (), low, high);
@@ -3332,7 +3332,7 @@ ada_array_bound (struct value *arr, int n, int which)
 {
   struct type *arr_type;
 
-  if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
+  if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
     arr = value_ind (arr);
   arr_type = value_enclosing_type (arr);
 
@@ -3356,7 +3356,7 @@ ada_array_length (struct value *arr, int n)
   struct type *arr_type, *index_type;
   int low, high;
 
-  if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
+  if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
     arr = value_ind (arr);
   arr_type = value_enclosing_type (arr);
 
@@ -3984,7 +3984,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
       else
 	{
 	  struct type *ftype = ada_check_typedef (func_type->field (i).type ());
-	  struct type *atype = ada_check_typedef (value_type (actuals[i]));
+	  struct type *atype = ada_check_typedef (actuals[i]->type ());
 
 	  if (!ada_type_match (ftype, atype))
 	    return 0;
@@ -4185,9 +4185,9 @@ static int
 possible_user_operator_p (enum exp_opcode op, struct value *args[])
 {
   struct type *type0 =
-    (args[0] == NULL) ? NULL : ada_check_typedef (value_type (args[0]));
+    (args[0] == NULL) ? NULL : ada_check_typedef (args[0]->type ());
   struct type *type1 =
-    (args[1] == NULL) ? NULL : ada_check_typedef (value_type (args[1]));
+    (args[1] == NULL) ? NULL : ada_check_typedef (args[1]->type ());
 
   if (type0 == NULL)
     return 0;
@@ -4352,7 +4352,7 @@ ensure_lval (struct value *val)
   if (VALUE_LVAL (val) == not_lval
       || VALUE_LVAL (val) == lval_internalvar)
     {
-      int len = ada_check_typedef (value_type (val))->length ();
+      int len = ada_check_typedef (val->type ())->length ();
       const CORE_ADDR addr =
 	value_as_long (value_allocate_space_in_inferior (len));
 
@@ -4384,7 +4384,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
   int check_tag;
 
   v = NULL;
-  t1 = t = ada_check_typedef (value_type (arg));
+  t1 = t = ada_check_typedef (arg->type ());
   if (t->code () == TYPE_CODE_REF)
     {
       t1 = t->target_type ();
@@ -4459,7 +4459,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
 
       /* Resolve the dynamic type as well.  */
       arg = value_from_contents_and_address (t1, nullptr, address);
-      t1 = value_type (arg);
+      t1 = arg->type ();
 
       if (find_struct_field (name, t1, 0,
 			     &field_type, &byte_offset, &bit_offset,
@@ -4501,7 +4501,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
 struct value *
 ada_convert_actual (struct value *actual, struct type *formal_type0)
 {
-  struct type *actual_type = ada_check_typedef (value_type (actual));
+  struct type *actual_type = ada_check_typedef (actual->type ());
   struct type *formal_type = ada_check_typedef (formal_type0);
   struct type *formal_target =
     formal_type->code () == TYPE_CODE_PTR
@@ -4527,7 +4527,7 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
 	    {
 	      struct value *val;
 
-	      actual_type = ada_check_typedef (value_type (actual));
+	      actual_type = ada_check_typedef (actual->type ());
 	      val = allocate_value (actual_type);
 	      copy (value_contents (actual), value_contents_raw (val));
 	      actual = ensure_lval (val);
@@ -4588,15 +4588,15 @@ make_array_descriptor (struct type *type, struct value *arr)
   struct value *bounds = allocate_value (bounds_type);
   int i;
 
-  for (i = ada_array_arity (ada_check_typedef (value_type (arr)));
+  for (i = ada_array_arity (ada_check_typedef (arr->type ()));
        i > 0; i -= 1)
     {
-      modify_field (value_type (bounds),
+      modify_field (bounds->type (),
 		    value_contents_writeable (bounds).data (),
 		    ada_array_bound (arr, i, 0),
 		    desc_bound_bitpos (bounds_type, i, 0),
 		    desc_bound_bitsize (bounds_type, i, 0));
-      modify_field (value_type (bounds),
+      modify_field (bounds->type (),
 		    value_contents_writeable (bounds).data (),
 		    ada_array_bound (arr, i, 1),
 		    desc_bound_bitpos (bounds_type, i, 1),
@@ -4605,14 +4605,14 @@ make_array_descriptor (struct type *type, struct value *arr)
 
   bounds = ensure_lval (bounds);
 
-  modify_field (value_type (descriptor),
+  modify_field (descriptor->type (),
 		value_contents_writeable (descriptor).data (),
 		value_pointer (ensure_lval (arr),
 			       desc_type->field (0).type ()),
 		fat_pntr_data_bitpos (desc_type),
 		fat_pntr_data_bitsize (desc_type));
 
-  modify_field (value_type (descriptor),
+  modify_field (descriptor->type (),
 		value_contents_writeable (descriptor).data (),
 		value_pointer (bounds,
 			       desc_type->field (1).type ()),
@@ -6361,7 +6361,7 @@ ada_is_tag_type (struct type *type)
 static struct type *
 ada_tag_type (struct value *val)
 {
-  return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0);
+  return ada_lookup_struct_elt_type (val->type (), "_tag", 1, 0);
 }
 
 /* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95,
@@ -6435,7 +6435,7 @@ ada_tag_value_at_base_address (struct value *obj)
   struct value *tag;
   CORE_ADDR base_address;
 
-  obj_type = value_type (obj);
+  obj_type = obj->type ();
 
   /* It is the responsability of the caller to deref pointers.  */
 
@@ -6618,7 +6618,7 @@ ada_tag_name (struct value *tag)
 {
   gdb::unique_xmalloc_ptr<char> name;
 
-  if (!ada_is_tag_type (value_type (tag)))
+  if (!ada_is_tag_type (tag->type ()))
     return NULL;
 
   /* It is perfectly possible that an exception be raised while trying
@@ -7513,7 +7513,7 @@ ada_value_ind (struct value *val0)
 {
   struct value *val = value_ind (val0);
 
-  if (ada_is_tagged_type (value_type (val), 0))
+  if (ada_is_tagged_type (val->type (), 0))
     val = ada_tag_value_at_base_address (val);
 
   return ada_to_fixed_value (val);
@@ -7525,13 +7525,13 @@ ada_value_ind (struct value *val0)
 static struct value *
 ada_coerce_ref (struct value *val0)
 {
-  if (value_type (val0)->code () == TYPE_CODE_REF)
+  if (val0->type ()->code () == TYPE_CODE_REF)
     {
       struct value *val = val0;
 
       val = coerce_ref (val);
 
-      if (ada_is_tagged_type (value_type (val), 0))
+      if (ada_is_tagged_type (val->type (), 0))
 	val = ada_tag_value_at_base_address (val);
 
       return ada_to_fixed_value (val);
@@ -7832,7 +7832,7 @@ empty_record (struct type *templ)
    the value of type TYPE at VALADDR or ADDRESS (see comments at
    the beginning of this section) VAL according to GNAT conventions.
    DVAL0 should describe the (portion of a) record that contains any
-   necessary discriminants.  It should be NULL if value_type (VAL) is
+   necessary discriminants.  It should be NULL if VAL->type () is
    an outer-level type (i.e., as opposed to a branch of a variant.)  A
    variant field (unless unchecked) is replaced by a particular branch
    of the variant.
@@ -7915,7 +7915,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
 	      dval = value_from_contents_and_address_unresolved (rtype,
 								 valaddr,
 								 address);
-	      rtype = value_type (dval);
+	      rtype = dval->type ();
 	    }
 	  else
 	    dval = dval0;
@@ -8014,7 +8014,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
 	     that is currently being constructed.  */
 	  dval = value_from_contents_and_address_unresolved (rtype, valaddr,
 							     address);
-	  rtype = value_type (dval);
+	  rtype = dval->type ();
 	}
       else
 	dval = dval0;
@@ -8175,7 +8175,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
   if (dval0 == NULL)
     {
       dval = value_from_contents_and_address (type, valaddr, address);
-      type = value_type (dval);
+      type = dval->type ();
     }
   else
     dval = dval0;
@@ -8296,7 +8296,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
   if (templ_type != NULL)
     var_type = templ_type;
 
-  if (is_unchecked_variant (var_type, value_type (dval)))
+  if (is_unchecked_variant (var_type, dval->type ()))
       return var_type0;
   which = ada_which_variant_applies (var_type, dval);
 
@@ -8587,7 +8587,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
 	      value_from_contents_and_address (fixed_record_type,
 					       valaddr,
 					       address);
-	    fixed_record_type = value_type (obj);
+	    fixed_record_type = obj->type ();
 	    if (real_type != NULL)
 	      return to_fixed_record_type
 		(real_type, NULL,
@@ -8860,7 +8860,7 @@ struct value *
 ada_to_fixed_value (struct value *val)
 {
   val = unwrap_value (val);
-  val = ada_to_fixed_value_create (value_type (val), value_address (val), val);
+  val = ada_to_fixed_value_create (val->type (), value_address (val), val);
   return val;
 }
 \f
@@ -8902,7 +8902,7 @@ static LONGEST
 pos_atr (struct value *arg)
 {
   struct value *val = coerce_ref (arg);
-  struct type *type = value_type (val);
+  struct type *type = val->type ();
 
   if (!discrete_type_p (type))
     error (_("'POS only defined on discrete types"));
@@ -8951,7 +8951,7 @@ ada_val_atr (enum noside noside, struct type *type, struct value *arg)
 
   if (!discrete_type_p (type))
     error (_("'VAL only defined on discrete types"));
-  if (!integer_type_p (value_type (arg)))
+  if (!integer_type_p (arg->type ()))
     error (_("'VAL requires integral argument"));
 
   return val_atr (type, value_as_long (arg));
@@ -9199,12 +9199,12 @@ ada_enum_name (const char *name)
 static struct value *
 unwrap_value (struct value *val)
 {
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
 
   if (ada_is_aligner_type (type))
     {
       struct value *v = ada_value_struct_elt (val, "F", 0);
-      struct type *val_type = ada_check_typedef (value_type (v));
+      struct type *val_type = ada_check_typedef (v->type ());
 
       if (ada_type_name (val_type) == NULL)
 	val_type->set_name (ada_type_name (type));
@@ -9273,10 +9273,10 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
      of type's element.  */
   gdb_assert (type->code () == TYPE_CODE_ARRAY);
   gdb_assert (is_integral_type (type->target_type ()));
-  gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY);
-  gdb_assert (is_integral_type (value_type (val)->target_type ()));
+  gdb_assert (val->type ()->code () == TYPE_CODE_ARRAY);
+  gdb_assert (is_integral_type (val->type ()->target_type ()));
   gdb_assert (type->target_type ()->length ()
-	      > value_type (val)->target_type ()->length ());
+	      > val->type ()->target_type ()->length ());
 
   if (!get_array_bounds (type, &lo, &hi))
     error (_("unable to determine array bounds"));
@@ -9302,7 +9302,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
 static struct value *
 coerce_for_assign (struct type *type, struct value *val)
 {
-  struct type *type2 = value_type (val);
+  struct type *type2 = val->type ();
 
   if (type == type2)
     return val;
@@ -9314,7 +9314,7 @@ coerce_for_assign (struct type *type, struct value *val)
       && type->code () == TYPE_CODE_ARRAY)
     {
       val = ada_value_ind (val);
-      type2 = value_type (val);
+      type2 = val->type ();
     }
 
   if (type2->code () == TYPE_CODE_ARRAY
@@ -9348,8 +9348,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 
   arg1 = coerce_ref (arg1);
   arg2 = coerce_ref (arg2);
-  type1 = get_base_type (ada_check_typedef (value_type (arg1)));
-  type2 = get_base_type (ada_check_typedef (value_type (arg2)));
+  type1 = get_base_type (ada_check_typedef (arg1->type ()));
+  type2 = get_base_type (ada_check_typedef (arg2->type ()));
 
   if (type1->code () != TYPE_CODE_INT
       || type2->code () != TYPE_CODE_INT)
@@ -9405,7 +9405,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 
   val = allocate_value (type1);
   store_unsigned_integer (value_contents_raw (val).data (),
-			  value_type (val)->length (),
+			  val->type ()->length (),
 			  type_byte_order (type1), v);
   return val;
 }
@@ -9413,8 +9413,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 static int
 ada_value_equal (struct value *arg1, struct value *arg2)
 {
-  if (ada_is_direct_array_type (value_type (arg1))
-      || ada_is_direct_array_type (value_type (arg2)))
+  if (ada_is_direct_array_type (arg1->type ())
+      || ada_is_direct_array_type (arg2->type ()))
     {
       struct type *arg1_type, *arg2_type;
 
@@ -9426,8 +9426,8 @@ ada_value_equal (struct value *arg1, struct value *arg2)
       arg1 = ada_coerce_to_simple_array (arg1);
       arg2 = ada_coerce_to_simple_array (arg2);
 
-      arg1_type = ada_check_typedef (value_type (arg1));
-      arg2_type = ada_check_typedef (value_type (arg2));
+      arg1_type = ada_check_typedef (arg1->type ());
+      arg2_type = ada_check_typedef (arg2->type ());
 
       if (arg1_type->code () != TYPE_CODE_ARRAY
 	  || arg2_type->code () != TYPE_CODE_ARRAY)
@@ -9465,7 +9465,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
   scoped_value_mark mark;
 
   struct value *elt;
-  struct type *lhs_type = check_typedef (value_type (lhs));
+  struct type *lhs_type = check_typedef (lhs->type ());
 
   if (lhs_type->code () == TYPE_CODE_ARRAY)
     {
@@ -9476,7 +9476,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
     }
   else
     {
-      elt = ada_index_struct_field (index, lhs, 0, value_type (lhs));
+      elt = ada_index_struct_field (index, lhs, 0, lhs->type ());
       elt = ada_to_fixed_value (elt);
     }
 
@@ -9528,17 +9528,17 @@ ada_aggregate_operation::assign_aggregate (struct value *container,
   LONGEST low_index, high_index;
 
   container = ada_coerce_ref (container);
-  if (ada_is_direct_array_type (value_type (container)))
+  if (ada_is_direct_array_type (container->type ()))
     container = ada_coerce_to_simple_array (container);
   lhs = ada_coerce_ref (lhs);
   if (!deprecated_value_modifiable (lhs))
     error (_("Left operand of assignment is not a modifiable lvalue."));
 
-  lhs_type = check_typedef (value_type (lhs));
+  lhs_type = check_typedef (lhs->type ());
   if (ada_is_direct_array_type (lhs_type))
     {
       lhs = ada_coerce_to_simple_array (lhs);
-      lhs_type = check_typedef (value_type (lhs));
+      lhs_type = check_typedef (lhs->type ());
       low_index = lhs_type->bounds ()->low.const_val ();
       high_index = lhs_type->bounds ()->high.const_val ();
     }
@@ -9654,7 +9654,7 @@ ada_name_association::assign (struct value *container,
 {
   int index;
 
-  if (ada_is_direct_array_type (value_type (lhs)))
+  if (ada_is_direct_array_type (lhs->type ()))
     index = longest_to_int (value_as_long (m_val->evaluate (nullptr, exp,
 							    EVAL_NORMAL)));
   else
@@ -9675,7 +9675,7 @@ ada_name_association::assign (struct value *container,
 	}
 
       index = 0;
-      if (! find_struct_field (name, value_type (lhs), 0,
+      if (! find_struct_field (name, lhs->type (), 0,
 			       NULL, NULL, NULL, NULL, &index))
 	error (_("Unknown component name: %s."), name);
     }
@@ -9770,7 +9770,7 @@ ada_assign_operation::evaluate (struct type *expect_type,
      except if the lhs of our assignment is a convenience variable.
      In the case of assigning to a convenience variable, the lhs
      should be exactly the result of the evaluation of the rhs.  */
-  struct type *type = value_type (arg1);
+  struct type *type = arg1->type ();
   if (VALUE_LVAL (arg1) == lval_internalvar)
     type = NULL;
   value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside);
@@ -9781,7 +9781,7 @@ ada_assign_operation::evaluate (struct type *expect_type,
       /* Nothing.  */
     }
   else
-    arg2 = coerce_for_assign (value_type (arg1), arg2);
+    arg2 = coerce_for_assign (arg1->type (), arg2);
   return ada_value_assign (arg1, arg2);
 }
 
@@ -9831,7 +9831,7 @@ add_component_interval (LONGEST low, LONGEST high,
 static struct value *
 ada_value_cast (struct type *type, struct value *arg2)
 {
-  if (type == ada_check_typedef (value_type (arg2)))
+  if (type == ada_check_typedef (arg2->type ()))
     return arg2;
 
   return value_cast (type, arg2);
@@ -10177,7 +10177,7 @@ ada_atr_size (struct type *expect_type,
 	      enum noside noside, enum exp_opcode op,
 	      struct value *arg1)
 {
-  struct type *type = value_type (arg1);
+  struct type *type = arg1->type ();
 
   /* If the argument is a reference, then dereference its type, since
      the user is really asking for the size of the actual object,
@@ -10201,7 +10201,7 @@ ada_abs (struct type *expect_type,
 	 struct value *arg1)
 {
   unop_promote (exp->language_defn, exp->gdbarch, &arg1);
-  if (value_less (arg1, value_zero (value_type (arg1), not_lval)))
+  if (value_less (arg1, value_zero (arg1->type (), not_lval)))
     return value_neg (arg1);
   else
     return arg1;
@@ -10218,7 +10218,7 @@ ada_mult_binop (struct type *expect_type,
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     {
       binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
-      return value_zero (value_type (arg1), not_lval);
+      return value_zero (arg1->type (), not_lval);
     }
   else
     {
@@ -10267,24 +10267,24 @@ ada_ternop_slice (struct expression *exp,
 
   /* If this is a reference to an aligner type, then remove all
      the aligners.  */
-  if (value_type (array)->code () == TYPE_CODE_REF
-      && ada_is_aligner_type (value_type (array)->target_type ()))
-    value_type (array)->set_target_type
-      (ada_aligned_type (value_type (array)->target_type ()));
+  if (array->type ()->code () == TYPE_CODE_REF
+      && ada_is_aligner_type (array->type ()->target_type ()))
+    array->type ()->set_target_type
+      (ada_aligned_type (array->type ()->target_type ()));
 
-  if (ada_is_any_packed_array_type (value_type (array)))
+  if (ada_is_any_packed_array_type (array->type ()))
     error (_("cannot slice a packed array"));
 
   /* If this is a reference to an array or an array lvalue,
      convert to a pointer.  */
-  if (value_type (array)->code () == TYPE_CODE_REF
-      || (value_type (array)->code () == TYPE_CODE_ARRAY
+  if (array->type ()->code () == TYPE_CODE_REF
+      || (array->type ()->code () == TYPE_CODE_ARRAY
 	  && VALUE_LVAL (array) == lval_memory))
     array = value_addr (array);
 
   if (noside == EVAL_AVOID_SIDE_EFFECTS
       && ada_is_array_descriptor_type (ada_check_typedef
-				       (value_type (array))))
+				       (array->type ())))
     return empty_array (ada_type_of_array (array, 0), low_bound,
 			high_bound);
 
@@ -10292,8 +10292,8 @@ ada_ternop_slice (struct expression *exp,
 
   /* If we have more than one level of pointer indirection,
      dereference the value until we get only one level.  */
-  while (value_type (array)->code () == TYPE_CODE_PTR
-	 && (value_type (array)->target_type ()->code ()
+  while (array->type ()->code () == TYPE_CODE_PTR
+	 && (array->type ()->target_type ()->code ()
 	     == TYPE_CODE_PTR))
     array = value_ind (array);
 
@@ -10301,13 +10301,13 @@ ada_ternop_slice (struct expression *exp,
      to avoid a SEGV when trying to get the index type or the target
      type later down the road if the debug info generated by
      the compiler is incorrect or incomplete.  */
-  if (!ada_is_simple_array_type (value_type (array)))
+  if (!ada_is_simple_array_type (array->type ()))
     error (_("cannot take slice of non-array"));
 
-  if (ada_check_typedef (value_type (array))->code ()
+  if (ada_check_typedef (array->type ())->code ()
       == TYPE_CODE_PTR)
     {
-      struct type *type0 = ada_check_typedef (value_type (array));
+      struct type *type0 = ada_check_typedef (array->type ());
 
       if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
 	return empty_array (type0->target_type (), low_bound, high_bound);
@@ -10324,7 +10324,7 @@ ada_ternop_slice (struct expression *exp,
   else if (noside == EVAL_AVOID_SIDE_EFFECTS)
     return array;
   else if (high_bound < low_bound)
-    return empty_array (value_type (array), low_bound, high_bound);
+    return empty_array (array->type (), low_bound, high_bound);
   else
     return ada_value_slice (array, longest_to_int (low_bound),
 			    longest_to_int (high_bound));
@@ -10343,9 +10343,9 @@ ada_binop_in_bounds (struct expression *exp, enum noside noside,
       return value_zero (type, not_lval);
     }
 
-  struct type *type = ada_index_type (value_type (arg2), n, "range");
+  struct type *type = ada_index_type (arg2->type (), n, "range");
   if (!type)
-    type = value_type (arg1);
+    type = arg1->type ();
 
   value *arg3 = value_from_longest (type, ada_array_bound (arg2, n, 1));
   arg2 = value_from_longest (type, ada_array_bound (arg2, n, 0));
@@ -10369,7 +10369,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     {
       if (type_arg == NULL)
-	type_arg = value_type (arg1);
+	type_arg = arg1->type ();
 
       if (ada_is_constrained_packed_array_type (type_arg))
 	type_arg = decode_constrained_packed_array_type (type_arg);
@@ -10397,7 +10397,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
     {
       arg1 = ada_coerce_ref (arg1);
 
-      if (ada_is_constrained_packed_array_type (value_type (arg1)))
+      if (ada_is_constrained_packed_array_type (arg1->type ()))
 	arg1 = ada_coerce_to_simple_array (arg1);
 
       struct type *type;
@@ -10405,7 +10405,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
 	type = builtin_type (exp->gdbarch)->builtin_int;
       else
 	{
-	  type = ada_index_type (value_type (arg1), tem,
+	  type = ada_index_type (arg1->type (), tem,
 				 ada_attribute_name (op));
 	  if (type == NULL)
 	    type = builtin_type (exp->gdbarch)->builtin_int;
@@ -10496,7 +10496,7 @@ ada_binop_minmax (struct type *expect_type,
 		  struct value *arg1, struct value *arg2)
 {
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
-    return value_zero (value_type (arg1), not_lval);
+    return value_zero (arg1->type (), not_lval);
   else
     {
       binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -10513,12 +10513,12 @@ ada_binop_exp (struct type *expect_type,
 	       struct value *arg1, struct value *arg2)
 {
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
-    return value_zero (value_type (arg1), not_lval);
+    return value_zero (arg1->type (), not_lval);
   else
     {
       /* For integer exponentiation operations,
 	 only promote the first argument.  */
-      if (is_integral_type (value_type (arg2)))
+      if (is_integral_type (arg2->type ()))
 	unop_promote (exp->language_defn, exp->gdbarch, &arg1);
       else
 	binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -10723,12 +10723,12 @@ ada_concat_operation::evaluate (struct type *expect_type,
   if (dynamic_cast<ada_string_operation *> (lhs_expr.get ()) != nullptr)
     {
       rhs = rhs_expr->evaluate (nullptr, exp, noside);
-      lhs = lhs_expr->evaluate (value_type (rhs), exp, noside);
+      lhs = lhs_expr->evaluate (rhs->type (), exp, noside);
     }
   else if (dynamic_cast<ada_char_operation *> (lhs_expr.get ()) != nullptr)
     {
       rhs = rhs_expr->evaluate (nullptr, exp, noside);
-      struct type *rhs_type = check_typedef (value_type (rhs));
+      struct type *rhs_type = check_typedef (rhs->type ());
       struct type *elt_type = nullptr;
       if (rhs_type->code () == TYPE_CODE_ARRAY)
 	elt_type = rhs_type->target_type ();
@@ -10737,12 +10737,12 @@ ada_concat_operation::evaluate (struct type *expect_type,
   else if (dynamic_cast<ada_string_operation *> (rhs_expr.get ()) != nullptr)
     {
       lhs = lhs_expr->evaluate (nullptr, exp, noside);
-      rhs = rhs_expr->evaluate (value_type (lhs), exp, noside);
+      rhs = rhs_expr->evaluate (lhs->type (), exp, noside);
     }
   else if (dynamic_cast<ada_char_operation *> (rhs_expr.get ()) != nullptr)
     {
       lhs = lhs_expr->evaluate (nullptr, exp, noside);
-      struct type *lhs_type = check_typedef (value_type (lhs));
+      struct type *lhs_type = check_typedef (lhs->type ());
       struct type *elt_type = nullptr;
       if (lhs_type->code () == TYPE_CODE_ARRAY)
 	elt_type = lhs_type->target_type ();
@@ -10789,18 +10789,18 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
       return x - y;
     };
 
-  if (value_type (arg1)->code () == TYPE_CODE_PTR)
+  if (arg1->type ()->code () == TYPE_CODE_PTR)
     return (value_from_longest
-	    (value_type (arg1),
+	    (arg1->type (),
 	     do_op (value_as_long (arg1), value_as_long (arg2))));
-  if (value_type (arg2)->code () == TYPE_CODE_PTR)
+  if (arg2->type ()->code () == TYPE_CODE_PTR)
     return (value_from_longest
-	    (value_type (arg2),
+	    (arg2->type (),
 	     do_op (value_as_long (arg1), value_as_long (arg2))));
   /* Preserve the original type for use by the range case below.
      We cannot cast the result to a reference type, so if ARG1 is
      a reference type, find its underlying type.  */
-  struct type *type = value_type (arg1);
+  struct type *type = arg1->type ();
   while (type->code () == TYPE_CODE_REF)
     type = type->target_type ();
   binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -10826,7 +10826,7 @@ ada_unop_atr_operation::evaluate (struct type *expect_type,
     {
       value *tem = std::get<0> (m_storage)->evaluate (nullptr, exp,
 						      EVAL_AVOID_SIDE_EFFECTS);
-      type_arg = value_type (tem);
+      type_arg = tem->type ();
     }
   else
     val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -11011,7 +11011,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
 {
   value *arg1 = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
 
-  struct type *type = ada_check_typedef (value_type (arg1));
+  struct type *type = ada_check_typedef (arg1->type ());
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     {
       if (ada_is_array_descriptor_type (type))
@@ -11039,7 +11039,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
 	    {
 	      arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp,
 							EVAL_NORMAL);
-	      type = value_type (ada_value_ind (arg1));
+	      type = ada_value_ind (arg1)->type ();
 	    }
 	  else
 	    {
@@ -11066,7 +11066,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
 	error (_("Attempt to take contents of a non-pointer value."));
     }
   arg1 = ada_coerce_ref (arg1);     /* FIXME: What is this for??  */
-  type = ada_check_typedef (value_type (arg1));
+  type = ada_check_typedef (arg1->type ());
 
   if (type->code () == TYPE_CODE_INT)
     /* GDB allows dereferencing an int.  If we were given
@@ -11098,7 +11098,7 @@ ada_structop_operation::evaluate (struct type *expect_type,
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     {
       struct type *type;
-      struct type *type1 = value_type (arg1);
+      struct type *type1 = arg1->type ();
 
       if (ada_is_tagged_type (type1, 1))
 	{
@@ -11114,7 +11114,7 @@ ada_structop_operation::evaluate (struct type *expect_type,
 							EVAL_NORMAL);
 	      arg1 = ada_value_struct_elt (arg1, str, 0);
 	      arg1 = unwrap_value (arg1);
-	      type = value_type (ada_to_fixed_value (arg1));
+	      type = ada_to_fixed_value (arg1)->type ();
 	    }
 	}
       else
@@ -11152,15 +11152,15 @@ ada_funcall_operation::evaluate (struct type *expect_type,
     argvec[i] = args_up[i]->evaluate (nullptr, exp, noside);
 
   if (ada_is_constrained_packed_array_type
-      (desc_base_type (value_type (callee))))
+      (desc_base_type (callee->type ())))
     callee = ada_coerce_to_simple_array (callee);
-  else if (value_type (callee)->code () == TYPE_CODE_ARRAY
-	   && TYPE_FIELD_BITSIZE (value_type (callee), 0) != 0)
+  else if (callee->type ()->code () == TYPE_CODE_ARRAY
+	   && TYPE_FIELD_BITSIZE (callee->type (), 0) != 0)
     /* This is a packed array that has already been fixed, and
        therefore already coerced to a simple array.  Nothing further
        to do.  */
     ;
-  else if (value_type (callee)->code () == TYPE_CODE_REF)
+  else if (callee->type ()->code () == TYPE_CODE_REF)
     {
       /* Make sure we dereference references so that all the code below
 	 feels like it's really handling the referenced value.  Wrapping
@@ -11168,11 +11168,11 @@ ada_funcall_operation::evaluate (struct type *expect_type,
 	 well.  */
       callee = ada_to_fixed_value (coerce_ref (callee));
     }
-  else if (value_type (callee)->code () == TYPE_CODE_ARRAY
+  else if (callee->type ()->code () == TYPE_CODE_ARRAY
 	   && VALUE_LVAL (callee) == lval_memory)
     callee = value_addr (callee);
 
-  struct type *type = ada_check_typedef (value_type (callee));
+  struct type *type = ada_check_typedef (callee->type ());
 
   /* Ada allows us to implicitly dereference arrays when subscripting
      them.  So, if this is an array typedef (encoding use for array
@@ -11196,7 +11196,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
 	  break;
 	default:
 	  error (_("cannot subscript or call something of type `%s'"),
-		 ada_type_name (value_type (callee)));
+		 ada_type_name (callee->type ()));
 	  break;
 	}
     }
@@ -11320,7 +11320,7 @@ ada_ternop_slice_operation::resolve (struct expression *exp,
      continue that here.  */
   value *v = std::get<0> (m_storage)->evaluate (context_type, exp,
 						EVAL_AVOID_SIDE_EFFECTS);
-  if (ada_is_any_packed_array_type (value_type (v)))
+  if (ada_is_any_packed_array_type (v->type ()))
     error (_("cannot slice a packed array"));
   return false;
 }
@@ -11375,7 +11375,7 @@ scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
       k = pend - str;
     }
 
-  bound_val = ada_search_struct_field (bound, dval, 0, value_type (dval));
+  bound_val = ada_search_struct_field (bound, dval, 0, dval->type ());
   if (bound_val == NULL)
     return 0;
 
@@ -12025,7 +12025,7 @@ ada_exception_message_1 (void)
 
   e_msg_val = ada_coerce_to_simple_array (e_msg_val);
   gdb_assert (e_msg_val != NULL);
-  e_msg_len = value_type (e_msg_val)->length ();
+  e_msg_len = e_msg_val->type ()->length ();
 
   /* If the message string is empty, then treat it as if there was
      no exception message.  */
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index a3a28063daa..979d64a54ad 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -457,7 +457,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
      to extract the string from the fat string.  */
   if (initialize_fieldnos)
     {
-      struct type *type = value_type (val);
+      struct type *type = val->type ();
       struct type *bounds_type;
 
       array_fieldno = ada_get_field_index (type, "P_ARRAY", 0);
@@ -784,7 +784,7 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
 	value_subscript (entry_calls_value,
 			 value_as_long (atc_nesting_level_value));
       called_task_fieldno =
-	ada_get_field_index (value_type (entry_calls_value_element),
+	ada_get_field_index (entry_calls_value_element->type (),
 			     "called_task", 0);
       task_info->called_task =
 	value_as_address (value_field (entry_calls_value_element,
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 10d3b0a41bf..1f22ab61ce2 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -196,12 +196,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 					       (i * bitsize) / HOST_CHAR_BIT,
 					       (i * bitsize) % HOST_CHAR_BIT,
 					       bitsize, elttype);
-	  if (check_typedef (value_type (v0))->length ()
-	      != check_typedef (value_type (v1))->length ())
+	  if (check_typedef (v0->type ())->length ()
+	      != check_typedef (v1->type ())->length ())
 	    break;
 	  if (!value_contents_eq (v0, value_embedded_offset (v0),
 				  v1, value_embedded_offset (v1),
-				  check_typedef (value_type (v0))->length ()))
+				  check_typedef (v0->type ())->length ()))
 	    break;
 	}
 
@@ -552,7 +552,7 @@ print_variant_part (struct value *value, int field_num,
 		    int comma_needed,
 		    const struct language_defn *language)
 {
-  struct type *type = value_type (value);
+  struct type *type = value->type ();
   struct type *var_type = type->field (field_num).type ();
   int which = ada_which_variant_applies (var_type, outer_value);
 
@@ -588,7 +588,7 @@ print_field_values (struct value *value, struct value *outer_value,
 {
   int i, len;
 
-  struct type *type = value_type (value);
+  struct type *type = value->type ();
   len = type->num_fields ();
 
   for (i = 0; i < len; i += 1)
@@ -732,8 +732,8 @@ ada_value_print_ptr (struct value *val,
 		     const struct value_print_options *options)
 {
   if (!options->format
-      && value_type (val)->target_type ()->code () == TYPE_CODE_INT
-      && value_type (val)->target_type ()->length () == 0)
+      && val->type ()->target_type ()->code () == TYPE_CODE_INT
+      && val->type ()->target_type ()->length () == 0)
     {
       gdb_puts ("null", stream);
       return;
@@ -741,7 +741,7 @@ ada_value_print_ptr (struct value *val,
 
   common_val_print (val, stream, recurse, options, language_def (language_c));
 
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
   if (ada_is_tag_type (type))
     {
       gdb::unique_xmalloc_ptr<char> name = ada_tag_name (val);
@@ -758,7 +758,7 @@ static void
 ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
 		     const struct value_print_options *options)
 {
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
   const gdb_byte *valaddr = value_contents_for_printing (val).data ();
 
   if (type->code () == TYPE_CODE_RANGE
@@ -838,7 +838,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
       return;
     }
 
-  struct type *type = ada_check_typedef (value_type (value));
+  struct type *type = ada_check_typedef (value->type ());
   const gdb_byte *valaddr = value_contents_for_printing (value).data ();
   int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
 
@@ -875,7 +875,7 @@ ada_val_print_struct_union (struct value *value,
 			    int recurse,
 			    const struct value_print_options *options)
 {
-  if (ada_is_bogus_array_descriptor (value_type (value)))
+  if (ada_is_bogus_array_descriptor (value->type ()))
     {
       gdb_printf (stream, "(...?)");
       return;
@@ -901,7 +901,7 @@ static void
 ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
 		       const struct value_print_options *options)
 {
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
 
   /* For an array of characters, print with string syntax.  */
   if (ada_is_string_type (type)
@@ -961,7 +961,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
   deref_val = coerce_ref_if_computed (original_value);
   if (deref_val)
     {
-      if (ada_is_tagged_type (value_type (deref_val), 1))
+      if (ada_is_tagged_type (deref_val->type (), 1))
 	deref_val = ada_tag_value_at_base_address (deref_val);
 
       common_val_print (deref_val, stream, recurse + 1, options,
@@ -979,7 +979,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
   deref_val
     = ada_value_ind (value_from_pointer (lookup_pointer_type (elttype),
 					 deref_val_int));
-  if (ada_is_tagged_type (value_type (deref_val), 1))
+  if (ada_is_tagged_type (deref_val->type (), 1))
     deref_val = ada_tag_value_at_base_address (deref_val);
 
   if (value_lazy (deref_val))
@@ -997,7 +997,7 @@ void
 ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
 		       const struct value_print_options *options)
 {
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
 
   if (ada_is_array_descriptor_type (type)
       || (ada_is_constrained_packed_array_type (type)
@@ -1018,7 +1018,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
   else
     val = ada_to_fixed_value (val);
 
-  type = value_type (val);
+  type = val->type ();
   struct type *saved_type = type;
 
   const gdb_byte *valaddr = value_contents_for_printing (val).data ();
@@ -1088,7 +1088,7 @@ ada_value_print (struct value *val0, struct ui_file *stream,
 		 const struct value_print_options *options)
 {
   struct value *val = ada_to_fixed_value (val0);
-  struct type *type = ada_check_typedef (value_type (val));
+  struct type *type = ada_check_typedef (val->type ());
   struct value_print_options opts;
 
   /* If it is a pointer, indicate what it points to; but not for
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 6b92b76f092..63e851e7ae5 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -66,7 +66,7 @@ ada_varobj_decode_var (struct value **value_ptr, struct type **type_ptr)
     *value_ptr = ada_get_decoded_value (*value_ptr);
 
   if (*value_ptr != nullptr)
-    *type_ptr = ada_check_typedef (value_type (*value_ptr));
+    *type_ptr = ada_check_typedef ((*value_ptr)->type ());
   else
     *type_ptr = ada_get_decoded_type (*type_ptr);
 }
@@ -102,7 +102,7 @@ ada_varobj_struct_elt (struct value *parent_value,
   if (parent_value)
     {
       value = value_field (parent_value, fieldno);
-      type = value_type (value);
+      type = value->type ();
     }
   else
     type = parent_type->field (fieldno).type ();
@@ -150,7 +150,7 @@ ada_varobj_ind (struct value *parent_value,
   if (parent_value)
     {
       value = ada_value_ind (parent_value);
-      type = value_type (value);
+      type = value->type ();
     }
   else
     type = parent_type->target_type ();
@@ -181,7 +181,7 @@ ada_varobj_simple_array_elt (struct value *parent_value,
 	value_from_longest (parent_type->index_type (), elt_index);
 
       value = ada_value_subscript (parent_value, 1, &index_value);
-      type = value_type (value);
+      type = value->type ();
     }
   else
     type = parent_type->target_type ();
@@ -221,7 +221,7 @@ ada_varobj_adjust_for_child_access (struct value **value,
   if (*value != NULL && ada_is_tagged_type (*type, 1))
     {
       *value = ada_tag_value_at_base_address (*value);
-      *type = value_type (*value);
+      *type = (*value)->type ();
     }
 }
 
@@ -943,7 +943,7 @@ static bool
 ada_value_is_changeable_p (const struct varobj *var)
 {
   struct type *type = (var->value != nullptr
-		       ? value_type (var->value.get ()) : var->type);
+		       ? var->value.get ()->type () : var->type);
 
   if (type->code () == TYPE_CODE_REF)
     type = type->target_type ();
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 14f5a0492d3..5edde7abcae 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -319,7 +319,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   for (i = 0, m_arg = alpha_args; i < nargs; i++, m_arg++)
     {
       struct value *arg = args[i];
-      struct type *arg_type = check_typedef (value_type (arg));
+      struct type *arg_type = check_typedef (arg->type ());
 
       /* Cast argument to long if necessary as the compiler does it too.  */
       switch (arg_type->code ())
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 328e001f5bb..5e098b1ce79 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -376,7 +376,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
 	    memcpy (buf, raw_buf + 1, 1);
 	  else
 	    mark_value_bytes_unavailable (result_value, 0,
-					  value_type (result_value)->length ());
+					  result_value->type ()->length ());
 	}
       else
 	{
@@ -386,7 +386,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
 	    memcpy (buf, raw_buf, 1);
 	  else
 	    mark_value_bytes_unavailable (result_value, 0,
-					  value_type (result_value)->length ());
+					  result_value->type ()->length ());
 	}
     }
   else if (i386_dword_regnum_p (gdbarch, regnum))
@@ -399,7 +399,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
 	memcpy (buf, raw_buf, 4);
       else
 	mark_value_bytes_unavailable (result_value, 0,
-				      value_type (result_value)->length ());
+				      result_value->type ()->length ());
     }
   else
     i386_pseudo_register_read_into_value (gdbarch, regcache, regnum,
@@ -962,7 +962,7 @@ if (return_method == return_method_struct)
 
   for (i = 0; i < nargs; i++)
     {
-      struct type *type = value_type (args[i]);
+      struct type *type = args[i]->type ();
       int len = type->length ();
       enum amd64_reg_class theclass[2];
       int needed_integer_regs = 0;
@@ -1046,7 +1046,7 @@ if (return_method == return_method_struct)
   /* Write out the arguments to the stack.  */
   for (i = 0; i < num_stack_args; i++)
     {
-      struct type *type = value_type (stack_args[i]);
+      struct type *type = stack_args[i]->type ();
       const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
       int len = type->length ();
 
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 411a6204a90..5c779cbb118 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -176,9 +176,9 @@ amd64_windows_adjust_args_passed_by_pointer (struct value **args,
   int i;
 
   for (i = 0; i < nargs; i++)
-    if (amd64_windows_passed_by_pointer (value_type (args[i])))
+    if (amd64_windows_passed_by_pointer (args[i]->type ()))
       {
-	struct type *type = value_type (args[i]);
+	struct type *type = args[i]->type ();
 	const gdb_byte *valbuf = value_contents (args[i]).data ();
 	const int len = type->length ();
 
@@ -204,7 +204,7 @@ static void
 amd64_windows_store_arg_in_reg (struct regcache *regcache,
 				struct value *arg, int regno)
 {
-  struct type *type = value_type (arg);
+  struct type *type = arg->type ();
   const gdb_byte *valbuf = value_contents (arg).data ();
   gdb_byte buf[8];
 
@@ -251,7 +251,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
 
   for (i = 0; i < nargs; i++)
     {
-      struct type *type = value_type (args[i]);
+      struct type *type = args[i]->type ();
       int len = type->length ();
       int on_stack_p = 1;
 
@@ -294,7 +294,7 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
   /* Write out the arguments to the stack.  */
   for (i = 0; i < num_stack_args; i++)
     {
-      struct type *type = value_type (stack_args[i]);
+      struct type *type = stack_args[i]->type ();
       const gdb_byte *valbuf = value_contents (stack_args[i]).data ();
 
       write_memory (sp + element * 8, valbuf, type->length ());
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index c232eb98432..f42abc2ec42 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -761,7 +761,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 	 argument's size up to an integral number of words.  */
       for (int i = 0; i < nargs; i++)
 	{
-	  unsigned int len = value_type (args[i])->length ();
+	  unsigned int len = args[i]->type ()->length ();
 	  unsigned int space = align_up (len, 4);
 
 	  total_space += space;
@@ -776,7 +776,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       gdb_byte *data = memory_image;
       for (int i = 0; i < nargs; i++)
 	{
-	  unsigned int len = value_type (args[i])->length ();
+	  unsigned int len = args[i]->type ()->length ();
 	  unsigned int space = align_up (len, 4);
 
 	  memcpy (data, value_contents (args[i]).data (), (size_t) len);
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 347f3e6b307..a21f7120ab4 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -4635,7 +4635,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
   /* Determine the type of this function and whether the VFP ABI
      applies.  */
-  ftype = check_typedef (value_type (function));
+  ftype = check_typedef (function->type ());
   if (ftype->code () == TYPE_CODE_PTR)
     ftype = check_typedef (ftype->target_type ());
   use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
@@ -4678,7 +4678,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int vfp_base_count;
       int may_use_core_reg = 1;
 
-      arg_type = check_typedef (value_type (args[argnum]));
+      arg_type = check_typedef (args[argnum]->type ());
       len = arg_type->length ();
       target_type = arg_type->target_type ();
       typecode = arg_type->code ();
@@ -9178,7 +9178,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
 		  struct value **read_value, const gdb_byte *writebuf)
 {
   arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
-  struct type *func_type = function ? value_type (function) : NULL;
+  struct type *func_type = function ? function->type () : NULL;
   enum arm_vfp_cprc_base_type vfp_base_type;
   int vfp_base_count;
 
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index fa76a3d24da..023ebc37efb 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1298,7 +1298,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int last_regnum;
       int j;
       struct value *arg = args[i];
-      struct type *type = check_typedef (value_type (arg));
+      struct type *type = check_typedef (arg->type ());
       const bfd_byte *contents = value_contents (arg).data ();
       int len = type->length ();
 
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index fc214e7dfe1..3cfe99718a5 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1585,7 +1585,7 @@ operation::generate_ax (struct expression *exp,
       struct value *v = evaluate (nullptr, exp, EVAL_AVOID_SIDE_EFFECTS);
       ax_const_l (ax, value_as_long (v));
       value->kind = axs_rvalue;
-      value->type = check_typedef (value_type (v));
+      value->type = check_typedef (v->type ());
     }
   else
     {
@@ -1745,7 +1745,7 @@ repeat_operation::do_generate_ax (struct expression *exp,
   struct value *v
     = std::get<1> (m_storage)->evaluate (nullptr, exp,
 					 EVAL_AVOID_SIDE_EFFECTS);
-  if (value_type (v)->code () != TYPE_CODE_INT)
+  if (v->type ()->code () != TYPE_CODE_INT)
     error (_("Right operand of `@' must be an integer."));
   int length = value_as_long (v);
   if (length <= 0)
@@ -1862,7 +1862,7 @@ unop_memval_type_operation::do_generate_ax (struct expression *exp,
   struct value *val
     = std::get<0> (m_storage)->evaluate (nullptr, exp,
 					 EVAL_AVOID_SIDE_EFFECTS);
-  struct type *type = value_type (val);
+  struct type *type = val->type ();
 
   std::get<1> (m_storage)->generate_ax (exp, ax, value);
 
@@ -1980,7 +1980,7 @@ unop_cast_type_operation::do_generate_ax (struct expression *exp,
   struct value *val
     = std::get<0> (m_storage)->evaluate (nullptr, exp,
 					 EVAL_AVOID_SIDE_EFFECTS);
-  std::get<1> (m_storage)->generate_ax (exp, ax, value, value_type (val));
+  std::get<1> (m_storage)->generate_ax (exp, ax, value, val->type ());
 }
 
 void
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 97dee5cd0fe..eaaef94f59e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1864,7 +1864,7 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
   if (val == NULL)
     return NULL;
 
-  bit_val = allocate_value (value_type (val));
+  bit_val = allocate_value (val->type ());
 
   unpack_value_bitfield (bit_val,
 			 w->val_bitpos,
@@ -2078,7 +2078,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
 	  if (VALUE_LVAL (v) == lval_memory
 	      && (v == val_chain[0] || ! value_lazy (v)))
 	    {
-	      struct type *vtype = check_typedef (value_type (v));
+	      struct type *vtype = check_typedef (v->type ());
 
 	      /* We only watch structs and arrays if user asked
 		 for it explicitly, never if they just happen to
@@ -2125,7 +2125,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
 		  for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
 		    ;
 		  *tmp = loc;
-		  loc->gdbarch = value_type (v)->arch ();
+		  loc->gdbarch = v->type ()->arch ();
 
 		  loc->pspace = frame_pspace;
 		  loc->address
@@ -2137,7 +2137,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
 		      loc->length = ((bitpos % 8) + bitsize + 7) / 8;
 		    }
 		  else
-		    loc->length = value_type (v)->length ();
+		    loc->length = v->type ()->length ();
 
 		  loc->watchpoint_type = type;
 		}
@@ -10317,7 +10317,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   w->cond_exp_valid_block = cond_exp_valid_block;
   if (just_location)
     {
-      struct type *t = value_type (val.get ());
+      struct type *t = val.get ()->type ();
       CORE_ADDR addr = value_as_address (val.get ());
 
       w->exp_string_reparse
@@ -10426,7 +10426,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
 	    {
 	      /* Ahh, memory we actually used!  Check if we can cover
 		 it with hardware watchpoints.  */
-	      struct type *vtype = check_typedef (value_type (v));
+	      struct type *vtype = check_typedef (v->type ());
 
 	      /* We only watch structs and arrays if user asked for it
 		 explicitly, never if they just happen to appear in a
@@ -10441,7 +10441,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
 
 		  len = (target_exact_watchpoints
 			 && is_scalar_type_recursive (vtype))?
-		    1 : value_type (v)->length ();
+		    1 : v->type ()->length ();
 
 		  num_regs = target_region_ok_for_hw_watchpoint (vaddr, len);
 		  if (!num_regs)
diff --git a/gdb/c-exp.h b/gdb/c-exp.h
index 20eeaca9a89..51e2d26eb2e 100644
--- a/gdb/c-exp.h
+++ b/gdb/c-exp.h
@@ -138,7 +138,7 @@ public:
     value *lhs
       = std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
     value *rhs
-      = std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp,
+      = std::get<1> (this->m_storage)->evaluate (lhs->type (), exp,
 						 noside);
     return FUNC (expect_type, exp, noside, OP, lhs, rhs);
   }
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index a6d912a7be7..c2c763154c7 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -245,7 +245,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
 {
   int err, width;
   unsigned int fetchlimit;
-  struct type *type = check_typedef (value_type (value));
+  struct type *type = check_typedef (value->type ());
   struct type *element_type = type->target_type ();
   int req_length = *length;
   enum bfd_endian byte_order
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 69aa91d1ec3..8d28c45cbfc 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -235,7 +235,7 @@ c_value_print_array (struct value *val,
 		     struct ui_file *stream, int recurse,
 		     const struct value_print_options *options)
 {
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
   CORE_ADDR address = value_address (val);
   const gdb_byte *valaddr = value_contents_for_printing (val).data ();
   struct type *unresolved_elttype = type->target_type ();
@@ -333,7 +333,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
       return;
     }
 
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
   const gdb_byte *valaddr = value_contents_for_printing (val).data ();
 
   if (options->vtblprint && cp_is_vtbl_ptr_type (type))
@@ -363,7 +363,7 @@ static void
 c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
 		      const struct value_print_options *options)
 {
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
 
   if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint)
     gdb_printf (stream, "{...}");
@@ -405,7 +405,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
 	 instead.  Since we don't know whether the value is really
 	 intended to be used as an integer or a character, print
 	 the character equivalent as well.  */
-      struct type *type = value_type (val);
+      struct type *type = val->type ();
       const gdb_byte *valaddr = value_contents_for_printing (val).data ();
       if (c_textual_element_type (type, options->format))
 	{
@@ -422,7 +422,7 @@ void
 c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
 		     const struct value_print_options *options)
 {
-  struct type *type = value_type (val);
+  struct type *type = val->type ();
 
   type = check_typedef (type);
   switch (type->code ())
@@ -486,11 +486,11 @@ c_value_print (struct value *val, struct ui_file *stream,
      C++: if it is a member pointer, we will take care
      of that when we print it.  */
 
-  type = check_typedef (value_type (val));
+  type = check_typedef (val->type ());
 
   if (type->is_pointer_or_reference ())
     {
-      struct type *original_type = value_type (val);
+      struct type *original_type = val->type ();
 
       /* Hack:  remove (char *) for char strings.  Their
 	 type is indicated by the quoted string anyway.
@@ -541,7 +541,7 @@ c_value_print (struct value *val, struct ui_file *stream,
 	  if (is_ref)
 	    val = value_ref (value_ind (val), refcode);
 
-	  type = value_type (val);
+	  type = val->type ();
 	  type_print (type, "", stream, -1);
 	  gdb_printf (stream, ") ");
 	}
@@ -549,7 +549,7 @@ c_value_print (struct value *val, struct ui_file *stream,
 	{
 	  /* normal case */
 	  gdb_printf (stream, "(");
-	  type_print (value_type (val), "", stream, -1);
+	  type_print (val->type (), "", stream, -1);
 	  gdb_printf (stream, ") ");
 	}
     }
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index a6b3306d22b..d517c798a6a 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -245,7 +245,7 @@ static struct value *
 value_struct_element_index (struct value *value, int type_index)
 {
   struct value *result = NULL;
-  struct type *type = value_type (value);
+  struct type *type = value->type ();
 
   type = check_typedef (type);
 
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 6c0d780face..7267d607916 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2190,7 +2190,7 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist,
   if (argc != 1)
     error (_("You can only provide one argument to %s"), fnname);
 
-  struct type *type0 = check_typedef (value_type (argv[0]));
+  struct type *type0 = check_typedef (argv[0]->type ());
 
   if (type0->code () != TYPE_CODE_ARRAY
       && type0->code () != TYPE_CODE_STRING)
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index a8811c4b4d7..e1d40c0e0ce 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -225,7 +225,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
   /* Have everything.  Open/write the data.  */
   if (file_format == NULL || strcmp (file_format, "binary") == 0)
     dump_binary_file (filename.get (), mode, value_contents (val).data (),
-		      value_type (val)->length ());
+		      val->type ()->length ());
   else
     {
       CORE_ADDR vaddr;
@@ -242,7 +242,7 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
 
       dump_bfd_file (filename.get (), mode, file_format, vaddr,
 		     value_contents (val).data (), 
-		     value_type (val)->length ());
+		     val->type ()->length ());
     }
 }
 
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 81c3c728dc6..b78568e3cc6 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -37,7 +37,7 @@ get_ulongest (const char **pp, int trailer)
 
       if (val != NULL)	/* Value history reference */
 	{
-	  if (value_type (val)->code () == TYPE_CODE_INT)
+	  if (val->type ()->code () == TYPE_CODE_INT)
 	    retval = value_as_long (val);
 	  else
 	    error (_("History value must have integer type."));
@@ -96,7 +96,7 @@ get_number_trailer (const char **pp, int trailer)
 
       if (val)	/* Value history reference */
 	{
-	  if (value_type (val)->code () == TYPE_CODE_INT)
+	  if (val->type ()->code () == TYPE_CODE_INT)
 	    retval = value_as_long (val);
 	  else
 	    {
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 87a3b5c0a96..538d314efda 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -111,7 +111,7 @@ value_rtti_type (struct value *v, int *full,
   struct type *ret = NULL;
 
   if ((current_cp_abi.rtti_type) == NULL
-      || !HAVE_CPLUS_STRUCT (check_typedef (value_type (v))))
+      || !HAVE_CPLUS_STRUCT (check_typedef (v->type ())))
     return NULL;
   try
     {
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index ca73882a0ce..33ff17b8d2b 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -129,7 +129,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
   int fields_seen = 0;
   static int last_set_recurse = -1;
 
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
 
   if (recurse == 0)
     {
@@ -389,7 +389,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
 		int recurse, const struct value_print_options *options,
 		struct type **dont_print_vb)
 {
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
   CORE_ADDR address = value_address (val);
   struct type **last_dont_print
     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
@@ -461,7 +461,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
 		  base_val = value_from_contents_and_address (baseclass,
 							      buf.data (),
 							      address + boffset);
-		  baseclass = value_type (base_val);
+		  baseclass = base_val->type ();
 		  boffset = 0;
 		}
 	      else
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index edf4e74715c..cc8d7634c9d 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -821,7 +821,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       int reg_demand;
       int i;
       
-      len = value_type (args[argnum])->length ();
+      len = args[argnum]->type ()->length ();
       val = value_contents (args[argnum]).data ();
       
       /* How may registers worth of storage do we need for this argument?  */
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index df9520fe37d..9fa1fb37154 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -806,7 +806,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       struct type *arg_type;
       const gdb_byte *val;
 
-      arg_type = check_typedef (value_type (args[argnum]));
+      arg_type = check_typedef (args[argnum]->type ());
       len = arg_type->length ();
       val = value_contents (args[argnum]).data ();
 
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 18697545ce8..6c7748efa4c 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -61,7 +61,7 @@ dynamic_array_type (struct type *type,
 
       true_type = lookup_array_range_type (true_type, 0, length - 1);
       ival = value_at (true_type, addr);
-      true_type = value_type (ival);
+      true_type = ival->type ();
 
       d_value_print_inner (ival, stream, recurse + 1, options);
       return 0;
@@ -77,7 +77,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
 {
   int ret;
 
-  struct type *type = check_typedef (value_type (val));
+  struct type *type = check_typedef (val->type ());
   switch (type->code ())
     {
       case TYPE_CODE_STRUCT:
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index d4dba555b6a..9e562074cf8 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -724,7 +724,7 @@ info_mach_region_command (const char *exp, int from_tty)
 
   expression_up expr = parse_expression (exp);
   val = evaluate_expression (expr.get ());
-  if (TYPE_IS_REFERENCE (value_type (val)))
+  if (TYPE_IS_REFERENCE (val->type ()))
     {
       val = value_ind (val);
     }
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 9805b8a8e78..70fa1a9413e 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -494,7 +494,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
 	    }
 
 	  if (expr != NULL && expr->first_opcode () == OP_TYPE)
-	    type = value_type (evaluate_type (expr.get ()));
+	    type = evaluate_type (expr.get ())->type ();
 
 	  args.emplace_back (type, std::move (type_str), std::move (expr));
 	}
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index eecd18f59c9..7310295db4d 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -151,7 +151,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
   piece_closure *c
     = (piece_closure *) value_computed_closure (v);
   gdb::byte_vector buffer;
-  bool bits_big_endian = type_byte_order (value_type (v)) == BFD_ENDIAN_BIG;
+  bool bits_big_endian = type_byte_order (v->type ()) == BFD_ENDIAN_BIG;
 
   gdb_assert (!check_optimized || from == nullptr);
   if (from != nullptr)
@@ -174,18 +174,18 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
       bits_to_skip += (8 * value_offset (value_parent (v))
 		       + value_bitpos (v));
       if (from != nullptr
-	  && (type_byte_order (value_type (from))
+	  && (type_byte_order (from->type ())
 	      == BFD_ENDIAN_BIG))
 	{
 	  /* Use the least significant bits of FROM.  */
-	  max_offset = 8 * value_type (from)->length ();
+	  max_offset = 8 * from->type ()->length ();
 	  offset = max_offset - value_bitsize (v);
 	}
       else
 	max_offset = value_bitsize (v);
     }
   else
-    max_offset = 8 * value_type (v)->length ();
+    max_offset = 8 * v->type ()->length ();
 
   /* Advance to the first non-skipped piece.  */
   for (i = 0; i < c->pieces.size () && bits_to_skip >= c->pieces[i].size; i++)
@@ -364,7 +364,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
 
 	    gdbarch *objfile_gdbarch = c->per_objfile->objfile->arch ();
 	    ULONGEST stack_value_size_bits
-	      = 8 * value_type (p->v.value)->length ();
+	      = 8 * p->v.value->type ()->length ();
 
 	    /* Use zeroes if piece reaches beyond stack value.  */
 	    if (p->offset + p->size > stack_value_size_bits)
@@ -507,7 +507,7 @@ indirect_pieced_value (value *value)
   int i;
   dwarf_expr_piece *piece = NULL;
 
-  struct type *type = check_typedef (value_type (value));
+  struct type *type = check_typedef (value->type ());
   if (type->code () != TYPE_CODE_PTR)
     return NULL;
 
@@ -574,7 +574,7 @@ indirect_pieced_value (value *value)
 static value *
 coerce_pieced_ref (const value *value)
 {
-  struct type *type = check_typedef (value_type (value));
+  struct type *type = check_typedef (value->type ());
 
   if (value_bits_synthetic_pointer (value, value_embedded_offset (value),
 				    TARGET_CHAR_BIT * type->length ()))
@@ -1012,7 +1012,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
 	case DWARF_VALUE_STACK:
 	  {
 	    value *val = this->fetch (0);
-	    size_t n = value_type (val)->length ();
+	    size_t n = val->type ()->length ();
 	    size_t len = subobj_type->length ();
 	    size_t max = type->length ();
 
@@ -1144,7 +1144,7 @@ dwarf_expr_context::fetch_address (int n)
   bfd_endian byte_order = gdbarch_byte_order (arch);
   ULONGEST result;
 
-  dwarf_require_integral (value_type (result_val));
+  dwarf_require_integral (result_val->type ());
   result = extract_unsigned_integer (value_contents (result_val), byte_order);
 
   /* For most architectures, calling extract_unsigned_integer() alone
@@ -1157,7 +1157,7 @@ dwarf_expr_context::fetch_address (int n)
     {
       gdb_byte *buf = (gdb_byte *) alloca (this->m_addr_size);
       type *int_type = get_unsigned_type (arch,
-					  value_type (result_val));
+					  result_val->type ());
 
       store_unsigned_integer (buf, this->m_addr_size, byte_order, result);
       return gdbarch_integer_to_address (arch, int_type, buf);
@@ -1929,18 +1929,18 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	      {
 	      case DW_OP_abs:
 		if (value_less (result_val,
-				value_zero (value_type (result_val), not_lval)))
+				value_zero (result_val->type (), not_lval)))
 		  result_val = value_neg (result_val);
 		break;
 	      case DW_OP_neg:
 		result_val = value_neg (result_val);
 		break;
 	      case DW_OP_not:
-		dwarf_require_integral (value_type (result_val));
+		dwarf_require_integral (result_val->type ());
 		result_val = value_complement (result_val);
 		break;
 	      case DW_OP_plus_uconst:
-		dwarf_require_integral (value_type (result_val));
+		dwarf_require_integral (result_val->type ());
 		result = value_as_long (result_val);
 		op_ptr = safe_read_uleb128 (op_ptr, op_end, &reg);
 		result += reg;
@@ -1977,14 +1977,14 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	    first = fetch (0);
 	    pop ();
 
-	    if (! base_types_equal_p (value_type (first), value_type (second)))
+	    if (! base_types_equal_p (first->type (), second->type ()))
 	      error (_("Incompatible types on DWARF stack"));
 
 	    switch (op)
 	      {
 	      case DW_OP_and:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
 		result_val = value_binop (first, second, BINOP_BITWISE_AND);
 		break;
 	      case DW_OP_div:
@@ -1996,7 +1996,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	      case DW_OP_mod:
 		{
 		  int cast_back = 0;
-		  struct type *orig_type = value_type (first);
+		  struct type *orig_type = first->type ();
 
 		  /* We have to special-case "old-style" untyped values
 		     -- these must have mod computed using unsigned
@@ -2020,25 +2020,25 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 		result_val = value_binop (first, second, BINOP_MUL);
 		break;
 	      case DW_OP_or:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
 		result_val = value_binop (first, second, BINOP_BITWISE_IOR);
 		break;
 	      case DW_OP_plus:
 		result_val = value_binop (first, second, BINOP_ADD);
 		break;
 	      case DW_OP_shl:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
 		result_val = value_binop (first, second, BINOP_LSH);
 		break;
 	      case DW_OP_shr:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
-		if (!value_type (first)->is_unsigned ())
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
+		if (!first->type ()->is_unsigned ())
 		  {
 		    struct type *utype
-		      = get_unsigned_type (arch, value_type (first));
+		      = get_unsigned_type (arch, first->type ());
 
 		    first = value_cast (utype, first);
 		  }
@@ -2046,16 +2046,16 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 		result_val = value_binop (first, second, BINOP_RSH);
 		/* Make sure we wind up with the same type we started
 		   with.  */
-		if (value_type (result_val) != value_type (second))
-		  result_val = value_cast (value_type (second), result_val);
+		if (result_val->type () != second->type ())
+		  result_val = value_cast (second->type (), result_val);
 		break;
 	      case DW_OP_shra:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
-		if (value_type (first)->is_unsigned ())
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
+		if (first->type ()->is_unsigned ())
 		  {
 		    struct type *stype
-		      = get_signed_type (arch, value_type (first));
+		      = get_signed_type (arch, first->type ());
 
 		    first = value_cast (stype, first);
 		  }
@@ -2063,12 +2063,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 		result_val = value_binop (first, second, BINOP_RSH);
 		/* Make sure we wind up with the same type we started
 		   with.  */
-		if (value_type (result_val) != value_type (second))
-		  result_val = value_cast (value_type (second), result_val);
+		if (result_val->type () != second->type ())
+		  result_val = value_cast (second->type (), result_val);
 		break;
 	      case DW_OP_xor:
-		dwarf_require_integral (value_type (first));
-		dwarf_require_integral (value_type (second));
+		dwarf_require_integral (first->type ());
+		dwarf_require_integral (second->type ());
 		result_val = value_binop (first, second, BINOP_BITWISE_XOR);
 		break;
 	      case DW_OP_le:
@@ -2142,7 +2142,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	    offset = extract_signed_integer (op_ptr, 2, byte_order);
 	    op_ptr += 2;
 	    val = fetch (0);
-	    dwarf_require_integral (value_type (val));
+	    dwarf_require_integral (val->type ());
 	    if (value_as_long (val) != 0)
 	      op_ptr += offset;
 	    pop ();
@@ -2341,12 +2341,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 
 	    if (op == DW_OP_convert || op == DW_OP_GNU_convert)
 	      result_val = value_cast (type, result_val);
-	    else if (type == value_type (result_val))
+	    else if (type == result_val->type ())
 	      {
 		/* Nothing.  */
 	      }
 	    else if (type->length ()
-		     != value_type (result_val)->length ())
+		     != result_val->type ()->length ())
 	      error (_("DW_OP_reinterpret has wrong size"));
 	    else
 	      result_val
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 236ad820462..4af4dfde090 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1273,7 +1273,7 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
 static struct value *
 entry_data_value_coerce_ref (const struct value *value)
 {
-  struct type *checked_type = check_typedef (value_type (value));
+  struct type *checked_type = check_typedef (value->type ());
   struct value *target_val;
 
   if (!TYPE_IS_REFERENCE (checked_type))
diff --git a/gdb/eval.c b/gdb/eval.c
index bb42e693b17..c24ff258b43 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -241,7 +241,7 @@ unop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
   struct type *type1;
 
   *arg1 = coerce_ref (*arg1);
-  type1 = check_typedef (value_type (*arg1));
+  type1 = check_typedef ((*arg1)->type ());
 
   if (is_integral_type (type1))
     {
@@ -278,8 +278,8 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
   *arg1 = coerce_ref (*arg1);
   *arg2 = coerce_ref (*arg2);
 
-  type1 = check_typedef (value_type (*arg1));
-  type2 = check_typedef (value_type (*arg2));
+  type1 = check_typedef ((*arg1)->type ());
+  type2 = check_typedef ((*arg2)->type ());
 
   if ((type1->code () != TYPE_CODE_FLT
        && type1->code () != TYPE_CODE_DECFLOAT
@@ -628,7 +628,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
 	 call an error.  This can happen if somebody tries to turn
 	 a variable into a function call.  */
 
-      type *ftype = value_type (callee);
+      type *ftype = callee->type ();
 
       if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION)
 	{
@@ -672,7 +672,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
 	error (_("Expression of type other than "
 		 "\"Function returning ...\" used as function"));
     }
-  switch (value_type (callee)->code ())
+  switch (callee->type ()->code ())
     {
     case TYPE_CODE_INTERNAL_FUNCTION:
       return call_internal_function (exp->gdbarch, exp->language_defn,
@@ -697,7 +697,7 @@ operation::evaluate_funcall (struct type *expect_type,
   std::vector<value *> vals (args.size ());
 
   value *callee = evaluate_with_coercion (exp, noside);
-  struct type *type = value_type (callee);
+  struct type *type = callee->type ();
   if (type->code () == TYPE_CODE_PTR)
     type = type->target_type ();
   for (int i = 0; i < args.size (); ++i)
@@ -836,7 +836,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
   value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
   value *callee;
 
-  type *a1_type = check_typedef (value_type (rhs));
+  type *a1_type = check_typedef (rhs->type ());
   if (a1_type->code () == TYPE_CODE_METHODPTR)
     {
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -963,7 +963,7 @@ structop_base_operation::evaluate_funcall
       /* value_struct_elt updates temp with the correct value of the
 	 ``this'' pointer if necessary, so modify it to reflect any
 	 ``this'' changes.  */
-      vals[0] = value_from_longest (lookup_pointer_type (value_type (temp)),
+      vals[0] = value_from_longest (lookup_pointer_type (temp->type ()),
 				    value_address (temp)
 				    + value_embedded_offset (temp));
     }
@@ -1041,7 +1041,7 @@ structop_base_operation::complete (struct expression *exp,
 
   value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp,
 						  EVAL_AVOID_SIDE_EFFECTS);
-  struct type *type = value_type (lhs);
+  struct type *type = lhs->type ();
   for (;;)
     {
       type = check_typedef (type);
@@ -1122,7 +1122,7 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp,
   value *val = evaluate_var_msym_value (noside, msymbol.objfile,
 					msymbol.minsym);
 
-  struct type *type = value_type (val);
+  struct type *type = val->type ();
   if (type->code () == TYPE_CODE_ERROR
       && (noside != EVAL_AVOID_SIDE_EFFECTS || !outermost_p))
     error_unknown_type (msymbol.minsym->print_name ());
@@ -1224,7 +1224,7 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp,
   struct value *arg3 = value_struct_elt (&arg1, {}, string,
 					 NULL, "structure");
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
-    arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
+    arg3 = value_zero (arg3->type (), VALUE_LVAL (arg3));
   return arg3;
 }
 
@@ -1260,7 +1260,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
      with rtti type in order to continue on with successful
      lookup of member / method only available in the rtti type.  */
   {
-    struct type *arg_type = value_type (arg1);
+    struct type *arg_type = arg1->type ();
     struct type *real_type;
     int full, using_enc;
     LONGEST top;
@@ -1280,7 +1280,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
   struct value *arg3 = value_struct_elt (&arg1, {}, string,
 					 NULL, "structure pointer");
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
-    arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
+    arg3 = value_zero (arg3->type (), VALUE_LVAL (arg3));
   return arg3;
 }
 
@@ -1294,7 +1294,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
   long mem_offset;
 
   struct value *arg3;
-  struct type *type = check_typedef (value_type (arg2));
+  struct type *type = check_typedef (arg2->type ());
   switch (type->code ())
     {
     case TYPE_CODE_METHODPTR:
@@ -1303,13 +1303,13 @@ eval_op_member (struct type *expect_type, struct expression *exp,
       else
 	{
 	  arg2 = cplus_method_ptr_to_value (&arg1, arg2);
-	  gdb_assert (value_type (arg2)->code () == TYPE_CODE_PTR);
+	  gdb_assert (arg2->type ()->code () == TYPE_CODE_PTR);
 	  return value_ind (arg2);
 	}
 
     case TYPE_CODE_MEMBERPTR:
       /* Now, convert these values to an address.  */
-      if (check_typedef (value_type (arg1))->code () != TYPE_CODE_PTR)
+      if (check_typedef (arg1->type ())->code () != TYPE_CODE_PTR)
 	arg1 = value_addr (arg1);
       arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)),
 				  arg1, 1);
@@ -1335,11 +1335,11 @@ eval_op_add (struct type *expect_type, struct expression *exp,
 {
   if (binop_user_defined_p (BINOP_ADD, arg1, arg2))
     return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside);
-  else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
-	   && is_integral_or_integral_reference (value_type (arg2)))
+  else if (ptrmath_type_p (exp->language_defn, arg1->type ())
+	   && is_integral_or_integral_reference (arg2->type ()))
     return value_ptradd (arg1, value_as_long (arg2));
-  else if (ptrmath_type_p (exp->language_defn, value_type (arg2))
-	   && is_integral_or_integral_reference (value_type (arg1)))
+  else if (ptrmath_type_p (exp->language_defn, arg2->type ())
+	   && is_integral_or_integral_reference (arg1->type ()))
     return value_ptradd (arg2, value_as_long (arg1));
   else
     {
@@ -1357,15 +1357,15 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
 {
   if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
     return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
-  else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
-	   && ptrmath_type_p (exp->language_defn, value_type (arg2)))
+  else if (ptrmath_type_p (exp->language_defn, arg1->type ())
+	   && ptrmath_type_p (exp->language_defn, arg2->type ()))
     {
       /* FIXME -- should be ptrdiff_t */
       struct type *type = builtin_type (exp->gdbarch)->builtin_long;
       return value_from_longest (type, value_ptrdiff (arg1, arg2));
     }
-  else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
-	   && is_integral_or_integral_reference (value_type (arg2)))
+  else if (ptrmath_type_p (exp->language_defn, arg1->type ())
+	   && is_integral_or_integral_reference (arg2->type ()))
     return value_ptradd (arg1, - value_as_long (arg2));
   else
     {
@@ -1400,7 +1400,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
 	{
 	  struct value *v_one;
 
-	  v_one = value_one (value_type (arg2));
+	  v_one = value_one (arg2->type ());
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one);
 	  return value_binop (arg1, v_one, op);
 	}
@@ -1409,7 +1409,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
 	  /* For shift and integer exponentiation operations,
 	     only promote the first argument.  */
 	  if ((op == BINOP_LSH || op == BINOP_RSH || op == BINOP_EXP)
-	      && is_integral_type (value_type (arg2)))
+	      && is_integral_type (arg2->type ()))
 	    unop_promote (exp->language_defn, exp->gdbarch, &arg1);
 	  else
 	    binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -1435,7 +1435,7 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
 	 then report this as an error.  */
 
       arg1 = coerce_ref (arg1);
-      struct type *type = check_typedef (value_type (arg1));
+      struct type *type = check_typedef (arg1->type ());
       if (type->code () != TYPE_CODE_ARRAY
 	  && type->code () != TYPE_CODE_PTR)
 	{
@@ -1586,13 +1586,13 @@ eval_op_repeat (struct type *expect_type, struct expression *exp,
 		enum noside noside, enum exp_opcode op,
 		struct value *arg1, struct value *arg2)
 {
-  struct type *type = check_typedef (value_type (arg2));
+  struct type *type = check_typedef (arg2->type ());
   if (type->code () != TYPE_CODE_INT
       && type->code () != TYPE_CODE_ENUM)
     error (_("Non-integral right operand for \"@\" operator."));
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     {
-      return allocate_repeat_value (value_type (arg1),
+      return allocate_repeat_value (arg1->type (),
 				    longest_to_int (value_as_long (arg2)));
     }
   else
@@ -1671,7 +1671,7 @@ eval_op_ind (struct type *expect_type[...]

[diff truncated at 100000 bytes]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-13 22:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 22:27 [binutils-gdb] Turn value_type into method Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).