[llvm] [llvm-jitlink] Use heterogenous lookups with std::map (NFC) (PR #113245)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 19:09:07 PDT 2024


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

None

>From 0e667f45bb5a8edd406ced1859ac28df16040c51 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 21 Oct 2024 18:55:19 -0700
Subject: [PATCH] [llvm-jitlink] Use heterogenous lookups with std::map (NFC)

---
 llvm/tools/llvm-jitlink/llvm-jitlink.cpp | 2 +-
 llvm/tools/llvm-jitlink/llvm-jitlink.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index d90176818c8e61..cc144cda18e1a3 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1201,7 +1201,7 @@ void Session::modifyPassConfig(const Triple &TT,
 }
 
 Expected<JITDylib *> Session::getOrLoadDynamicLibrary(StringRef LibPath) {
-  auto It = DynLibJDs.find(LibPath.str());
+  auto It = DynLibJDs.find(LibPath);
   if (It != DynLibJDs.end()) {
     return It->second;
   }
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.h b/llvm/tools/llvm-jitlink/llvm-jitlink.h
index e09c15adace20e..07b56680719f69 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.h
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.h
@@ -65,7 +65,7 @@ struct Session {
                                  GetSymbolTargetFunction GetSymbolTarget);
   };
 
-  using DynLibJDMap = std::map<std::string, orc::JITDylib *>;
+  using DynLibJDMap = std::map<std::string, orc::JITDylib *, std::less<>>;
   using SymbolInfoMap = StringMap<MemoryRegionInfo>;
   using FileInfoMap = StringMap<FileInfo>;
 



More information about the llvm-commits mailing list