aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-08-09 14:28:47 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-08-09 14:28:47 +0000
commitd4ccba6615b947c4a59daa9be2006c42640e2477 (patch)
tree46b3e04776b38a3d4202531495680d0b99b493be /gcc/cp/name-lookup.c
parentf38958e826ab3971068e7f0605966da9dbd461f2 (diff)
downloadgcc-d4ccba6615b947c4a59daa9be2006c42640e2477.zip
gcc-d4ccba6615b947c4a59daa9be2006c42640e2477.tar.gz
gcc-d4ccba6615b947c4a59daa9be2006c42640e2477.tar.bz2
name-lookup.c (is_associated_namespace): Convert local variables to be VECs instead of TREE_LISTs.
* name-lookup.c (is_associated_namespace): Convert local variables to be VECs instead of TREE_LISTs. From-SVN: r163034
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index c6e31c29..01f29e4 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4659,25 +4659,38 @@ add_function (struct arg_lookup *k, tree fn)
bool
is_associated_namespace (tree current, tree scope)
{
- tree seen = NULL_TREE;
- tree todo = NULL_TREE;
+ VEC(tree,gc) *seen = make_tree_vector ();
+ VEC(tree,gc) *todo = make_tree_vector ();
tree t;
+ bool ret;
+
while (1)
{
if (scope == current)
- return true;
- seen = tree_cons (scope, NULL_TREE, seen);
+ {
+ ret = true;
+ break;
+ }
+ VEC_safe_push (tree, gc, seen, scope);
for (t = DECL_NAMESPACE_ASSOCIATIONS (scope); t; t = TREE_CHAIN (t))
- if (!purpose_member (TREE_PURPOSE (t), seen))
- todo = tree_cons (TREE_PURPOSE (t), NULL_TREE, todo);
- if (todo)
+ if (!vec_member (TREE_PURPOSE (t), seen))
+ VEC_safe_push (tree, gc, todo, TREE_PURPOSE (t));
+ if (!VEC_empty (tree, todo))
{
- scope = TREE_PURPOSE (todo);
- todo = TREE_CHAIN (todo);
+ scope = VEC_last (tree, todo);
+ VEC_pop (tree, todo);
}
else
- return false;
+ {
+ ret = false;
+ break;
+ }
}
+
+ release_tree_vector (seen);
+ release_tree_vector (todo);
+
+ return ret;
}
/* Add functions of a namespace to the lookup structure.