summaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-29 16:09:35 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-29 16:09:35 +0000
commit80a58eb0a89adf7bf6d4f2d1811ba8996c4fe2f4 (patch)
treeeffb9d381a62e67766863cbbe83fd7aac2b98280 /gcc/cp/name-lookup.c
parent51bad4971e69b642dfcc10d78c915eafc54fe689 (diff)
downloadgcc-80a58eb0a89adf7bf6d4f2d1811ba8996c4fe2f4.tar.gz
* tree.h (VAR_P): New.
cp/ * call.c (build_java_interface_fn_ref): Likewise. (make_temporary_var_for_ref_to_temp): Likewise. * class.c (check_field_decls): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. (fixed_type_or_null): Likewise. (get_vtbl_decl_for_binfo): Likewise. * cp-gimplify.c (omp_var_to_track): Likewise. (cp_genericize_r): Likewise. * cp-objcp-common.c (cxx_warn_unused_global_decl): Likewise. * cp-tree.h (LANG_DECL_HAS_MIN): Likewise. (DECL_DISCRIMINATOR_P): Likewise. * decl.c (poplevel): Likewise. (decls_match): Likewise. (duplicate_decls): Likewise. (decl_jump_unsafe): Likewise. (start_decl): Likewise. (check_for_uninitialized_const_var): Likewise. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (local_variable_p): Likewise. (maybe_register_incomplete_var): Likewise. * decl2.c (grokfield): Likewise. (comdat_linkage): Likewise. (determine_visibility): Likewise. (import_export_decl): Likewise. (prune_vars_needing_no_initialization): Likewise. (decl_maybe_constant_var_p): Likewise. * error.c (dump_simple_decl): Likewise. (dump_template_decl): Likewise. (cp_printer): Likewise. * except.c (build_throw): Likewise. * init.c (build_vtbl_address): Likewise. (member_init_ok_or_else): Likewise. (build_aggr_init): Likewise. (expand_aggr_init_1): Likewise. (build_offset_ref): Likewise. (constant_value_1): Likewise. * mangle.c (write_mangled_name): Likewise. (write_prefix): Likewise. * name-lookup.c (supplement_binding_1): Likewise. (add_decl_to_level): Likewise. (pushdecl_maybe_friend_1): Likewise. (check_for_out_of_scope_variable): Likewise. (validate_nonmember_using_decl): Likewise. (lookup_name_innermost_nonclass_level_1): Likewise. (lookup_arg_dependent_1): Likewise. * parser.c (cp_parser_lambda_introducer): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_single_declaration): Likewise. * pt.c (convert_nontype_argument): Likewise. (instantiate_class_template_1): Likewise. (tsubst_decl): Likewise. (tsubst_expr): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. (regenerate_decl_from_template): Likewise. (always_instantiate_p): Likewise. (instantiate_decl): Likewise. (type_dependent_expression_p): Likewise. (build_non_dependent_expr): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_dynamic_cast_1): Likewise. * search.c (shared_member_p): Likewise. * semantics.c (outer_var_p): Likewise. (finish_id_expression): Likewise. (finish_omp_clauses): Likewise. (finish_decltype_type): Likewise. (ensure_literal_type_for_constexpr_object): Likewise. * tree.c (lvalue_kind): Likewise. (bot_replace): Likewise. (cp_tree_equal): Likewise. (handle_init_priority_attribute): Likewise. (decl_storage_duration): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (decay_conversion): Likewise. (build_class_member_access_expr): Likewise. (cp_build_array_ref): Likewise. (cxx_mark_addressable): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_readonly_error): Likewise. (abstract_virtuals_error_sfinae): Likewise. (cxx_incomplete_type_diagnostic): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 88a516a4282..b25db14f1e1 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -509,8 +509,8 @@ supplement_binding_1 (cxx_binding *binding, tree decl)
A member shall not be declared twice in the
member-specification. */
- else if (TREE_CODE (target_decl) == VAR_DECL
- && TREE_CODE (target_bval) == VAR_DECL
+ else if (VAR_P (target_decl)
+ && VAR_P (target_bval)
&& DECL_EXTERNAL (target_decl) && DECL_EXTERNAL (target_bval)
&& !DECL_CLASS_SCOPE_P (target_decl))
{
@@ -574,7 +574,7 @@ add_decl_to_level (tree decl, cp_binding_level *b)
{
/* We used to record virtual tables as if they were ordinary
variables, but no longer do so. */
- gcc_assert (!(TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl)));
+ gcc_assert (!(VAR_P (decl) && DECL_VIRTUAL_P (decl)));
if (TREE_CODE (decl) == NAMESPACE_DECL
&& !DECL_NAMESPACE_ALIAS (decl))
@@ -594,7 +594,7 @@ add_decl_to_level (tree decl, cp_binding_level *b)
static later. It's OK for this list to contain a few false
positives. */
if (b->kind == sk_namespace)
- if ((TREE_CODE (decl) == VAR_DECL
+ if ((VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
|| (TREE_CODE (decl) == FUNCTION_DECL
&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
@@ -636,7 +636,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
/* A local declaration for an `extern' variable is in the
scope of the current namespace, not the current
function. */
- && !(TREE_CODE (x) == VAR_DECL && DECL_EXTERNAL (x))
+ && !(VAR_P (x) && DECL_EXTERNAL (x))
/* When parsing the parameter list of a function declarator,
don't set DECL_CONTEXT to an enclosing function. When we
push the PARM_DECLs in order to process the function body,
@@ -973,7 +973,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
&& t != NULL_TREE)
&& (TREE_CODE (x) == TYPE_DECL
- || TREE_CODE (x) == VAR_DECL
+ || VAR_P (x)
|| TREE_CODE (x) == NAMESPACE_DECL
|| TREE_CODE (x) == CONST_DECL
|| TREE_CODE (x) == TEMPLATE_DECL))
@@ -1021,7 +1021,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
tree d = oldlocal;
while (oldlocal
- && TREE_CODE (oldlocal) == VAR_DECL
+ && VAR_P (oldlocal)
&& DECL_DEAD_FOR_LOCAL (oldlocal))
oldlocal = DECL_SHADOWED_FOR_VAR (oldlocal);
@@ -1065,7 +1065,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
/* Inline decls shadow nothing. */
&& !DECL_FROM_INLINE (x)
&& (TREE_CODE (oldlocal) == PARM_DECL
- || TREE_CODE (oldlocal) == VAR_DECL
+ || VAR_P (oldlocal)
/* If the old decl is a type decl, only warn if the
old decl is an explicit typedef or if both the old
and new decls are type decls. */
@@ -1125,7 +1125,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
outermost block of the controlled statement.
Redeclaring a variable from a for or while condition is
detected elsewhere. */
- else if (TREE_CODE (oldlocal) == VAR_DECL
+ else if (VAR_P (oldlocal)
&& oldscope == current_binding_level->level_chain
&& (oldscope->kind == sk_cond
|| oldscope->kind == sk_for))
@@ -1179,7 +1179,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
x);
}
else if (oldglobal != NULL_TREE
- && (TREE_CODE (oldglobal) == VAR_DECL
+ && (VAR_P (oldglobal)
/* If the old decl is a type decl, only warn if the
old decl is an explicit typedef or if both the
old and new decls are type decls. */
@@ -1196,7 +1196,7 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
}
}
- if (TREE_CODE (x) == VAR_DECL)
+ if (VAR_P (x))
maybe_register_incomplete_var (x);
}
@@ -1309,12 +1309,12 @@ check_for_out_of_scope_variable (tree decl)
tree shadowed;
/* We only care about out of scope variables. */
- if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl)))
+ if (!(VAR_P (decl) && DECL_DEAD_FOR_LOCAL (decl)))
return decl;
shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl)
? DECL_SHADOWED_FOR_VAR (decl) : NULL_TREE ;
- while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
+ while (shadowed != NULL_TREE && VAR_P (shadowed)
&& DECL_DEAD_FOR_LOCAL (shadowed))
shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE;
@@ -2435,7 +2435,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
if (using_decl == NULL_TREE
&& at_function_scope_p ()
- && TREE_CODE (decl) == VAR_DECL)
+ && VAR_P (decl))
/* C++11 7.3.3/10. */
error ("%qD is already declared in this scope", name);
@@ -3061,7 +3061,7 @@ push_class_level_binding_1 (tree name, tree x)
(Non-static data members were also forbidden to have the same
name as T until TC1.) */
- if ((TREE_CODE (x) == VAR_DECL
+ if ((VAR_P (x)
|| TREE_CODE (x) == CONST_DECL
|| (TREE_CODE (x) == TYPE_DECL
&& !DECL_SELF_REFERENCE_P (x))
@@ -4955,7 +4955,7 @@ lookup_name_innermost_nonclass_level_1 (tree name)
while (1)
{
if (binding->scope == b
- && !(TREE_CODE (binding->value) == VAR_DECL
+ && !(VAR_P (binding->value)
&& DECL_DEAD_FOR_LOCAL (binding->value)))
return binding->value;
@@ -4994,7 +4994,7 @@ is_local_extern (tree decl)
if (TREE_CODE (decl) == FUNCTION_DECL)
return DECL_LOCAL_FUNCTION_P (decl);
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
return false;
if (!current_function_decl)
return false;
@@ -5554,7 +5554,7 @@ lookup_arg_dependent_1 (tree name, tree fns, vec<tree, va_gc> *args,
fns = k.functions;
if (fns
- && TREE_CODE (fns) != VAR_DECL
+ && !VAR_P (fns)
&& !is_overloaded_fn (fns))
{
error ("argument dependent lookup finds %q+D", fns);