diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp --- a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp @@ -113,7 +113,7 @@ DependencyScanningFilesystemSharedCache::SharedFileSystemEntry & DependencyScanningFilesystemSharedCache::SingleCache::get(StringRef Key) { CacheShard &Shard = CacheShards[llvm::hash_value(Key) % NumShards]; - std::unique_lock LockGuard(Shard.CacheLock); + std::lock_guard LockGuard(Shard.CacheLock); auto It = Shard.Cache.try_emplace(Key); return It.first->getValue(); } @@ -195,7 +195,7 @@ &SharedCacheEntry = SharedCache.get(Filename, ShouldMinimize); const CachedFileSystemEntry *Result; { - std::unique_lock LockGuard(SharedCacheEntry.ValueLock); + std::lock_guard LockGuard(SharedCacheEntry.ValueLock); CachedFileSystemEntry &CacheEntry = SharedCacheEntry.Value; if (!CacheEntry.isValid()) {