mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-25 14:44:37 +08:00
search.c (lookup_member): New fn.
* search.c (lookup_member): New fn. * class.c (finish_struct_1): Use it. * decl.c (lookup_name_real): Use it. From-SVN: r20375
This commit is contained in:
parent
9ae4ec4602
commit
d23a1bb127
@ -1,3 +1,9 @@
|
||||
1998-06-09 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* search.c (lookup_member): New fn.
|
||||
* class.c (finish_struct_1): Use it.
|
||||
* decl.c (lookup_name_real): Use it.
|
||||
|
||||
Mon Jun 8 20:45:52 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* Makefile.in (decl2.o): Depend on dwarf2out.h and dwarfout.h.
|
||||
|
@ -3210,9 +3210,7 @@ finish_struct_1 (t, warn_anon)
|
||||
|| sname == constructor_name_full (ctype))
|
||||
cp_error_at ("using-declaration for constructor", x);
|
||||
|
||||
fdecl = lookup_field (binfo, sname, 0, 0);
|
||||
if (! fdecl)
|
||||
fdecl = lookup_fnfields (binfo, sname, 0);
|
||||
fdecl = lookup_member (binfo, sname, 0, 0);
|
||||
|
||||
if (fdecl)
|
||||
access_decls = scratch_tree_cons (access, fdecl, access_decls);
|
||||
|
@ -2708,6 +2708,7 @@ extern tree compute_access PROTO((tree, tree));
|
||||
extern tree lookup_field PROTO((tree, tree, int, int));
|
||||
extern tree lookup_nested_field PROTO((tree, int));
|
||||
extern tree lookup_fnfields PROTO((tree, tree, int));
|
||||
extern tree lookup_member PROTO((tree, tree, int, int));
|
||||
extern tree lookup_nested_tag PROTO((tree, tree));
|
||||
extern tree get_matching_virtual PROTO((tree, tree, int));
|
||||
extern tree get_abstract_virtuals PROTO((tree));
|
||||
|
@ -4816,7 +4816,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
|
||||
else if (type == current_class_type)
|
||||
val = IDENTIFIER_CLASS_VALUE (name);
|
||||
else
|
||||
val = lookup_field (type, name, 0, prefer_type);
|
||||
val = lookup_member (type, name, 0, prefer_type);
|
||||
}
|
||||
else
|
||||
val = NULL_TREE;
|
||||
|
@ -2005,6 +2005,35 @@ lookup_fnfields (basetype_path, name, complain)
|
||||
|
||||
return rvals;
|
||||
}
|
||||
|
||||
/* Look for a field or function named NAME in an inheritance lattice
|
||||
dominated by XBASETYPE. PROTECT is zero if we can avoid computing
|
||||
access information, otherwise it is 1. WANT_TYPE is 1 when we should
|
||||
only return TYPE_DECLs, if no TYPE_DECL can be found return NULL_TREE. */
|
||||
|
||||
tree
|
||||
lookup_member (xbasetype, name, protect, want_type)
|
||||
tree xbasetype, name;
|
||||
int protect, want_type;
|
||||
{
|
||||
tree ret, basetype_path;
|
||||
|
||||
if (TREE_CODE (xbasetype) == TREE_VEC)
|
||||
basetype_path = xbasetype;
|
||||
else if (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
|
||||
{
|
||||
basetype_path = TYPE_BINFO (xbasetype);
|
||||
BINFO_VIA_PUBLIC (basetype_path) = 1;
|
||||
BINFO_INHERITANCE_CHAIN (basetype_path) = NULL_TREE;
|
||||
}
|
||||
else
|
||||
my_friendly_abort (97);
|
||||
|
||||
ret = lookup_field (basetype_path, name, protect, want_type);
|
||||
if (! ret && ! want_type)
|
||||
ret = lookup_fnfields (basetype_path, name, protect);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* BREADTH-FIRST SEARCH ROUTINES. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user