clang API Documentation
#include <FileManager.h>


Classes | |
| class | UniqueDirContainer |
| class | UniqueFileContainer |
Public Member Functions | |
| FileManager (const FileSystemOptions &FileSystemOpts) | |
| ~FileManager () | |
| void | addStatCache (FileSystemStatCache *statCache, bool AtBeginning=false) |
| Installs the provided FileSystemStatCache object within the FileManager. | |
| void | removeStatCache (FileSystemStatCache *statCache) |
| Removes the specified FileSystemStatCache object from the manager. | |
| const DirectoryEntry * | getDirectory (StringRef DirName, bool CacheFailure=true) |
| const FileEntry * | getFile (StringRef Filename, bool OpenFile=false, bool CacheFailure=true) |
| Lookup, cache, and verify the specified file (real or virtual). This returns NULL if the file doesn't exist. | |
| const FileSystemOptions & | getFileSystemOptions () |
| Returns the current file system options. | |
| const FileEntry * | getVirtualFile (StringRef Filename, off_t Size, time_t ModificationTime) |
| Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on disk. The file itself is not accessed. | |
| llvm::MemoryBuffer * | getBufferForFile (const FileEntry *Entry, std::string *ErrorStr=0) |
| Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. | |
| llvm::MemoryBuffer * | getBufferForFile (StringRef Filename, std::string *ErrorStr=0) |
| bool | getNoncachedStatValue (StringRef Path, struct stat &StatBuf) |
| void | FixupRelativePath (SmallVectorImpl< char > &path) const |
| If path is not absolute and FileSystemOptions set the working directory, the path is modified to be relative to the given working directory. | |
| void | GetUniqueIDMapping (SmallVectorImpl< const FileEntry * > &UIDToFiles) const |
| Produce an array mapping from the unique IDs assigned to each file to the corresponding FileEntry pointer. | |
| void | PrintStats () const |
FileManager - Implements support for file system lookup, file system caching, and directory search management. This also handles more advanced properties, such as uniquing files based on "inode", so that a file with two names (e.g. symlinked) will be treated as a single file.
Definition at line 113 of file FileManager.h.
| FileManager::FileManager | ( | const FileSystemOptions & | FileSystemOpts | ) |
Definition at line 163 of file FileManager.cpp.
| FileManager::~FileManager | ( | ) |
Definition at line 172 of file FileManager.cpp.
| void FileManager::addStatCache | ( | FileSystemStatCache * | statCache, |
| bool | AtBeginning = false |
||
| ) |
Installs the provided FileSystemStatCache object within the FileManager.
Ownership of this object is transferred to the FileManager.
| statCache | the new stat cache to install. Ownership of this object is transferred to the FileManager. |
| AtBeginning | whether this new stat cache must be installed at the beginning of the chain of stat caches. Otherwise, it will be added to the end of the chain. |
Definition at line 181 of file FileManager.cpp.
References clang::FileSystemStatCache::getNextStatCache(), and clang::FileSystemStatCache::setNextStatCache().
Referenced by clang::CacheTokens(), clang::PCHGenerator::PCHGenerator(), and clang::Preprocessor::setPTHManager().
| void FileManager::FixupRelativePath | ( | SmallVectorImpl< char > & | path | ) | const |
If path is not absolute and FileSystemOptions set the working directory, the path is modified to be relative to the given working directory.
Definition at line 473 of file FileManager.cpp.
References clang::FileSystemOptions::WorkingDir.
Referenced by getBufferForFile(), and getNoncachedStatValue().
| llvm::MemoryBuffer * FileManager::getBufferForFile | ( | const FileEntry * | Entry, |
| std::string * | ErrorStr = 0 |
||
| ) |
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
Definition at line 486 of file FileManager.cpp.
References FixupRelativePath(), getFile(), clang::FileEntry::getName(), clang::FileEntry::getSize(), and clang::FileSystemOptions::WorkingDir.
Referenced by clang::serialization::ModuleManager::addModule(), clang::GenerateModuleAction::BeginSourceFileAction(), clang::HeaderMap::Create(), clang::CodeGenAction::CreateASTConsumer(), clang::PrintPreambleAction::ExecuteAction(), clang::SrcMgr::ContentCache::getBuffer(), clang::ASTUnit::getBufferForFile(), and clang::ASTReader::getOriginalSourceFile().
| llvm::MemoryBuffer * FileManager::getBufferForFile | ( | StringRef | Filename, |
| std::string * | ErrorStr = 0 |
||
| ) |
Definition at line 521 of file FileManager.cpp.
References FixupRelativePath(), getFile(), and clang::FileSystemOptions::WorkingDir.
| const DirectoryEntry * FileManager::getDirectory | ( | StringRef | DirName, |
| bool | CacheFailure = true |
||
| ) |
getDirectory - Lookup, cache, and verify the specified directory (real or virtual). This returns NULL if the directory doesn't exist.
| CacheFailure | If true and the file does not exist, we'll cache the failure to find this file. |
getDirectory - Lookup, cache, and verify the specified directory (real or virtual). This returns NULL if the directory doesn't exist.
Definition at line 266 of file FileManager.cpp.
References clang::FileManager::UniqueDirContainer::getDirectory(), clang::DirectoryEntry::getName(), and NON_EXISTENT_DIR.
Referenced by clang::ApplyHeaderSearchOptions(), clang::HeaderSearch::collectAllModules(), computeRelativePath(), clang::ModuleMap::findModuleForHeader(), getDirectoryFromFile(), clang::HeaderSearch::hasModuleMap(), clang::ModuleMap::inferFrameworkModule(), clang::ModuleMap::isHeaderInUnavailableModule(), clang::HeaderSearch::lookupModule(), and clang::HeaderSearch::LookupSubframeworkHeader().
| const FileEntry * FileManager::getFile | ( | StringRef | Filename, |
| bool | openFile = false, |
||
| bool | CacheFailure = true |
||
| ) |
Lookup, cache, and verify the specified file (real or virtual). This returns NULL if the file doesn't exist.
| OpenFile | if true and the file exists, it will be opened. |
| CacheFailure | If true and the file does not exist, we'll cache the failure to find this file. |
getFile - Lookup, cache, and verify the specified file (real or virtual). This returns NULL if the file doesn't exist.
Definition at line 321 of file FileManager.cpp.
References getDirectoryFromFile(), clang::FileManager::UniqueFileContainer::getFile(), clang::FileEntry::getName(), and NON_EXISTENT_FILE.
Referenced by clang::serialization::ModuleManager::addModule(), clang::GenerateModuleAction::BeginSourceFileAction(), collectModuleHeaderIncludes(), EnableCodeCompletion(), getBufferForFile(), clang::Preprocessor::HandleEndOfFile(), clang::ASTImporter::Import(), clang::ModuleMap::inferFrameworkModule(), InitializeFileRemapping(), clang::CompilerInstance::InitializeSourceManager(), clang::CompilerInstance::loadModule(), clang::HeaderSearch::loadModuleMapFile(), clang::serialization::ModuleManager::lookup(), clang::serialization::ModuleManager::lookupBuffer(), clang::HeaderMap::LookupFile(), clang::DirectoryLookup::LookupFile(), clang::HeaderSearch::LookupFile(), clang::HeaderSearch::LookupSubframeworkHeader(), and clang::HeaderSearch::NormalizeDashIncludePath().
| const FileSystemOptions& clang::FileManager::getFileSystemOptions | ( | ) | [inline] |
Returns the current file system options.
Definition at line 199 of file FileManager.h.
| bool FileManager::getNoncachedStatValue | ( | StringRef | Path, |
| struct stat & | StatBuf | ||
| ) |
Definition at line 559 of file FileManager.cpp.
References FixupRelativePath().
| void FileManager::GetUniqueIDMapping | ( | SmallVectorImpl< const FileEntry * > & | UIDToFiles | ) | const |
Produce an array mapping from the unique IDs assigned to each file to the corresponding FileEntry pointer.
Definition at line 567 of file FileManager.cpp.
References NON_EXISTENT_FILE.
| const FileEntry * FileManager::getVirtualFile | ( | StringRef | Filename, |
| off_t | Size, | ||
| time_t | ModificationTime | ||
| ) |
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on disk. The file itself is not accessed.
Definition at line 402 of file FileManager.cpp.
References getDirectoryFromFile(), clang::FileManager::UniqueFileContainer::getFile(), clang::FileEntry::getName(), and NON_EXISTENT_FILE.
Referenced by clang::serialization::ModuleManager::addInMemoryBuffer(), clang::GenerateModuleAction::BeginSourceFileAction(), InitializeFileRemapping(), and clang::CompilerInstance::InitializeSourceManager().
| void FileManager::PrintStats | ( | ) | const |
Definition at line 588 of file FileManager.cpp.
References clang::FileManager::UniqueDirContainer::size(), and clang::FileManager::UniqueFileContainer::size().
Referenced by clang::CompilerInstance::ExecuteAction().
| void FileManager::removeStatCache | ( | FileSystemStatCache * | statCache | ) |
Removes the specified FileSystemStatCache object from the manager.
Definition at line 197 of file FileManager.cpp.
References clang::FileSystemStatCache::getNextStatCache(), and clang::FileSystemStatCache::setNextStatCache().
Referenced by clang::CacheTokens().