cp-tree.h (INDIRECT_TYPE_P): New.
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 24 May 2018 17:20:01 +0000 (17:20 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 24 May 2018 17:20:01 +0000 (17:20 +0000)
2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>

* cp-tree.h (INDIRECT_TYPE_P): New.
* call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
joust): Use it instead of POINTER_TYPE_P.
* class.c (update_vtable_entry_for_fn, find_flexarrays,
* fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
* constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
* cxx_eval_increment_expression, potential_constant_expression_1):
Likewise.
* cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
* cp-objcp-common.c (cxx_get_alias_set): Likewise.
* cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
cp_ubsan_maybe_instrument_downcast): Likewise.
* cvt.c (cp_convert_to_pointer, ocp_convert,
cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
* cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
pp_cxx_offsetof_expression_1): Likewise.
* decl.c (grokparms, static_fn_type): Likewise.
* decl2.c (grokbitfield): Likewise.
* error.c (dump_expr): Likewise.
* except.c (initialize_handler_parm, check_noexcept_r): Likewise.
* init.c (warn_placement_new_too_small): Likewise.
* lambda.c (build_capture_proxy, add_capture): Likewise.
* parser.c (cp_parser_omp_for_loop): Likewise.
* pt.c (convert_nontype_argument, fn_type_unification,
uses_deducible_template_parms, check_cv_quals_for_unify,
dependent_type_p_r): Likewise.
* search.c (check_final_overrider): Likewise.
* semantics.c (handle_omp_array_sections, finish_omp_clauses,
finish_omp_for): Likewise.
* tree.c (cp_build_qualified_type_real): Likewise.
* typeck.c (build_class_member_access_expr,
finish_class_member_access_expr, build_x_indirect_ref,
cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
Likewise.

From-SVN: r260677

22 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/constexpr.c
gcc/cp/cp-gimplify.c
gcc/cp/cp-objcp-common.c
gcc/cp/cp-tree.h
gcc/cp/cp-ubsan.c
gcc/cp/cvt.c
gcc/cp/cxx-pretty-print.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/lambda.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/search.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c

index c8832a1..10e57ee 100644 (file)
@@ -1,3 +1,40 @@
+2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * cp-tree.h (INDIRECT_TYPE_P): New.
+       * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
+       joust): Use it instead of POINTER_TYPE_P.
+       * class.c (update_vtable_entry_for_fn, find_flexarrays,
+       * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
+       * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
+       * cxx_eval_increment_expression, potential_constant_expression_1):
+       Likewise.
+       * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
+       * cp-objcp-common.c (cxx_get_alias_set): Likewise.
+       * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
+       cp_ubsan_maybe_instrument_downcast): Likewise.
+       * cvt.c (cp_convert_to_pointer, ocp_convert,
+       cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
+       * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
+       pp_cxx_offsetof_expression_1): Likewise.
+       * decl.c (grokparms, static_fn_type): Likewise.
+       * decl2.c (grokbitfield): Likewise.
+       * error.c (dump_expr): Likewise.
+       * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
+       * init.c (warn_placement_new_too_small): Likewise.
+       * lambda.c (build_capture_proxy, add_capture): Likewise.
+       * parser.c (cp_parser_omp_for_loop): Likewise.
+       * pt.c (convert_nontype_argument, fn_type_unification,
+       uses_deducible_template_parms, check_cv_quals_for_unify,
+       dependent_type_p_r): Likewise.
+       * search.c (check_final_overrider): Likewise.
+       * semantics.c (handle_omp_array_sections, finish_omp_clauses,
+       finish_omp_for): Likewise.
+       * tree.c (cp_build_qualified_type_real): Likewise.
+       * typeck.c (build_class_member_access_expr,
+       finish_class_member_access_expr, build_x_indirect_ref,
+       cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
+       Likewise.
+
 2018-05-24  Jason Merrill  <jason@redhat.com>
 
        PR c++/85864 - literal template and default template arg.
index c100a92..7aadd64 100644 (file)
@@ -7622,7 +7622,7 @@ build_trivial_dtor_call (tree instance)
       return fold_convert (void_type_node, instance);
     }
 
-  if (POINTER_TYPE_P (TREE_TYPE (instance)))
+  if (INDIRECT_TYPE_P (TREE_TYPE (instance)))
     {
       if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (instance))))
        goto no_clobber;
@@ -8511,7 +8511,7 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl,
   unsigned srcidx = !dstidx;
 
   tree dest = (*args)[dstidx];
-  if (!TREE_TYPE (dest) || !POINTER_TYPE_P (TREE_TYPE (dest)))
+  if (!TREE_TYPE (dest) || !INDIRECT_TYPE_P (TREE_TYPE (dest)))
     return;
 
   tree srctype = NULL_TREE;
@@ -8643,7 +8643,7 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl,
     case BUILT_IN_MEMPCPY:
       /* Determine the type of the source object.  */
       srctype = TREE_TYPE ((*args)[srcidx]);
-      if (!srctype || !POINTER_TYPE_P (srctype))
+      if (!srctype || !INDIRECT_TYPE_P (srctype))
        srctype = void_type_node;
       else
        srctype = TREE_TYPE (srctype);
@@ -10210,7 +10210,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
          tree t = TREE_TYPE (TREE_TYPE (l->fn));
          tree f = TREE_TYPE (TREE_TYPE (w->fn));
 
-         if (TREE_CODE (t) == TREE_CODE (f) && POINTER_TYPE_P (t))
+         if (TREE_CODE (t) == TREE_CODE (f) && INDIRECT_TYPE_P (t))
            {
              t = TREE_TYPE (t);
              f = TREE_TYPE (f);
@@ -10226,7 +10226,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
       else if (warn)
        {
          tree source = source_type (w->convs[0]);
-         if (POINTER_TYPE_P (source))
+         if (INDIRECT_TYPE_P (source))
            source = TREE_TYPE (source);
          if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn)
              && warning (OPT_Wconversion, "  for conversion from %qH to %qI",
index 25753d4..a17c8ed 100644 (file)
@@ -2445,7 +2445,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
   over_return = TREE_TYPE (TREE_TYPE (overrider_target));
   base_return = TREE_TYPE (TREE_TYPE (target_fn));
 
-  if (POINTER_TYPE_P (over_return)
+  if (INDIRECT_TYPE_P (over_return)
       && TREE_CODE (over_return) == TREE_CODE (base_return)
       && CLASS_TYPE_P (TREE_TYPE (over_return))
       && CLASS_TYPE_P (TREE_TYPE (base_return))
@@ -6481,8 +6481,7 @@ find_flexarrays (tree t, flexmems_t *fmem, bool base_p,
         members if it hasn't been yet.  */
       tree eltype = fldtype;
       while (TREE_CODE (eltype) == ARRAY_TYPE
-            || TYPE_PTR_P (eltype)
-            || TYPE_REF_P (eltype))
+            || INDIRECT_TYPE_P (eltype))
        eltype = TREE_TYPE (eltype);
 
       if (RECORD_OR_UNION_TYPE_P (eltype))
@@ -7144,7 +7143,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
   switch (TREE_CODE (instance))
     {
     case INDIRECT_REF:
-      if (POINTER_TYPE_P (TREE_TYPE (instance)))
+      if (INDIRECT_TYPE_P (TREE_TYPE (instance)))
        return NULL_TREE;
       else
        return RECUR (TREE_OPERAND (instance, 0));
@@ -7314,7 +7313,7 @@ resolves_to_fixed_type_p (tree instance, int* nonnull)
   fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
   if (fixed == NULL_TREE)
     return 0;
-  if (POINTER_TYPE_P (t))
+  if (INDIRECT_TYPE_P (t))
     t = TREE_TYPE (t);
   if (!same_type_ignoring_top_level_qualifiers_p (t, fixed))
     return 0;
index fa1cfce..a099408 100644 (file)
@@ -2088,7 +2088,7 @@ cxx_eval_binary_expression (const constexpr_ctx *ctx, tree t,
     *non_constant_p = true;
   /* Don't VERIFY_CONSTANT if this might be dealing with a pointer to
      a local array in a constexpr function.  */
-  bool ptr = POINTER_TYPE_P (TREE_TYPE (lhs));
+  bool ptr = INDIRECT_TYPE_P (TREE_TYPE (lhs));
   if (!ptr)
     VERIFY_CONSTANT (r);
   return r;
@@ -3082,7 +3082,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
 
   STRIP_NOPS (sub);
   subtype = TREE_TYPE (sub);
-  if (!POINTER_TYPE_P (subtype))
+  if (!INDIRECT_TYPE_P (subtype))
     return NULL_TREE;
 
   if (TREE_CODE (sub) == ADDR_EXPR)
@@ -3784,14 +3784,14 @@ cxx_eval_increment_expression (const constexpr_ctx *ctx, tree t,
                                    non_constant_p, overflow_p);
   /* Don't VERIFY_CONSTANT if this might be dealing with a pointer to
      a local array in a constexpr function.  */
-  bool ptr = POINTER_TYPE_P (TREE_TYPE (val));
+  bool ptr = INDIRECT_TYPE_P (TREE_TYPE (val));
   if (!ptr)
     VERIFY_CONSTANT (val);
 
   /* The modified value.  */
   bool inc = (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR);
   tree mod;
-  if (POINTER_TYPE_P (type))
+  if (INDIRECT_TYPE_P (type))
     {
       /* The middle end requires pointers to use POINTER_PLUS_EXPR.  */
       offset = convert_to_ptrofftype (offset);
@@ -4613,7 +4613,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
            return cp_fold_convert (type, op);
          }
 
-       if (POINTER_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST)
+       if (INDIRECT_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST)
          {
            if (integer_zerop (op))
              {
@@ -5499,7 +5499,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
         may change to something more specific to type-punning (DR 1312).  */
       {
         tree from = TREE_OPERAND (t, 0);
-       if (POINTER_TYPE_P (TREE_TYPE (t))
+       if (INDIRECT_TYPE_P (TREE_TYPE (t))
            && TREE_CODE (from) == INTEGER_CST
            && !integer_zerop (from))
          {
index 55aef86..b4e23e2 100644 (file)
@@ -783,7 +783,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
        {
          /* If flag_strong_eval_order, evaluate the object argument first.  */
          tree fntype = TREE_TYPE (CALL_EXPR_FN (*expr_p));
-         if (POINTER_TYPE_P (fntype))
+         if (INDIRECT_TYPE_P (fntype))
            fntype = TREE_TYPE (fntype);
          if (TREE_CODE (fntype) == METHOD_TYPE)
            {
@@ -1499,7 +1499,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
          tree fn = CALL_EXPR_FN (stmt);
          if (fn != NULL_TREE
              && !error_operand_p (fn)
-             && POINTER_TYPE_P (TREE_TYPE (fn))
+             && INDIRECT_TYPE_P (TREE_TYPE (fn))
              && TREE_CODE (TREE_TYPE (TREE_TYPE (fn))) == METHOD_TYPE)
            {
              bool is_ctor
index 25f0b3e..eef7ed6 100644 (file)
@@ -37,7 +37,7 @@ cxx_get_alias_set (tree t)
 
   /* Punt on PMFs until we canonicalize functions properly.  */
   if (TYPE_PTRMEMFUNC_P (t)
-      || (POINTER_TYPE_P (t)
+      || (INDIRECT_TYPE_P (t)
          && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
     return 0;
 
index b23a7c8..e18480b 100644 (file)
@@ -4237,6 +4237,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 #define TYPE_REF_P(NODE)                       \
   (TREE_CODE (NODE) == REFERENCE_TYPE)
 
+/* Returns true if NODE is a pointer or a reference.  */
+#define INDIRECT_TYPE_P(NODE)                  \
+  (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE))
+
 /* Returns true if NODE is an object type:
 
      [basic.types]
index 507433a..0c02db4 100644 (file)
@@ -121,7 +121,7 @@ cp_ubsan_maybe_instrument_member_call (tree stmt)
   tree *opp = &CALL_EXPR_ARG (stmt, 0);
   tree op = *opp;
   if (op == error_mark_node
-      || !POINTER_TYPE_P (TREE_TYPE (op)))
+      || !INDIRECT_TYPE_P (TREE_TYPE (op)))
     return;
   while (TREE_CODE (op) == COMPOUND_EXPR)
     {
@@ -257,9 +257,9 @@ tree
 cp_ubsan_maybe_instrument_downcast (location_t loc, tree type,
                                    tree intype, tree op)
 {
-  if (!POINTER_TYPE_P (type)
-      || !POINTER_TYPE_P (intype)
-      || !POINTER_TYPE_P (TREE_TYPE (op))
+  if (!INDIRECT_TYPE_P (type)
+      || !INDIRECT_TYPE_P (intype)
+      || !INDIRECT_TYPE_P (TREE_TYPE (op))
       || !CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (op)))
       || !is_properly_derived_from (TREE_TYPE (type), TREE_TYPE (intype)))
     return NULL_TREE;
index 3f87317..f29dacd 100644 (file)
@@ -122,7 +122,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
 
   form = TREE_CODE (intype);
 
-  if (POINTER_TYPE_P (intype))
+  if (INDIRECT_TYPE_P (intype))
     {
       intype = TYPE_MAIN_VARIANT (intype);
 
@@ -842,7 +842,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
       /* Ignore any integer overflow caused by the conversion.  */
       return ignore_overflows (converted, e);
     }
-  if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type))
+  if (INDIRECT_TYPE_P (type) || TYPE_PTRMEM_P (type))
     return cp_convert_to_pointer (type, e, dofold, complain);
   if (code == VECTOR_TYPE)
     {
@@ -962,7 +962,7 @@ cp_get_fndecl_from_callee (tree fn, bool fold /* = true */)
   tree type = TREE_TYPE (fn);
   if (type == unknown_type_node)
     return NULL_TREE;
-  gcc_assert (POINTER_TYPE_P (type));
+  gcc_assert (INDIRECT_TYPE_P (type));
   if (fold)
     fn = maybe_constant_init (fn);
   STRIP_NOPS (fn);
@@ -1009,7 +1009,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
   tree type = TREE_TYPE (callee);
   if (TYPE_PTRMEMFUNC_P (type))
     type = TYPE_PTRMEMFUNC_FN_TYPE (type);
-  if (POINTER_TYPE_P (type))
+  if (INDIRECT_TYPE_P (type))
     type = TREE_TYPE (type);
 
   tree rettype = TREE_TYPE (type);
@@ -1602,7 +1602,7 @@ convert (tree type, tree expr)
 
   intype = TREE_TYPE (expr);
 
-  if (POINTER_TYPE_P (type) && POINTER_TYPE_P (intype))
+  if (INDIRECT_TYPE_P (type) && INDIRECT_TYPE_P (intype))
     return build_nop (type, expr);
 
   return ocp_convert (type, expr, CONV_BACKEND_CONVERT,
index 9a5545c..df81aa3 100644 (file)
@@ -1702,7 +1702,7 @@ cxx_pretty_printer::abstract_declarator (tree t)
 {
   if (TYPE_PTRMEM_P (t))
     pp_cxx_right_paren (this);
-  else if (POINTER_TYPE_P (t))
+  else if (INDIRECT_TYPE_P (t))
     {
       if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
          || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
@@ -2395,7 +2395,7 @@ pp_cxx_offsetof_expression_1 (cxx_pretty_printer *pp, tree t)
     {
     case ARROW_EXPR:
       if (TREE_CODE (TREE_OPERAND (t, 0)) == STATIC_CAST_EXPR
-         && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0))))
+         && INDIRECT_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0))))
        {
          pp->type_id (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0))));
          pp_cxx_separate_with (pp, ',');
index f50812f..5d736e7 100644 (file)
@@ -12783,7 +12783,7 @@ grokparms (tree parmlist, tree *parms)
            }
          else if (abstract_virtuals_error (decl, type))
            any_error = 1;  /* Seems like a good idea.  */
-         else if (cxx_dialect < cxx17 && POINTER_TYPE_P (type))
+         else if (cxx_dialect < cxx17 && INDIRECT_TYPE_P (type))
            {
              /* Before C++17 DR 393:
                 [dcl.fct]/6, parameter types cannot contain pointers
@@ -16138,7 +16138,7 @@ static_fn_type (tree memfntype)
 
   if (TYPE_PTRMEMFUNC_P (memfntype))
     memfntype = TYPE_PTRMEMFUNC_FN_TYPE (memfntype);
-  if (POINTER_TYPE_P (memfntype)
+  if (INDIRECT_TYPE_P (memfntype)
       || TREE_CODE (memfntype) == FUNCTION_DECL)
     memfntype = TREE_TYPE (memfntype);
   if (TREE_CODE (memfntype) == FUNCTION_TYPE)
index b6e8e07..e16e476 100644 (file)
@@ -1032,7 +1032,7 @@ grokbitfield (const cp_declarator *declarator,
     return void_type_node;
 
   if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value))
-      && (POINTER_TYPE_P (value)
+      && (INDIRECT_TYPE_P (value)
           || !dependent_type_p (TREE_TYPE (value))))
     {
       error ("bit-field %qD with non-integral type", value);
index 374ab0d..f567c52 100644 (file)
@@ -2412,8 +2412,8 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
        tree optype = TREE_TYPE (op);
 
        if (TREE_CODE (ttype) != TREE_CODE (optype)
-           && POINTER_TYPE_P (ttype)
-           && POINTER_TYPE_P (optype)
+           && INDIRECT_TYPE_P (ttype)
+           && INDIRECT_TYPE_P (optype)
            && same_type_p (TREE_TYPE (optype),
                            TREE_TYPE (ttype)))
          {
index 4599619..f85ae04 100644 (file)
@@ -301,7 +301,7 @@ initialize_handler_parm (tree decl, tree exp)
      adjusted by value from __cxa_begin_catch.  Others are returned by
      reference.  */
   init_type = TREE_TYPE (decl);
-  if (!POINTER_TYPE_P (init_type))
+  if (!INDIRECT_TYPE_P (init_type))
     init_type = build_reference_type (init_type);
 
   /* Since pointers are passed by value, initialize a reference to
@@ -1024,7 +1024,7 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/)
          We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */
       tree fn = cp_get_callee (t);
       tree type = TREE_TYPE (fn);
-      gcc_assert (POINTER_TYPE_P (type));
+      gcc_assert (INDIRECT_TYPE_P (type));
       type = TREE_TYPE (type);
 
       STRIP_NOPS (fn);
index 5bfd084..3f1e49b 100644 (file)
@@ -2600,7 +2600,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
     }
 
   tree opertype = TREE_TYPE (oper);
-  if ((addr_expr || !POINTER_TYPE_P (opertype))
+  if ((addr_expr || !INDIRECT_TYPE_P (opertype))
       && (VAR_P (oper)
          || TREE_CODE (oper) == FIELD_DECL
          || TREE_CODE (oper) == PARM_DECL))
index cf7c380..9c1b49b 100644 (file)
@@ -411,7 +411,7 @@ build_capture_proxy (tree member, tree init)
 
   type = lambda_proxy_type (object);
 
-  if (name == this_identifier && !POINTER_TYPE_P (type))
+  if (name == this_identifier && !INDIRECT_TYPE_P (type))
     {
       type = build_pointer_type (type);
       type = cp_build_qualified_type (type, TYPE_QUAL_CONST);
@@ -571,7 +571,7 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
 
       if (id == this_identifier && !by_reference_p)
        {
-         gcc_assert (POINTER_TYPE_P (type));
+         gcc_assert (INDIRECT_TYPE_P (type));
          type = TREE_TYPE (type);
          initializer = cp_build_fold_indirect_ref (initializer);
        }
index d3e7348..c0220bf 100644 (file)
@@ -35348,7 +35348,7 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses,
          if (real_decl
              && ((processing_template_decl
                   && (TREE_TYPE (real_decl) == NULL_TREE
-                      || !POINTER_TYPE_P (TREE_TYPE (real_decl))))
+                      || !INDIRECT_TYPE_P (TREE_TYPE (real_decl))))
                  || CLASS_TYPE_P (TREE_TYPE (real_decl))))
            incr = cp_parser_omp_for_incr (parser, real_decl);
          else
index d118105..cfce9a9 100644 (file)
@@ -6831,7 +6831,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
                       "a variable", orig_expr, expr);
              return NULL_TREE;
            }
-         if (POINTER_TYPE_P (expr_type))
+         if (INDIRECT_TYPE_P (expr_type))
            {
              if (complain & tf_error)
                error ("%qE is not a valid template argument for %qT "
@@ -19548,7 +19548,7 @@ fn_type_unification (tree fn,
     {
       /* We're deducing for a call to the result of a template conversion
          function.  The parms we really want are in return_type.  */
-      if (POINTER_TYPE_P (return_type))
+      if (INDIRECT_TYPE_P (return_type))
        return_type = TREE_TYPE (return_type);
       parms = TYPE_ARG_TYPES (return_type);
     }
@@ -19928,7 +19928,7 @@ uses_deducible_template_parms (tree type)
   /* T*
      T&
      T&&  */
-  if (POINTER_TYPE_P (type))
+  if (INDIRECT_TYPE_P (type))
     return uses_deducible_template_parms (TREE_TYPE (type));
 
   /* T[integer-constant ]
@@ -20945,7 +20945,7 @@ check_cv_quals_for_unify (int strict, tree arg, tree parm)
          && (parm_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)))
        return 0;
 
-      if ((!POINTER_TYPE_P (arg) && TREE_CODE (arg) != TEMPLATE_TYPE_PARM)
+      if ((!INDIRECT_TYPE_P (arg) && TREE_CODE (arg) != TEMPLATE_TYPE_PARM)
          && (parm_quals & TYPE_QUAL_RESTRICT))
        return 0;
     }
@@ -24471,8 +24471,7 @@ dependent_type_p_r (tree type)
     return (dependent_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
            || dependent_type_p (TYPE_PTRMEM_POINTED_TO_TYPE
                                           (type)));
-  else if (TYPE_PTR_P (type)
-          || TYPE_REF_P (type))
+  else if (INDIRECT_TYPE_P (type))
     return dependent_type_p (TREE_TYPE (type));
   else if (TREE_CODE (type) == FUNCTION_TYPE
           || TREE_CODE (type) == METHOD_TYPE)
index 22c0492..e343a15 100644 (file)
@@ -1868,12 +1868,12 @@ check_final_overrider (tree overrider, tree basefn)
     /* OK */;
   else if ((CLASS_TYPE_P (over_return) && CLASS_TYPE_P (base_return))
           || (TREE_CODE (base_return) == TREE_CODE (over_return)
-              && POINTER_TYPE_P (base_return)))
+              && INDIRECT_TYPE_P (base_return)))
     {
       /* Potentially covariant.  */
       unsigned base_quals, over_quals;
 
-      fail = !POINTER_TYPE_P (base_return);
+      fail = !INDIRECT_TYPE_P (base_return);
       if (!fail)
        {
          fail = cp_type_quals (base_return) != cp_type_quals (over_return);
index 46251de..e00331a 100644 (file)
@@ -5001,7 +5001,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
              tree type = build_array_type (eltype, index_type);
              tree ptype = build_pointer_type (eltype);
              if (TYPE_REF_P (TREE_TYPE (t))
-                 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t))))
+                 && INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (t))))
                t = convert_from_reference (t);
              else if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
                t = build_fold_addr_expr (t);
@@ -5076,7 +5076,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
                                ptrdiff_type_node, t);
          tree ptr = OMP_CLAUSE_DECL (c2);
          ptr = convert_from_reference (ptr);
-         if (!POINTER_TYPE_P (TREE_TYPE (ptr)))
+         if (!INDIRECT_TYPE_P (TREE_TYPE (ptr)))
            ptr = build_fold_addr_expr (ptr);
          t = fold_build2_loc (OMP_CLAUSE_LOCATION (c), MINUS_EXPR,
                               ptrdiff_type_node, t,
@@ -5088,7 +5088,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
          ptr = OMP_CLAUSE_DECL (c2);
          if (OMP_CLAUSE_MAP_KIND (c2) != GOMP_MAP_FIRSTPRIVATE_POINTER
              && TYPE_REF_P (TREE_TYPE (ptr))
-             && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (ptr))))
+             && INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (ptr))))
            {
              tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
                                          OMP_CLAUSE_MAP);
@@ -6537,7 +6537,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
                   && !TYPE_PTR_P (TREE_TYPE (t))
                   && TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE
                   && (!TYPE_REF_P (TREE_TYPE (t))
-                      || (!POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t)))
+                      || (!INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (t)))
                           && (TREE_CODE (TREE_TYPE (TREE_TYPE (t)))
                               != ARRAY_TYPE))))
            {
@@ -6790,7 +6790,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
                   && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FORCE_DEVICEPTR
                   && !type_dependent_expression_p (t)
-                  && !POINTER_TYPE_P (TREE_TYPE (t)))
+                  && !INDIRECT_TYPE_P (TREE_TYPE (t)))
            {
              error ("%qD is not a pointer variable", t);
              remove = true;
@@ -8283,14 +8283,14 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv,
            case POSTINCREMENT_EXPR:
              /* c_omp_for_incr_canonicalize_ptr() should have been
                 called to massage things appropriately.  */
-             gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl)));
+             gcc_assert (!INDIRECT_TYPE_P (TREE_TYPE (decl)));
              OMP_CLAUSE_LINEAR_STEP (c) = build_int_cst (TREE_TYPE (decl), 1);
              break;
            case PREDECREMENT_EXPR:
            case POSTDECREMENT_EXPR:
              /* c_omp_for_incr_canonicalize_ptr() should have been
                 called to massage things appropriately.  */
-             gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl)));
+             gcc_assert (!INDIRECT_TYPE_P (TREE_TYPE (decl)));
              OMP_CLAUSE_LINEAR_STEP (c)
                = build_int_cst (TREE_TYPE (decl), -1);
              break;
@@ -8314,7 +8314,7 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv,
                  gcc_unreachable ();
                }
              stept = TREE_TYPE (decl);
-             if (POINTER_TYPE_P (stept))
+             if (INDIRECT_TYPE_P (stept))
                stept = sizetype;
              step = fold_convert (stept, step);
              if (TREE_CODE (incr) == MINUS_EXPR)
index efb8c2b..9d97816 100644 (file)
@@ -1287,7 +1287,7 @@ cp_build_qualified_type_real (tree type,
   if ((type_quals & TYPE_QUAL_RESTRICT)
       && TREE_CODE (type) != TEMPLATE_TYPE_PARM
       && TREE_CODE (type) != TYPENAME_TYPE
-      && !POINTER_TYPE_P (type))
+      && !INDIRECT_TYPE_P (type))
     {
       bad_quals |= TYPE_QUAL_RESTRICT;
       type_quals &= ~TYPE_QUAL_RESTRICT;
index a694499..3df043e 100644 (file)
@@ -2363,7 +2363,7 @@ build_class_member_access_expr (cp_expr object, tree member,
     {
       if (complain & tf_error)
        {
-         if (POINTER_TYPE_P (object_type)
+         if (INDIRECT_TYPE_P (object_type)
              && CLASS_TYPE_P (TREE_TYPE (object_type)))
            error ("request for member %qD in %qE, which is of pointer "
                   "type %qT (maybe you meant to use %<->%> ?)",
@@ -2804,7 +2804,7 @@ finish_class_member_access_expr (cp_expr object, tree name, bool template_p,
     {
       if (complain & tf_error)
        {
-         if (POINTER_TYPE_P (object_type)
+         if (INDIRECT_TYPE_P (object_type)
              && CLASS_TYPE_P (TREE_TYPE (object_type)))
            error ("request for member %qD in %qE, which is of pointer "
                   "type %qT (maybe you meant to use %<->%> ?)",
@@ -3079,7 +3079,7 @@ build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring,
   if (processing_template_decl)
     {
       /* Retain the type if we know the operand is a pointer.  */
-      if (TREE_TYPE (expr) && POINTER_TYPE_P (TREE_TYPE (expr)))
+      if (TREE_TYPE (expr) && INDIRECT_TYPE_P (TREE_TYPE (expr)))
        return build_min (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr);
       if (type_dependent_expression_p (expr))
        return build_min_nt_loc (loc, INDIRECT_REF, expr);
@@ -3130,7 +3130,7 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator errorstring,
 
   type = TREE_TYPE (pointer);
 
-  if (POINTER_TYPE_P (type))
+  if (INDIRECT_TYPE_P (type))
     {
       /* [expr.unary.op]
 
@@ -4456,7 +4456,7 @@ cp_build_binary_op (location_t location,
            type0 = TREE_TYPE (type0);
          if (!TYPE_P (type1))
            type1 = TREE_TYPE (type1);
-         if (POINTER_TYPE_P (type0) && same_type_p (TREE_TYPE (type0), type1)
+         if (INDIRECT_TYPE_P (type0) && same_type_p (TREE_TYPE (type0), type1)
              && !(TREE_CODE (first_arg) == PARM_DECL
                   && DECL_ARRAY_PARAMETER_P (first_arg)
                   && warn_sizeof_array_argument)
@@ -7552,7 +7552,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
   if (valid_p)
     *valid_p = false;
 
-  if (!POINTER_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type))
+  if (!INDIRECT_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type))
     {
       if (complain & tf_error)
        error ("invalid use of const_cast with type %qT, "