cp-tree.h (identifier_p): New.

* cp-tree.h (identifier_p): New.
	* call.c: Throughout, call identifier_p insstead of direct
	comparaison of TREE_CODE against IDENTIFIER_NODE.
	* decl.c: Likewisse.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* mangle.c: Likewise.
	* name-lookup.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* tree.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

From-SVN: r196897
This commit is contained in:
Gabriel Dos Reis 2013-03-22 03:55:51 +00:00 committed by Gabriel Dos Reis
parent 35054b15e4
commit 9dc6f476ce
15 changed files with 101 additions and 85 deletions

View File

@ -1,3 +1,21 @@
2013-03-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (identifier_p): New.
* call.c: Throughout, call identifier_p insstead of direct
comparaison of TREE_CODE against IDENTIFIER_NODE.
* decl.c: Likewisse.
* decl2.c: Likewise.
* init.c: Likewise.
* mangle.c: Likewise.
* name-lookup.c: Likewise.
* parser.c: Likewise.
* pt.c: Likewise.
* search.c: Likewise.
* semantics.c: Likewise.
* tree.c: Likewise.
* typeck.c: Likewise.
* typeck2.c: Likewise.
2013-03-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/48087

View File

@ -233,7 +233,7 @@ check_dtor_name (tree basetype, tree name)
name = TREE_TYPE (name);
else if (TYPE_P (name))
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
else if (identifier_p (name))
{
if ((MAYBE_CLASS_TYPE_P (basetype)
&& name == constructor_name (basetype))
@ -3147,7 +3147,7 @@ print_z_candidate (location_t loc, const char *msgstr,
: ACONCAT ((msgstr, " ", NULL)));
location_t cloc = location_of (candidate->fn);
if (TREE_CODE (candidate->fn) == IDENTIFIER_NODE)
if (identifier_p (candidate->fn))
{
cloc = loc;
if (candidate->num_convs == 3)
@ -8563,8 +8563,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
- do not have the same parameter type list as any non-template
non-member candidate. */
if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE
|| TREE_CODE (cand2->fn) == IDENTIFIER_NODE)
if (identifier_p (cand1->fn) || identifier_p (cand2->fn))
{
for (i = 0; i < len; ++i)
if (!same_type_p (cand1->convs[i]->type,
@ -8575,7 +8574,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn,
if (cand1->fn == cand2->fn)
/* Two built-in candidates; arbitrarily pick one. */
return 1;
else if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE)
else if (identifier_p (cand1->fn))
/* cand1 is built-in; prefer cand2. */
return -1;
else

View File

@ -241,6 +241,16 @@ struct GTY(()) lang_identifier {
tree label_value;
};
/* Return a typed pointer version of T if it designates a
C++ front-end identifier. */
inline lang_identifier*
identifier_p (tree t)
{
if (TREE_CODE (t) == IDENTIFIER_NODE)
return (lang_identifier*) t;
return NULL;
}
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
and C_RID_YYCODE is the token number wanted by Yacc. */

View File

@ -3296,7 +3296,7 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
error ("%qD used without template parameters", name);
return error_mark_node;
}
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
gcc_assert (TYPE_P (context));
if (!MAYBE_CLASS_TYPE_P (context))
@ -3402,7 +3402,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
name = TYPE_IDENTIFIER (name);
else if (DECL_P (name))
name = DECL_NAME (name);
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
if (!dependent_type_p (context)
|| currently_open_class (context))
@ -4781,7 +4781,7 @@ check_array_designated_initializer (const constructor_elt *ce,
}
else
{
gcc_assert (TREE_CODE (ce->index) == IDENTIFIER_NODE);
gcc_assert (identifier_p (ce->index));
error ("name %qD used in a GNU-style designated "
"initializer for an array", ce->index);
}
@ -7413,8 +7413,7 @@ grokfndecl (tree ctype,
== current_class_type);
fns = TREE_OPERAND (fns, 1);
}
gcc_assert (TREE_CODE (fns) == IDENTIFIER_NODE
|| TREE_CODE (fns) == OVERLOAD);
gcc_assert (identifier_p (fns) || TREE_CODE (fns) == OVERLOAD);
DECL_TEMPLATE_INFO (decl) = build_template_info (fns, args);
for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t))
@ -7772,7 +7771,7 @@ grokvardecl (tree type,
tree decl;
tree explicit_scope;
gcc_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (!name || identifier_p (name));
/* Compute the scope in which to place the variable, but remember
whether or not that scope was explicitly specified by the user. */
@ -8509,7 +8508,7 @@ check_var_type (tree identifier, tree type)
{
if (!identifier)
error ("unnamed variable or field declared void");
else if (TREE_CODE (identifier) == IDENTIFIER_NODE)
else if (identifier_p (identifier))
{
gcc_assert (!IDENTIFIER_OPNAME_P (identifier));
error ("variable or field %qE declared void", identifier);
@ -8778,7 +8777,7 @@ grokdeclarator (const cp_declarator *declarator,
tree fns = TREE_OPERAND (decl, 0);
dname = fns;
if (TREE_CODE (dname) != IDENTIFIER_NODE)
if (!identifier_p (dname))
{
gcc_assert (is_overloaded_fn (dname));
dname = DECL_NAME (get_first_fn (dname));
@ -8787,7 +8786,7 @@ grokdeclarator (const cp_declarator *declarator,
/* Fall through. */
case IDENTIFIER_NODE:
if (TREE_CODE (decl) == IDENTIFIER_NODE)
if (identifier_p (decl))
dname = decl;
if (C_IS_RESERVED_WORD (dname))
@ -8852,7 +8851,7 @@ grokdeclarator (const cp_declarator *declarator,
}
if (dname
&& TREE_CODE (dname) == IDENTIFIER_NODE
&& identifier_p (dname)
&& UDLIT_OPER_P (dname)
&& innermost_code != cdk_function)
{
@ -8977,7 +8976,7 @@ grokdeclarator (const cp_declarator *declarator,
common. With no options, it is allowed. With -Wreturn-type,
it is a warning. It is only an error with -pedantic-errors. */
is_main = (funcdef_flag
&& dname && TREE_CODE (dname) == IDENTIFIER_NODE
&& dname && identifier_p (dname)
&& MAIN_NAME_P (dname)
&& ctype == NULL_TREE
&& in_namespace == NULL_TREE
@ -11896,7 +11895,7 @@ xref_tag_1 (enum tag_types tag_code, tree name,
tree context = NULL_TREE;
tag_scope scope;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
switch (tag_code)
{
@ -12323,7 +12322,7 @@ start_enum (tree name, tree enumtype, tree underlying_type,
bool scoped_enum_p, bool *is_new)
{
tree prevtype = NULL_TREE;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
if (is_new)
*is_new = false;

View File

@ -1121,7 +1121,7 @@ is_late_template_attribute (tree attr, tree decl)
second and following arguments. Attributes like mode, format,
cleanup and several target specific attributes aren't late
just because they have an IDENTIFIER_NODE as first argument. */
if (arg == args && TREE_CODE (t) == IDENTIFIER_NODE)
if (arg == args && identifier_p (t))
continue;
if (value_dependent_expression_p (t)

View File

@ -1416,7 +1416,7 @@ expand_member_init (tree name)
}
else
{
if (TREE_CODE (name) == IDENTIFIER_NODE)
if (identifier_p (name))
field = lookup_field (current_class_type, name, 1, false);
else
field = name;

View File

@ -1189,7 +1189,7 @@ write_unqualified_name (const tree decl)
{
MANGLE_TRACE_TREE ("unqualified-name", decl);
if (TREE_CODE (decl) == IDENTIFIER_NODE)
if (identifier_p (decl))
{
write_unqualified_id (decl);
return;
@ -2519,7 +2519,7 @@ write_template_args (tree args)
static void
write_member_name (tree member)
{
if (TREE_CODE (member) == IDENTIFIER_NODE)
if (identifier_p (member))
write_unqualified_id (member);
else if (DECL_P (member))
write_unqualified_name (member);
@ -2697,7 +2697,7 @@ write_expression (tree expr)
{
write_expression (TREE_OPERAND (expr, 0));
}
else if (TREE_CODE (expr) == IDENTIFIER_NODE)
else if (identifier_p (expr))
{
/* An operator name appearing as a dependent name needs to be
specially marked to disambiguate between a use of the operator

View File

@ -1959,7 +1959,7 @@ constructor_name_p (tree name, tree type)
if (!name)
return false;
if (TREE_CODE (name) != IDENTIFIER_NODE)
if (!identifier_p (name))
return false;
/* These don't have names. */
@ -2073,7 +2073,7 @@ lookup_extern_c_fun_in_all_ns (tree function)
gcc_assert (function && TREE_CODE (function) == FUNCTION_DECL);
name = DECL_NAME (function);
gcc_assert (name && TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (name && identifier_p (name));
for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name);
iter;
@ -2136,7 +2136,7 @@ push_using_decl_1 (tree scope, tree name)
tree decl;
gcc_assert (TREE_CODE (scope) == NAMESPACE_DECL);
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
for (decl = current_binding_level->usings; decl; decl = DECL_CHAIN (decl))
if (USING_DECL_SCOPE (decl) == scope && DECL_NAME (decl) == name)
break;
@ -5724,7 +5724,7 @@ pushtag_1 (tree name, tree type, tag_scope scope)
|| COMPLETE_TYPE_P (b->this_entity))))
b = b->level_chain;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
/* Do C++ gratuitous typedefing. */
if (identifier_type_value_1 (name) != type)

View File

@ -1110,7 +1110,7 @@ cp_lexer_print_token (FILE * stream, cp_token *token)
case CPP_KEYWORD:
/* Some keywords have a value that is not an IDENTIFIER_NODE.
For example, `struct' is mapped to an INTEGER_CST. */
if (TREE_CODE (token->u.value) != IDENTIFIER_NODE)
if (!identifier_p (token->u.value))
break;
/* else fall through */
case CPP_NAME:
@ -1259,7 +1259,7 @@ make_id_declarator (tree qualifying_scope, tree unqualified_name,
if (qualifying_scope && TYPE_P (qualifying_scope))
qualifying_scope = TYPE_MAIN_VARIANT (qualifying_scope);
gcc_assert (TREE_CODE (unqualified_name) == IDENTIFIER_NODE
gcc_assert (identifier_p (unqualified_name)
|| TREE_CODE (unqualified_name) == BIT_NOT_EXPR
|| TREE_CODE (unqualified_name) == TEMPLATE_ID_EXPR);
@ -2587,7 +2587,7 @@ cp_parser_check_for_invalid_template_id (cp_parser* parser,
{
if (TYPE_P (type))
error_at (location, "%qT is not a template", type);
else if (TREE_CODE (type) == IDENTIFIER_NODE)
else if (identifier_p (type))
{
if (tag_type != none_type)
error_at (location, "%qE is not a class template", type);
@ -3193,7 +3193,7 @@ cp_parser_make_typename_type (cp_parser *parser, tree scope,
tree id, location_t id_location)
{
tree result;
if (TREE_CODE (id) == IDENTIFIER_NODE)
if (identifier_p (id))
{
result = make_typename_type (scope, id, typename_type,
/*complain=*/tf_none);
@ -5654,7 +5654,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
while (true)
{
if (idk == CP_ID_KIND_UNQUALIFIED
&& TREE_CODE (postfix_expression) == IDENTIFIER_NODE
&& identifier_p (postfix_expression)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN))
/* It is not a Koenig lookup function call. */
postfix_expression
@ -5741,7 +5741,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
if (idk == CP_ID_KIND_UNQUALIFIED
|| idk == CP_ID_KIND_TEMPLATE_ID)
{
if (TREE_CODE (postfix_expression) == IDENTIFIER_NODE)
if (identifier_p (postfix_expression))
{
if (!args->is_empty ())
{
@ -11310,7 +11310,7 @@ cp_parser_decltype (cp_parser *parser)
cp_id_kind idk;
const char *error_msg;
if (TREE_CODE (expr) == IDENTIFIER_NODE)
if (identifier_p (expr))
/* Lookup the name we got back from the id-expression. */
expr = cp_parser_lookup_name (parser, expr,
none_type,
@ -12759,7 +12759,7 @@ cp_parser_template_id (cp_parser *parser,
}
/* Build a representation of the specialization. */
if (TREE_CODE (templ) == IDENTIFIER_NODE)
if (identifier_p (templ))
template_id = build_min_nt_loc (next_token->location,
TEMPLATE_ID_EXPR,
templ, arguments);
@ -13980,7 +13980,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
&& !global_p
&& !qualified_p
&& TREE_CODE (type) == TYPE_DECL
&& TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
&& identifier_p (DECL_NAME (type)))
maybe_note_name_used_in_class (DECL_NAME (type), type);
/* If it didn't work out, we don't have a TYPE. */
if ((flags & CP_PARSER_FLAGS_OPTIONAL)
@ -15279,7 +15279,7 @@ cp_parser_using_declaration (cp_parser* parser,
depending on what scope we are in. */
if (qscope == error_mark_node || identifier == error_mark_node)
;
else if (TREE_CODE (identifier) != IDENTIFIER_NODE
else if (!identifier_p (identifier)
&& TREE_CODE (identifier) != BIT_NOT_EXPR)
/* [namespace.udecl]
@ -16562,8 +16562,7 @@ cp_parser_direct_declarator (cp_parser* parser,
unqualified_name = error_mark_node;
else if (unqualified_name
&& (qualifying_scope
|| (TREE_CODE (unqualified_name)
!= IDENTIFIER_NODE)))
|| (!identifier_p (unqualified_name))))
{
cp_parser_error (parser, "expected unqualified-id");
unqualified_name = error_mark_node;
@ -18226,7 +18225,7 @@ cp_parser_class_name (cp_parser *parser,
/* Check to see that it is really the name of a class. */
if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
&& TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE
&& identifier_p (TREE_OPERAND (decl, 0))
&& cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))
/* Situations like this:
@ -21120,7 +21119,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
/* By this point, the NAME should be an ordinary identifier. If
the id-expression was a qualified name, the qualifying scope is
stored in PARSER->SCOPE at this point. */
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
/* Perform the lookup. */
if (parser->scope)
@ -24290,7 +24289,7 @@ cp_parser_objc_protocol_qualifiers (cp_parser* parser)
node = token->u.value;
while (node && TREE_CODE (node) == IDENTIFIER_NODE
while (node && identifier_p (node)
&& (node == ridpointers [(int) RID_IN]
|| node == ridpointers [(int) RID_OUT]
|| node == ridpointers [(int) RID_INOUT]

View File

@ -2467,7 +2467,7 @@ check_explicit_specialization (tree declarator,
{
tree fns;
gcc_assert (TREE_CODE (declarator) == IDENTIFIER_NODE);
gcc_assert (identifier_p (declarator));
if (ctype)
fns = dname;
else
@ -2528,8 +2528,7 @@ check_explicit_specialization (tree declarator,
return decl;
}
else if (ctype != NULL_TREE
&& (TREE_CODE (TREE_OPERAND (declarator, 0)) ==
IDENTIFIER_NODE))
&& (identifier_p (TREE_OPERAND (declarator, 0))))
{
/* Find the list of functions in ctype that have the same
name as the declared function. */
@ -6955,7 +6954,7 @@ lookup_template_function (tree fns, tree arglist)
gcc_assert (!arglist || TREE_CODE (arglist) == TREE_VEC);
if (!is_overloaded_fn (fns) && TREE_CODE (fns) != IDENTIFIER_NODE)
if (!is_overloaded_fn (fns) && !identifier_p (fns))
{
error ("%q#D is not a function template", fns);
return error_mark_node;
@ -7058,7 +7057,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
spec_entry elt;
hashval_t hash;
if (TREE_CODE (d1) == IDENTIFIER_NODE)
if (identifier_p (d1))
{
tree value = innermost_non_namespace_value (d1);
if (value && DECL_TEMPLATE_TEMPLATE_PARM_P (value))
@ -7853,7 +7852,7 @@ uses_template_parms (tree t)
|| TREE_CODE (t) == TEMPLATE_PARM_INDEX
|| TREE_CODE (t) == OVERLOAD
|| BASELINK_P (t)
|| TREE_CODE (t) == IDENTIFIER_NODE
|| identifier_p (t)
|| TREE_CODE (t) == TRAIT_EXPR
|| TREE_CODE (t) == CONSTRUCTOR
|| CONSTANT_CLASS_P (t))
@ -8482,8 +8481,7 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
if (TREE_VALUE (t)
&& TREE_CODE (TREE_VALUE (t)) == TREE_LIST
&& TREE_VALUE (TREE_VALUE (t))
&& (TREE_CODE (TREE_VALUE (TREE_VALUE (t)))
== IDENTIFIER_NODE))
&& (identifier_p (TREE_VALUE (TREE_VALUE (t)))))
{
tree chain
= tsubst_expr (TREE_CHAIN (TREE_VALUE (t)), args, complain,
@ -13480,7 +13478,7 @@ tsubst_copy_and_build (tree t,
input_location);
if (error_msg)
error (error_msg);
if (!function_p && TREE_CODE (decl) == IDENTIFIER_NODE)
if (!function_p && identifier_p (decl))
{
if (complain & tf_error)
unqualified_name_lookup_error (decl);
@ -13907,7 +13905,7 @@ tsubst_copy_and_build (tree t,
/*done=*/false,
/*address_p=*/false);
}
else if (koenig_p && TREE_CODE (function) == IDENTIFIER_NODE)
else if (koenig_p && identifier_p (function))
{
/* Do nothing; calling tsubst_copy_and_build on an identifier
would incorrectly perform unqualified lookup again.
@ -13991,7 +13989,7 @@ tsubst_copy_and_build (tree t,
not appropriate, even if an unqualified-name was used
to denote the function. */
&& !DECL_FUNCTION_MEMBER_P (get_first_fn (function)))
|| TREE_CODE (function) == IDENTIFIER_NODE)
|| identifier_p (function))
/* Only do this when substitution turns a dependent call
into a non-dependent call. */
&& type_dependent_expression_p_push (t)
@ -13999,7 +13997,7 @@ tsubst_copy_and_build (tree t,
function = perform_koenig_lookup (function, call_args, false,
tf_none);
if (TREE_CODE (function) == IDENTIFIER_NODE
if (identifier_p (function)
&& !any_type_dependent_arguments_p (call_args))
{
if (koenig_p && (complain & tf_warning_or_error))
@ -14049,7 +14047,7 @@ tsubst_copy_and_build (tree t,
function = unq;
}
}
if (TREE_CODE (function) == IDENTIFIER_NODE)
if (identifier_p (function))
{
if (complain & tf_error)
unqualified_name_lookup_error (function);
@ -19781,8 +19779,7 @@ type_dependent_expression_p (tree expression)
return false;
/* An unresolved name is always dependent. */
if (TREE_CODE (expression) == IDENTIFIER_NODE
|| TREE_CODE (expression) == USING_DECL)
if (identifier_p (expression) || TREE_CODE (expression) == USING_DECL)
return true;
/* Some expression forms are never type-dependent. */
@ -19887,7 +19884,7 @@ type_dependent_expression_p (tree expression)
if (type_dependent_expression_p (TREE_OPERAND (expression, 0)))
return true;
expression = TREE_OPERAND (expression, 1);
if (TREE_CODE (expression) == IDENTIFIER_NODE)
if (identifier_p (expression))
return false;
}
/* SCOPE_REF with non-null TREE_TYPE is always non-dependent. */
@ -19978,7 +19975,7 @@ instantiation_dependent_r (tree *tp, int *walk_subtrees,
return NULL_TREE;
case COMPONENT_REF:
if (TREE_CODE (TREE_OPERAND (*tp, 1)) == IDENTIFIER_NODE)
if (identifier_p (TREE_OPERAND (*tp, 1)))
/* In a template, finish_class_member_access_expr creates a
COMPONENT_REF with an IDENTIFIER_NODE for op1 even if it isn't
type-dependent, so that we can check access control at
@ -20222,8 +20219,7 @@ dependent_template_p (tree tmpl)
|| TREE_CODE (tmpl) == TEMPLATE_TEMPLATE_PARM)
return true;
/* So are names that have not been looked up. */
if (TREE_CODE (tmpl) == SCOPE_REF
|| TREE_CODE (tmpl) == IDENTIFIER_NODE)
if (TREE_CODE (tmpl) == SCOPE_REF || identifier_p (tmpl))
return true;
/* So are member templates of dependent classes. */
if (TYPE_P (CP_DECL_CONTEXT (tmpl)))
@ -20380,7 +20376,7 @@ resolve_typename_type (tree type, bool only_current_p)
find a TEMPLATE_DECL. Otherwise, we want to find a TYPE_DECL. */
if (!decl)
/*nop*/;
else if (TREE_CODE (TYPENAME_TYPE_FULLNAME (type)) == IDENTIFIER_NODE
else if (identifier_p (TYPENAME_TYPE_FULLNAME (type))
&& TREE_CODE (decl) == TYPE_DECL)
{
result = TREE_TYPE (decl);

View File

@ -381,7 +381,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
{
tree field;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
@ -1190,7 +1190,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type,
|| xbasetype == error_mark_node)
return NULL_TREE;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
gcc_assert (identifier_p (name));
if (TREE_CODE (xbasetype) == TREE_BINFO)
{

View File

@ -536,7 +536,7 @@ simplify_loop_decl_cond (tree *cond_p, tree body)
tree
finish_goto_stmt (tree destination)
{
if (TREE_CODE (destination) == IDENTIFIER_NODE)
if (identifier_p (destination))
destination = lookup_label (destination);
/* We warn about unused labels with -Wunused. That means we have to
@ -1999,7 +1999,7 @@ perform_koenig_lookup (tree fn, vec<tree, va_gc> *args, bool include_std,
}
/* Find the name of the overloaded function. */
if (TREE_CODE (fn) == IDENTIFIER_NODE)
if (identifier_p (fn))
identifier = fn;
else if (is_overloaded_fn (fn))
{
@ -2966,7 +2966,7 @@ finish_id_expression (tree id_expression,
if (scope
&& (!TYPE_P (scope)
|| (!dependent_type_p (scope)
&& !(TREE_CODE (id_expression) == IDENTIFIER_NODE
&& !(identifier_p (id_expression)
&& IDENTIFIER_TYPENAME_P (id_expression)
&& dependent_type_p (TREE_TYPE (id_expression))))))
{
@ -2995,8 +2995,7 @@ finish_id_expression (tree id_expression,
the current class so that we can check later to see if
the meaning would have been different after the class
was entirely defined. */
if (!scope && decl != error_mark_node
&& TREE_CODE (id_expression) == IDENTIFIER_NODE)
if (!scope && decl != error_mark_node && identifier_p (id_expression))
maybe_note_name_used_in_class (id_expression, decl);
/* Disallow uses of local variables from containing functions, except
@ -3169,8 +3168,7 @@ finish_id_expression (tree id_expression,
/* A template-id where the name of the template was not resolved
is definitely dependent. */
else if (TREE_CODE (decl) == TEMPLATE_ID_EXPR
&& (TREE_CODE (TREE_OPERAND (decl, 0))
== IDENTIFIER_NODE))
&& (identifier_p (TREE_OPERAND (decl, 0))))
dependent_p = true;
/* For anything except an overloaded function, just check its
type. */
@ -5301,7 +5299,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
[expr.ref]), decltype(e) is defined as the type of the entity
named by e. If there is no such entity, or e names a set of
overloaded functions, the program is ill-formed. */
if (TREE_CODE (expr) == IDENTIFIER_NODE)
if (identifier_p (expr))
expr = lookup_name (expr);
if (TREE_CODE (expr) == INDIRECT_REF)

View File

@ -1734,7 +1734,7 @@ is_overloaded_fn (tree x)
tree
dependent_name (tree x)
{
if (TREE_CODE (x) == IDENTIFIER_NODE)
if (identifier_p (x))
return x;
if (TREE_CODE (x) != COMPONENT_REF
&& TREE_CODE (x) != OFFSET_REF

View File

@ -2467,7 +2467,7 @@ lookup_destructor (tree object, tree scope, tree dtor_name)
scope, dtor_type);
return error_mark_node;
}
if (TREE_CODE (dtor_type) == IDENTIFIER_NODE)
if (identifier_p (dtor_type))
{
/* In a template, names we can't find a match for are still accepted
destructor names, and we check them here. */
@ -2588,7 +2588,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
dependent_type_p (object_type)
/* If NAME is just an IDENTIFIER_NODE, then the expression
is dependent. */
|| TREE_CODE (object) == IDENTIFIER_NODE
|| identifier_p (object)
/* If NAME is "f<args>", where either 'f' or 'args' is
dependent, then the expression is dependent. */
|| (TREE_CODE (name) == TEMPLATE_ID_EXPR
@ -2604,7 +2604,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
object = build_non_dependent_expr (object);
}
else if (c_dialect_objc ()
&& TREE_CODE (name) == IDENTIFIER_NODE
&& identifier_p (name)
&& (expr = objc_maybe_build_component_ref (object, name)))
return expr;
@ -2671,8 +2671,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
}
gcc_assert (CLASS_TYPE_P (scope));
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE
|| TREE_CODE (name) == BIT_NOT_EXPR);
gcc_assert (identifier_p (name) || TREE_CODE (name) == BIT_NOT_EXPR);
if (constructor_name_p (name, scope))
{
@ -5067,8 +5066,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
arg = mark_lvalue_use (arg);
argtype = lvalue_type (arg);
gcc_assert (TREE_CODE (arg) != IDENTIFIER_NODE
|| !IDENTIFIER_OPNAME_P (arg));
gcc_assert (!identifier_p (arg) || !IDENTIFIER_OPNAME_P (arg));
if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
&& !really_overloaded_fn (TREE_OPERAND (arg, 1)))

View File

@ -278,8 +278,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
void **slot;
struct pending_abstract_type *pat;
gcc_assert (!decl || DECL_P (decl)
|| TREE_CODE (decl) == IDENTIFIER_NODE);
gcc_assert (!decl || DECL_P (decl) || identifier_p (decl));
if (!abstract_pending_vars)
abstract_pending_vars = htab_create_ggc (31, &pat_calc_hash,
@ -336,7 +335,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, abstract_class_use use,
error ("invalid abstract return type for member function %q+#D", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
error ("invalid abstract return type for function %q+#D", decl);
else if (TREE_CODE (decl) == IDENTIFIER_NODE)
else if (identifier_p (decl))
/* Here we do not have location information. */
error ("invalid abstract type %qT for %qE", type, decl);
else
@ -1241,7 +1240,7 @@ process_init_constructor_record (tree type, tree init,
latter case can happen in templates where lookup has to be
deferred. */
gcc_assert (TREE_CODE (ce->index) == FIELD_DECL
|| TREE_CODE (ce->index) == IDENTIFIER_NODE);
|| identifier_p (ce->index));
if (ce->index != field
&& ce->index != DECL_NAME (field))
{
@ -1367,7 +1366,7 @@ process_init_constructor_union (tree type, tree init,
{
if (TREE_CODE (ce->index) == FIELD_DECL)
;
else if (TREE_CODE (ce->index) == IDENTIFIER_NODE)
else if (identifier_p (ce->index))
{
/* This can happen within a cast, see g++.dg/opt/cse2.C. */
tree name = ce->index;