aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-01-27 10:53:07 -0500
committerJason Merrill <jason@redhat.com>2022-02-01 14:14:12 -0500
commitb649071d4b3490aa43c6c2212312ace304c9ff1c (patch)
tree727dd53672950c787bdc7a75f8a27c42b3494707 /gcc/tree.h
parentf32f74c2e8cef5fe37af6d4e8d7e8f6b4c8ae9a8 (diff)
downloadgcc-b649071d4b3490aa43c6c2212312ace304c9ff1c.zip
gcc-b649071d4b3490aa43c6c2212312ace304c9ff1c.tar.gz
gcc-b649071d4b3490aa43c6c2212312ace304c9ff1c.tar.bz2
tree: move tree_vec_map_cache_hasher into header
gcc/ChangeLog: * tree.h (struct tree_vec_map_cache_hasher): Move from... * tree.cc (struct tree_vec_map_cache_hasher): ...here.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 4c01d94..e2157d6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5559,6 +5559,23 @@ struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash<tree_decl_map>
#define tree_vec_map_hash tree_decl_map_hash
#define tree_vec_map_marked_p tree_map_base_marked_p
+struct tree_vec_map_cache_hasher : ggc_cache_ptr_hash<tree_vec_map>
+{
+ static hashval_t hash (tree_vec_map *m) { return DECL_UID (m->base.from); }
+
+ static bool
+ equal (tree_vec_map *a, tree_vec_map *b)
+ {
+ return a->base.from == b->base.from;
+ }
+
+ static int
+ keep_cache_entry (tree_vec_map *&m)
+ {
+ return ggc_marked_p (m->base.from);
+ }
+};
+
/* Hasher for tree decls. Pointer equality is enough here, but the DECL_UID
is a better hash than the pointer value and gives a predictable traversal
order. Additionally it can be used across PCH save/restore. */