[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113121)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 20 18:47:53 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113121

None

>From 14a4eccbbde981c5ff3a4d9e3081398d5609a699 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 20 Oct 2024 12:07:41 -0700
Subject: [PATCH] [lldb] Avoid repeated map lookups (NFC)

---
 lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 584c2115459c66..4fc48b4d133382 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1295,12 +1295,11 @@ void SymbolFilePDB::CacheFunctionNames() {
         continue;
 
       if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
-        auto vm_addr = pub_sym_up->getVirtualAddress();
-
         // PDB public symbol has mangled name for its associated function.
-        if (vm_addr && addr_ids.find(vm_addr) != addr_ids.end()) {
-          // Cache mangled name.
-          m_func_full_names.Append(ConstString(name), addr_ids[vm_addr]);
+        if (auto vm_addr = pub_sym_up->getVirtualAddress()) {
+          if (auto it = addr_ids.find(vm_addr); it != addr_ids.end())
+            // Cache mangled name.
+            m_func_full_names.Append(ConstString(name), it->second);
         }
       }
     }



More information about the lldb-commits mailing list