Reduce garbage from push_to_top_level.
authorJason Merrill <jason@redhat.com>
Thu, 21 Jun 2018 18:19:34 +0000 (14:19 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 21 Jun 2018 18:19:34 +0000 (14:19 -0400)
* name-lookup.c (do_push_to_top_level): Don't allocate
current_lang_base.
(do_pop_from_top_level): Release current_lang_base.

From-SVN: r261860

gcc/cp/ChangeLog
gcc/cp/name-lookup.c

index 55e9e0b0fc3b257d5d2ddd87064cb48159cd9cda..18673c095af49dc8c4eb5c0dccfa8d5b041ca731 100644 (file)
@@ -1,5 +1,9 @@
 2018-06-21  Jason Merrill  <jason@redhat.com>
 
+       * name-lookup.c (do_push_to_top_level): Don't allocate
+       current_lang_base.
+       (do_pop_from_top_level): Release current_lang_base.
+
        Let -fmem-report see callers of cxx_make_type.
        * lex.c (cxx_make_type): Add MEM_STAT_DECL.
        (make_class_type): Likewise.
index ec001016d3ed40a0ef4c57fa1035f5ba7c659ea2..a30c37428adb7ca637155d230a1f552128a44e40 100644 (file)
@@ -6852,7 +6852,7 @@ do_push_to_top_level (void)
 
   scope_chain = s;
   current_function_decl = NULL_TREE;
-  vec_alloc (current_lang_base, 10);
+  current_lang_base = NULL;
   current_lang_name = lang_name_cplusplus;
   current_namespace = global_namespace;
   push_class_stack ();
@@ -6872,7 +6872,7 @@ do_pop_from_top_level (void)
     invalidate_class_lookup_cache ();
   pop_class_stack ();
 
-  current_lang_base = 0;
+  release_tree_vector (current_lang_base);
 
   scope_chain = s->prev;
   FOR_EACH_VEC_SAFE_ELT (s->old_bindings, i, saved)