Free datastructures pointing to CFG after parsing
authorJan Hubicka <jh@suse.cz>
Sat, 2 Jan 2021 15:03:41 +0000 (16:03 +0100)
committerJan Hubicka <jh@suse.cz>
Sat, 2 Jan 2021 15:04:24 +0000 (16:04 +0100)
* cp-tree.h (cp_tree_c_finish_parsing): Declare.
* decl2.c (c_parse_final_cleanups): Call cp_tree_c_finish_parsing.
* tree.c (cp_tree_c_finish_parsing): New function.

gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/tree.c

index fc6a7898475d4fcdaa7fd12b7f4a895ad638f9a9..102f6e1464a6ebcbfec9da413ac9332de6108d50 100644 (file)
@@ -8238,6 +8238,8 @@ struct uid_sensitive_constexpr_evaluation_checker
   bool evaluation_restricted_p () const;
 };
 
+void cp_tree_c_finish_parsing ();
+
 /* In cp-ubsan.c */
 extern void cp_ubsan_maybe_instrument_member_call (tree);
 extern void cp_ubsan_instrument_member_accesses (tree *);
index af88e7f5cab420894e0005ccd44ccf768959f223..8769ff51be9ebbe009779ab24cf4189b4b25efbd 100644 (file)
@@ -5257,6 +5257,7 @@ c_parse_final_cleanups (void)
   perform_deferred_noexcept_checks ();
 
   fini_constexpr ();
+  cp_tree_c_finish_parsing ();
   clear_consteval_vfns (consteval_vtables);
 
   /* The entire file is now complete.  If requested, dump everything
index 0584a7b725e49e25097bf2b60706667011789884..e1ad0acb1f97210d153b16aac2e5e11799b6ee48 100644 (file)
@@ -5926,6 +5926,15 @@ maybe_warn_zero_as_null_pointer_constant (tree expr, location_t loc)
   return false;
 }
 \f
+/* Release memory we no longer need after parsing.  */
+void
+cp_tree_c_finish_parsing ()
+{
+  if (previous_class_level)
+    invalidate_class_lookup_cache ();
+  deleted_copy_types = NULL;
+}
+\f
 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
 /* Complain that some language-specific thing hanging off a tree
    node has been accessed improperly.  */