summaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-26 18:39:06 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-26 18:39:06 +0000
commit21543d4cd558cada630271a0cf3075ad7ce94cbf (patch)
tree08bdb3f3e0a9d0f71e72bb56d9ddb7b916e7dfeb /gcc/cp/search.c
parented0bc1ffb674fe93d0df68654b5bb76869f0bc8c (diff)
downloadgcc-21543d4cd558cada630271a0cf3075ad7ce94cbf.tar.gz
2013-06-26 Basile Starynkevitch <basile@starynkevitch.net>
{{merged with trunk [4.9] svn rev. 196654-200426}} MELT branch merged with trunk rev. 200426 using svnmerge.py [gcc/] 2013-06-26 Basile Starynkevitch <basile@starynkevitch.net> {{merge with trunk [4.9] svn rev. 196654-200426}} * melt-runtime.c (melt_val2passflag): TODO_ggc_collect & TODO_do_not_ggc_collect are conditionalized. * melt/generated/warmelt-first+03.cc: Manually remove calls to MELT_TRACE_EXIT_LOCATION macro. * melt/generated/warmelt-base+03.cc: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@200430 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 4cc02ba7dfc..b113477d088 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -188,6 +188,14 @@ lookup_base (tree t, tree base, base_access access,
tree t_binfo;
base_kind bk;
+ /* "Nothing" is definitely not derived from Base. */
+ if (t == NULL_TREE)
+ {
+ if (kind_ptr)
+ *kind_ptr = bk_not_base;
+ return NULL_TREE;
+ }
+
if (t == error_mark_node || base == error_mark_node)
{
if (kind_ptr)
@@ -373,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
@@ -416,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
@@ -470,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. */
@@ -769,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);
@@ -788,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. */
@@ -975,7 +978,7 @@ struct lookup_field_info {
int
shared_member_p (tree t)
{
- if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == TYPE_DECL \
+ if (VAR_P (t) || TREE_CODE (t) == TYPE_DECL \
|| TREE_CODE (t) == CONST_DECL)
return 1;
if (is_overloaded_fn (t))
@@ -1051,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))
{
@@ -1182,7 +1184,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)
{
@@ -1501,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 :
@@ -1841,8 +1842,8 @@ check_final_overrider (tree overrider, tree basefn)
{
tree over_type = TREE_TYPE (overrider);
tree base_type = TREE_TYPE (basefn);
- tree over_return = TREE_TYPE (over_type);
- tree base_return = TREE_TYPE (base_type);
+ tree over_return = fndecl_declared_return_type (overrider);
+ tree base_return = fndecl_declared_return_type (basefn);
tree over_throw, base_throw;
int fail = 0;
@@ -1896,8 +1897,7 @@ check_final_overrider (tree overrider, tree basefn)
{
/* can_convert will permit user defined conversion from a
(reference to) class type. We must reject them. */
- over_return = non_reference (TREE_TYPE (over_type));
- if (CLASS_TYPE_P (over_return))
+ if (CLASS_TYPE_P (non_reference (over_return)))
fail = 2;
else
{