* call.c (set_up_extended_ref_temp): Use VAR_P.
* class.c: Use VAR_P throughout.
* constexpr.c (cxx_eval_constant_expression): Use VAR_P.
* cp-array-notation.c (make_triplet_val_inv): Likewise.
* decl.c: Use VAR_OR_FUNCTION_DECL_P or VAR_P
throughout.
* decl2.c: Likewise.
* error.c (dump_decl): Use VAR_P.
* mangle.c (decl_implicit_alias_p): Likewise.
* parser.c: Use VAR_P throughout.
* pt.c: Likewise.
* semantics.c: Likewise.
* vtable-class-hierarchy.c: Likewise.
* tree.c (handle_abi_tag_attribute): Use VAR_OR_FUNCTION_DECL_P.
From-SVN: r225098
+2015-06-27 Marek Polacek <polacek@redhat.com>
+
+ * call.c (set_up_extended_ref_temp): Use VAR_P.
+ * class.c: Use VAR_P throughout.
+ * constexpr.c (cxx_eval_constant_expression): Use VAR_P.
+ * cp-array-notation.c (make_triplet_val_inv): Likewise.
+ * decl.c: Use VAR_OR_FUNCTION_DECL_P or VAR_P
+ throughout.
+ * decl2.c: Likewise.
+ * error.c (dump_decl): Use VAR_P.
+ * mangle.c (decl_implicit_alias_p): Likewise.
+ * parser.c: Use VAR_P throughout.
+ * pt.c: Likewise.
+ * semantics.c: Likewise.
+ * vtable-class-hierarchy.c: Likewise.
+ * tree.c (handle_abi_tag_attribute): Use VAR_OR_FUNCTION_DECL_P.
+
2015-06-27 Andreas Schwab <schwab@linux-m68k.org>
* pt.c (check_unstripped_args): Mark parameter as unused.
}
/* Avoid -Wunused-variable warning (c++/38958). */
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
- && TREE_CODE (decl) == VAR_DECL)
+ && VAR_P (decl))
TREE_USED (decl) = DECL_READ_P (decl) = true;
*initp = init;
p->t, tag, *tp))
inform (location_of (*tp), "%qT declared here", *tp);
}
- else if (TREE_CODE (p->t) == VAR_DECL)
+ else if (VAR_P (p->t))
{
if (warning (OPT_Wabi_tag, "%qD inherits the %E ABI tag "
"that %qT (used in its type) has", p->t, tag, *tp))
void
check_abi_tags (tree decl)
{
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
check_abi_tags (decl, TREE_TYPE (decl));
else if (TREE_CODE (decl) == FUNCTION_DECL
&& !mangle_return_type_p (decl))
{
/* We already complained about static data members in
finish_static_data_member_decl. */
- if (complain && TREE_CODE (elt) != VAR_DECL)
+ if (complain && !VAR_P (elt))
{
if (is_union)
permerror (input_location,
if (TREE_CODE (r) == TARGET_EXPR
&& TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR)
r = TARGET_EXPR_INITIAL (r);
- if (TREE_CODE (r) == VAR_DECL)
+ if (VAR_P (r))
if (tree *p = ctx->values->get (r))
r = *p;
if (DECL_P (r))
{
if (TREE_CODE (*value) != INTEGER_CST
&& TREE_CODE (*value) != PARM_DECL
- && TREE_CODE (*value) != VAR_DECL)
+ && !VAR_P (*value))
*value = get_temp_regvar (ptrdiff_type_node, *value);
}
{
struct symtab_node *snode = NULL;
- if (TREE_CODE (newdecl) == VAR_DECL
- && (TREE_STATIC (olddecl) || TREE_PUBLIC (olddecl) || DECL_EXTERNAL (olddecl)))
+ if (VAR_P (newdecl)
+ && (TREE_STATIC (olddecl) || TREE_PUBLIC (olddecl)
+ || DECL_EXTERNAL (olddecl)))
snode = symtab_node::get (olddecl);
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
(char *) newdecl + sizeof (struct tree_decl_common),
size - sizeof (struct tree_decl_common)
+ TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *));
- if (TREE_CODE (newdecl) == VAR_DECL)
+ if (VAR_P (newdecl))
olddecl->decl_with_vis.symtab_node = snode;
}
break;
}
}
- if (TREE_CODE (newdecl) == FUNCTION_DECL
- || TREE_CODE (newdecl) == VAR_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (newdecl))
{
if (DECL_EXTERNAL (olddecl)
|| TREE_PUBLIC (olddecl)
}
}
- if (TREE_CODE (newdecl) == VAR_DECL
+ if (VAR_P (newdecl)
&& DECL_THREAD_LOCAL_P (newdecl))
set_decl_tls_model (olddecl, DECL_TLS_MODEL (newdecl));
}
structure is shared in between newdecl and oldecl. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
DECL_STRUCT_FUNCTION (newdecl) = NULL;
- if (TREE_CODE (newdecl) == FUNCTION_DECL
- || TREE_CODE (newdecl) == VAR_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (newdecl))
{
struct symtab_node *snode = symtab_node::get (newdecl);
if (snode)
/* Enter this declaration into the symbol table. Don't push the plain
VAR_DECL for a variable template. */
if (!template_parm_scope_p ()
- || TREE_CODE (decl) != VAR_DECL)
+ || !VAR_P (decl))
decl = maybe_push_decl (decl);
if (processing_template_decl)
return value;
/* Need to set this before push_template_decl. */
- if (TREE_CODE (value) == VAR_DECL)
+ if (VAR_P (value))
DECL_CONTEXT (value) = current_class_type;
if (processing_template_decl && VAR_OR_FUNCTION_DECL_P (value))
{
tree field;
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (TREE_CODE (field) == VAR_DECL)
+ if (VAR_P (field))
return false;
/* All fields must have mappable types. */
else if (TREE_CODE (field) == FIELD_DECL
/* Add implicit "omp declare target" attribute if requested. */
if (scope_chain->omp_declare_target_attribute
- && ((TREE_CODE (*decl) == VAR_DECL
+ && ((VAR_P (*decl)
&& (TREE_STATIC (*decl) || DECL_EXTERNAL (*decl)))
|| TREE_CODE (*decl) == FUNCTION_DECL))
{
- if (TREE_CODE (*decl) == VAR_DECL
+ if (VAR_P (*decl)
&& DECL_CLASS_SCOPE_P (*decl))
error ("%q+D static data member inside of declare target directive",
*decl);
- else if (TREE_CODE (*decl) == VAR_DECL
+ else if (VAR_P (*decl)
&& (DECL_FUNCTION_SCOPE_P (*decl)
|| (current_function_decl && !DECL_EXTERNAL (*decl))))
error ("%q+D in block scope inside of declare target directive",
*decl);
else if (!processing_template_decl
- && TREE_CODE (*decl) == VAR_DECL
+ && VAR_P (*decl)
&& !cp_omp_mappable_type (TREE_TYPE (*decl)))
error ("%q+D in declare target directive does not have mappable type",
*decl);
FOR_EACH_CLONE (clone, decl)
mark_needed (clone);
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
{
varpool_node *node = varpool_node::get_create (decl);
/* C++ frontend use mark_decl_references to force COMDAT variables
DECL_WEAK (decl) = 0;
DECL_COMMON (decl) = 0;
DECL_COMDAT (decl) = false;
- if (TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == VAR_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (decl))
{
struct symtab_node *snode = symtab_node::get (decl);
reset_decl_linkage (ti);
}
for (tree m = TYPE_FIELDS (type); m; m = DECL_CHAIN (m))
- if (TREE_CODE (m) == VAR_DECL)
+ if (VAR_P (m))
reset_decl_linkage (m);
for (tree m = TYPE_METHODS (type); m; m = DECL_CHAIN (m))
{
DECL_INTERFACE_KNOWN (decl) = 1;
}
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
maybe_commonize_var (decl);
}
}
"anonymous type, is used but never defined", decl);
else if (DECL_EXTERN_C_P (decl))
/* Allow this; it's pretty common in C. */;
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
/* DRs 132, 319 and 389 seem to indicate types with
no linkage can only be used to declare extern "C"
entities. Since it's not always an error in the
}
else if (cxx_dialect >= cxx11)
{
- if (TREE_CODE (decl) == VAR_DECL || !DECL_PURE_VIRTUAL_P (decl))
+ if (VAR_P (decl) || !DECL_PURE_VIRTUAL_P (decl))
permerror (DECL_SOURCE_LOCATION (decl),
"%q#D, declared using local type "
"%qT, is used but never defined", decl, t);
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
warning_at (DECL_SOURCE_LOCATION (decl), 0, "type %qT with no linkage "
"used to declare variable %q#D with linkage", t, decl);
else
dump_simple_decl (pp, t, TREE_TYPE (t), flags);
/* Handle variable template specializations. */
- if (TREE_CODE (t) == VAR_DECL
+ if (VAR_P (t)
&& DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INFO (t)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)))
if (DECL_P (decl) && DECL_ARTIFICIAL (decl)
&& DECL_IGNORED_P (decl)
&& (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && TREE_STATIC (decl))))
+ || (VAR_P (decl) && TREE_STATIC (decl))))
{
symtab_node *n = symtab_node::get (decl);
if (n && n->cpp_implicit_alias)
{
tree range_temp;
- if (TREE_CODE (range_expr) == VAR_DECL
+ if (VAR_P (range_expr)
&& array_of_runtime_bound_p (TREE_TYPE (range_expr)))
/* Can't bind a reference to an array of runtime bound. */
range_temp = range_expr;
c_parser_omp_var_list_parens should construct a list of
locations to go along with the var list. */
- if (TREE_CODE (v) != VAR_DECL)
+ if (!VAR_P (v))
error_at (loc, "%qD is not a variable", v);
else if (TREE_TYPE (v) == error_mark_node)
;
switch (tsk)
{
case tsk_none:
- if (processing_specialization && TREE_CODE (decl) != VAR_DECL)
+ if (processing_specialization && !VAR_P (decl))
{
specialization = 1;
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
/* A specialization is not necessarily COMDAT. */
DECL_COMDAT (decl) = (TREE_PUBLIC (decl)
&& DECL_DECLARED_INLINE_P (decl));
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
DECL_COMDAT (decl) = false;
/* Register this specialization so that we can find it
is_partial = ((DECL_IMPLICIT_TYPEDEF_P (decl)
&& TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
&& CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)))
- || (TREE_CODE (decl) == VAR_DECL
+ || (VAR_P (decl)
&& DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_SPECIALIZATION (decl)
&& TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
if (PRIMARY_TEMPLATE_P (t))
DECL_PRIMARY_TEMPLATE (r) = r;
- if (TREE_CODE (decl) != TYPE_DECL && TREE_CODE (decl) != VAR_DECL)
+ if (TREE_CODE (decl) != TYPE_DECL && !VAR_P (decl))
/* Record this non-type partial instantiation. */
register_specialization (r, t,
DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)),
= decl_function_context (containing_function);
}
- if (lambda_expr && TREE_CODE (decl) == VAR_DECL
+ if (lambda_expr && VAR_P (decl)
&& DECL_ANON_UNION_VAR_P (decl))
{
if (complain & tf_error)
return error_mark_node;
if (type_dependent_expression_p (t))
return NULL_TREE;
- if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
{
if (processing_template_decl)
return NULL_TREE;
return error_mark_node;
}
else if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_DEPEND
- && TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+ && VAR_P (t) && DECL_THREAD_LOCAL_P (t))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD is threadprivate variable in %qs clause", t,
case OMP_CLAUSE_ALIGNED:
t = OMP_CLAUSE_DECL (c);
- if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
{
if (processing_template_decl)
break;
}
if (t == error_mark_node)
remove = true;
- else if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ else if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
{
if (processing_template_decl)
break;
}
if (t == error_mark_node)
remove = true;
- else if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+ else if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
{
if (processing_template_decl)
break;
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
remove = true;
}
- else if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+ else if (VAR_P (t) && DECL_THREAD_LOCAL_P (t))
{
error ("%qD is threadprivate variable in %qs clause", t,
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
}
else
{
- if (TREE_CODE (*node) != FUNCTION_DECL
- && TREE_CODE (*node) != VAR_DECL)
+ if (!VAR_OR_FUNCTION_DECL_P (*node))
{
error ("%qE attribute applied to non-function, non-variable %qD",
name, *node);
if (TREE_OPERAND (value, 0))
val_vtbl_decl = TREE_OPERAND (value, 0);
- while (TREE_CODE (val_vtbl_decl) != VAR_DECL
+ while (!VAR_P (val_vtbl_decl)
&& TREE_OPERAND (val_vtbl_decl, 0))
val_vtbl_decl = TREE_OPERAND (val_vtbl_decl, 0);
- gcc_assert (TREE_CODE (val_vtbl_decl) == VAR_DECL);
+ gcc_assert (VAR_P (val_vtbl_decl));
/* Check to see if we already have this vtable pointer in
our valid set for this base class. */
if (TREE_CODE (arg0) == ADDR_EXPR)
arg0 = TREE_OPERAND (arg0, 0);
- if (TREE_CODE (arg0) == VAR_DECL)
+ if (VAR_P (arg0))
vptr_name = IDENTIFIER_POINTER (DECL_NAME (arg0));
if (TREE_CODE (arg1) == INTEGER_CST)