[llvm] [Support] Use a hetrogenous lookup with std::map (NFC) (PR #113075)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 09:09:42 PDT 2024


https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/113075

>From 5e61eb4b9dfb476d17d2920e1cb8f7aeb658e696 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 19 Oct 2024 18:47:46 -0700
Subject: [PATCH] [Support] Use a hetrogenous lookup with std::map (NFC)

---
 llvm/lib/Support/VirtualFileSystem.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index 928c0b5a24ed65..3e79ecf2fc7e35 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -750,7 +750,7 @@ class InMemoryFileAdaptor : public File {
 
 class InMemoryDirectory : public InMemoryNode {
   Status Stat;
-  std::map<std::string, std::unique_ptr<InMemoryNode>> Entries;
+  std::map<std::string, std::unique_ptr<InMemoryNode>, std::less<>> Entries;
 
 public:
   InMemoryDirectory(Status Stat)
@@ -766,7 +766,7 @@ class InMemoryDirectory : public InMemoryNode {
   UniqueID getUniqueID() const { return Stat.getUniqueID(); }
 
   InMemoryNode *getChild(StringRef Name) const {
-    auto I = Entries.find(Name.str());
+    auto I = Entries.find(Name);
     if (I != Entries.end())
       return I->second.get();
     return nullptr;



More information about the llvm-commits mailing list