File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
clang/lib/Tooling/DependencyScanning Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -143,16 +143,17 @@ DependencyScanningFilesystemSharedCache::CacheShard::getOrEmplaceEntryForUID(
143
143
llvm::sys::fs::UniqueID UID, llvm::vfs::Status Stat,
144
144
std::unique_ptr<llvm::MemoryBuffer> Contents) {
145
145
std::lock_guard<std::mutex> LockGuard (CacheLock);
146
- auto Insertion = EntriesByUID.insert ({UID, nullptr });
147
- if (Insertion.second ) {
146
+ auto [It, Inserted] = EntriesByUID.insert ({UID, nullptr });
147
+ auto &CachedEntry = It->getSecond ();
148
+ if (Inserted) {
148
149
CachedFileContents *StoredContents = nullptr ;
149
150
if (Contents)
150
151
StoredContents = new (ContentsStorage.Allocate ())
151
152
CachedFileContents (std::move (Contents));
152
- Insertion. first -> second = new (EntryStorage.Allocate ())
153
+ CachedEntry = new (EntryStorage.Allocate ())
153
154
CachedFileSystemEntry (std::move (Stat), StoredContents);
154
155
}
155
- return *Insertion. first -> second ;
156
+ return *CachedEntry ;
156
157
}
157
158
158
159
const CachedFileSystemEntry &
You can’t perform that action at this time.
0 commit comments