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

via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 21 06:51:31 PDT 2024


Author: Kazu Hirata
Date: 2024-10-21T06:51:25-07:00
New Revision: 1bf1e92c72ec9086ab24103cf968e115b7248101

URL: https://github.com/llvm/llvm-project/commit/1bf1e92c72ec9086ab24103cf968e115b7248101
DIFF: https://github.com/llvm/llvm-project/commit/1bf1e92c72ec9086ab24103cf968e115b7248101.diff

LOG: [lldb] Avoid repeated map lookups (NFC) (#113121)

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: 
    


################################################################################
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