* search.c (lookup_member): New fn.
* class.c (finish_struct_1): Use it.
* decl.c (lookup_name_real): Use it.
From-SVN: r20375
+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.
|| 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);
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));
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;
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;
+}
\f
/* BREADTH-FIRST SEARCH ROUTINES. */