clang  10.0.0svn
Public Member Functions | Static 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 ()
 Default constructor creates an entry with an invalid stat. More...
 
 CachedFileSystemEntry (std::error_code Error)
 
bool isValid () const
 
bool isDirectory () const
 
llvm::ErrorOr< StringRef > getContents () const
 
llvm::ErrorOr< llvm::vfs::Status > getStatus () const
 
StringRef getName () const
 
const PreprocessorSkippedRangeMappinggetPPSkippedRangeMapping () const
 Return the mapping between location -> distance that is used to speed up the block skipping in the preprocessor. More...
 
 CachedFileSystemEntry (CachedFileSystemEntry &&)=default
 
CachedFileSystemEntryoperator= (CachedFileSystemEntry &&)=default
 
 CachedFileSystemEntry (const CachedFileSystemEntry &)=delete
 
CachedFileSystemEntryoperator= (const CachedFileSystemEntry &)=delete
 

Static Public Member Functions

static CachedFileSystemEntry createFileEntry (StringRef Filename, llvm::vfs::FileSystem &FS, bool Minimize=true)
 Create an entry that represents an opened source file with minimized or original contents. More...
 
static CachedFileSystemEntry createDirectoryEntry (llvm::vfs::Status &&Stat)
 Create an entry that represents a directory on the filesystem. More...
 

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:

Definition at line 34 of file DependencyScanningFilesystem.h.

Constructor & Destructor Documentation

◆ CachedFileSystemEntry() [1/4]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( )
inline

Default constructor creates an entry with an invalid stat.

Definition at line 37 of file DependencyScanningFilesystem.h.

Referenced by clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::get(), and getPPSkippedRangeMapping().

◆ CachedFileSystemEntry() [2/4]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( std::error_code  Error)
inline

◆ CachedFileSystemEntry() [3/4]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( CachedFileSystemEntry &&  )
default

◆ CachedFileSystemEntry() [4/4]

clang::tooling::dependencies::CachedFileSystemEntry::CachedFileSystemEntry ( const CachedFileSystemEntry )
delete

Member Function Documentation

◆ createDirectoryEntry()

CachedFileSystemEntry CachedFileSystemEntry::createDirectoryEntry ( llvm::vfs::Status &&  Stat)
static

Create an entry that represents a directory on the filesystem.

Definition at line 95 of file DependencyScanningFilesystem.cpp.

Referenced by CachedFileSystemEntry(), and clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::get().

◆ createFileEntry()

CachedFileSystemEntry CachedFileSystemEntry::createFileEntry ( StringRef  Filename,
llvm::vfs::FileSystem &  FS,
bool  Minimize = true 
)
static

Create an entry that represents an opened source file with minimized or original contents.

The filesystem opens the file even for stat calls open to avoid the issues with stat + open of minimized files that might lead to a mismatching size of the file. If file is not minimized, the full file is read and copied into memory to ensure that it's not memory mapped to avoid running out of file descriptors.

Definition at line 18 of file DependencyScanningFilesystem.cpp.

Referenced by CachedFileSystemEntry(), and clang::tooling::dependencies::DependencyScanningFilesystemSharedCache::get().

◆ getContents()

llvm::ErrorOr<StringRef> clang::tooling::dependencies::CachedFileSystemEntry::getContents ( ) const
inline
Returns
The error or the file's contents.

Definition at line 63 of file DependencyScanningFilesystem.h.

References isValid().

◆ getName()

StringRef clang::tooling::dependencies::CachedFileSystemEntry::getName ( ) const
inline
Returns
the name of the file.

Definition at line 78 of file DependencyScanningFilesystem.h.

References isValid().

◆ getPPSkippedRangeMapping()

const PreprocessorSkippedRangeMapping& clang::tooling::dependencies::CachedFileSystemEntry::getPPSkippedRangeMapping ( ) const
inline

Return the mapping between location -> distance that is used to speed up the block skipping in the preprocessor.

Definition at line 85 of file DependencyScanningFilesystem.h.

References CachedFileSystemEntry(), and operator=().

◆ getStatus()

llvm::ErrorOr<llvm::vfs::Status> clang::tooling::dependencies::CachedFileSystemEntry::getStatus ( ) const
inline
Returns
The error or the status of the entry.

Definition at line 72 of file DependencyScanningFilesystem.h.

References isValid().

◆ isDirectory()

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

Definition at line 60 of file DependencyScanningFilesystem.h.

◆ isValid()

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

◆ operator=() [1/2]

CachedFileSystemEntry& clang::tooling::dependencies::CachedFileSystemEntry::operator= ( CachedFileSystemEntry &&  )
default

◆ operator=() [2/2]

CachedFileSystemEntry& clang::tooling::dependencies::CachedFileSystemEntry::operator= ( const CachedFileSystemEntry )
delete

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