Skip to content

Commit ab3850f

Browse files
committed
NFCI: Use structured binding to align with rest of file
1 parent 8d7f7d4 commit ab3850f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,17 @@ DependencyScanningFilesystemSharedCache::CacheShard::getOrEmplaceEntryForUID(
143143
llvm::sys::fs::UniqueID UID, llvm::vfs::Status Stat,
144144
std::unique_ptr<llvm::MemoryBuffer> Contents) {
145145
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) {
148149
CachedFileContents *StoredContents = nullptr;
149150
if (Contents)
150151
StoredContents = new (ContentsStorage.Allocate())
151152
CachedFileContents(std::move(Contents));
152-
Insertion.first->second = new (EntryStorage.Allocate())
153+
CachedEntry = new (EntryStorage.Allocate())
153154
CachedFileSystemEntry(std::move(Stat), StoredContents);
154155
}
155-
return *Insertion.first->second;
156+
return *CachedEntry;
156157
}
157158

158159
const CachedFileSystemEntry &

0 commit comments

Comments
 (0)