diff options
author | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-08 02:14:07 +0000 |
---|---|---|
committer | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-08 02:14:07 +0000 |
commit | 28a7874aacc4d2a9013512ebcbb1cf5135ce9880 (patch) | |
tree | ec0f33939d736e4820c0acb516a046ec590e7857 /gcc/cp/decl.c | |
parent | f809c097920eff4f5972a375ebbe2c9d0ca0f63b (diff) | |
download | gcc-28a7874aacc4d2a9013512ebcbb1cf5135ce9880.tar.gz |
* name-lookup.h (cp_label_binding): Declare. Declare a VEC type
containing it.
(cp_binding_level): Convert shadowed_labels and dead_vars_from_for
fields to VECs.
* decl.c (poplevel): Adjust for type changes.
(declare_local_label): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162991 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4e4a27786b8..198921fd082 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -543,6 +543,8 @@ poplevel (int keep, int reverse, int functionbody) tree decl; int leaving_for_scope; scope_kind kind; + unsigned ix; + cp_label_binding *label_bind; timevar_push (TV_NAME_LOOKUP); restart: @@ -687,10 +689,9 @@ poplevel (int keep, int reverse, int functionbody) /* Add it to the list of dead variables in the next outermost binding to that we can remove these when we leave that binding. */ - current_binding_level->level_chain->dead_vars_from_for - = tree_cons (NULL_TREE, link, - current_binding_level->level_chain-> - dead_vars_from_for); + VEC_safe_push (tree, gc, + current_binding_level->level_chain->dead_vars_from_for, + link); /* Although we don't pop the cxx_binding, we do clear its SCOPE since the scope is going away now. */ @@ -719,9 +720,10 @@ poplevel (int keep, int reverse, int functionbody) /* Remove declarations for any `for' variables from inner scopes that we kept around. */ - for (link = current_binding_level->dead_vars_from_for; - link; link = TREE_CHAIN (link)) - pop_binding (DECL_NAME (TREE_VALUE (link)), TREE_VALUE (link)); + for (ix = VEC_length (tree, current_binding_level->dead_vars_from_for) - 1; + VEC_iterate (tree, current_binding_level->dead_vars_from_for, ix, decl); + ix--) + pop_binding (DECL_NAME (decl), decl); /* Restore the IDENTIFIER_TYPE_VALUEs. */ for (link = current_binding_level->type_shadowed; @@ -729,10 +731,12 @@ poplevel (int keep, int reverse, int functionbody) SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link), TREE_VALUE (link)); /* Restore the IDENTIFIER_LABEL_VALUEs for local labels. */ - for (link = current_binding_level->shadowed_labels; - link; - link = TREE_CHAIN (link)) - pop_local_label (TREE_VALUE (link), TREE_PURPOSE (link)); + for (ix = VEC_length (cp_label_binding, + current_binding_level->shadowed_labels) - 1; + VEC_iterate (cp_label_binding, current_binding_level->shadowed_labels, + ix, label_bind); + ix--) + pop_local_label (label_bind->label, label_bind->prev_value); /* There may be OVERLOADs (wrapped in TREE_LISTs) on the BLOCK_VARs list if a `using' declaration put them there. The debugging @@ -2508,16 +2512,17 @@ lookup_label (tree id) tree declare_local_label (tree id) { - tree decl, shadow; + tree decl; + cp_label_binding *bind; /* Add a new entry to the SHADOWED_LABELS list so that when we leave this scope we can restore the old value of IDENTIFIER_TYPE_VALUE. */ - shadow = tree_cons (IDENTIFIER_LABEL_VALUE (id), NULL_TREE, - current_binding_level->shadowed_labels); - current_binding_level->shadowed_labels = shadow; + bind = VEC_safe_push (cp_label_binding, gc, + current_binding_level->shadowed_labels, NULL); + bind->prev_value = IDENTIFIER_LABEL_VALUE (id); decl = make_label_decl (id, /*local_p=*/1); - TREE_VALUE (shadow) = decl; + bind->label = decl; return decl; } |