aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1999-03-10 10:53:35 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-03-10 10:53:35 +0000
commit6cbd257eb5e361f019c5aff53e189e9123f30054 (patch)
tree7e4165eec480a1ed2d810ea264f82907d45723ac
parent5f23a307e27deb2693c2181812f3414ff73f490f (diff)
downloadgcc-6cbd257eb5e361f019c5aff53e189e9123f30054.zip
gcc-6cbd257eb5e361f019c5aff53e189e9123f30054.tar.gz
gcc-6cbd257eb5e361f019c5aff53e189e9123f30054.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/search.c43
2 files changed, 47 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 30d3b5d..4ccda9e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
1999-03-10 Mark Mitchell <mark@markmitchell.com>
+ * 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 42678f1..fecec21 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;
}