aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-09-27 12:00:08 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-09-27 12:00:08 +0000
commit8d83768f785fecd3b735b7e97b8d33d9c2ed7608 (patch)
treeecfec79fb69f49e8c3f8e058a7f40be3f9c62a96 /gcc/cp/class.c
parent75e50bd288af0eaa7342f8cb5e506985fd4067f8 (diff)
downloadgcc-8d83768f785fecd3b735b7e97b8d33d9c2ed7608.zip
gcc-8d83768f785fecd3b735b7e97b8d33d9c2ed7608.tar.gz
gcc-8d83768f785fecd3b735b7e97b8d33d9c2ed7608.tar.bz2
class.c (struct count_depth_data): Remove.
* class.c (struct count_depth_data): Remove. (dfs_depth_post, dfs_depth_q): Remove. (find_final_overrider): Use number of vbase classes as depth bound. * cp-tree.h (types_overlap_p): Remove. * search.c (struct overlap_info): Remove. (dfs_check_overlap, dfs_no_overlap_yet, types_overlap_p): Remove. * pt.c (GTB_VIA_VIRTUAL, GTB_IGNORE_TYPE): Remove. (get_template_base_recursive): Remove. Replace with ... (get_template_base_r): ... this. (struct get_template_base_data_s): New. (get_template_base): Use get_template_base_r via dfs_walk. Always return NULL on failure. (unify): Remove error_mark_node check from get_template_base result. From-SVN: r88169
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 071cd80..f32f9cc 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1801,36 +1801,6 @@ base_derived_from (tree derived, tree base)
return false;
}
-typedef struct count_depth_data {
- /* The depth of the current subobject, with "1" as the depth of the
- most derived object in the hierarchy. */
- size_t depth;
- /* The maximum depth found so far. */
- size_t max_depth;
-} count_depth_data;
-
-/* Called from find_final_overrider via dfs_walk. */
-
-static tree
-dfs_depth_post (tree binfo ATTRIBUTE_UNUSED, void *data)
-{
- count_depth_data *cd = (count_depth_data *) data;
- if (cd->depth > cd->max_depth)
- cd->max_depth = cd->depth;
- cd->depth--;
- return NULL_TREE;
-}
-
-/* Called from find_final_overrider via dfs_walk. */
-
-static tree
-dfs_depth_q (tree derived, int i, void *data)
-{
- count_depth_data *cd = (count_depth_data *) data;
- cd->depth++;
- return BINFO_BASE_BINFO (derived, i);
-}
-
typedef struct find_final_overrider_data_s {
/* The function for which we are trying to find a final overrider. */
tree fn;
@@ -1943,7 +1913,6 @@ static tree
find_final_overrider (tree derived, tree binfo, tree fn)
{
find_final_overrider_data ffod;
- count_depth_data cd;
/* Getting this right is a little tricky. This is valid:
@@ -1967,15 +1936,15 @@ find_final_overrider (tree derived, tree binfo, tree fn)
fn = THUNK_TARGET (fn);
/* Determine the depth of the hierarchy. */
- cd.depth = 0;
- cd.max_depth = 0;
- dfs_walk (derived, dfs_depth_post, dfs_depth_q, &cd);
-
ffod.fn = fn;
ffod.declaring_base = binfo;
ffod.most_derived_type = BINFO_TYPE (derived);
ffod.candidates = NULL_TREE;
- ffod.vpath_list = (tree *) xcalloc (cd.max_depth, sizeof (tree));
+ /* The virtual depth cannot be greater than the number of virtual
+ bases. */
+ ffod.vpath_list = (tree *) xcalloc
+ (VEC_length (tree, CLASSTYPE_VBASECLASSES (BINFO_TYPE (derived))),
+ sizeof (tree));
ffod.vpath = ffod.vpath_list;
dfs_walk_real (derived,