@@ -4540,7 +4540,7 @@ return_slot_opt_for_pure_call_p (tree target, tree call)
FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
{
tree arg_type = TREE_TYPE (arg);
- if (TREE_CODE (arg_type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (arg_type))
arg_type = TREE_TYPE (arg_type);
if (is_array_of_scalar_type (arg_type))
@@ -1406,7 +1406,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
= build_pointer_type_for_mode (TREE_TYPE (result_type),
TYPE_MODE (result_type),
true);
- else if (TREE_CODE (result_type) == REFERENCE_TYPE
+ else if (TYPE_REF_P (result_type)
&& !TYPE_REF_CAN_ALIAS_ALL (result_type))
result_type
= build_reference_type_for_mode (TREE_TYPE (result_type),
@@ -1041,7 +1041,7 @@ get_alias_set (tree t)
p = ptr_type_node;
break;
}
- if (TREE_CODE (p) == REFERENCE_TYPE)
+ if (TYPE_REF_P (p))
/* In LTO we want languages that use references to be compatible
with languages that use pointers. */
reference.safe_push (true && !in_lto_p);
@@ -6098,7 +6098,7 @@ has_attribute (location_t atloc, tree t, tree attr, tree (*convert)(tree))
if (code == INDIRECT_REF)
{
tree op0 = TREE_OPERAND (t, 0);
- if (TREE_CODE (TREE_TYPE (op0)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (op0)))
t = op0;
else
break;
@@ -3657,7 +3657,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
if (POINTER_TYPE_P (totype)
&& !c_inhibit_evaluation_warnings
- && TREE_CODE (fromtype) == REFERENCE_TYPE)
+ && TYPE_REF_P (fromtype))
{
tree inner = expr;
STRIP_NOPS (inner);
@@ -3672,8 +3672,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
since that affects how `default_conversion' will behave. */
- if (TREE_CODE (totype) == REFERENCE_TYPE
- || TREE_CODE (fromtype) == REFERENCE_TYPE)
+ if (TYPE_REF_P (totype) || TYPE_REF_P (fromtype))
break;
/* Don't strip a conversion from C++0x scoped enum, since they
don't implicitly convert to other types. */
@@ -3768,7 +3767,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
return;
if ((type_quals & TYPE_QUAL_CONST)
- || (type && TREE_CODE (type) == REFERENCE_TYPE))
+ || (type && TYPE_REF_P (type)))
/* We used to check TYPE_NEEDS_CONSTRUCTING here, but now a constexpr
constructor can produce constant init, so rely on cp_finish_decl to
clear TREE_READONLY if the variable has non-constant init. */
@@ -2181,7 +2181,7 @@ c_pretty_printer::unary_expression (tree e)
else if (code == INDIRECT_REF)
{
tree type = TREE_TYPE (TREE_OPERAND (e, 0));
- if (type && TREE_CODE (type) == REFERENCE_TYPE)
+ if (type && TYPE_REF_P (type))
/* Reference decay is implicit, don't print anything. */;
else
pp_c_star (this);
@@ -534,7 +534,7 @@ ubsan_maybe_instrument_reference_or_call (location_t loc, tree op, tree ptype,
&& TREE_CODE (TREE_TYPE (op)) == POINTER_TYPE)
op = TREE_OPERAND (op, 0);
if (TREE_CODE (op) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE)
+ && TYPE_REF_P (TREE_TYPE (op)))
{
if (mina && mina > min_align_of_type (TREE_TYPE (TREE_TYPE (op))))
instrument = true;
@@ -570,7 +570,7 @@ ubsan_maybe_instrument_reference_or_call (location_t loc, tree op, tree ptype,
return NULL_TREE;
op = save_expr (orig_op);
gcc_assert (POINTER_TYPE_P (ptype));
- if (TREE_CODE (ptype) == REFERENCE_TYPE)
+ if (TYPE_REF_P (ptype))
ptype = build_pointer_type (TREE_TYPE (ptype));
tree kind = build_int_cst (ptype, ckind);
tree align = build_int_cst (pointer_sized_int_node, mina);
@@ -659,7 +659,7 @@ warn_if_unused_value (const_tree exp, location_t locus, bool quiet)
case INDIRECT_REF:
/* Don't warn about automatic dereferencing of references, since
the user cannot control it. */
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (TREE_OPERAND (exp, 0))))
{
exp = TREE_OPERAND (exp, 0);
goto restart;
@@ -310,7 +310,7 @@ gcn_goacc_get_worker_red_decl (tree type, unsigned offset)
{
machine_function *machfun = cfun->machine;
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
type = TREE_TYPE (type);
tree var_type
@@ -4544,7 +4544,7 @@ check_bit_cast_type (const constexpr_ctx *ctx, location_t loc, tree type,
}
return true;
}
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
{
if (!ctx->quiet)
{
@@ -3834,7 +3834,7 @@ analyze_fn_parms (tree orig)
actual_type = error_mark_node;
parm.orig_type = actual_type;
parm.by_ref = parm.pt_ref = parm.rv_ref = false;
- if (TREE_CODE (actual_type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (actual_type))
{
/* If the user passes by reference, then we will save the
pointer to the original. As noted in
@@ -18210,7 +18210,7 @@ finish_function (bool inline_p)
if (IDENTIFIER_ASSIGN_OP_P (DECL_NAME (fndecl)))
{
tree valtype = TREE_TYPE (DECL_RESULT (fndecl));
- if (TREE_CODE (valtype) == REFERENCE_TYPE
+ if (TYPE_REF_P (valtype)
&& current_class_ref
&& same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (valtype), TREE_TYPE (current_class_ref))
@@ -4366,7 +4366,7 @@ find_allocator_temps_r (tree *tp, int *walk_subtrees, void *data)
{
tree arg = get_nth_callarg (t, i);
tree atype = TREE_TYPE (arg);
- if (TREE_CODE (atype) == REFERENCE_TYPE
+ if (TYPE_REF_P (atype)
&& is_std_allocator (TREE_TYPE (atype)))
{
STRIP_NOPS (arg);
@@ -1207,7 +1207,7 @@ early_check_defaulted_comparison (tree fn)
tree parmtype = TREE_VALUE (parmnode);
if (CLASS_TYPE_P (parmtype))
saw_byval = true;
- else if (TREE_CODE (parmtype) == REFERENCE_TYPE
+ else if (TYPE_REF_P (parmtype)
&& !TYPE_REF_IS_RVALUE (parmtype)
&& TYPE_QUALS (TREE_TYPE (parmtype)) == TYPE_QUAL_CONST)
{
@@ -1533,7 +1533,7 @@ build_comparison_op (tree fndecl, bool defining, tsubst_flags_t complain)
/* A defaulted comparison operator function for class C is defined as
deleted if any non-static data member of C is of reference type or
C has variant members. */
- if (TREE_CODE (expr_type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (expr_type))
{
if (complain & tf_error)
inform (field_loc, "cannot default compare "
@@ -28023,7 +28023,7 @@ value_dependent_expression_p (tree expression)
if (TREE_CODE (expression) == TREE_LIST)
return any_value_dependent_elements_p (expression);
- if (TREE_CODE (type) == REFERENCE_TYPE
+ if (TYPE_REF_P (type)
&& has_value_dependent_address (expression))
return true;
@@ -6816,7 +6816,7 @@ cp_oacc_check_attachments (tree c)
type = TREE_TYPE (t);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
type = TREE_TYPE (type);
if (TREE_CODE (type) != POINTER_TYPE)
@@ -9645,7 +9645,7 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr)
tree fld = TREE_OPERAND (t, 1);
if (data->ptr_members_accessed.get (fld) == NULL)
{
- if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (t)))
t = convert_from_reference (t);
data->ptr_members_accessed.put (fld, t);
}
@@ -9834,7 +9834,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr)
tree closure_expr = DECL_VALUE_EXPR (orig_decl);
if (TREE_CODE (TREE_TYPE (orig_decl)) == POINTER_TYPE
- || TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE)
+ || TYPE_REF_P (TREE_TYPE (orig_decl)))
{
/* this-pointer is processed above, outside this loop. */
if (omp_target_this_expr
@@ -9931,7 +9931,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr)
if (!cxx_mark_addressable (ptr_member))
gcc_unreachable ();
- if (TREE_CODE (TREE_TYPE (field_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (field_decl)))
{
/* For reference to pointers, we need to map the referenced
pointer first for things to be correct. */
@@ -10026,7 +10026,7 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr)
OMP_CLAUSE_SIZE (c) = size_zero_node;
new_clauses.safe_push (c);
}
- else if (TREE_CODE (TREE_TYPE (fld)) == REFERENCE_TYPE)
+ else if (TYPE_REF_P (TREE_TYPE (fld)))
{
tree exp = build3 (COMPONENT_REF, TREE_TYPE (fld),
lobj, fld, NULL_TREE);
@@ -307,7 +307,7 @@ build_frontend_type (tree type)
}
StorageClass sc = STCundefined;
- if (TREE_CODE (argtype) == REFERENCE_TYPE)
+ if (TYPE_REF_P (argtype))
{
argtype = TREE_TYPE (argtype);
sc |= STCref;
@@ -1625,7 +1625,7 @@ indirect_ref (tree type, tree exp)
/* Maybe rewrite: *(e1, e2) => (e1, *e2) */
tree init = stabilize_expr (&exp);
- if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (exp)))
exp = fold_build1 (INDIRECT_REF, type, exp);
else
{
@@ -185,8 +185,8 @@ d_truthvalue_conversion (tree expr)
case CONVERT_EXPR:
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
since that affects how `default_conversion' will behave. */
- if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE
- || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (expr))
+ || TYPE_REF_P (TREE_TYPE (TREE_OPERAND (expr, 0))))
break;
/* Fall through. */
@@ -9507,7 +9507,7 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
when type is a reference type and arg00's type is not,
because arg00 could be validly nullptr and if arg01 doesn't return,
we don't want false positive binding of reference to nullptr. */
- if (TREE_CODE (type) == REFERENCE_TYPE
+ if (TYPE_REF_P (type)
&& !in_gimple_form
&& sanitize_flags_p (SANITIZE_NULL)
&& TREE_CODE (TREE_TYPE (arg00)) != REFERENCE_TYPE)
@@ -258,7 +258,7 @@ tree
gfc_conv_descriptor_data_get (tree desc)
{
tree type = TREE_TYPE (desc);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
gcc_unreachable ();
tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
@@ -9105,7 +9105,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tree dest,
decl_type = TREE_TYPE (decl);
if ((POINTER_TYPE_P (decl_type))
- || (TREE_CODE (decl_type) == REFERENCE_TYPE && rank == 0))
+ || (TYPE_REF_P (decl_type) && rank == 0))
{
decl = build_fold_indirect_ref_loc (input_location, decl);
/* Deref dest in sync with decl, but only when it is not NULL. */
@@ -7648,7 +7648,7 @@ gfc_generate_function_code (gfc_namespace * ns)
if (POINTER_TYPE_P (TREE_TYPE (type)))
/* For instance, allocatable scalars. */
type = TREE_TYPE (type);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
type = build_pointer_type (TREE_TYPE (type));
desc_p = build_decl (loc, VAR_DECL, get_identifier (fsym->name), type);
if (!fsym->attr.dimension)
@@ -1298,7 +1298,7 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
gcc_assert (tmp != NULL_TREE);
/* Dereference if needs be. */
- if (TREE_CODE (TREE_TYPE (tmp)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (tmp)))
tmp = build_fold_indirect_ref_loc (input_location, tmp);
if (!(gfc_is_class_array_function (e) && parmse->class_vptr))
@@ -1777,7 +1777,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
lhs_kind = kind;
caf_decl = gfc_get_tree_for_caf_expr (array_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
image_index = gfc_caf_get_image_index (&se->pre, array_expr,
caf_decl);
@@ -1899,7 +1899,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
gfc_add_block_to_block (&se->post, &argse.post);
caf_decl = gfc_get_tree_for_caf_expr (array_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
image_index = gfc_caf_get_image_index (&se->pre, array_expr, caf_decl);
gfc_get_caf_token_offset (se, &token, &offset, caf_decl, argse.expr,
@@ -2166,7 +2166,7 @@ conv_caf_send (gfc_code *code) {
/* Obtain token, offset and image index for the LHS. */
caf_decl = gfc_get_tree_for_caf_expr (lhs_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
image_index = gfc_caf_get_image_index (&block, lhs_expr, caf_decl);
tmp = lhs_se.expr;
@@ -2305,7 +2305,7 @@ conv_caf_send (gfc_code *code) {
gfc_add_expr_to_block (&block, tmp);
caf_decl = gfc_get_tree_for_caf_expr (rhs_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
rhs_image_index = gfc_caf_get_image_index (&block, rhs_expr, caf_decl);
tmp = rhs_se.expr;
@@ -8783,7 +8783,7 @@ trans_caf_is_present (gfc_se *se, gfc_expr *expr)
gcc_assert (caf_reference != NULL_TREE);
caf_decl = gfc_get_tree_for_caf_expr (expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
image_index = gfc_caf_get_image_index (&se->pre, expr, caf_decl);
gfc_get_caf_token_offset (se, &token, NULL, caf_decl, NULL,
@@ -11845,7 +11845,7 @@ conv_intrinsic_atomic_op (gfc_code *code)
}
caf_decl = gfc_get_tree_for_caf_expr (atom_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
if (gfc_is_coindexed (atom_expr))
@@ -12001,7 +12001,7 @@ conv_intrinsic_atomic_ref (gfc_code *code)
tree orig_value = NULL_TREE, vardecl = NULL_TREE;
caf_decl = gfc_get_tree_for_caf_expr (atom_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
if (gfc_is_coindexed (atom_expr))
@@ -12123,7 +12123,7 @@ conv_intrinsic_atomic_cas (gfc_code *code)
tree image_index, caf_decl, offset, token;
caf_decl = gfc_get_tree_for_caf_expr (atom_expr);
- if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (caf_decl)))
caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
if (gfc_is_coindexed (atom_expr))
@@ -219,7 +219,7 @@ gfc_omp_privatize_by_reference (const_tree decl)
{
tree type = TREE_TYPE (decl);
- if (TREE_CODE (type) == REFERENCE_TYPE
+ if (TYPE_REF_P (type)
&& (!DECL_ARTIFICIAL (decl) || TREE_CODE (decl) == PARM_DECL))
return true;
@@ -1584,7 +1584,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p, bool openacc)
OMP_CLAUSE_DECL (c) = decl;
OMP_CLAUSE_SIZE (c) = NULL_TREE;
}
- if (TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (orig_decl))
&& (GFC_DECL_GET_SCALAR_POINTER (orig_decl)
|| GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
{
@@ -1747,7 +1747,7 @@ bool
gfc_omp_scalar_p (tree decl, bool ptr_alloc_ok)
{
tree type = TREE_TYPE (decl);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
type = TREE_TYPE (type);
if (TREE_CODE (type) == POINTER_TYPE)
{
@@ -2015,7 +2015,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where)
type = TREE_TYPE (decl);
outer_decl = create_tmp_var_raw (type);
if (TREE_CODE (decl) == PARM_DECL
- && TREE_CODE (type) == REFERENCE_TYPE
+ && TYPE_REF_P (type)
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (type))
&& GFC_TYPE_ARRAY_AKIND (TREE_TYPE (type)) == GFC_ARRAY_ALLOCATABLE)
{
@@ -3277,7 +3277,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
OMP_CLAUSE_SIZE (node4) = size;
}
decl = build_fold_indirect_ref (decl);
- if ((TREE_CODE (TREE_TYPE (orig_decl)) == REFERENCE_TYPE
+ if ((TYPE_REF_P (TREE_TYPE (orig_decl))
|| gfc_omp_is_optional_argument (orig_decl))
&& (GFC_DECL_GET_SCALAR_POINTER (orig_decl)
|| GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
@@ -1706,7 +1706,7 @@ gimple_call_nonnull_result_p (gcall *call)
/* References are always non-NULL. */
if (flag_delete_null_pointer_checks
- && TREE_CODE (TREE_TYPE (fndecl)) == REFERENCE_TYPE)
+ && TYPE_REF_P (TREE_TYPE (fndecl)))
return true;
if (flag_delete_null_pointer_checks
@@ -1861,7 +1861,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
&& !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (decl)))
{
gimplify_type_sizes (TREE_TYPE (decl), seq_p);
- if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (decl)))
gimplify_type_sizes (TREE_TYPE (TREE_TYPE (decl)), seq_p);
}
@@ -1872,7 +1872,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
&& !TYPE_SIZES_GIMPLIFIED (DECL_ORIGINAL_TYPE (decl)))
{
gimplify_type_sizes (DECL_ORIGINAL_TYPE (decl), seq_p);
- if (TREE_CODE (DECL_ORIGINAL_TYPE (decl)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (DECL_ORIGINAL_TYPE (decl)))
gimplify_type_sizes (TREE_TYPE (DECL_ORIGINAL_TYPE (decl)), seq_p);
}
@@ -7905,7 +7905,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
else if (lang_hooks.decls.omp_scalar_p (decl, false))
gdmk = GDMK_SCALAR;
else if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
- || (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE
+ || (TYPE_REF_P (TREE_TYPE (decl))
&& (TREE_CODE (TREE_TYPE (TREE_TYPE (decl)))
== POINTER_TYPE)))
gdmk = GDMK_POINTER;
@@ -10418,7 +10418,7 @@ omp_accumulate_sibling_list (enum omp_region_type region_type,
ptrdiff_type_node, baddr);
/* This isn't going to be good enough when we add support for more
complicated lvalue expressions. FIXME. */
- if (TREE_CODE (TREE_TYPE (sdecl)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (sdecl))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (sdecl))) == POINTER_TYPE)
sdecl = build_simple_mem_ref (sdecl);
tree decladdr = fold_convert_loc (OMP_CLAUSE_LOCATION (grp_end),
@@ -10677,7 +10677,7 @@ omp_build_struct_sibling_lists (enum tree_code code,
}
tree stype = TREE_TYPE (decl);
- if (TREE_CODE (stype) == REFERENCE_TYPE)
+ if (TYPE_REF_P (stype))
stype = TREE_TYPE (stype);
if (TYPE_SIZE_UNIT (stype) == NULL
|| TREE_CODE (TYPE_SIZE_UNIT (stype)) != INTEGER_CST)
@@ -11801,7 +11801,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
&& TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF
&& (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
- || (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE
+ || (TYPE_REF_P (TREE_TYPE (decl))
&& (TREE_CODE (TREE_TYPE (TREE_TYPE (decl)))
== POINTER_TYPE))))
omp_firstprivatize_variable (outer_ctx, decl);
@@ -12184,7 +12184,7 @@ omp_shared_to_firstprivate_optimizable_decl_p (tree decl)
return false;
tree type = TREE_TYPE (decl);
if (!is_gimple_reg_type (type)
- || TREE_CODE (type) == REFERENCE_TYPE
+ || TYPE_REF_P (type)
|| TREE_ADDRESSABLE (type))
return false;
/* Don't optimize too large decls, as each thread/task will have
@@ -12432,7 +12432,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
{
tree nc = build_omp_clause (input_location, OMP_CLAUSE_MAP);
OMP_CLAUSE_DECL (nc) = decl;
- if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (decl))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE)
OMP_CLAUSE_DECL (clause)
= build_simple_mem_ref_loc (input_location, decl);
@@ -13591,7 +13591,7 @@ gimplify_omp_taskloop_expr (tree type, tree *tp, gimple_seq *pre_p,
here. */
if (type
&& TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (*tp)) == REFERENCE_TYPE)
+ && TYPE_REF_P (TREE_TYPE (*tp)))
{
tree v = create_tmp_var (TYPE_MAIN_VARIANT (type));
tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, *tp);
@@ -771,7 +771,7 @@ find_decls_types_r (tree *tp, int *ws, void *data)
in them. */
if (TREE_CODE (t) == POINTER_TYPE)
fld_worklist_push (TYPE_NEXT_PTR_TO (t), fld);
- if (TREE_CODE (t) == REFERENCE_TYPE)
+ if (TYPE_REF_P (t))
fld_worklist_push (TYPE_NEXT_REF_TO (t), fld);
if (!POINTER_TYPE_P (t))
fld_worklist_push (TYPE_MIN_VALUE_RAW (t), fld);
@@ -1206,7 +1206,7 @@ create_parameter_descriptors (cgraph_node *node,
if (POINTER_TYPE_P (type))
{
desc->by_ref = true;
- if (TREE_CODE (type) == REFERENCE_TYPE
+ if (TYPE_REF_P (type)
|| (num == 0
&& TREE_CODE (TREE_TYPE (node->decl)) == METHOD_TYPE))
desc->safe_ref = true;
@@ -650,7 +650,7 @@ bool
lhd_omp_scalar_p (tree decl, bool ptr_ok)
{
tree type = TREE_TYPE (decl);
- if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (type))
type = TREE_TYPE (type);
if (TREE_CODE (type) == COMPLEX_TYPE)
type = TREE_TYPE (type);
@@ -998,7 +998,7 @@ lto_fixup_prevailing_type (tree t)
TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t));
TYPE_POINTER_TO (TREE_TYPE (t)) = t;
}
- else if (TREE_CODE (t) == REFERENCE_TYPE && !TYPE_REF_IS_RVALUE (t))
+ else if (TYPE_REF_P (t) && !TYPE_REF_IS_RVALUE (t))
{
TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t));
TYPE_REFERENCE_TO (TREE_TYPE (t)) = t;
@@ -95,7 +95,7 @@ m2tree_skip_const_decl (tree exp)
tree
m2tree_skip_reference_type (tree exp)
{
- if (TREE_CODE (exp) == REFERENCE_TYPE)
+ if (TYPE_REF_P (exp))
return m2tree_skip_reference_type (TREE_TYPE (exp));
if (TREE_CODE (exp) == POINTER_TYPE)
return m2tree_skip_reference_type (TREE_TYPE (exp));
@@ -302,7 +302,7 @@ m2treelib_get_set_value (location_t location, tree p, tree field, bool is_const,
field);
else
{
- ASSERT_CONDITION (TREE_CODE (TREE_TYPE (p)) == REFERENCE_TYPE);
+ ASSERT_CONDITION (TYPE_REF_P (TREE_TYPE (p)));
value = m2expr_BuildComponentRef (location, p, field);
}
}
@@ -905,7 +905,7 @@ m2pp_parameter (pretty *s, tree t)
{
if (TREE_CODE (t) == PARM_DECL)
{
- if (TREE_TYPE (t) && (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE))
+ if (TREE_TYPE (t) && TYPE_REF_P (TREE_TYPE (t)))
{
m2pp_print (s, "VAR");
m2pp_needspace (s);
@@ -929,7 +929,7 @@ m2pp_parameter (pretty *s, tree t)
static void
m2pp_param_type (pretty *s, tree t)
{
- if (t && (TREE_CODE (t) == REFERENCE_TYPE))
+ if (t && TYPE_REF_P (t))
{
m2pp_print (s, "VAR");
m2pp_needspace (s);
@@ -6343,7 +6343,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Don't perform this optimization in GENERIC if @0 has reference
type when sanitizing. See PR101210. */
&& !(GENERIC
- && TREE_CODE (TREE_TYPE (@0)) == REFERENCE_TYPE
+ && TYPE_REF_P (TREE_TYPE (@0))
&& (flag_sanitize & (SANITIZE_NULL | SANITIZE_ALIGNMENT))))
|| (INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& POINTER_TYPE_P (TREE_TYPE (@1))
@@ -6374,7 +6374,7 @@ add_instance_variable (tree klass, objc_ivar_visibility_kind visibility,
tree field_type = TREE_TYPE (field_decl);
#ifdef OBJCPLUS
- if (TREE_CODE (field_type) == REFERENCE_TYPE)
+ if (TYPE_REF_P (field_type))
{
error ("illegal reference type specified for instance variable %qs",
printable_ivar_name (field_decl));
@@ -1298,7 +1298,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
&& (!is_global_var (maybe_lookup_decl_in_outer_ctx (t, ctx))
|| (is_task_ctx (ctx)
&& (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
- || (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
+ || (TYPE_REF_P (TREE_TYPE (t))
&& (TREE_CODE (TREE_TYPE (TREE_TYPE (t)))
== POINTER_TYPE)))))
&& !is_variable_sized (t)
@@ -1308,7 +1308,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
{
by_ref = use_pointer_for_field (t, NULL);
if (is_task_ctx (ctx)
- && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
+ && TYPE_REF_P (TREE_TYPE (t))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (t))) == POINTER_TYPE)
{
install_var_field (t, false, 1, ctx);
@@ -5306,7 +5306,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
{
bool by_ref = use_pointer_for_field (var, NULL);
x = build_receiver_ref (var, by_ref, ctx);
- if (TREE_CODE (TREE_TYPE (var)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (var))
&& (TREE_CODE (TREE_TYPE (TREE_TYPE (var)))
== POINTER_TYPE))
x = build_fold_addr_expr (x);
@@ -12200,7 +12200,7 @@ create_task_copyfn (gomp_task *task_stmt, omp_context *ctx)
src = build_simple_mem_ref_loc (loc, sarg);
src = omp_build_component_ref (src, sf);
if (decl != OMP_CLAUSE_DECL (c)
- && TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE
+ && TYPE_REF_P (TREE_TYPE (decl))
&& TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == POINTER_TYPE)
src = build_simple_mem_ref_loc (loc, src);
dst = build_simple_mem_ref_loc (loc, arg);
@@ -13313,7 +13313,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
{
gcc_checking_assert (is_gimple_omp_oacc (ctx->stmt));
s = TREE_TYPE (ovar);
- if (TREE_CODE (s) == REFERENCE_TYPE
+ if (TYPE_REF_P (s)
|| omp_check_optional_argument (ovar, false))
s = TREE_TYPE (s);
s = TYPE_SIZE_UNIT (s);
@@ -14046,7 +14046,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
else if (TREE_CODE (OMP_CLAUSE_DECL (c)) == COMPONENT_REF)
{
type = TREE_TYPE (OMP_CLAUSE_DECL (c));
- is_ref = TREE_CODE (type) == REFERENCE_TYPE;
+ is_ref = TYPE_REF_P (type);
new_var = build2 (MEM_REF, type,
build_fold_addr_expr (new_var),
build_int_cst (build_pointer_type (type),
@@ -14076,7 +14076,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
new_var = decl2;
type = TREE_TYPE (new_var);
}
- else if (TREE_CODE (type) == REFERENCE_TYPE
+ else if (TYPE_REF_P (type)
&& TREE_CODE (TREE_TYPE (type)) == POINTER_TYPE)
{
type = TREE_TYPE (type);
@@ -14617,8 +14617,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
tree lhs = get_base_address (gimple_assign_lhs (stmt));
if (TREE_CODE (lhs) == MEM_REF
&& DECL_P (TREE_OPERAND (lhs, 0))
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (lhs,
- 0))) == REFERENCE_TYPE)
+ && TYPE_REF_P (TREE_TYPE (TREE_OPERAND (lhs, 0))))
lhs = TREE_OPERAND (lhs, 0);
if (DECL_P (lhs))
if (tree *v = up->lastprivate_conditional_map->get (lhs))
@@ -365,7 +365,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses,
if (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (t))
{
enum cgraph_simd_clone_arg_type arg_type;
- if (TREE_CODE (args[argno]) == REFERENCE_TYPE)
+ if (TYPE_REF_P (args[argno]))
switch (OMP_CLAUSE_LINEAR_KIND (t))
{
case OMP_CLAUSE_LINEAR_REF:
@@ -410,7 +410,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses,
else
{
enum cgraph_simd_clone_arg_type arg_type;
- if (TREE_CODE (args[argno]) == REFERENCE_TYPE)
+ if (TYPE_REF_P (args[argno]))
switch (OMP_CLAUSE_LINEAR_KIND (t))
{
case OMP_CLAUSE_LINEAR_REF:
@@ -1392,7 +1392,7 @@ simd_clone_linear_addend (struct cgraph_node *node, unsigned int i,
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
ret = gimple_assign_lhs (g);
}
- if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE)
+ if (TYPE_REF_P (TREE_TYPE (arg)))
{
g = gimple_build_assign (make_ssa_name (TREE_TYPE (TREE_TYPE (arg))),
build_simple_mem_ref (ret));
@@ -1823,7 +1823,7 @@ simd_clone_adjust (struct cgraph_node *node)
tree orig_arg = node->simdclone->args[i].orig_arg;
tree def = ssa_default_def (cfun, orig_arg);
gcc_assert (!TREE_ADDRESSABLE (orig_arg)
- && TREE_CODE (TREE_TYPE (orig_arg)) == REFERENCE_TYPE);
+ && TYPE_REF_P (TREE_TYPE (orig_arg)));
if (def && !has_zero_uses (def))
{
tree rtype = TREE_TYPE (TREE_TYPE (orig_arg));
@@ -432,7 +432,7 @@ remap_type_1 (tree type, copy_body_data *id)
insert_decl_map (id, type, new_tree);
return new_tree;
}
- else if (TREE_CODE (type) == REFERENCE_TYPE)
+ else if (TYPE_REF_P (type))
{
new_tree = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
TYPE_MODE (type),
@@ -10050,7 +10050,7 @@ reconstruct_complex_type (tree type, tree bottom)
outer = build_pointer_type_for_mode (inner, TYPE_MODE (type),
TYPE_REF_CAN_ALIAS_ALL (type));
}
- else if (TREE_CODE (type) == REFERENCE_TYPE)
+ else if (TYPE_REF_P (type))
{
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
outer = build_reference_type_for_mode (inner, TYPE_MODE (type),
@@ -13387,7 +13387,7 @@ verify_type_variant (const_tree t, tree tv)
/* FIXME: TYPE_SIZES_GIMPLIFIED may differs for Ada build. */
verify_variant_match (TYPE_UNSIGNED);
verify_variant_match (TYPE_PACKED);
- if (TREE_CODE (t) == REFERENCE_TYPE)
+ if (TYPE_REF_P (t))
verify_variant_match (TYPE_REF_IS_RVALUE);
if (AGGREGATE_TYPE_P (t))
verify_variant_match (TYPE_REVERSE_STORAGE_ORDER);
@@ -14033,7 +14033,7 @@ verify_type (const_tree t)
error_found = true;
}
}
- else if (TREE_CODE (t) == REFERENCE_TYPE)
+ else if (TYPE_REF_P (t))
{
if (TYPE_NEXT_REF_TO (t)
&& TREE_CODE (TYPE_NEXT_REF_TO (t)) != REFERENCE_TYPE)
@@ -14202,7 +14202,7 @@ verify_type (const_tree t)
else if (TREE_CODE (t) == INTEGER_TYPE
|| TREE_CODE (t) == BOOLEAN_TYPE
|| TREE_CODE (t) == OFFSET_TYPE
- || TREE_CODE (t) == REFERENCE_TYPE
+ || TYPE_REF_P (t)
|| TREE_CODE (t) == NULLPTR_TYPE
|| TREE_CODE (t) == POINTER_TYPE)
{
@@ -14395,7 +14395,7 @@ nonnull_arg_p (const_tree arg)
return true;
/* Values passed by reference are always non-NULL. */
- if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (arg))
&& flag_delete_null_pointer_checks)
return true;
@@ -687,7 +687,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
ascending code order. */
#define POINTER_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
+ (TREE_CODE (TYPE) == POINTER_TYPE || TYPE_REF_P (TYPE))
/* Nonzero if TYPE represents a pointer to function. */
#define FUNCTION_POINTER_TYPE_P(TYPE) \
@@ -6282,7 +6282,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn)
{
for (t = TYPE_ARG_TYPES (type); t && t != void_list_node;
t = TREE_CHAIN (t))
- if (TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_VALUE (t))
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_VALUE (t))))
break;
if ((t == NULL || t == void_list_node) && obj_type_ref == NULL_TREE)
@@ -6433,7 +6433,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn)
function_arg_info arg (TREE_VALUE (t), /*named=*/true);
apply_pass_by_reference_rules (&args_so_far_v, arg);
reg = targetm.calls.function_arg (args_so_far, arg);
- if (TREE_CODE (arg.type) == REFERENCE_TYPE
+ if (TYPE_REF_P (arg.type)
&& INTEGRAL_TYPE_P (TREE_TYPE (arg.type))
&& reg
&& REG_P (reg)
@@ -9870,7 +9870,7 @@ vt_add_function_parameter (tree parm)
if (dv_is_value_p (dv))
{
record_entry_value (CSELIB_VAL_PTR (dv_as_value (dv)), incoming);
- if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE
+ if (TYPE_REF_P (TREE_TYPE (parm))
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (parm))))
{
machine_mode indmode