clang 10.0.0git

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 PreprocessorSkippedRangeMapping & | getPPSkippedRangeMapping () const
| Return the mapping between location -> distance that is used to speed up the block skipping in the preprocessor. More...
| CachedFileSystemEntry (CachedFileSystemEntry &&)=default
CachedFileSystemEntry & | operator= (CachedFileSystemEntry &&)=default
| CachedFileSystemEntry (const CachedFileSystemEntry &)=delete
CachedFileSystemEntry & | operator= (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:

- an opened source file with minimized contents and a stat value.
- an opened source file with original contents and a stat value.
- a directory entry with its stat value.
- an error value to represent a file system error.
- a placeholder with an invalid stat indicating a not yet initialized entry.

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 getPPSkippedRangeMapping().

## ◆ CachedFileSystemEntry() [2/4]

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

Definition at line 39 of file DependencyScanningFilesystem.h.

References createFileEntry(), and Filename.

## ◆ 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.

## ◆ 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().

## ◆ 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

Returns
  True if the entry is valid.

Definition at line 57 of file DependencyScanningFilesystem.h.

Referenced by getContents(), getName(), getStatus(), and shouldCacheStatFailures().

## ◆ operator=() [1/2]

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

Referenced by getPPSkippedRangeMapping().

## ◆ operator=() [2/2]

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

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

- include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
- lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp