From ddf628e42fe261293cbbe39d0d8b38d30d852154 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 4 Nov 2019 10:11:14 +0100 Subject: Come up with ggc_delete. 2019-11-04 Martin Liska * 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 --- gcc/ggc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/ggc.h') 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 +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. */ -- cgit v1.1