Skip to content

Commit d050083

Browse files
[lldb] Avoid repeated map lookups (NFC) (#124077)
1 parent 113e1fd commit d050083

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lldb/source/Target/DynamicRegisterInfo.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ void DynamicRegisterInfo::Finalize(const ArchSpec &arch) {
460460
// Now update all value_regs with each register info as needed
461461
const size_t num_regs = m_regs.size();
462462
for (size_t i = 0; i < num_regs; ++i) {
463-
if (m_value_regs_map.find(i) != m_value_regs_map.end())
464-
m_regs[i].value_regs = m_value_regs_map[i].data();
463+
if (auto it = m_value_regs_map.find(i); it != m_value_regs_map.end())
464+
m_regs[i].value_regs = it->second.data();
465465
else
466466
m_regs[i].value_regs = nullptr;
467467
}
@@ -509,8 +509,9 @@ void DynamicRegisterInfo::Finalize(const ArchSpec &arch) {
509509

510510
// Now update all invalidate_regs with each register info as needed
511511
for (size_t i = 0; i < num_regs; ++i) {
512-
if (m_invalidate_regs_map.find(i) != m_invalidate_regs_map.end())
513-
m_regs[i].invalidate_regs = m_invalidate_regs_map[i].data();
512+
if (auto it = m_invalidate_regs_map.find(i);
513+
it != m_invalidate_regs_map.end())
514+
m_regs[i].invalidate_regs = it->second.data();
514515
else
515516
m_regs[i].invalidate_regs = nullptr;
516517
}

0 commit comments

Comments
 (0)