From: Jason Merrill Date: Thu, 27 Jan 2022 15:53:07 +0000 (-0500) Subject: tree: move tree_vec_map_cache_hasher into header X-Git-Tag: basepoints/gcc-13~1341 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b649071d4b3490aa43c6c2212312ace304c9ff1c;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/tree.cc b/gcc/tree.cc index 9d445b2740f5..7ce4f242751a 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -242,23 +242,6 @@ static GTY ((cache)) static GTY ((cache)) hash_table *value_expr_for_decl; -struct tree_vec_map_cache_hasher : ggc_cache_ptr_hash -{ - 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); - } -}; - static GTY ((cache)) hash_table *debug_args_for_decl; diff --git a/gcc/tree.h b/gcc/tree.h index 4c01d94244ef..e2157d66d6c7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -5559,6 +5559,23 @@ struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash #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 +{ + 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. */