diff options
author | Trevor Saunders <tbsaunde+gcc@tbsaunde.org> | 2015-11-24 11:46:10 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2015-11-24 11:46:10 +0000 |
commit | 76b6ddbfe234ed3d68dfaaadfc85a86119a3d0af (patch) | |
tree | 58070dd13c6248487e3ae1a088186d0901249d7f /gcc/hash-map-traits.h | |
parent | cfa55545f9aff809f267babb110b1037e164a1cd (diff) | |
download | gcc-76b6ddbfe234ed3d68dfaaadfc85a86119a3d0af.zip gcc-76b6ddbfe234ed3d68dfaaadfc85a86119a3d0af.tar.gz gcc-76b6ddbfe234ed3d68dfaaadfc85a86119a3d0af.tar.bz2 |
destroy values as well as keys when removing them from hash maps
gcc/ChangeLog:
2015-11-24 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* hash-map-traits.h (simple_hashmap_traits ::remove): call
destructors on values that are being removed.
* mem-stats.h (hash_map): Pass type of values to
simple_hashmap_traits.
* tree-sra.c (sra_deinitialize): Remove work around for hash
maps not destructing values.
* genmatch.c (sinfo_hashmap_traits): Adjust.
* tree-ssa-uncprop.c (val_ssa_equiv_hash_traits): Likewise.
From-SVN: r230801
Diffstat (limited to 'gcc/hash-map-traits.h')
-rw-r--r-- | gcc/hash-map-traits.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc/hash-map-traits.h b/gcc/hash-map-traits.h index 2225426..773ac1b 100644 --- a/gcc/hash-map-traits.h +++ b/gcc/hash-map-traits.h @@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see /* Implement hash_map traits for a key with hash traits H. Empty and deleted map entries are represented as empty and deleted keys. */ -template <typename H> +template <typename H, typename Value> struct simple_hashmap_traits { typedef typename H::value_type key_type; @@ -41,56 +41,58 @@ struct simple_hashmap_traits template <typename T> static inline void mark_deleted (T &); }; -template <typename H> +template <typename H, typename Value> inline hashval_t -simple_hashmap_traits <H>::hash (const key_type &h) +simple_hashmap_traits <H, Value>::hash (const key_type &h) { return H::hash (h); } -template <typename H> +template <typename H, typename Value> inline bool -simple_hashmap_traits <H>::equal_keys (const key_type &k1, const key_type &k2) +simple_hashmap_traits <H, Value>::equal_keys (const key_type &k1, + const key_type &k2) { return H::equal (k1, k2); } -template <typename H> +template <typename H, typename Value> template <typename T> inline void -simple_hashmap_traits <H>::remove (T &entry) +simple_hashmap_traits <H, Value>::remove (T &entry) { H::remove (entry.m_key); + entry.m_value.~Value (); } -template <typename H> +template <typename H, typename Value> template <typename T> inline bool -simple_hashmap_traits <H>::is_empty (const T &entry) +simple_hashmap_traits <H, Value>::is_empty (const T &entry) { return H::is_empty (entry.m_key); } -template <typename H> +template <typename H, typename Value> template <typename T> inline bool -simple_hashmap_traits <H>::is_deleted (const T &entry) +simple_hashmap_traits <H, Value>::is_deleted (const T &entry) { return H::is_deleted (entry.m_key); } -template <typename H> +template <typename H, typename Value> template <typename T> inline void -simple_hashmap_traits <H>::mark_empty (T &entry) +simple_hashmap_traits <H, Value>::mark_empty (T &entry) { H::mark_empty (entry.m_key); } -template <typename H> +template <typename H, typename Value> template <typename T> inline void -simple_hashmap_traits <H>::mark_deleted (T &entry) +simple_hashmap_traits <H, Value>::mark_deleted (T &entry) { H::mark_deleted (entry.m_key); } |