[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 15 08:59:24 PDT 2025
================
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID(
return CacheShards[Hash % NumShards];
}
+void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths(
+ llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const {
+ // Iterate through all shards and look for cached stat errors.
+ for (unsigned i = 0; i < NumShards; i++) {
+ const CacheShard &Shard = CacheShards[i];
+ for (const auto &Path : Shard.CacheByFilename.keys()) {
+ auto CachedPairIt = Shard.CacheByFilename.find(Path);
----------------
jansvoboda11 wrote:
Why the extra lookup?
```suggestion
for (const auto &[Filename, Entry] : Shard.CacheByFilename) {
const CachedFileSystemEntry *Entry = Entry.first;
```
https://github.com/llvm/llvm-project/pull/135703
More information about the cfe-commits
mailing list