================ @@ -220,13 +221,34 @@ class DependencyScanningFilesystemSharedCache { CacheShard &getShardForFilename(StringRef Filename) const; CacheShard &getShardForUID(llvm::sys::fs::UniqueID UID) const; - /// Visits all cached entries and re-stat an entry using FS if - /// it is negatively stat cached. If re-stat succeeds on a path, - /// the path is added to InvalidPaths, indicating that the cache - /// may have erroneously negatively cached it. The caller can then - /// use InvalidPaths to issue diagnostics. - std::vector<StringRef> - getInvalidNegativeStatCachedPaths(llvm::vfs::FileSystem &UnderlyingFS) const; + struct OutOfDateEntry { + // A null terminated string that contains a path. + const char *Path = nullptr; + + struct NegativelyCachedInfo {}; + struct SizeChangedInfo { + uint64_t CachedSize = 0; + uint64_t ActualSize = 0; + }; + + std::variant<NegativelyCachedInfo, SizeChangedInfo> Info; + + OutOfDateEntry(const char *Path) + : Path(Path), Info(NegativelyCachedInfo{}) {} + + OutOfDateEntry(const char *Path, uint64_t CachedSize, uint64_t ActualSize) + : Path(Path), Info(SizeChangedInfo{CachedSize, ActualSize}) {} + }; + + /// Visits all cached entries and re-stat an entry using UnderlyingFS to check + /// if the cache contains out-of-date entries. An entry can be out-of-date for + /// two reasons: + /// 1. The entry contains a stat error, indicating the file did not exist + /// in the cache, but the file exists on the UnderlyingFS. + /// 2. The entry is associated with a file whose size is different from the + /// size of the file on the same path on the UnderlyingFS. + std::vector<OutOfDateEntry> + getInvalidEntryDiagInfo(llvm::vfs::FileSystem &UnderlyingFS) const; ---------------- qiongsiwu wrote:
Good catch! Fixed. https://github.com/llvm/llvm-project/pull/144105 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits