mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 19:07:53 +08:00
[lldb] Avoid repeated map lookups (NFC) (#123892)
This commit is contained in:
@@ -1294,17 +1294,12 @@ bool Process::HasAssignedIndexIDToThread(uint64_t thread_id) {
|
||||
}
|
||||
|
||||
uint32_t Process::AssignIndexIDToThread(uint64_t thread_id) {
|
||||
uint32_t result = 0;
|
||||
std::map<uint64_t, uint32_t>::iterator iterator =
|
||||
m_thread_id_to_index_id_map.find(thread_id);
|
||||
if (iterator == m_thread_id_to_index_id_map.end()) {
|
||||
result = ++m_thread_index_id;
|
||||
m_thread_id_to_index_id_map[thread_id] = result;
|
||||
} else {
|
||||
result = iterator->second;
|
||||
}
|
||||
auto [iterator, inserted] =
|
||||
m_thread_id_to_index_id_map.try_emplace(thread_id, m_thread_index_id + 1);
|
||||
if (inserted)
|
||||
++m_thread_index_id;
|
||||
|
||||
return result;
|
||||
return iterator->second;
|
||||
}
|
||||
|
||||
StateType Process::GetState() {
|
||||
|
||||
Reference in New Issue
Block a user