aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-objcp-common.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-10-02 15:26:47 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-10-02 15:26:47 -0400
commitc89844e5d30a5235960a2c627abc9369306fda61 (patch)
tree49f593d8b44f2a0038aa8a77148c902c63381b29 /gcc/cp/cp-objcp-common.c
parentd61bff850d13ff103de3c2fb13d5e371996e1a3c (diff)
downloadgcc-c89844e5d30a5235960a2c627abc9369306fda61.zip
gcc-c89844e5d30a5235960a2c627abc9369306fda61.tar.gz
gcc-c89844e5d30a5235960a2c627abc9369306fda61.tar.bz2
Add some hash_map_safe_* functions like vec_safe_*.
gcc/ * hash-map.h (default_hash_map_size): New variable. (create_ggc): Use it as default argument. (hash_map_maybe_create, hash_map_safe_get) (hash_map_safe_get_or_insert, hash_map_safe_put): New fns. gcc/cp/ * constexpr.c (maybe_initialize_fundef_copies_table): Remove. (get_fundef_copy): Use hash_map_safe_get_or_insert. * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*. * decl.c (store_decomp_type): Remove. (cp_finish_decomp): Use hash_map_safe_put. * init.c (get_nsdmi): Use hash_map_safe_*. * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove. (add_defaults_to_ttp): Use hash_map_safe_*. From-SVN: r276484
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r--gcc/cp/cp-objcp-common.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 4369a5b..0a72231 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -145,11 +145,9 @@ cp_get_debug_type (const_tree type)
if (dtype)
{
tree ktype = CONST_CAST_TREE (type);
- if (debug_type_map == NULL)
- debug_type_map = tree_cache_map::create_ggc (512);
- else if (tree *slot = debug_type_map->get (ktype))
+ if (tree *slot = hash_map_safe_get (debug_type_map, ktype))
return *slot;
- debug_type_map->put (ktype, dtype);
+ hash_map_safe_put<hm_ggc> (debug_type_map, ktype, dtype);
}
return dtype;