diff options
author | tbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-02 11:34:54 +0000 |
---|---|---|
committer | tbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-02 11:34:54 +0000 |
commit | 06ecf4884b35f5ee5b211f0c2f753d5d4eee2481 (patch) | |
tree | b20f9df1d7e2cb3a642d2fab604f827c7d23712a /gcc/hash-map.h | |
parent | 431205b753bfa26d1711e40ce478d9e92fd157da (diff) | |
download | gcc-06ecf4884b35f5ee5b211f0c2f753d5d4eee2481.tar.gz |
convert many uses of pointer_map to hash_map
gcc/c-family/
* cilk.c: Use hash_map instead of pointer_map.
gcc/c/
* c-typeck.c: Use hash_map instead of pointer_map.
gcc/cp/
* optimize.c, semantics.c: Use hash_map instead of pointer_map.
gcc/
* hash-map.h (default_hashmap_traits::mark_key_deleted):
Fix cast.
(hash_map::remove): New method.
(hash_map::traverse): New method.
* cgraph.h, except.c, except.h, gimple-ssa-strength-reduction.c,
ipa-utils.c, lto-cgraph.c, lto-streamer.h, omp-low.c, predict.c,
tree-cfg.c, tree-cfgcleanup.c, tree-eh.c, tree-eh.h, tree-inline.c,
tree-inline.h, tree-nested.c, tree-sra.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-reassoc.c, tree-ssa-structalias.c,
tree-ssa.c, tree-ssa.h, var-tracking.c: Use hash_map instead of
pointer_map.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213517 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hash-map.h')
-rw-r--r-- | gcc/hash-map.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 0b50f724251..ec48844b81f 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -93,7 +93,7 @@ private: static void mark_key_deleted (T *&k) { - k = static_cast<T *> (1); + k = reinterpret_cast<T *> (1); } template<typename T> @@ -185,6 +185,11 @@ public: return e->m_value; } + void remove (const Key &k) + { + m_table.remove_elt_with_hash (k, Traits::hash (k)); + } + /* Call the call back on each pair of key and value with the passed in arg. */ @@ -196,6 +201,15 @@ public: f ((*iter).m_key, (*iter).m_value, a); } + template<typename Arg, bool (*f)(const Key &, Value *, Arg)> + void traverse (Arg a) const + { + for (typename hash_table<hash_entry>::iterator iter = m_table.begin (); + iter != m_table.end (); ++iter) + if (!f ((*iter).m_key, &(*iter).m_value, a)) + break; + } + private: hash_table<hash_entry> m_table; }; |