aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2025-02-10 11:54:58 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2025-02-11 10:10:31 -0500
commit8e745eac7db3d7a8989d88d36f8823fcc77d1a1b (patch)
tree9d39136d65b246c1ad4befda5c86ca4b165ae9b6
parent6c6492e7d34cf563a840d26d44b67e41763dcaa4 (diff)
downloadbinutils-8e745eac7db3d7a8989d88d36f8823fcc77d1a1b.zip
binutils-8e745eac7db3d7a8989d88d36f8823fcc77d1a1b.tar.gz
binutils-8e745eac7db3d7a8989d88d36f8823fcc77d1a1b.tar.bz2
gdb/dwarf: rename cooked_index::m_vector to m_shards
I think that is clearer and helps readability. Rename a few iteration variables from "index" or "idx" to "shard". In my mental model, the "index" is the whole thing, so it's confusing to use that word when referring to shards. Change-Id: I208cb839e873c514d1f8eae250d4a16f31016148 Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/dwarf2/cooked-index.c30
-rw-r--r--gdb/dwarf2/cooked-index.h8
2 files changed, 19 insertions, 19 deletions
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 0aaa405..896f587 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -647,12 +647,12 @@ cooked_index::wait (cooked_state desired_state, bool allow_quit)
}
void
-cooked_index::set_contents (std::vector<cooked_index_shard_up> &&vec,
+cooked_index::set_contents (std::vector<cooked_index_shard_up> &&shards,
deferred_warnings *warn,
const parent_map_map *parent_maps)
{
- gdb_assert (m_vector.empty ());
- m_vector = std::move (vec);
+ gdb_assert (m_shards.empty ());
+ m_shards = std::move (shards);
m_state->set (cooked_state::MAIN_AVAILABLE);
@@ -668,10 +668,10 @@ cooked_index::set_contents (std::vector<cooked_index_shard_up> &&vec,
m_state->set (cooked_state::CACHE_DONE);
});
- for (auto &idx : m_vector)
+ for (auto &shard : m_shards)
{
- auto this_index = idx.get ();
- finalizers.add_task ([=] () { this_index->finalize (parent_maps); });
+ auto this_shard = shard.get ();
+ finalizers.add_task ([=] () { this_shard->finalize (parent_maps); });
}
finalizers.start ();
@@ -697,9 +697,9 @@ cooked_index::lookup (unrelocated_addr addr)
{
/* Ensure that the address maps are ready. */
wait (cooked_state::MAIN_AVAILABLE, true);
- for (const auto &index : m_vector)
+ for (const auto &shard : m_shards)
{
- dwarf2_per_cu_data *result = index->lookup (addr);
+ dwarf2_per_cu_data *result = shard->lookup (addr);
if (result != nullptr)
return result;
}
@@ -714,8 +714,8 @@ cooked_index::get_addrmaps ()
/* Ensure that the address maps are ready. */
wait (cooked_state::MAIN_AVAILABLE, true);
std::vector<const addrmap *> result;
- for (const auto &index : m_vector)
- result.push_back (index->m_addrmap);
+ for (const auto &shard : m_shards)
+ result.push_back (shard->m_addrmap);
return result;
}
@@ -726,9 +726,9 @@ cooked_index::find (const std::string &name, bool completing)
{
wait (cooked_state::FINALIZED, true);
std::vector<cooked_index_shard::range> result_range;
- result_range.reserve (m_vector.size ());
- for (auto &entry : m_vector)
- result_range.push_back (entry->find (name, completing));
+ result_range.reserve (m_shards.size ());
+ for (auto &shard : m_shards)
+ result_range.push_back (shard->find (name, completing));
return range (std::move (result_range));
}
@@ -752,9 +752,9 @@ const cooked_index_entry *
cooked_index::get_main () const
{
const cooked_index_entry *best_entry = nullptr;
- for (const auto &index : m_vector)
+ for (const auto &shard : m_shards)
{
- const cooked_index_entry *entry = index->get_main ();
+ const cooked_index_entry *entry = shard->get_main ();
/* Choose the first "main" we see. We only do this for names
not requiring canonicalization. At this point in the process
names might not have been canonicalized. However, currently,
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 43ac953..b7a38b8 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -658,9 +658,9 @@ public:
{
wait (cooked_state::FINALIZED, true);
std::vector<cooked_index_shard::range> result_range;
- result_range.reserve (m_vector.size ());
- for (auto &entry : m_vector)
- result_range.push_back (entry->all_entries ());
+ result_range.reserve (m_shards.size ());
+ for (auto &shard : m_shards)
+ result_range.push_back (shard->all_entries ());
return range (std::move (result_range));
}
@@ -710,7 +710,7 @@ private:
/* The vector of cooked_index objects. This is stored because the
entries are stored on the obstacks in those objects. */
- std::vector<cooked_index_shard_up> m_vector;
+ std::vector<cooked_index_shard_up> m_shards;
/* This tracks the current state. When this is nullptr, it means
that the state is CACHE_DONE -- it's important to note that only