From 6cbd257eb5e361f019c5aff53e189e9123f30054 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 10 Mar 1999 10:53:35 +0000 Subject: [PATCH] search.c (dfs_canonical_queue): New function. * search.c (dfs_canonical_queue): New function. (dfs_assert_unmarked_p): Likewise. (assert_canonical_unmarked): Likewise. (access_in_type): Use it. (accessible_p): Likewise. Walk the whole tree when umarking. From-SVN: r25668 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/search.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 30d3b5d257a..4ccda9ebcc7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 1999-03-10 Mark Mitchell + * search.c (dfs_canonical_queue): New function. + (dfs_assert_unmarked_p): Likewise. + (assert_canonical_unmarked): Likewise. + (access_in_type): Use it. + (accessible_p): Likewise. Walk the whole tree when umarking. + * sig.c (build_signature_table_constructor): Use accessible_p instead of compute_access. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 42678f150f7..fecec217327 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -144,6 +144,9 @@ static tree dfs_accessible_queue_p PROTO ((tree, void *)); static tree dfs_accessible_p PROTO ((tree, void *)); static tree dfs_access_in_type PROTO ((tree, void *)); static tree access_in_type PROTO ((tree, tree)); +static tree dfs_canonical_queue PROTO ((tree, void *)); +static tree dfs_assert_unmarked_P PROTO ((tree, void *)); +static tree assert_canonical_unmarked PROTO ((tree)); /* Allocate a level of searching. */ @@ -622,6 +625,38 @@ canonical_binfo (binfo) ? TYPE_BINFO (BINFO_TYPE (binfo)) : binfo); } +/* A queue function that simply ensures that we walk into the + canonical versions of virtual bases. */ + +static tree +dfs_canonical_queue (binfo, data) + tree binfo; + void *data ATTRIBUTE_UNUSED; +{ + return canonical_binfo (binfo); +} + +/* Called via dfs_walk from assert_canonical_unmarked. */ + +static tree +dfs_assert_unmarked_p (binfo, data) + tree binfo; + void *data ATTRIBUTE_UNUSED; +{ + my_friendly_assert (!BINFO_MARKED (binfo), 0); + return NULL_TREE; +} + +/* Asserts that all the nodes below BINFO (using the canonical + versions of virtual bases) are unmarked. */ + +static void +assert_canonical_unmarked (binfo) + tree binfo; +{ + dfs_walk (binfo, dfs_assert_unmarked_p, dfs_canonical_queue, 0); +} + /* If BINFO is marked, return a canonical version of BINFO. Otherwise, return NULL_TREE. */ @@ -762,6 +797,7 @@ access_in_type (type, decl) each node with the most lenient access. */ dfs_walk_real (binfo, 0, dfs_access_in_type, shared_unmarked_p, decl); dfs_walk (binfo, dfs_unmark, shared_marked_p, 0); + assert_canonical_unmarked (binfo); return TREE_CHAIN (binfo); } @@ -927,8 +963,11 @@ accessible_p (type, decl) t = dfs_walk (binfo, dfs_accessible_p, dfs_accessible_queue_p, protected_ok ? &protected_ok : 0); - /* Clear any mark bits. */ - dfs_walk (binfo, dfs_unmark, shared_marked_p, 0); + /* Clear any mark bits. Note that we have to walk the whole tree + here, since we have aborted the previous walk from some point + deep in the tree. */ + dfs_walk (binfo, dfs_unmark, dfs_canonical_queue, 0); + assert_canonical_unmarked (binfo); return t != NULL_TREE; } -- 2.30.2