diff options
Diffstat (limited to 'gcc/hash-traits.h')
-rw-r--r-- | gcc/hash-traits.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h index e4c182eabf2..77f88f30dc6 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -121,14 +121,11 @@ pointer_hash <Type>::is_empty (Type *e) return e == NULL; } -/* Hasher for entry in gc memory. */ +/* Remover and marker for entries in gc memory. */ template<typename T> -struct ggc_hasher +struct ggc_remove { - typedef T value_type; - typedef T compare_type; - static void remove (T &) {} static void @@ -155,8 +152,11 @@ struct ggc_hasher /* Hasher for cache entry in gc memory. */ template<typename T> -struct ggc_cache_hasher : ggc_hasher<T> +struct ggc_cache_hasher : ggc_remove<T> { + typedef T value_type; + typedef T compare_type; + /* Entries are weakly held because this is for caches. */ static void ggc_mx (T &) {} @@ -179,4 +179,10 @@ struct nofree_ptr_hash : pointer_hash <T>, typed_noop_remove <T> {}; template <typename T> struct free_ptr_hash : pointer_hash <T>, typed_free_remove <T> {}; +/* Traits for elements that point to gc memory. The pointed-to data + must be kept across collections. */ + +template <typename T> +struct ggc_ptr_hash : pointer_hash <T>, ggc_remove <T *> {}; + #endif |