summaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-31 11:15:46 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-31 11:15:46 +0000
commit398c50e2a1bf021d3eb527cb6eaa5731b7a0b969 (patch)
tree5ad67559d56d4a15cb8a9a36539b90eadff292d1 /gcc/cp/search.c
parent4332ce67df2baabecb5b5dddca89f167e1388d5a (diff)
downloadgcc-398c50e2a1bf021d3eb527cb6eaa5731b7a0b969.tar.gz
2013-03-31 Paolo Carlini <paolo.carlini@oracle.com>
* decl2.c (collect_candidates_for_java_method_aliases): Use DECL_CLASS_SCOPE_P. * name-lookup.c (pushtag_1) Use TYPE_FUNCTION_SCOPE_P. (pushdecl_maybe_friend_1): Use DECL_DECLARES_FUNCTION_P. * decl.c (duplicate_decls): Likewise. * parser.c (cp_parser_template_declaration_after_export): Likewise, also DECL_DECLARES_TYPE_P. * pt.c (instantiate_class_template_1): Likewise. * search.c (lookup_field_1): Use DECL_DECLARES_TYPE_P. (lookup_field_r): Likewise. (friend_accessible_p): Use DECL_DECLARES_FUNCTION_P. (lookup_fnfields_slot_nolazy): Likewise. * semantics.c (finish_member_declaration): Likewise. * typeck.c (convert_for_initialization): Use TYPE_REFFN_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197283 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 19a4c43ff0d..b64398fac6d 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -424,8 +424,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
do
field = fields[i--];
while (i >= lo && DECL_NAME (fields[i]) == name);
- if (TREE_CODE (field) != TYPE_DECL
- && !DECL_TYPE_TEMPLATE_P (field))
+ if (!DECL_DECLARES_TYPE_P (field))
field = NULL_TREE;
}
else
@@ -478,9 +477,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
}
if (DECL_NAME (decl) == name
- && (!want_type
- || TREE_CODE (decl) == TYPE_DECL
- || DECL_TYPE_TEMPLATE_P (decl)))
+ && (!want_type || DECL_DECLARES_TYPE_P (decl)))
return decl;
}
/* Not found. */
@@ -777,8 +774,7 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
if (!scope)
return 0;
- if (TREE_CODE (scope) == FUNCTION_DECL
- || DECL_FUNCTION_TEMPLATE_P (scope))
+ if (DECL_DECLARES_FUNCTION_P (scope))
befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
else if (TYPE_P (scope))
befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope);
@@ -796,8 +792,7 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
if (protected_accessible_p (decl, t, binfo))
return 1;
- if (TREE_CODE (scope) == FUNCTION_DECL
- || DECL_FUNCTION_TEMPLATE_P (scope))
+ if (DECL_DECLARES_FUNCTION_P (scope))
{
/* Perhaps this SCOPE is a member of a class which is a
friend. */
@@ -1059,8 +1054,7 @@ lookup_field_r (tree binfo, void *data)
/* If we're looking up a type (as with an elaborated type specifier)
we ignore all non-types we find. */
- if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL
- && !DECL_TYPE_TEMPLATE_P (nval))
+ if (lfi->want_type && !DECL_DECLARES_TYPE_P (nval))
{
if (lfi->name == TYPE_IDENTIFIER (type))
{
@@ -1509,8 +1503,7 @@ lookup_fnfields_slot_nolazy (tree type, tree name)
int
class_method_index_for_fn (tree class_type, tree function)
{
- gcc_assert (TREE_CODE (function) == FUNCTION_DECL
- || DECL_FUNCTION_TEMPLATE_P (function));
+ gcc_assert (DECL_DECLARES_FUNCTION_P (function));
return lookup_fnfields_1 (class_type,
DECL_CONSTRUCTOR_P (function) ? ctor_identifier :