call.c (set_up_extended_ref_temp): Use VAR_P.

* 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
This commit is contained in:
Marek Polacek 2015-06-27 10:39:31 +00:00 committed by Marek Polacek
parent e1cc235523
commit 56a6f1d33f
14 changed files with 63 additions and 50 deletions

View File

@ -1,3 +1,20 @@
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> 2015-06-27 Andreas Schwab <schwab@linux-m68k.org>
* pt.c (check_unstripped_args): Mark parameter as unused. * pt.c (check_unstripped_args): Mark parameter as unused.

View File

@ -9697,7 +9697,7 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,
} }
/* Avoid -Wunused-variable warning (c++/38958). */ /* Avoid -Wunused-variable warning (c++/38958). */
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& TREE_CODE (decl) == VAR_DECL) && VAR_P (decl))
TREE_USED (decl) = DECL_READ_P (decl) = true; TREE_USED (decl) = DECL_READ_P (decl) = true;
*initp = init; *initp = init;

View File

@ -1399,7 +1399,7 @@ check_tag (tree tag, tree id, tree *tp, abi_tag_data *p)
p->t, tag, *tp)) p->t, tag, *tp))
inform (location_of (*tp), "%qT declared here", *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 " if (warning (OPT_Wabi_tag, "%qD inherits the %E ABI tag "
"that %qT (used in its type) has", p->t, tag, *tp)) "that %qT (used in its type) has", p->t, tag, *tp))
@ -1588,7 +1588,7 @@ check_abi_tags (tree t, tree subob)
void void
check_abi_tags (tree decl) check_abi_tags (tree decl)
{ {
if (TREE_CODE (decl) == VAR_DECL) if (VAR_P (decl))
check_abi_tags (decl, TREE_TYPE (decl)); check_abi_tags (decl, TREE_TYPE (decl));
else if (TREE_CODE (decl) == FUNCTION_DECL else if (TREE_CODE (decl) == FUNCTION_DECL
&& !mangle_return_type_p (decl)) && !mangle_return_type_p (decl))
@ -3040,7 +3040,7 @@ finish_struct_anon_r (tree field, bool complain)
{ {
/* We already complained about static data members in /* We already complained about static data members in
finish_static_data_member_decl. */ finish_static_data_member_decl. */
if (complain && TREE_CODE (elt) != VAR_DECL) if (complain && !VAR_P (elt))
{ {
if (is_union) if (is_union)
permerror (input_location, permerror (input_location,

View File

@ -3033,7 +3033,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
if (TREE_CODE (r) == TARGET_EXPR if (TREE_CODE (r) == TARGET_EXPR
&& TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR) && TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR)
r = TARGET_EXPR_INITIAL (r); r = TARGET_EXPR_INITIAL (r);
if (TREE_CODE (r) == VAR_DECL) if (VAR_P (r))
if (tree *p = ctx->values->get (r)) if (tree *p = ctx->values->get (r))
r = *p; r = *p;
if (DECL_P (r)) if (DECL_P (r))

View File

@ -87,7 +87,7 @@ make_triplet_val_inv (tree *value)
{ {
if (TREE_CODE (*value) != INTEGER_CST if (TREE_CODE (*value) != INTEGER_CST
&& TREE_CODE (*value) != PARM_DECL && TREE_CODE (*value) != PARM_DECL
&& TREE_CODE (*value) != VAR_DECL) && !VAR_P (*value))
*value = get_temp_regvar (ptrdiff_type_node, *value); *value = get_temp_regvar (ptrdiff_type_node, *value);
} }

View File

@ -2476,14 +2476,15 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{ {
struct symtab_node *snode = NULL; struct symtab_node *snode = NULL;
if (TREE_CODE (newdecl) == VAR_DECL if (VAR_P (newdecl)
&& (TREE_STATIC (olddecl) || TREE_PUBLIC (olddecl) || DECL_EXTERNAL (olddecl))) && (TREE_STATIC (olddecl) || TREE_PUBLIC (olddecl)
|| DECL_EXTERNAL (olddecl)))
snode = symtab_node::get (olddecl); snode = symtab_node::get (olddecl);
memcpy ((char *) olddecl + sizeof (struct tree_decl_common), memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
(char *) newdecl + sizeof (struct tree_decl_common), (char *) newdecl + sizeof (struct tree_decl_common),
size - sizeof (struct tree_decl_common) size - sizeof (struct tree_decl_common)
+ TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *)); + 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; olddecl->decl_with_vis.symtab_node = snode;
} }
break; break;
@ -2496,8 +2497,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
} }
} }
if (TREE_CODE (newdecl) == FUNCTION_DECL if (VAR_OR_FUNCTION_DECL_P (newdecl))
|| TREE_CODE (newdecl) == VAR_DECL)
{ {
if (DECL_EXTERNAL (olddecl) if (DECL_EXTERNAL (olddecl)
|| TREE_PUBLIC (olddecl) || TREE_PUBLIC (olddecl)
@ -2522,7 +2522,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
} }
} }
if (TREE_CODE (newdecl) == VAR_DECL if (VAR_P (newdecl)
&& DECL_THREAD_LOCAL_P (newdecl)) && DECL_THREAD_LOCAL_P (newdecl))
set_decl_tls_model (olddecl, DECL_TLS_MODEL (newdecl)); set_decl_tls_model (olddecl, DECL_TLS_MODEL (newdecl));
} }
@ -2559,8 +2559,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
structure is shared in between newdecl and oldecl. */ structure is shared in between newdecl and oldecl. */
if (TREE_CODE (newdecl) == FUNCTION_DECL) if (TREE_CODE (newdecl) == FUNCTION_DECL)
DECL_STRUCT_FUNCTION (newdecl) = NULL; DECL_STRUCT_FUNCTION (newdecl) = NULL;
if (TREE_CODE (newdecl) == FUNCTION_DECL if (VAR_OR_FUNCTION_DECL_P (newdecl))
|| TREE_CODE (newdecl) == VAR_DECL)
{ {
struct symtab_node *snode = symtab_node::get (newdecl); struct symtab_node *snode = symtab_node::get (newdecl);
if (snode) if (snode)
@ -4828,7 +4827,7 @@ start_decl (const cp_declarator *declarator,
/* Enter this declaration into the symbol table. Don't push the plain /* Enter this declaration into the symbol table. Don't push the plain
VAR_DECL for a variable template. */ VAR_DECL for a variable template. */
if (!template_parm_scope_p () if (!template_parm_scope_p ()
|| TREE_CODE (decl) != VAR_DECL) || !VAR_P (decl))
decl = maybe_push_decl (decl); decl = maybe_push_decl (decl);
if (processing_template_decl) if (processing_template_decl)

View File

@ -1005,7 +1005,7 @@ grokfield (const cp_declarator *declarator,
return value; return value;
/* Need to set this before push_template_decl. */ /* Need to set this before push_template_decl. */
if (TREE_CODE (value) == VAR_DECL) if (VAR_P (value))
DECL_CONTEXT (value) = current_class_type; DECL_CONTEXT (value) = current_class_type;
if (processing_template_decl && VAR_OR_FUNCTION_DECL_P (value)) if (processing_template_decl && VAR_OR_FUNCTION_DECL_P (value))
@ -1417,7 +1417,7 @@ cp_omp_mappable_type (tree type)
{ {
tree field; tree field;
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == VAR_DECL) if (VAR_P (field))
return false; return false;
/* All fields must have mappable types. */ /* All fields must have mappable types. */
else if (TREE_CODE (field) == FIELD_DECL else if (TREE_CODE (field) == FIELD_DECL
@ -1438,21 +1438,21 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
/* Add implicit "omp declare target" attribute if requested. */ /* Add implicit "omp declare target" attribute if requested. */
if (scope_chain->omp_declare_target_attribute if (scope_chain->omp_declare_target_attribute
&& ((TREE_CODE (*decl) == VAR_DECL && ((VAR_P (*decl)
&& (TREE_STATIC (*decl) || DECL_EXTERNAL (*decl))) && (TREE_STATIC (*decl) || DECL_EXTERNAL (*decl)))
|| TREE_CODE (*decl) == FUNCTION_DECL)) || TREE_CODE (*decl) == FUNCTION_DECL))
{ {
if (TREE_CODE (*decl) == VAR_DECL if (VAR_P (*decl)
&& DECL_CLASS_SCOPE_P (*decl)) && DECL_CLASS_SCOPE_P (*decl))
error ("%q+D static data member inside of declare target directive", error ("%q+D static data member inside of declare target directive",
*decl); *decl);
else if (TREE_CODE (*decl) == VAR_DECL else if (VAR_P (*decl)
&& (DECL_FUNCTION_SCOPE_P (*decl) && (DECL_FUNCTION_SCOPE_P (*decl)
|| (current_function_decl && !DECL_EXTERNAL (*decl)))) || (current_function_decl && !DECL_EXTERNAL (*decl))))
error ("%q+D in block scope inside of declare target directive", error ("%q+D in block scope inside of declare target directive",
*decl); *decl);
else if (!processing_template_decl else if (!processing_template_decl
&& TREE_CODE (*decl) == VAR_DECL && VAR_P (*decl)
&& !cp_omp_mappable_type (TREE_TYPE (*decl))) && !cp_omp_mappable_type (TREE_TYPE (*decl)))
error ("%q+D in declare target directive does not have mappable type", error ("%q+D in declare target directive does not have mappable type",
*decl); *decl);
@ -1980,7 +1980,7 @@ mark_needed (tree decl)
FOR_EACH_CLONE (clone, decl) FOR_EACH_CLONE (clone, decl)
mark_needed (clone); mark_needed (clone);
} }
else if (TREE_CODE (decl) == VAR_DECL) else if (VAR_P (decl))
{ {
varpool_node *node = varpool_node::get_create (decl); varpool_node *node = varpool_node::get_create (decl);
/* C++ frontend use mark_decl_references to force COMDAT variables /* C++ frontend use mark_decl_references to force COMDAT variables
@ -2179,8 +2179,7 @@ constrain_visibility (tree decl, int visibility, bool tmpl)
DECL_WEAK (decl) = 0; DECL_WEAK (decl) = 0;
DECL_COMMON (decl) = 0; DECL_COMMON (decl) = 0;
DECL_COMDAT (decl) = false; DECL_COMDAT (decl) = false;
if (TREE_CODE (decl) == FUNCTION_DECL if (VAR_OR_FUNCTION_DECL_P (decl))
|| TREE_CODE (decl) == VAR_DECL)
{ {
struct symtab_node *snode = symtab_node::get (decl); struct symtab_node *snode = symtab_node::get (decl);
@ -2643,7 +2642,7 @@ reset_type_linkage_2 (tree type)
reset_decl_linkage (ti); reset_decl_linkage (ti);
} }
for (tree m = TYPE_FIELDS (type); m; m = DECL_CHAIN (m)) 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); reset_decl_linkage (m);
for (tree m = TYPE_METHODS (type); m; m = DECL_CHAIN (m)) for (tree m = TYPE_METHODS (type); m; m = DECL_CHAIN (m))
{ {
@ -2701,7 +2700,7 @@ tentative_decl_linkage (tree decl)
DECL_INTERFACE_KNOWN (decl) = 1; DECL_INTERFACE_KNOWN (decl) = 1;
} }
} }
else if (TREE_CODE (decl) == VAR_DECL) else if (VAR_P (decl))
maybe_commonize_var (decl); maybe_commonize_var (decl);
} }
} }
@ -4208,7 +4207,7 @@ no_linkage_error (tree decl)
"anonymous type, is used but never defined", decl); "anonymous type, is used but never defined", decl);
else if (DECL_EXTERN_C_P (decl)) else if (DECL_EXTERN_C_P (decl))
/* Allow this; it's pretty common in C. */; /* 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 /* DRs 132, 319 and 389 seem to indicate types with
no linkage can only be used to declare extern "C" no linkage can only be used to declare extern "C"
entities. Since it's not always an error in the entities. Since it's not always an error in the
@ -4227,12 +4226,12 @@ no_linkage_error (tree decl)
} }
else if (cxx_dialect >= cxx11) 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), permerror (DECL_SOURCE_LOCATION (decl),
"%q#D, declared using local type " "%q#D, declared using local type "
"%qT, is used but never defined", decl, t); "%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 " warning_at (DECL_SOURCE_LOCATION (decl), 0, "type %qT with no linkage "
"used to declare variable %q#D with linkage", t, decl); "used to declare variable %q#D with linkage", t, decl);
else else

View File

@ -1065,7 +1065,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
dump_simple_decl (pp, t, TREE_TYPE (t), flags); dump_simple_decl (pp, t, TREE_TYPE (t), flags);
/* Handle variable template specializations. */ /* Handle variable template specializations. */
if (TREE_CODE (t) == VAR_DECL if (VAR_P (t)
&& DECL_LANG_SPECIFIC (t) && DECL_LANG_SPECIFIC (t)
&& DECL_TEMPLATE_INFO (t) && DECL_TEMPLATE_INFO (t)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t))) && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)))

View File

@ -3530,8 +3530,7 @@ decl_implicit_alias_p (tree decl)
if (DECL_P (decl) && DECL_ARTIFICIAL (decl) if (DECL_P (decl) && DECL_ARTIFICIAL (decl)
&& DECL_IGNORED_P (decl) && DECL_IGNORED_P (decl)
&& (TREE_CODE (decl) == FUNCTION_DECL && (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == VAR_DECL || (VAR_P (decl) && TREE_STATIC (decl))))
&& TREE_STATIC (decl))))
{ {
symtab_node *n = symtab_node::get (decl); symtab_node *n = symtab_node::get (decl);
if (n && n->cpp_implicit_alias) if (n && n->cpp_implicit_alias)

View File

@ -10571,7 +10571,7 @@ cp_convert_range_for (tree statement, tree range_decl, tree range_expr,
{ {
tree range_temp; tree range_temp;
if (TREE_CODE (range_expr) == VAR_DECL if (VAR_P (range_expr)
&& array_of_runtime_bound_p (TREE_TYPE (range_expr))) && array_of_runtime_bound_p (TREE_TYPE (range_expr)))
/* Can't bind a reference to an array of runtime bound. */ /* Can't bind a reference to an array of runtime bound. */
range_temp = range_expr; range_temp = range_expr;
@ -28091,7 +28091,7 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
c_parser_omp_var_list_parens should construct a list of c_parser_omp_var_list_parens should construct a list of
locations to go along with the var list. */ 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); error_at (loc, "%qD is not a variable", v);
else if (TREE_TYPE (v) == error_mark_node) else if (TREE_TYPE (v) == error_mark_node)
; ;

View File

@ -2455,7 +2455,7 @@ check_explicit_specialization (tree declarator,
switch (tsk) switch (tsk)
{ {
case tsk_none: case tsk_none:
if (processing_specialization && TREE_CODE (decl) != VAR_DECL) if (processing_specialization && !VAR_P (decl))
{ {
specialization = 1; specialization = 1;
SET_DECL_TEMPLATE_SPECIALIZATION (decl); SET_DECL_TEMPLATE_SPECIALIZATION (decl);
@ -2888,7 +2888,7 @@ check_explicit_specialization (tree declarator,
/* A specialization is not necessarily COMDAT. */ /* A specialization is not necessarily COMDAT. */
DECL_COMDAT (decl) = (TREE_PUBLIC (decl) DECL_COMDAT (decl) = (TREE_PUBLIC (decl)
&& DECL_DECLARED_INLINE_P (decl)); && DECL_DECLARED_INLINE_P (decl));
else if (TREE_CODE (decl) == VAR_DECL) else if (VAR_P (decl))
DECL_COMDAT (decl) = false; DECL_COMDAT (decl) = false;
/* Register this specialization so that we can find it /* Register this specialization so that we can find it
@ -4771,7 +4771,7 @@ push_template_decl_real (tree decl, bool is_friend)
is_partial = ((DECL_IMPLICIT_TYPEDEF_P (decl) is_partial = ((DECL_IMPLICIT_TYPEDEF_P (decl)
&& TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
&& CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl))) && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)))
|| (TREE_CODE (decl) == VAR_DECL || (VAR_P (decl)
&& DECL_LANG_SPECIFIC (decl) && DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_SPECIALIZATION (decl) && DECL_TEMPLATE_SPECIALIZATION (decl)
&& TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl)))); && TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
@ -10792,7 +10792,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
if (PRIMARY_TEMPLATE_P (t)) if (PRIMARY_TEMPLATE_P (t))
DECL_PRIMARY_TEMPLATE (r) = r; 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. */ /* Record this non-type partial instantiation. */
register_specialization (r, t, register_specialization (r, t,
DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)), DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)),

View File

@ -3161,7 +3161,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
= decl_function_context (containing_function); = 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)) && DECL_ANON_UNION_VAR_P (decl))
{ {
if (complain & tf_error) if (complain & tf_error)
@ -4281,7 +4281,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
return error_mark_node; return error_mark_node;
if (type_dependent_expression_p (t)) if (type_dependent_expression_p (t))
return NULL_TREE; 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) if (processing_template_decl)
return NULL_TREE; return NULL_TREE;
@ -4296,7 +4296,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
return error_mark_node; return error_mark_node;
} }
else if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_DEPEND 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), error_at (OMP_CLAUSE_LOCATION (c),
"%qD is threadprivate variable in %qs clause", t, "%qD is threadprivate variable in %qs clause", t,
@ -5662,7 +5662,7 @@ finish_omp_clauses (tree clauses)
case OMP_CLAUSE_ALIGNED: case OMP_CLAUSE_ALIGNED:
t = OMP_CLAUSE_DECL (c); 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) if (processing_template_decl)
break; break;
@ -5732,7 +5732,7 @@ finish_omp_clauses (tree clauses)
} }
if (t == error_mark_node) if (t == error_mark_node)
remove = true; 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) if (processing_template_decl)
break; break;
@ -5774,7 +5774,7 @@ finish_omp_clauses (tree clauses)
} }
if (t == error_mark_node) if (t == error_mark_node)
remove = true; 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) if (processing_template_decl)
break; break;
@ -5789,7 +5789,7 @@ finish_omp_clauses (tree clauses)
omp_clause_code_name[OMP_CLAUSE_CODE (c)]); omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
remove = true; 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, error ("%qD is threadprivate variable in %qs clause", t,
omp_clause_code_name[OMP_CLAUSE_CODE (c)]); omp_clause_code_name[OMP_CLAUSE_CODE (c)]);

View File

@ -3683,8 +3683,7 @@ handle_abi_tag_attribute (tree* node, tree name, tree args,
} }
else else
{ {
if (TREE_CODE (*node) != FUNCTION_DECL if (!VAR_OR_FUNCTION_DECL_P (*node))
&& TREE_CODE (*node) != VAR_DECL)
{ {
error ("%qE attribute applied to non-function, non-variable %qD", error ("%qE attribute applied to non-function, non-variable %qD",
name, *node); name, *node);

View File

@ -557,11 +557,11 @@ register_construction_vtables (tree base_class, tree record_type,
if (TREE_OPERAND (value, 0)) if (TREE_OPERAND (value, 0))
val_vtbl_decl = 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)) && TREE_OPERAND (val_vtbl_decl, 0))
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 /* Check to see if we already have this vtable pointer in
our valid set for this base class. */ our valid set for this base class. */
@ -876,7 +876,7 @@ output_set_info (tree record_type, vec<tree> vtbl_ptr_array)
if (TREE_CODE (arg0) == ADDR_EXPR) if (TREE_CODE (arg0) == ADDR_EXPR)
arg0 = TREE_OPERAND (arg0, 0); arg0 = TREE_OPERAND (arg0, 0);
if (TREE_CODE (arg0) == VAR_DECL) if (VAR_P (arg0))
vptr_name = IDENTIFIER_POINTER (DECL_NAME (arg0)); vptr_name = IDENTIFIER_POINTER (DECL_NAME (arg0));
if (TREE_CODE (arg1) == INTEGER_CST) if (TREE_CODE (arg1) == INTEGER_CST)