diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-06-09 12:10:57 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-06-09 08:10:57 -0400 |
commit | d23a1bb1274291149ed419b2a89ed80e73b4d0ca (patch) | |
tree | 1b6c401c419abd68e88269dfb6e2db0aec238ba4 /gcc | |
parent | 9ae4ec4602f0b57ac1a8c5a4d1ab38f96cf6a0c6 (diff) | |
download | gcc-d23a1bb1274291149ed419b2a89ed80e73b4d0ca.zip gcc-d23a1bb1274291149ed419b2a89ed80e73b4d0ca.tar.gz gcc-d23a1bb1274291149ed419b2a89ed80e73b4d0ca.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/search.c | 29 |
5 files changed, 38 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 794665e..09249c4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c1f58bd..0e1aa26 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d5c4617..6324bec 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4804c9f..dd7ddea 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 6d2a530..e92e8d8 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -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. */ |