aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-modref.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-09-22 22:16:00 +0200
committerJan Hubicka <jh@suse.cz>2020-09-22 22:16:00 +0200
commit39b3b1bdd9ea3d36ce41276b8452506b79cc4368 (patch)
tree73312eeeb748fae914dff5f43aca2a842270b25a /gcc/ipa-modref.c
parent7d8177b027b87cf3211e2d6cf144ec71616425ea (diff)
downloadgcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.zip
gcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.tar.gz
gcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.tar.bz2
Fix ipa-modref selftest and destructor
* ipa-modref-tree.c: Add namespace selftest. (modref_tree_c_tests): Rename to ... (ipa_modref_tree_c_tests): ... this. * ipa-modref.c (pass_modref): Remove destructor. (ipa_modref_c_finalize): New function. * ipa-modref.h (ipa_modref_c_finalize): Declare. * selftest-run-tests.c (selftest::run_tests): Call ipa_modref_c_finalize. * selftest.h (ipa_modref_tree_c_tests): Declare. * toplev.c: Include ipa-modref-tree.h and ipa-modref.h (toplev::finalize): Call ipa_modref_c_finalize.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r--gcc/ipa-modref.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 0411f66..d195354 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -767,12 +767,6 @@ class pass_modref : public gimple_opt_pass
pass_modref (gcc::context *ctxt)
: gimple_opt_pass (pass_data_modref, ctxt) {}
- ~pass_modref ()
- {
- ggc_delete (summaries);
- summaries = NULL;
- }
-
/* opt_pass methods: */
opt_pass *clone ()
{
@@ -1373,4 +1367,14 @@ unsigned int pass_ipa_modref::execute (function *)
return 0;
}
+/* Summaries must stay alive until end of compilation. */
+
+void
+ipa_modref_c_finalize ()
+{
+ if (summaries)
+ ggc_delete (summaries);
+ summaries = NULL;
+}
+
#include "gt-ipa-modref.h"