integral types plus floating types. */
return ((CP_INTEGRAL_TYPE_P (type)
&& same_type_p (type_promotes_to (type), type))
- || TREE_CODE (type) == REAL_TYPE);
+ || SCALAR_FLOAT_TYPE_P (type));
}
/* Create any builtin operator overload candidates for the operator in
if ((TREE_CODE (arg2) == EXCESS_PRECISION_EXPR
|| TREE_CODE (arg3) == EXCESS_PRECISION_EXPR)
&& (TREE_CODE (arg2_type) == INTEGER_TYPE
- || TREE_CODE (arg2_type) == REAL_TYPE
+ || SCALAR_FLOAT_TYPE_P (arg2_type)
|| TREE_CODE (arg2_type) == COMPLEX_TYPE)
&& (TREE_CODE (arg3_type) == INTEGER_TYPE
- || TREE_CODE (arg3_type) == REAL_TYPE
+ || SCALAR_FLOAT_TYPE_P (arg3_type)
|| TREE_CODE (arg3_type) == COMPLEX_TYPE))
{
semantic_result_type
t1 = TREE_TYPE (t1);
if (TREE_CODE (t2) == COMPLEX_TYPE)
t2 = TREE_TYPE (t2);
- gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE
- && TREE_CODE (t2) == REAL_TYPE
+ gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1)
+ && SCALAR_FLOAT_TYPE_P (t2)
&& (extended_float_type_p (t1)
|| extended_float_type_p (t2))
&& cp_compare_floating_point_conversion_ranks
t1 = TREE_TYPE (t1);
if (TREE_CODE (t2) == COMPLEX_TYPE)
t2 = TREE_TYPE (t2);
- gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE
- && TREE_CODE (t2) == REAL_TYPE
+ gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1)
+ && SCALAR_FLOAT_TYPE_P (t2)
&& (extended_float_type_p (t1)
|| extended_float_type_p (t2))
&& cp_compare_floating_point_conversion_ranks
t1 = TREE_TYPE (t1);
if (TREE_CODE (t2) == COMPLEX_TYPE)
t2 = TREE_TYPE (t2);
- gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE
- && TREE_CODE (t2) == REAL_TYPE
+ gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1)
+ && SCALAR_FLOAT_TYPE_P (t2)
&& (extended_float_type_p (t1)
|| extended_float_type_p (t2))
&& cp_compare_floating_point_conversion_ranks
else if ((complain & tf_warning)
&& warn_deprecated_enum_float_conv
&& ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
- && TREE_CODE (arg3_type) == REAL_TYPE)
- || (TREE_CODE (arg2_type) == REAL_TYPE
+ && SCALAR_FLOAT_TYPE_P (arg3_type))
+ || (SCALAR_FLOAT_TYPE_P (arg2_type)
&& TREE_CODE (arg3_type) == ENUMERAL_TYPE)))
{
if (TREE_CODE (arg2_type) == ENUMERAL_TYPE)
"direct-initialization",
totype, TREE_TYPE (expr));
- if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
- && TREE_CODE (totype) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (expr))
+ && SCALAR_FLOAT_TYPE_P (totype)
&& (extended_float_type_p (TREE_TYPE (expr))
|| extended_float_type_p (totype)))
switch (cp_compare_floating_point_conversion_ranks (TREE_TYPE (expr),
type that is subject to the floating-point promotion
(_conv.fpprom_), the value of the argument is converted to the
promoted type before the call. */
- if (TREE_CODE (arg_type) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (arg_type)
&& (TYPE_PRECISION (arg_type)
< TYPE_PRECISION (double_type_node))
&& !DECIMAL_FLOAT_MODE_P (TYPE_MODE (arg_type))
obj_arg = NULL_TREE;
}
/* Look through *(const T *)&obj. */
- else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF)
+ else if (obj_arg && INDIRECT_REF_P (obj_arg))
{
tree addr = TREE_OPERAND (obj_arg, 0);
STRIP_NOPS (addr);
obj_arg = NULL_TREE;
}
/* Look through *(const T *)&obj. */
- else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF)
+ else if (obj_arg && INDIRECT_REF_P (obj_arg))
{
tree addr = TREE_OPERAND (obj_arg, 0);
STRIP_NOPS (addr);
std::swap (fp3, t3);
}
if (TYPE_MAIN_VARIANT (fp1) == TYPE_MAIN_VARIANT (fp3)
- && TREE_CODE (fp1) == REAL_TYPE
+ && SCALAR_FLOAT_TYPE_P (fp1)
/* Only apply this rule if at least one of the 3 types is
extended floating-point type, otherwise keep them as
before for compatibility reasons with types like __float128.
ranks and so when just those 3 types are involved, this
rule doesn't trigger. */
&& (extended_float_type_p (fp1)
- || (TREE_CODE (fp2) == REAL_TYPE && extended_float_type_p (fp2))
- || (TREE_CODE (t3) == REAL_TYPE && extended_float_type_p (t3))))
+ || (SCALAR_FLOAT_TYPE_P (fp2) && extended_float_type_p (fp2))
+ || (SCALAR_FLOAT_TYPE_P (t3) && extended_float_type_p (t3))))
{
if (TREE_CODE (fp2) != REAL_TYPE)
{
ret = -ret;
std::swap (fp2, t3);
}
- if (TREE_CODE (fp2) == REAL_TYPE)
+ if (SCALAR_FLOAT_TYPE_P (fp2))
{
/* cp_compare_floating_point_conversion_ranks returns -1, 0 or 1
if the conversion rank is equal (-1 or 1 if the subrank is
FP1 <-> T3 conversion is better. */
return -ret;
}
- else if (TREE_CODE (t3) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (t3)
&& IN_RANGE (cp_compare_floating_point_conversion_ranks
(fp1, t3),
-1, 1))
bool
is_empty_base_ref (tree expr)
{
- if (TREE_CODE (expr) == INDIRECT_REF)
+ if (INDIRECT_REF_P (expr))
expr = TREE_OPERAND (expr, 0);
if (TREE_CODE (expr) != NOP_EXPR)
return false;
param_frame_data *data = (param_frame_data *) d;
/* For lambda closure content, we have to look specifically. */
- if (TREE_CODE (*stmt) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*stmt))
+ if (VAR_P (*stmt) && DECL_HAS_VALUE_EXPR_P (*stmt))
{
tree t = DECL_VALUE_EXPR (*stmt);
return cp_walk_tree (&t, rewrite_param_uses, d, NULL);
/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
#define DECL_DISCRIMINATOR_P(NODE) \
- (((TREE_CODE (NODE) == VAR_DECL && TREE_STATIC (NODE)) \
+ (((VAR_P (NODE) && TREE_STATIC (NODE)) \
|| DECL_IMPLICIT_TYPEDEF_P (NODE)) \
&& DECL_FUNCTION_SCOPE_P (NODE))
Keep these checks in ascending code order. */
#define ARITHMETIC_TYPE_P(TYPE) \
(CP_INTEGRAL_TYPE_P (TYPE) \
- || TREE_CODE (TYPE) == REAL_TYPE \
+ || SCALAR_FLOAT_TYPE_P (TYPE) \
|| TREE_CODE (TYPE) == COMPLEX_TYPE)
/* [basic.types]
/* enum = enum, enum = int, enum = float, (enum)pointer are all
errors. */
if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
- || TREE_CODE (intype) == REAL_TYPE)
+ || SCALAR_FLOAT_TYPE_P (intype))
&& ! (convtype & CONV_STATIC))
|| TYPE_PTR_P (intype))
{
if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
&& TYPE_P (DECL_TEMPLATE_RESULT (arg))))
pp->type_id (arg);
- else if (TREE_CODE (arg) == VAR_DECL && DECL_NTTP_OBJECT_P (arg))
+ else if (VAR_P (arg) && DECL_NTTP_OBJECT_P (arg))
pp->expression (DECL_INITIAL (arg));
else
pp->expression (arg);
&& !vec_safe_is_empty (CONSTRUCTOR_ELTS (DECL_INITIAL (decl)))
&& DECL_SIZE (decl) != NULL_TREE
&& TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST
- && TYPE_SIZE (type) != NULL_TREE
+ && COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& tree_int_cst_equal (DECL_SIZE (decl), TYPE_SIZE (type)))
{
return NULL_TREE;
tree val = lookup_qualified_name (inst, value_identifier,
LOOK_want::NORMAL, /*complain*/false);
- if (TREE_CODE (val) == VAR_DECL || TREE_CODE (val) == CONST_DECL)
+ if (VAR_P (val) || TREE_CODE (val) == CONST_DECL)
val = maybe_constant_value (val);
if (TREE_CODE (val) == INTEGER_CST)
return val;
static void
dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags)
{
- if (TREE_CODE (t) == VAR_DECL && DECL_NTTP_OBJECT_P (t))
+ if (VAR_P (t) && DECL_NTTP_OBJECT_P (t))
return dump_expr (pp, DECL_INITIAL (t), flags);
if (flags & TFF_DECL_SPECIFIERS)
start_lambda_scope (tree decl)
{
gcc_checking_assert (decl);
- if (current_function_decl && TREE_CODE (decl) == VAR_DECL)
+ if (current_function_decl && VAR_P (decl))
// If we're inside a function, we ignore variable scope. Don't push.
lambda_scope.nesting++;
else
}
}
- if (TREE_CODE (node) == VAR_DECL && DECL_NTTP_OBJECT_P (node))
+ if (VAR_P (node) && DECL_NTTP_OBJECT_P (node))
/* We want to mangle the argument, not the var we stored it in. */
node = tparm_object_argument (node);
{
if (INTEGRAL_OR_ENUMERATION_TYPE_P (optype) || TYPE_PTROBV_P (optype))
return cc_strong_ordering;
- else if (TREE_CODE (optype) == REAL_TYPE)
+ else if (SCALAR_FLOAT_TYPE_P (optype))
return cc_partial_ordering;
/* ??? should vector <=> produce a vector of one of the above? */
}
}
else if (DECL_LANG_SPECIFIC (decl)
- && (TREE_CODE (decl) == VAR_DECL
+ && (VAR_P (decl)
|| TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == FIELD_DECL
switch (TREE_CODE (t))
{
default:
- if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_vl_exp)
+ if (VL_EXP_CLASS_P (t))
u (VL_EXP_OPERAND_LENGTH (t));
break;
{
tinfo:
/* A typeinfo, tt_tinfo_typedef or tt_tinfo_var. */
- bool is_var = TREE_CODE (decl) == VAR_DECL;
+ bool is_var = VAR_P (decl);
tree type = TREE_TYPE (decl);
unsigned ix = get_pseudo_tinfo_index (type);
if (streaming_p ())
Mostly things that can be defined outside of their (original
declaration) context. */
gcc_checking_assert (TREE_CODE (decl) == TEMPLATE_DECL
- || TREE_CODE (decl) == VAR_DECL
+ || VAR_P (decl)
|| TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == USING_DECL
trees_in::read_var_def (tree decl, tree maybe_template)
{
/* Do not mark the virtual table entries as used. */
- bool vtable = TREE_CODE (decl) == VAR_DECL && DECL_VTABLE_OR_VTT_P (decl);
+ bool vtable = VAR_P (decl) && DECL_VTABLE_OR_VTT_P (decl);
unused += vtable;
tree init = tree_node ();
tree dyn_init = init ? NULL_TREE : tree_node ();
set_instantiating_module (tree decl)
{
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == VAR_DECL
+ || VAR_P (decl)
|| TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == CONCEPT_DECL
|| TREE_CODE (decl) == TEMPLATE_DECL
tree not_tmpl = STRIP_TEMPLATE (decl);
if ((TREE_CODE (not_tmpl) == FUNCTION_DECL
- || TREE_CODE (not_tmpl) == VAR_DECL)
+ || VAR_P (not_tmpl))
&& DECL_THIS_STATIC (not_tmpl))
/* Internal linkage. */
return;
{
/* Skip compiler-generated variables (e.g. __for_begin/__for_end
within range for). */
- if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl))
+ if (VAR_P (decl) && DECL_ARTIFICIAL (decl))
return;
tree suggestion = DECL_NAME (decl);
{
/* Skip compiler-generated variables (e.g. __for_begin/__for_end
within range for). */
- if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl))
+ if (VAR_P (decl) && DECL_ARTIFICIAL (decl))
return false;
tree suggestion = DECL_NAME (decl);
integral promotions (_conv.prom_) and integral conversions
(_conv.integral_) are applied. */
if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)
- || TREE_CODE (type) == REAL_TYPE)
+ || SCALAR_FLOAT_TYPE_P (type))
{
if (cxx_dialect < cxx11)
{
&& TREE_CODE (TREE_OPERAND (t, 0)) == COMPONENT_REF)
t = TREE_OPERAND (t, 0);
ret = t;
- while (TREE_CODE (t) == INDIRECT_REF)
+ while (INDIRECT_REF_P (t))
{
t = TREE_OPERAND (t, 0);
STRIP_NOPS (t);
}
t = TREE_OPERAND (t, 0);
while (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
if (REFERENCE_REF_P (t))
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF)
+ || INDIRECT_REF_P (t))
{
t = TREE_OPERAND (t, 0);
STRIP_NOPS (t);
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH_DETACH)
OMP_CLAUSE_DECL (c) = t;
}
- while (TREE_CODE (t) == INDIRECT_REF
+ while (INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
remove = true;
indir_component_ref_p = false;
if (TREE_CODE (t) == COMPONENT_REF
- && (TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF
+ && (INDIRECT_REF_P (TREE_OPERAND (t, 0))
|| TREE_CODE (TREE_OPERAND (t, 0)) == ARRAY_REF))
{
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
t = TREE_OPERAND (t, 0);
}
while (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
t = OMP_CLAUSE_DECL (c);
while (TREE_CODE (t) == TREE_LIST)
t = TREE_CHAIN (t);
- while (TREE_CODE (t) == INDIRECT_REF
+ while (INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
t = TREE_OPERAND (t, 0);
}
{
t = OMP_CLAUSE_DECL (c);
while (handled_component_p (t)
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ADDR_EXPR
|| TREE_CODE (t) == MEM_REF
|| TREE_CODE (t) == NON_LVALUE_EXPR)
if (TREE_CODE (t) == POINTER_PLUS_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == ADDR_EXPR
- || TREE_CODE (t) == INDIRECT_REF)
+ || INDIRECT_REF_P (t))
t = TREE_OPERAND (t, 0);
if (DECL_P (t))
bitmap_clear_bit (&aligned_head, DECL_UID (t));
of DECL_VALUE_EXPRs during the target body walk seems the only way to
find them. */
if (current_closure
- && (TREE_CODE (t) == VAR_DECL
+ && (VAR_P (t)
|| TREE_CODE (t) == PARM_DECL
|| TREE_CODE (t) == RESULT_DECL)
&& DECL_HAS_VALUE_EXPR_P (t)
if (!DECL_P (t) || DECL_NAME (t) != this_identifier)
return false;
gcc_assert (TREE_CODE (t) == PARM_DECL
- || (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
- || (cp_binding_oracle && TREE_CODE (t) == VAR_DECL));
+ || (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
+ || (cp_binding_oracle && VAR_P (t)));
return true;
}
}
/* Avoid spurious warnings with VLAs (c++/54583). */
- if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t)))
+ if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t)))
suppress_warning (TYPE_SIZE (t), OPT_Wunused);
/* Push these needs up to the ARRAY_TYPE so that initialization takes
{
t = get_innermost_component (t);
/* See through deferences and no-op conversions. */
- if (TREE_CODE (t) == INDIRECT_REF)
+ if (INDIRECT_REF_P (t))
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == NOP_EXPR)
t = TREE_OPERAND (t, 0);
}
}
else if ((TREE_CODE (type0) == ENUMERAL_TYPE
- && TREE_CODE (type1) == REAL_TYPE)
- || (TREE_CODE (type0) == REAL_TYPE
+ && SCALAR_FLOAT_TYPE_P (type1))
+ || (SCALAR_FLOAT_TYPE_P (type0)
&& TREE_CODE (type1) == ENUMERAL_TYPE))
{
const bool enum_first_p = TREE_CODE (type0) == ENUMERAL_TYPE;
here it should have been digested into an actual value for the type. */
gcc_checking_assert (TREE_CODE (value) != CONSTRUCTOR
|| processing_template_decl
- || TREE_CODE (type) == VECTOR_TYPE
+ || VECTOR_TYPE_P (type)
|| !TREE_HAS_CONSTRUCTOR (value));
/* If the initializer is not a constant, fill in DECL_INITIAL with
return ok;
if (CP_INTEGRAL_TYPE_P (type)
- && TREE_CODE (ftype) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (ftype))
ok = false;
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
&& CP_INTEGRAL_TYPE_P (type))
}
/* [dcl.init.list]#7.2: "from long double to double or float, or from
double to float". */
- else if (TREE_CODE (ftype) == REAL_TYPE
- && TREE_CODE (type) == REAL_TYPE)
+ else if (SCALAR_FLOAT_TYPE_P (ftype)
+ && SCALAR_FLOAT_TYPE_P (type))
{
if ((extended_float_type_p (ftype) || extended_float_type_p (type))
? /* "from a floating-point type T to another floating-point type
}
}
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype)
- && TREE_CODE (type) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (type))
{
ok = false;
if (TREE_CODE (init) == INTEGER_CST)