[llvm] bc3c83f - [sancov] Use heterogeneous lookups with std::map (NFC) (#113406)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 09:39:58 PST 2024


Author: Kazu Hirata
Date: 2024-11-04T09:39:55-08:00
New Revision: bc3c83fe789ae6041289a06a2fa22b750fc8956c

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

LOG: [sancov] Use heterogeneous lookups with std::map (NFC) (#113406)

Added: 
    

Modified: 
    llvm/tools/sancov/sancov.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp
index b969fc651e0c1c..39feff62391fe1 100644
--- a/llvm/tools/sancov/sancov.cpp
+++ b/llvm/tools/sancov/sancov.cpp
@@ -1049,7 +1049,7 @@ readSymbolizeAndMergeCmdArguments(std::vector<std::string> FileNames) {
 
   {
     // Short name => file name.
-    std::map<std::string, std::string> ObjFiles;
+    std::map<std::string, std::string, std::less<>> ObjFiles;
     std::string FirstObjFile;
     std::set<std::string> CovFiles;
 
@@ -1066,7 +1066,7 @@ readSymbolizeAndMergeCmdArguments(std::vector<std::string> FileNames) {
         CovFiles.insert(FileName);
       } else {
         auto ShortFileName = llvm::sys::path::filename(FileName);
-        if (ObjFiles.find(std::string(ShortFileName)) != ObjFiles.end()) {
+        if (ObjFiles.find(ShortFileName) != ObjFiles.end()) {
           fail("Duplicate binary file with a short name: " + ShortFileName);
         }
 
@@ -1089,7 +1089,7 @@ readSymbolizeAndMergeCmdArguments(std::vector<std::string> FileNames) {
              FileName);
       }
 
-      auto Iter = ObjFiles.find(std::string(Components[1]));
+      auto Iter = ObjFiles.find(Components[1]);
       if (Iter == ObjFiles.end()) {
         fail("Object file for coverage not found: " + FileName);
       }


        


More information about the llvm-commits mailing list