clang 22.0.0git
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache Class Reference

This class is a shared cache, that caches the 'stat' and 'open' calls to the underlying real file system, and the scanned preprocessor directives of files. More...

#include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h"

Classes

struct  CacheShard
struct  OutOfDateEntry

Public Member Functions

 DependencyScanningFilesystemSharedCache ()
CacheShardgetShardForFilename (StringRef Filename) const
 Returns shard for the given key.
CacheShardgetShardForUID (llvm::sys::fs::UniqueID UID) const
std::vector< OutOfDateEntrygetOutOfDateEntries (llvm::vfs::FileSystem &UnderlyingFS) const
 Visits all cached entries and re-stat an entry using UnderlyingFS to check if the cache contains out-of-date entries.

Detailed Description

This class is a shared cache, that caches the 'stat' and 'open' calls to the underlying real file system, and the scanned preprocessor directives of files.

It is sharded based on the hash of the key to reduce the lock contention for the worker threads.

Definition at line 154 of file DependencyScanningFilesystem.h.

Constructor & Destructor Documentation

◆ DependencyScanningFilesystemSharedCache()

DependencyScanningFilesystemSharedCache::DependencyScanningFilesystemSharedCache ( )

Definition at line 84 of file DependencyScanningFilesystem.cpp.

Member Function Documentation

◆ getOutOfDateEntries()

std::vector< DependencyScanningFilesystemSharedCache::OutOfDateEntry > DependencyScanningFilesystemSharedCache::getOutOfDateEntries ( llvm::vfs::FileSystem & UnderlyingFS) const

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.

Definition at line 111 of file DependencyScanningFilesystem.cpp.

References clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::CacheShard::CacheByFilename, clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::CacheShard::CacheLock, clang::tooling::dependencies::CachedFileSystemEntry::getError(), and clang::tooling::dependencies::CachedFileSystemEntry::getStatus().

◆ getShardForFilename()

DependencyScanningFilesystemSharedCache::CacheShard & DependencyScanningFilesystemSharedCache::getShardForFilename ( StringRef Filename) const

Returns shard for the given key.

Definition at line 97 of file DependencyScanningFilesystem.cpp.

References llvm::hash_value().

◆ getShardForUID()

DependencyScanningFilesystemSharedCache::CacheShard & DependencyScanningFilesystemSharedCache::getShardForUID ( llvm::sys::fs::UniqueID UID) const

Definition at line 104 of file DependencyScanningFilesystem.cpp.


The documentation for this class was generated from the following files: