clang  3.9.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::FileSystemStatCache Class Referenceabstract

Abstract interface for introducing a FileManager cache for 'stat' system calls, which is used by precompiled and pretokenized headers to improve performance. More...

#include <FileSystemStatCache.h>

Inheritance diagram for clang::FileSystemStatCache:
[legend]
Collaboration diagram for clang::FileSystemStatCache:
[legend]

Public Types

enum  LookupResult { CacheExists, CacheMissing }
 

Public Member Functions

virtual ~FileSystemStatCache ()
 
void setNextStatCache (std::unique_ptr< FileSystemStatCache > Cache)
 Sets the next stat call cache in the chain of stat caches. More...
 
FileSystemStatCachegetNextStatCache ()
 Retrieve the next stat call cache in the chain. More...
 
std::unique_ptr
< FileSystemStatCache
takeNextStatCache ()
 Retrieve the next stat call cache in the chain, transferring ownership of this cache (and, transitively, all of the remaining caches) to the caller. More...
 

Static Public Member Functions

static bool get (const char *Path, FileData &Data, bool isFile, std::unique_ptr< vfs::File > *F, FileSystemStatCache *Cache, vfs::FileSystem &FS)
 Get the 'stat' information for the specified path, using the cache to accelerate it if possible. More...
 

Protected Member Functions

virtual LookupResult getStat (const char *Path, FileData &Data, bool isFile, std::unique_ptr< vfs::File > *F, vfs::FileSystem &FS)=0
 
LookupResult statChained (const char *Path, FileData &Data, bool isFile, std::unique_ptr< vfs::File > *F, vfs::FileSystem &FS)
 

Protected Attributes

std::unique_ptr
< FileSystemStatCache
NextStatCache
 

Detailed Description

Abstract interface for introducing a FileManager cache for 'stat' system calls, which is used by precompiled and pretokenized headers to improve performance.

Definition at line 48 of file FileSystemStatCache.h.

Member Enumeration Documentation

Enumerator
CacheExists 

We know the file exists and its cached stat data.

CacheMissing 

We know that the file doesn't exist.

Definition at line 56 of file FileSystemStatCache.h.

Constructor & Destructor Documentation

virtual clang::FileSystemStatCache::~FileSystemStatCache ( )
inlinevirtual

Definition at line 54 of file FileSystemStatCache.h.

Member Function Documentation

bool FileSystemStatCache::get ( const char *  Path,
FileData Data,
bool  isFile,
std::unique_ptr< vfs::File > *  F,
FileSystemStatCache Cache,
vfs::FileSystem FS 
)
static

Get the 'stat' information for the specified path, using the cache to accelerate it if possible.

FileSystemStatCache::get - Get the 'stat' information for the specified path, using the cache to accelerate it if possible.

Returns
true if the path does not exist or false if it exists.

If isFile is true, then this lookup should only return success for files (not directories). If it is false this lookup should only return success for directories (not files). On a successful file lookup, the implementation can optionally fill in F with a valid File object and the client guarantees that it will close it.

This returns true if the path does not exist or false if it exists.

If isFile is true, then this lookup should only return success for files (not directories). If it is false this lookup should only return success for directories (not files). On a successful file lookup, the implementation can optionally fill in FileDescriptor with a valid descriptor and the client guarantees that it will close it.

Definition at line 43 of file FileSystemStatCache.cpp.

References CacheExists, CacheMissing, copyStatusToFileData(), getStat(), clang::FileData::IsDirectory, clang::vfs::FileSystem::openFileForRead(), and clang::vfs::FileSystem::status().

FileSystemStatCache* clang::FileSystemStatCache::getNextStatCache ( )
inline

Retrieve the next stat call cache in the chain.

Definition at line 82 of file FileSystemStatCache.h.

References NextStatCache.

Referenced by clang::FileManager::addStatCache(), clang::FileManager::removeStatCache(), and statChained().

virtual LookupResult clang::FileSystemStatCache::getStat ( const char *  Path,
FileData Data,
bool  isFile,
std::unique_ptr< vfs::File > *  F,
vfs::FileSystem FS 
)
protectedpure virtual

Implemented in clang::PTHStatCache, and clang::MemorizeStatCalls.

Referenced by get().

void clang::FileSystemStatCache::setNextStatCache ( std::unique_ptr< FileSystemStatCache Cache)
inline

Sets the next stat call cache in the chain of stat caches.

Takes ownership of the given stat cache.

Definition at line 77 of file FileSystemStatCache.h.

References NextStatCache.

Referenced by clang::FileManager::addStatCache(), and clang::FileManager::removeStatCache().

LookupResult clang::FileSystemStatCache::statChained ( const char *  Path,
FileData Data,
bool  isFile,
std::unique_ptr< vfs::File > *  F,
vfs::FileSystem FS 
)
inlineprotected

Definition at line 99 of file FileSystemStatCache.h.

References CacheExists, CacheMissing, getNextStatCache(), and Next.

Referenced by clang::MemorizeStatCalls::getStat().

std::unique_ptr<FileSystemStatCache> clang::FileSystemStatCache::takeNextStatCache ( )
inline

Retrieve the next stat call cache in the chain, transferring ownership of this cache (and, transitively, all of the remaining caches) to the caller.

Definition at line 87 of file FileSystemStatCache.h.

References NextStatCache.

Referenced by clang::FileManager::removeStatCache().

Member Data Documentation

std::unique_ptr<FileSystemStatCache> clang::FileSystemStatCache::NextStatCache
protected

Definition at line 51 of file FileSystemStatCache.h.

Referenced by getNextStatCache(), setNextStatCache(), and takeNextStatCache().


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