gen_ptradd (struct agent_expr *ax, struct axs_value *value,
            struct axs_value *value1, struct axs_value *value2)
 {
-  gdb_assert (pointer_type (value1->type));
+  gdb_assert (value1->type->is_pointer_or_reference ());
   gdb_assert (value2->type->code () == TYPE_CODE_INT);
 
   gen_scale (ax, aop_mul, value1->type);
 gen_ptrsub (struct agent_expr *ax, struct axs_value *value,
            struct axs_value *value1, struct axs_value *value2)
 {
-  gdb_assert (pointer_type (value1->type));
+  gdb_assert (value1->type->is_pointer_or_reference ());
   gdb_assert (value2->type->code () == TYPE_CODE_INT);
 
   gen_scale (ax, aop_mul, value1->type);
             struct axs_value *value1, struct axs_value *value2,
             struct type *result_type)
 {
-  gdb_assert (pointer_type (value1->type));
-  gdb_assert (pointer_type (value2->type));
+  gdb_assert (value1->type->is_pointer_or_reference ());
+  gdb_assert (value2->type->is_pointer_or_reference ());
 
   if (TYPE_LENGTH (TYPE_TARGET_TYPE (value1->type))
       != TYPE_LENGTH (TYPE_TARGET_TYPE (value2->type)))
           struct axs_value *value1, struct axs_value *value2,
           struct type *result_type)
 {
-  if (pointer_type (value1->type) || pointer_type (value2->type))
+  if (value1->type->is_pointer_or_reference () || value2->type->is_pointer_or_reference ())
     ax_simple (ax, aop_equal);
   else
     gen_binop (ax, value, value1, value2,
          struct axs_value *value1, struct axs_value *value2,
          struct type *result_type)
 {
-  if (pointer_type (value1->type) || pointer_type (value2->type))
+  if (value1->type->is_pointer_or_reference () || value2->type->is_pointer_or_reference ())
     ax_simple (ax, aop_less_unsigned);
   else
     gen_binop (ax, value, value1, value2,
 {
   /* The caller should check the type, because several operators use
      this, and we don't know what error message to generate.  */
-  if (!pointer_type (value->type))
+  if (!value->type->is_pointer_or_reference ())
     internal_error (__FILE__, __LINE__,
                    _("gen_deref: expected a pointer"));
 
   /* Follow pointers until we reach a non-pointer.  These aren't the C
      semantics, but they're what the normal GDB evaluator does, so we
      should at least be consistent.  */
-  while (pointer_type (value->type))
+  while (value->type->is_pointer_or_reference ())
     {
       require_rvalue (ax, value);
       gen_deref (value);
     {
     case BINOP_ADD:
       if (value1->type->code () == TYPE_CODE_INT
-         && pointer_type (value2->type))
+         && value2->type->is_pointer_or_reference ())
        {
          /* Swap the values and proceed normally.  */
          ax_simple (ax, aop_swap);
          gen_ptradd (ax, value, value2, value1);
        }
-      else if (pointer_type (value1->type)
+      else if (value1->type->is_pointer_or_reference ()
               && value2->type->code () == TYPE_CODE_INT)
        gen_ptradd (ax, value, value1, value2);
       else
                   aop_add, aop_add, 1, "addition");
       break;
     case BINOP_SUB:
-      if (pointer_type (value1->type)
+      if (value1->type->is_pointer_or_reference ()
          && value2->type->code () == TYPE_CODE_INT)
        gen_ptrsub (ax,value, value1, value2);
-      else if (pointer_type (value1->type)
-              && pointer_type (value2->type))
+      else if (value1->type->is_pointer_or_reference ()
+              && value2->type->is_pointer_or_reference ())
        /* FIXME --- result type should be ptrdiff_t */
        gen_ptrdiff (ax, value, value1, value2,
                     builtin_type (ax->gdbarch)->builtin_long);
     case UNOP_IND:
       lhs->generate_ax (exp, ax, value);
       gen_usual_unary (ax, value);
-      if (!pointer_type (value->type))
+      if (!value->type->is_pointer_or_reference ())
        error (_("Argument of unary `*' is not a pointer."));
       gen_deref (value);
       break;
 
 
   type = check_typedef (value_type (val));
 
-  if (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
+  if (type->is_pointer_or_reference ())
     {
       struct type *original_type = value_type (val);
 
 
       if (opts.objectprint)
        {
          value = var->value.get ();
-         lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
-                               || var->type->code () == TYPE_CODE_PTR);
+         lookup_actual_type = var->type->is_pointer_or_reference ();
        }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
 
          const struct varobj *parent = var->parent;
 
          value = parent->value.get ();
-         lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
-                               || parent->type->code () == TYPE_CODE_PTR);
+         lookup_actual_type = parent->type->is_pointer_or_reference ();
        }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
 
 
   var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent;
   if (opts.objectprint)
-    lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
-                         || var->type->code () == TYPE_CODE_PTR);
+    lookup_actual_type = var->type->is_pointer_or_reference ();
   value = var->value.get ();
   type = varobj_get_value_type (var);
   if (cfull_expression)
 
       for (;;)
        {
          type = check_typedef (type);
-         if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+         if (!type->is_pointer_or_reference ())
            break;
          type = TYPE_TARGET_TYPE (type);
        }
 
   const char *type_name;
   int i, prefix_len;
 
-  while (type->code () == TYPE_CODE_PTR
-        || TYPE_IS_REFERENCE (type)
+  while (type->is_pointer_or_reference ()
         || type->code () == TYPE_CODE_ARRAY
         || type->code () == TYPE_CODE_TYPEDEF)
     {
 
         There is a risk that this dereference will have side-effects
         in the inferior, but being able to print accurate type
         information seems worth the risk. */
-      if ((type->code () != TYPE_CODE_PTR
-          && !TYPE_IS_REFERENCE (type))
+      if (!type->is_pointer_or_reference ()
          || !is_dynamic_type (TYPE_TARGET_TYPE (type)))
        {
-         if (type->code () == TYPE_CODE_PTR
-             || TYPE_IS_REFERENCE (type)
+         if (type->is_pointer_or_reference ()
              /* In C you can dereference an array to get the 1st elt.  */
              || type->code () == TYPE_CODE_ARRAY)
            return value_zero (TYPE_TARGET_TYPE (type),
   value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
                                                  EVAL_AVOID_SIDE_EFFECTS);
   struct type *type = check_typedef (value_type (val));
-  if (type->code () != TYPE_CODE_PTR
-      && !TYPE_IS_REFERENCE (type)
+  if (!type->is_pointer_or_reference ()
       && type->code () != TYPE_CODE_ARRAY)
     error (_("Attempt to take contents of a non-pointer value."));
   type = TYPE_TARGET_TYPE (type);
 
 CORE_ADDR
 extract_typed_address (const gdb_byte *buf, struct type *type)
 {
-  if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+  if (!type->is_pointer_or_reference ())
     internal_error (__FILE__, __LINE__,
                    _("extract_typed_address: "
                    "type is not a pointer or reference"));
 void
 store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
 {
-  if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+  if (!type->is_pointer_or_reference ())
     internal_error (__FILE__, __LINE__,
                    _("store_typed_address: "
                    "type is not a pointer or reference"));
 
       struct type *t2 = arg;
 
       /* For pointers and references, compare target type.  */
-      if (parm->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (parm))
+      if (parm->is_pointer_or_reference ())
        {
          t1 = TYPE_TARGET_TYPE (parm);
          t2 = TYPE_TARGET_TYPE (arg);
 
     return main_type->type_specific.int_stuff.bit_offset;
   }
 
+  /* Return true if this is a pointer or reference type.  */
+  bool is_pointer_or_reference () const
+  {
+    return this->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (this);
+  }
+
   /* * Type that is a pointer to this type.
      NULL if no such pointer-to type is known yet.
      The debugger may add the address of such a type
 
 }
 \f
 
-/* Returns non-zero if the value is a pointer type.  */
-int
-pointer_type (struct type *type)
-{
-  return type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
-}
-
-\f
 /* This page contains functions that return info about
    (struct value) values used in GDB.  */
 
 
    && ((c) < 0x7F || (c) >= 0xA0)      \
    && (!sevenbit_strings || (c) < 0x80))
 
-/* Type predicates */
-
-extern int pointer_type (struct type *);
-
 /* Error messages */
 
 extern void range_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
 
          GDB_PY_HANDLE_EXCEPTION (except);
        }
 
-      if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+      if (!type->is_pointer_or_reference ())
        break;
       type = TYPE_TARGET_TYPE (type);
     }
 
       type = value_type (val);
       type = check_typedef (type);
 
-      if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
+      if (type->is_pointer_or_reference ()
          && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
        {
          struct value *target;
     {
       val_type = value_type (v);
       val_type = check_typedef (val_type);
-      if (TYPE_IS_REFERENCE (val_type) || val_type->code () == TYPE_CODE_PTR)
+      if (val_type->is_pointer_or_reference ())
        val_type = check_typedef (TYPE_TARGET_TYPE (val_type));
 
       type_code = val_type->code ();
 
          /* I'm not really sure that type of this can ever
             be typedefed; just be safe.  */
          t = check_typedef (t);
-         if (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+         if (t->is_pointer_or_reference ())
            t = TYPE_TARGET_TYPE (t);
 
          if (t->code () != TYPE_CODE_STRUCT
 
   get_user_print_options (&opts);
   if (val != NULL && opts.objectprint)
     {
-      if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
+      if (type->is_pointer_or_reference ()
          && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
        real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
       else if (type->code () == TYPE_CODE_STRUCT)
 
 
   /* Follow pointers until we get to a non-pointer.  */
 
-  while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+  while (t->is_pointer_or_reference ())
     {
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
 
   t = check_typedef (value_type (*argp));
 
-  while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+  while (t->is_pointer_or_reference ())
     {
       *argp = value_ind (*argp);
       if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC)
   t = check_typedef (value_type (*argp));
 
   /* Code snarfed from value_struct_elt.  */
-  while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+  while (t->is_pointer_or_reference ())
     {
       *argp = value_ind (*argp);
       /* Don't coerce fn pointer to fn and then back again!  */
       struct type *objtype = check_typedef (obj_type);
 
       if (temp_type->code () != TYPE_CODE_PTR
-         && (objtype->code () == TYPE_CODE_PTR
-             || TYPE_IS_REFERENCE (objtype)))
+         && objtype->is_pointer_or_reference ())
        {
          temp = value_addr (temp);
        }
 
     {
       /* If result's target type is TYPE_CODE_STRUCT, proceed to
         fetch its rtti type.  */
-      if ((result->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
+      if (result->is_pointer_or_reference ()
          && (check_typedef (TYPE_TARGET_TYPE (result))->code ()
              == TYPE_CODE_STRUCT)
          && !value_optimized_out (value))
      converted to pointers; usually, the ABI doesn't either, but
      ABI-specific code is a more reasonable place to handle it.  */
 
-  if (value_type (val)->code () != TYPE_CODE_PTR
-      && !TYPE_IS_REFERENCE (value_type (val))
+  if (!value_type (val)->is_pointer_or_reference ()
       && gdbarch_integer_to_address_p (gdbarch))
     return gdbarch_integer_to_address (gdbarch, value_type (val),
                                       value_contents (val));
                              struct value *original_value,
                              CORE_ADDR original_value_address)
 {
-  gdb_assert (original_type->code () == TYPE_CODE_PTR
-             || TYPE_IS_REFERENCE (original_type));
+  gdb_assert (original_type->is_pointer_or_reference ());
 
   struct type *original_target_type = TYPE_TARGET_TYPE (original_type);
   gdb::array_view<const gdb_byte> view;