clang 19.0.0git
Public Member Functions | List of all members
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:

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 60 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 64 of file DependencyScanningFilesystem.h.

◆ 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 70 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 121 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 93 of file DependencyScanningFilesystem.h.

References clang::tooling::dependencies::CachedFileContents::DepDirectives, isDirectory(), and isError().

Referenced by clang::tooling::dependencies::EntryRef::getDirectiveTokens().

◆ getError()

std::error_code clang::tooling::dependencies::CachedFileSystemEntry::getError ( ) const
inline
Returns
The error.

Definition at line 105 of file DependencyScanningFilesystem.h.

Referenced by clang::tooling::dependencies::EntryRef::unwrapError().

◆ getOriginalContents()

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

Definition at line 83 of file DependencyScanningFilesystem.h.

References isError(), and clang::tooling::dependencies::CachedFileContents::Original.

Referenced by clang::tooling::dependencies::EntryRef::getContents().

◆ getStatus()

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

Definition at line 108 of file DependencyScanningFilesystem.h.

References isError().

Referenced by clang::tooling::dependencies::EntryRef::getStatus().

◆ getUniqueID()

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

Definition at line 115 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 80 of file DependencyScanningFilesystem.h.

References isError().

Referenced by getCachedContents(), getDirectiveTokens(), and clang::tooling::dependencies::EntryRef::isDirectory().

◆ isError()

bool clang::tooling::dependencies::CachedFileSystemEntry::isError ( ) const
inline

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