aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-11-04 10:11:14 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-11-04 09:11:14 +0000
commitddf628e42fe261293cbbe39d0d8b38d30d852154 (patch)
tree25587e9f5150392a00b9716c103e060d45165521 /gcc/ggc.h
parentcedaa3f605a927e1df2bd0470fd4cf3fa1217486 (diff)
downloadgcc-ddf628e42fe261293cbbe39d0d8b38d30d852154.zip
gcc-ddf628e42fe261293cbbe39d0d8b38d30d852154.tar.gz
gcc-ddf628e42fe261293cbbe39d0d8b38d30d852154.tar.bz2
Come up with ggc_delete.
2019-11-04 Martin Liska <mliska@suse.cz> * ggc.h (ggc_delete): New function. * ipa-fnsummary.c (ipa_free_fn_summary): Use it. * ipa-prop.c (ipa_free_all_edge_args): Likewise. (ipa_free_all_node_params): Likewise. * ipa-sra.c (ipa_sra_analysis): Likewise. From-SVN: r277767
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r--gcc/ggc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h
index c22fc37..6c64caa 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -242,6 +242,16 @@ ggc_alloc_atomic (size_t s CXX_MEM_STAT_INFO)
return ggc_internal_alloc (s PASS_MEM_STAT);
}
+/* Call destructor and free the garbage collected memory. */
+
+template <typename T>
+inline void
+ggc_delete (T *ptr)
+{
+ ptr->~T ();
+ ggc_free (ptr);
+}
+
/* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
If LENGTH is -1, then CONTENTS is assumed to be a
null-terminated string and the memory sized accordingly. */