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

An in-memory representation of a file system entity that is of interest to the dependency scanning filesystem. More...

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

Public Member Functions

 CachedFileSystemEntry (llvm::ErrorOr< llvm::vfs::Status > Stat)
 Creates an entry without contents: either a filesystem error or a directory with stat value.
 CachedFileSystemEntry (llvm::ErrorOr< llvm::vfs::Status > Stat, CachedFileContents *Contents)
 Creates an entry representing a file with contents.
bool isError () const
bool isDirectory () const
StringRef getOriginalContents () const
std::optional< ArrayRef< dependency_directives_scan::Directive > > getDirectiveTokens () const
std::error_code getError () const
llvm::vfs::Status getStatus () const
llvm::sys::fs::UniqueID getUniqueID () const
CachedFileContentsgetCachedContents () const

Detailed Description

An in-memory representation of a file system entity that is of interest to the dependency scanning filesystem.

It represents one of the following:

  • opened file with contents and a stat value,
  • opened file with contents, directive tokens and a stat value,
  • directory entry with its stat value,
  • filesystem error.

Single instance of this class can be shared across different filenames (e.g. a regular file and a symlink). For this reason the status filename is empty and is only materialized by EntryRef that knows the requested filename.

Definition at line 61 of file DependencyScanningFilesystem.h.

Constructor & Destructor Documentation

◆ CachedFileSystemEntry() [1/2]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( llvm::ErrorOr< llvm::vfs::Status > Stat)
inline

Creates an entry without contents: either a filesystem error or a directory with stat value.

Definition at line 65 of file DependencyScanningFilesystem.h.

References clang::nullptr.

◆ CachedFileSystemEntry() [2/2]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( llvm::ErrorOr< llvm::vfs::Status > Stat,
CachedFileContents * Contents )
inline

Creates an entry representing a file with contents.

Definition at line 71 of file DependencyScanningFilesystem.h.

Member Function Documentation

◆ getCachedContents()

CachedFileContents * clang::tooling::dependencies::CachedFileSystemEntry::getCachedContents ( ) const
inline
Returns
The data structure holding both contents and directive tokens.

Definition at line 122 of file DependencyScanningFilesystem.h.

References isDirectory(), and isError().

◆ getDirectiveTokens()

std::optional< ArrayRef< dependency_directives_scan::Directive > > clang::tooling::dependencies::CachedFileSystemEntry::getDirectiveTokens ( ) const
inline
Returns
The scanned preprocessor directive tokens of the file that are used to speed up preprocessing, if available.

Definition at line 94 of file DependencyScanningFilesystem.h.

References isDirectory(), and isError().

◆ getError()

std::error_code clang::tooling::dependencies::CachedFileSystemEntry::getError ( ) const
inline

◆ getOriginalContents()

StringRef clang::tooling::dependencies::CachedFileSystemEntry::getOriginalContents ( ) const
inline
Returns
Original contents of the file.

Definition at line 84 of file DependencyScanningFilesystem.h.

References isError().

◆ getStatus()

llvm::vfs::Status clang::tooling::dependencies::CachedFileSystemEntry::getStatus ( ) const
inline
Returns
The entry status with empty filename.

Definition at line 109 of file DependencyScanningFilesystem.h.

References isError().

Referenced by clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::getOutOfDateEntries().

◆ getUniqueID()

llvm::sys::fs::UniqueID clang::tooling::dependencies::CachedFileSystemEntry::getUniqueID ( ) const
inline
Returns
The unique ID of the entry.

Definition at line 116 of file DependencyScanningFilesystem.h.

References isError().

◆ isDirectory()

bool clang::tooling::dependencies::CachedFileSystemEntry::isDirectory ( ) const
inline
Returns
True if the current entry represents a directory.

Definition at line 81 of file DependencyScanningFilesystem.h.

References isError().

Referenced by getCachedContents(), and getDirectiveTokens().

◆ isError()

bool clang::tooling::dependencies::CachedFileSystemEntry::isError ( ) const
inline
Returns
True if the entry is a filesystem error.

Definition at line 78 of file DependencyScanningFilesystem.h.

Referenced by getCachedContents(), getDirectiveTokens(), getOriginalContents(), getStatus(), getUniqueID(), and isDirectory().


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