From 5430acc846acabe753e2c7d159aa27673a7daeb6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 7 Sep 1999 21:00:57 -0400 Subject: [PATCH] search.c (binfo_for_vtable): Use CLASSTYPE_VFIELD_PARENT. * search.c (binfo_for_vtable): Use CLASSTYPE_VFIELD_PARENT. (dfs_bfv_queue_p, dfs_bfv_helper, struct bfv_info): Remove. From-SVN: r29178 --- gcc/cp/ChangeLog | 15 ++++++------ gcc/cp/search.c | 61 ++++++++++++++---------------------------------- 2 files changed, 25 insertions(+), 51 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6e0fc826eebe..5ee46749a92e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-09-07 Jason Merrill + + * search.c (binfo_for_vtable): Use CLASSTYPE_VFIELD_PARENT. + (dfs_bfv_queue_p, dfs_bfv_helper, struct bfv_info): Remove. + 1999-09-07 Mark Mitchell * Makefile.in (tree.o): Depend on ggc.h. @@ -1010,10 +1015,10 @@ Mon Aug 23 22:17:20 1999 Mumit Khan 1999-08-13 Gavin Romig-Koch - cp-tree.h (init_cplus_unsave): New. + * cp-tree.h (init_cplus_unsave): New. (cplus_unsave_expr_now): New. - lex.c (init_parse): Call init_cplus_unsave. - tree.c (init_cplus_unsave): New. + * lex.c (init_parse): Call init_cplus_unsave. + * tree.c (init_cplus_unsave): New. (cplus_unsave_expr_now): New. 1999-08-13 Mark Mitchell @@ -1195,9 +1200,6 @@ Mon Aug 23 22:17:20 1999 Mumit Khan 1999-08-09 Kaveh R. Ghazi - * decl.c: Remove redundant prototype for `print_error_function'. - (lang_print_error_function): Constify a char*. - * lex.c (lang_identify): Likewise. 1999-08-09 Bernd Schmidt @@ -1614,7 +1616,6 @@ Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com) 1999-07-24 Richard Henderson - * decl.c (ptr_type_node, va_list_type_node): New. * gxx.gperf (__builtin_va_arg): New. * parse.y (VA_ARG): New token. (unary_expr): Recognize it. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index dc81a3383020..6ce849447a80 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -131,8 +131,6 @@ static tree dfs_walk_real PROTO ((tree, tree (*) (tree, void *), tree (*) (tree, void *), void *)); -static tree dfs_bfv_queue_p PROTO ((tree, void *)); -static tree dfs_bfv_helper PROTO ((tree, void *)); static tree get_virtuals_named_this_r PROTO ((tree, void *)); static tree context_for_name_lookup PROTO ((tree)); static tree canonical_binfo PROTO ((tree)); @@ -3270,55 +3268,30 @@ types_overlap_p (empty_type, next_type) return oi.found_overlap; } -struct bfv_info { - tree vbases; - tree var; -}; - -static tree -dfs_bfv_queue_p (binfo, data) - tree binfo; - void *data; -{ - struct bfv_info *bfvi = (struct bfv_info *) data; - - /* Use the real virtual base class objects, not the placeholders in - the usual hierarchy. */ - if (TREE_VIA_VIRTUAL (binfo)) - return binfo_member (BINFO_TYPE (binfo), bfvi->vbases); - - return binfo; -} - -/* Passed to dfs_walk_real by binfo_for_vtable; determine if bvtable - comes from BINFO. */ - -static tree -dfs_bfv_helper (binfo, data) - tree binfo; - void *data; -{ - struct bfv_info *bfvi = (struct bfv_info *) data; - - if (BINFO_VTABLE (binfo) == bfvi->var) - return binfo; - return NULL_TREE; -} - /* Given a vtable VAR, determine which binfo it comes from. */ tree binfo_for_vtable (var) tree var; { - tree type; - struct bfv_info bfvi; + tree binfo = TYPE_BINFO (DECL_CONTEXT (var)); + tree binfos; + int i; - type = DECL_CONTEXT (var); - bfvi.vbases = CLASSTYPE_VBASECLASSES (type); - bfvi.var = var; - return dfs_walk_real (TYPE_BINFO (type), - 0, dfs_bfv_helper, dfs_bfv_queue_p, &bfvi); + while (1) + { + binfos = BINFO_BASETYPES (binfo); + if (binfos == NULL_TREE) + break; + + i = CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); + if (i == -1) + break; + + binfo = TREE_VEC_ELT (binfos, i); + } + + return binfo; } /* Returns 1 iff BINFO is from a direct or indirect virtual base. */ -- 2.43.5