class CachedFileSystemEntry

Declaration

class CachedFileSystemEntry { /* full declaration omitted */ };

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 \c EntryRef that knows the requested filename.

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:59

Member Variables

private llvm::ErrorOr<llvm::vfs::Status> MaybeStat
Either the filesystem error or status of the entry. The filename is empty and only materialized by \c EntryRef.
private clang::tooling::dependencies::CachedFileContents* Contents
We're using pointer here to keep the size of this class small. Instances representing directories and filesystem errors don't hold any contents anyway.

Method Overview

Methods

CachedFileSystemEntry(
    llvm::ErrorOr<llvm::vfs::Status> Stat)

Description

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

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:63

Parameters

llvm::ErrorOr<llvm::vfs::Status> Stat

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

Description

Creates an entry representing a file with contents.

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:69

Parameters

llvm::ErrorOr<llvm::vfs::Status> Stat
clang::tooling::dependencies::CachedFileContents* Contents

void clearStatName()

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:128

clang::tooling::dependencies::CachedFileContents*
getCachedContents() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:121

Returns

The data structure holding both contents and directive tokens.

Optional<ArrayRef<
    dependency_directives_scan::Directive>>
getDirectiveTokens() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:92

Returns

The scanned preprocessor directive tokens of the file that are used to speed up preprocessing, if available.

std::error_code getError() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:105

Returns

The error.

llvm::StringRef getOriginalContents() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:82

Returns

Original contents of the file.

llvm::vfs::Status getStatus() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:108

Returns

The entry status with empty filename.

llvm::sys::fs::UniqueID getUniqueID() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:115

Returns

The unique ID of the entry.

bool isDirectory() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:79

Returns

True if the current entry represents a directory.

bool isError() const

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h:76

Returns

True if the entry is a filesystem error.