[llvm] [DebugInfo] Use heterogenous lookups with std::map (NFC) (PR #113118)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 18:40:22 PDT 2024


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

None

>From 87817f1f7138c3b68ec615d186f7be315e7b5376 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 20 Oct 2024 12:13:31 -0700
Subject: [PATCH] [DebugInfo] Use heterogenous lookups with std::map (NFC)

---
 .../llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h   | 2 +-
 llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
index f76f2ecd3e2121..9cda64e33ddf74 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
@@ -47,7 +47,7 @@ struct LVSymbolTableEntry final {
 
 // Function names extracted from the object symbol table.
 class LVSymbolTable final {
-  using LVSymbolNames = std::map<std::string, LVSymbolTableEntry>;
+  using LVSymbolNames = std::map<std::string, LVSymbolTableEntry, std::less<>>;
   LVSymbolNames SymbolNames;
 
 public:
diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
index c45f0e91c43589..932346e1b011bf 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
@@ -87,20 +87,20 @@ LVSectionIndex LVSymbolTable::update(LVScope *Function) {
 
 const LVSymbolTableEntry &LVSymbolTable::getEntry(StringRef Name) {
   static LVSymbolTableEntry Empty = LVSymbolTableEntry();
-  LVSymbolNames::iterator Iter = SymbolNames.find(std::string(Name));
+  LVSymbolNames::iterator Iter = SymbolNames.find(Name);
   return Iter != SymbolNames.end() ? Iter->second : Empty;
 }
 LVAddress LVSymbolTable::getAddress(StringRef Name) {
-  LVSymbolNames::iterator Iter = SymbolNames.find(std::string(Name));
+  LVSymbolNames::iterator Iter = SymbolNames.find(Name);
   return Iter != SymbolNames.end() ? Iter->second.Address : 0;
 }
 LVSectionIndex LVSymbolTable::getIndex(StringRef Name) {
-  LVSymbolNames::iterator Iter = SymbolNames.find(std::string(Name));
+  LVSymbolNames::iterator Iter = SymbolNames.find(Name);
   return Iter != SymbolNames.end() ? Iter->second.SectionIndex
                                    : getReader().getDotTextSectionIndex();
 }
 bool LVSymbolTable::getIsComdat(StringRef Name) {
-  LVSymbolNames::iterator Iter = SymbolNames.find(std::string(Name));
+  LVSymbolNames::iterator Iter = SymbolNames.find(Name);
   return Iter != SymbolNames.end() ? Iter->second.IsComdat : false;
 }
 



More information about the llvm-commits mailing list