aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/cooked-index-storage.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2025-03-18 09:48:51 -0400
committerSimon Marchi <simon.marchi@efficios.com>2025-03-18 16:21:29 -0400
commit4ea28692e88cdc4ff5d80f486bfd9ba7a78b5cc7 (patch)
tree5a786ea91d7ad9d09fa277d83998d79d3656101a /gdb/dwarf2/cooked-index-storage.h
parentc08c2adbb03ecd4fa9338932f26143389bf1135e (diff)
downloadbinutils-4ea28692e88cdc4ff5d80f486bfd9ba7a78b5cc7.zip
binutils-4ea28692e88cdc4ff5d80f486bfd9ba7a78b5cc7.tar.gz
binutils-4ea28692e88cdc4ff5d80f486bfd9ba7a78b5cc7.tar.bz2
gdb/dwarf: use gdb::unordered_set for cooked_index_storage::m_reader_hash
Replace an htab with gdb::unordered_set. I think we could also use the dwarf2_per_cu pointer itself as the identity, basically have the functional equivalent of: gdb::unordered_map<dwarf2_per_cu *, cutu_reader_up> But I kept the existing behavior of using dwarf2_per_cu::index as the identity. Change-Id: Ief3df9a71ac26ca7c07a7b79ca0c26c9d031c11d Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2/cooked-index-storage.h')
-rw-r--r--gdb/dwarf2/cooked-index-storage.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/gdb/dwarf2/cooked-index-storage.h b/gdb/dwarf2/cooked-index-storage.h
index 3d0b5b2..449fbe1 100644
--- a/gdb/dwarf2/cooked-index-storage.h
+++ b/gdb/dwarf2/cooked-index-storage.h
@@ -90,18 +90,34 @@ public:
}
private:
+ /* The abbrev table cache used by this indexer. */
+ abbrev_table_cache m_abbrev_table_cache;
/* Hash function for a cutu_reader. */
- static hashval_t hash_cutu_reader (const void *a);
+ struct cutu_reader_hash
+ {
+ using is_transparent = void;
+
+ std::uint64_t operator() (const cutu_reader_up &reader) const noexcept;
+ std::uint64_t operator() (const dwarf2_per_cu &per_cu) const noexcept;
+ };
/* Equality function for cutu_reader. */
- static int eq_cutu_reader (const void *a, const void *b);
+ struct cutu_reader_eq
+ {
+ using is_transparent = void;
- /* The abbrev table cache used by this indexer. */
- abbrev_table_cache m_abbrev_table_cache;
+ bool operator() (const cutu_reader_up &a,
+ const cutu_reader_up &b) const noexcept;
+
+ bool operator() (const dwarf2_per_cu &per_cu,
+ const cutu_reader_up &reader) const noexcept;
+ };
/* A hash table of cutu_reader objects. */
- htab_up m_reader_hash;
+ gdb::unordered_set<cutu_reader_up, cutu_reader_hash, cutu_reader_eq>
+ m_reader_hash;
+
/* The index shard that is being constructed. */
cooked_index_shard_up m_shard;