[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)
Ben Langmuir via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 11 09:46:02 PDT 2024
================
@@ -130,11 +130,11 @@ DependencyScanningFilesystemSharedCache::CacheShard::
getOrEmplaceEntryForFilename(StringRef Filename,
llvm::ErrorOr<llvm::vfs::Status> Stat) {
std::lock_guard<std::mutex> LockGuard(CacheLock);
- auto Insertion = EntriesByFilename.insert({Filename, nullptr});
- if (Insertion.second)
- Insertion.first->second =
+ const CachedFileSystemEntry *StoredEntry = CacheByFilename[Filename].first;
+ if (!StoredEntry)
+ StoredEntry =
----------------
benlangmuir wrote:
The original code modified the value in the cache, but doesn't this new code only put the value in the local variable StoredEntry (i.e. it's not a reference just a copy)?
https://github.com/llvm/llvm-project/pull/68645
More information about the cfe-commits
mailing list