From c89844e5d30a5235960a2c627abc9369306fda61 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 2 Oct 2019 15:26:47 -0400 Subject: 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 --- gcc/cp/cp-objcp-common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/cp/cp-objcp-common.c') 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 (debug_type_map, ktype, dtype); } return dtype; -- cgit v1.1