clang
7.0.0
|
A global index for a set of module files, providing information about the identifiers within those module files. More...
#include "clang/Serialization/GlobalModuleIndex.h"
Public Types | |
enum | ErrorCode { EC_None, EC_NotFound, EC_Building, EC_IOError } |
An error code returned when trying to read an index. More... | |
typedef llvm::SmallPtrSet< ModuleFile *, 4 > | HitSet |
A set of module files in which we found a result. More... | |
Public Member Functions | |
~GlobalModuleIndex () | |
IdentifierIterator * | createIdentifierIterator () const |
Returns an iterator for identifiers stored in the index table. More... | |
void | getKnownModules (SmallVectorImpl< ModuleFile *> &ModuleFiles) |
Retrieve the set of modules that have up-to-date indexes. More... | |
void | getModuleDependencies (ModuleFile *File, SmallVectorImpl< ModuleFile *> &Dependencies) |
Retrieve the set of module files on which the given module file directly depends. More... | |
bool | lookupIdentifier (StringRef Name, HitSet &Hits) |
Look for all of the module files with information about the given identifier, e.g., a global function, variable, or type with that name. More... | |
bool | loadedModuleFile (ModuleFile *File) |
Note that the given module file has been loaded. More... | |
void | printStats () |
Print statistics to standard error. More... | |
void | dump () |
Print debugging view to standard error. More... | |
Static Public Member Functions | |
static std::pair< GlobalModuleIndex *, ErrorCode > | readIndex (StringRef Path) |
Read a global index file for the given directory. More... | |
static ErrorCode | writeIndex (FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, StringRef Path) |
Write a global index into the given. More... | |
A global index for a set of module files, providing information about the identifiers within those module files.
The global index is an aid for name lookup into modules, offering a central place where one can look for identifiers determine which module files contain any information about that identifier. This allows the client to restrict the search to only those module files known to have a information about that identifier, improving performance. Moreover, the global module index may know about module files that have not been imported, and can be queried to determine which modules the current translation could or should load to fix a problem.
Definition at line 61 of file GlobalModuleIndex.h.
typedef llvm::SmallPtrSet<ModuleFile *, 4> clang::GlobalModuleIndex::HitSet |
A set of module files in which we found a result.
Definition at line 169 of file GlobalModuleIndex.h.
An error code returned when trying to read an index.
Definition at line 130 of file GlobalModuleIndex.h.
GlobalModuleIndex::~GlobalModuleIndex | ( | ) |
Definition at line 231 of file GlobalModuleIndex.cpp.
IdentifierIterator * GlobalModuleIndex::createIdentifierIterator | ( | ) | const |
Returns an iterator for identifiers stored in the index table.
The caller accepts ownership of the returned object.
Definition at line 939 of file GlobalModuleIndex.cpp.
LLVM_DUMP_METHOD void GlobalModuleIndex::dump | ( | ) |
Print debugging view to standard error.
Definition at line 353 of file GlobalModuleIndex.cpp.
References clang::frontend::ModuleFileInfo.
void GlobalModuleIndex::getKnownModules | ( | SmallVectorImpl< ModuleFile *> & | ModuleFiles | ) |
Retrieve the set of modules that have up-to-date indexes.
ModuleFiles | Will be populated with the set of module files that have been indexed. |
Definition at line 264 of file GlobalModuleIndex.cpp.
void GlobalModuleIndex::getModuleDependencies | ( | ModuleFile * | File, |
SmallVectorImpl< ModuleFile *> & | Dependencies | ||
) |
Retrieve the set of module files on which the given module file directly depends.
Definition at line 272 of file GlobalModuleIndex.cpp.
bool GlobalModuleIndex::loadedModuleFile | ( | ModuleFile * | File | ) |
Note that the given module file has been loaded.
Definition at line 316 of file GlobalModuleIndex.cpp.
Referenced by clang::serialization::ModuleManager::moduleFileAccepted().
Look for all of the module files with information about the given identifier, e.g., a global function, variable, or type with that name.
Name | The identifier to look for. |
Hits | Will be populated with the set of module files that have information about this name. |
Definition at line 290 of file GlobalModuleIndex.cpp.
void GlobalModuleIndex::printStats | ( | ) |
Print statistics to standard error.
Definition at line 343 of file GlobalModuleIndex.cpp.
|
static |
Read a global index file for the given directory.
Path | The path to the specific module cache where the module files for the intended configuration reside. |
The main bitstream cursor for the main block.
Definition at line 236 of file GlobalModuleIndex.cpp.
References IndexFileName.
Referenced by clang::ASTReader::loadGlobalIndex().
|
static |
Write a global index into the given.
FileMgr | The file manager to use to load module files. |
PCHContainerRdr | - The PCHContainerOperations to use for loading and creating modules. |
Path | The path to the directory containing module files, into which the global index will be written. |
Definition at line 821 of file GlobalModuleIndex.cpp.
References IndexFileName.
Referenced by clang::FrontendAction::Execute(), and clang::CompilerInstance::loadGlobalModuleIndex().