aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2017-06-16 14:33:45 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-06-16 14:33:45 +0000
commit6a2dfd9a66a678b26c762d0fc614fea267ea706b (patch)
tree71512245eb8338397e64115e91116c5af543c327 /gcc/cp/decl2.c
parent8c1ca7ee3a35bf00201c6a82ccd5b663575328a7 (diff)
downloadgcc-6a2dfd9a66a678b26c762d0fc614fea267ea706b.zip
gcc-6a2dfd9a66a678b26c762d0fc614fea267ea706b.tar.gz
gcc-6a2dfd9a66a678b26c762d0fc614fea267ea706b.tar.bz2
Make keyed_classes a vector.
* cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete. (keyed_classes): Declare as vector. * decl.c (keyed_classes): Define. (cxx_init_decl_processing): Allocate it. (record_key_method_defined): Use vec_safe_push. * class.c (finish_struct_1): Likewise. * pt.c (instantiate_class_template_1): Likewise. * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes. From-SVN: r249263
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index ab32b71..f9d5887 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4511,37 +4511,18 @@ c_parse_final_cleanups (void)
instantiate_pending_templates (retries);
ggc_collect ();
- /* Write out virtual tables as required. Note that writing out
- the virtual table for a template class may cause the
+ /* Write out virtual tables as required. Writing out the
+ virtual table for a template class may cause the
instantiation of members of that class. If we write out
vtables then we remove the class from our list so we don't
have to look at it again. */
-
- while (keyed_classes != NULL_TREE
- && maybe_emit_vtables (TREE_VALUE (keyed_classes)))
- {
- reconsider = true;
- keyed_classes = TREE_CHAIN (keyed_classes);
- }
-
- t = keyed_classes;
- if (t != NULL_TREE)
- {
- tree next = TREE_CHAIN (t);
-
- while (next)
- {
- if (maybe_emit_vtables (TREE_VALUE (next)))
- {
- reconsider = true;
- TREE_CHAIN (t) = TREE_CHAIN (next);
- }
- else
- t = next;
-
- next = TREE_CHAIN (t);
- }
- }
+ for (i = keyed_classes->length ();
+ keyed_classes->iterate (--i, &t);)
+ if (maybe_emit_vtables (t))
+ {
+ reconsider = true;
+ keyed_classes->unordered_remove (i);
+ }
/* Write out needed type info variables. We have to be careful
looping through unemitted decls, because emit_tinfo_decl may