[llvm] 04f45aa - [DebugInfo] Avoid repeated hash lookups (NFC) (#108486)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 22:40:49 PDT 2024


Author: Kazu Hirata
Date: 2024-09-12T22:40:46-07:00
New Revision: 04f45aa7a7874ee6686fad267e44ed6c9b4de19c

URL: https://github.com/llvm/llvm-project/commit/04f45aa7a7874ee6686fad267e44ed6c9b4de19c
DIFF: https://github.com/llvm/llvm-project/commit/04f45aa7a7874ee6686fad267e44ed6c9b4de19c.diff

LOG: [DebugInfo] Avoid repeated hash lookups (NFC) (#108486)

Added: 
    

Modified: 
    llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
index 59d57e83fc1038..801fa06cf3ab7f 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
@@ -39,11 +39,8 @@ class FunctionArgEnumerator : public IPDBEnumChildren<PDBSymbolData> {
     auto DataChildren = Func.findAllChildren<PDBSymbolData>();
     while (auto Child = DataChildren->getNext()) {
       if (Child->getDataKind() == PDB_DataKind::Param) {
-        std::string Name = Child->getName();
-        if (SeenNames.find(Name) != SeenNames.end())
-          continue;
-        Args.push_back(std::move(Child));
-        SeenNames.insert(Name);
+        if (SeenNames.insert(Child->getName()).second)
+          Args.push_back(std::move(Child));
       }
     }
     reset();


        


More information about the llvm-commits mailing list