|
clang 23.0.0git
|
Manages the set of modules loaded by an AST reader. More...
#include "clang/Serialization/ModuleManager.h"
Public Types | |
| using | ModuleIterator |
| using | ModuleConstIterator |
| using | ModuleReverseIterator |
| using | ModuleOffset = std::pair<uint32_t, StringRef> |
| using | ASTFileSignatureReader = ASTFileSignature (*)(StringRef) |
Public Member Functions | |
| ModuleManager (FileManager &FileMgr, ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, const HeaderSearch &HeaderSearchInfo) | |
| ModuleIterator | begin () |
| Forward iterator to traverse all loaded modules. | |
| ModuleIterator | end () |
| Forward iterator end-point to traverse all loaded modules. | |
| ModuleConstIterator | begin () const |
| Const forward iterator to traverse all loaded modules. | |
| ModuleConstIterator | end () const |
| Const forward iterator end-point to traverse all loaded modules. | |
| ModuleReverseIterator | rbegin () |
| Reverse iterator to traverse all loaded modules. | |
| ModuleReverseIterator | rend () |
| Reverse iterator end-point to traverse all loaded modules. | |
| llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > | pch_modules () const |
| A range covering the PCH and preamble module files loaded. | |
| ModuleFile & | getPrimaryModule () |
| Returns the primary module associated with the manager, that is, the first module loaded. | |
| ModuleFile & | getPrimaryModule () const |
| Returns the primary module associated with the manager, that is, the first module loaded. | |
| ModuleFile & | operator[] (unsigned Index) const |
| Returns the module associated with the given index. | |
| ModuleFile * | lookupByModuleName (StringRef ModName) const |
| Returns the module associated with the given module name. | |
| ModuleFile * | lookupByFileName (ModuleFileName FileName) const |
| Returns the module associated with the given module file name. | |
| ModuleFile * | lookup (ModuleFileKey Key) const |
| Returns the module associated with the given module file key. | |
| std::unique_ptr< llvm::MemoryBuffer > | lookupBuffer (StringRef Name) |
| Returns the in-memory (virtual file) buffer with the given name. | |
| unsigned | size () const |
| Number of modules loaded. | |
| AddModuleResult | addModule (ModuleFileName FileName, ModuleKind Type, SourceLocation ImportLoc, ModuleFile *ImportedBy, unsigned Generation, off_t ExpectedSize, time_t ExpectedModTime, ASTFileSignature ExpectedSignature, ASTFileSignatureReader ReadSignature) |
| Attempts to create a new module and add it to the list of known modules. | |
| void | removeModules (ModuleIterator First) |
| Remove the modules starting from First (to the end). | |
| void | addInMemoryBuffer (StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer) |
| Add an in-memory buffer the list of known buffers. | |
| void | setGlobalIndex (GlobalModuleIndex *Index) |
| Set the global module index. | |
| void | moduleFileAccepted (ModuleFile *MF) |
| Notification from the AST reader that the given module file has been "accepted", and will not (can not) be unloaded. | |
| void | visit (llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr) |
| Visit each of the modules. | |
| void | viewGraph () |
| View the graphviz representation of the module graph. | |
| ModuleCache & | getModuleCache () const |
Manages the set of modules loaded by an AST reader.
Definition at line 102 of file ModuleManager.h.
| using clang::serialization::ModuleManager::ASTFileSignatureReader = ASTFileSignature (*)(StringRef) |
Definition at line 253 of file ModuleManager.h.
Definition at line 193 of file ModuleManager.h.
Definition at line 191 of file ModuleManager.h.
| using clang::serialization::ModuleManager::ModuleOffset = std::pair<uint32_t, StringRef> |
Definition at line 197 of file ModuleManager.h.
Definition at line 195 of file ModuleManager.h.
| ModuleManager::ModuleManager | ( | FileManager & | FileMgr, |
| ModuleCache & | ModCache, | ||
| const PCHContainerReader & | PCHContainerRdr, | ||
| const HeaderSearch & | HeaderSearchInfo ) |
Definition at line 370 of file ModuleManager.cpp.
| void ModuleManager::addInMemoryBuffer | ( | StringRef | FileName, |
| std::unique_ptr< llvm::MemoryBuffer > | Buffer ) |
Add an in-memory buffer the list of known buffers.
Definition at line 324 of file ModuleManager.cpp.
References clang::FileName.
| AddModuleResult ModuleManager::addModule | ( | ModuleFileName | FileName, |
| ModuleKind | Type, | ||
| SourceLocation | ImportLoc, | ||
| ModuleFile * | ImportedBy, | ||
| unsigned | Generation, | ||
| off_t | ExpectedSize, | ||
| time_t | ExpectedModTime, | ||
| ASTFileSignature | ExpectedSignature, | ||
| ASTFileSignatureReader | ReadSignature ) |
Attempts to create a new module and add it to the list of known modules.
| FileName | The file name of the module to be loaded. |
| Type | The kind of module being loaded. |
| ImportLoc | The location at which the module is imported. |
| ImportedBy | The module that is importing this module, or NULL if this module is imported directly by the user. |
| Generation | The generation in which this module was loaded. |
| ExpectedSize | The expected size of the module file, used for validation. This will be zero if unknown. |
| ExpectedModTime | The expected modification time of the module file, used for validation. This will be zero if unknown. |
| ExpectedSignature | The expected signature of the module file, used for validation. This will be zero if unknown. |
| ReadSignature | Reads the signature from an AST file without actually loading it. |
Definition at line 111 of file ModuleManager.cpp.
References clang::InMemoryModuleCache::addBuiltPCM(), clang::InMemoryModuleCache::addPCM(), clang::serialization::AddModuleResult::AlreadyLoaded, clang::serialization::Disabled, clang::FileName, clang::ModuleCache::getInMemoryModuleCache(), clang::FileEntryRef::getModificationTime(), getModuleCache(), clang::FileEntryRef::getSize(), clang::serialization::ModuleFile::Kind, lookup(), lookupBuffer(), clang::serialization::AddModuleResult::Missing, clang::serialization::MK_ExplicitModule, clang::serialization::MK_ImplicitModule, clang::serialization::MK_PrebuiltModule, clang::serialization::AddModuleResult::NewlyLoaded, clang::serialization::NotStarted, clang::Result, and updateModuleImports().
|
inline |
Forward iterator to traverse all loaded modules.
Definition at line 204 of file ModuleManager.h.
Referenced by llvm::GraphTraits< ModuleManager >::nodes_begin(), and removeModules().
|
inline |
Const forward iterator to traverse all loaded modules.
Definition at line 210 of file ModuleManager.h.
|
inline |
Forward iterator end-point to traverse all loaded modules.
Definition at line 207 of file ModuleManager.h.
Referenced by llvm::GraphTraits< ModuleManager >::nodes_end(), and removeModules().
|
inline |
Const forward iterator end-point to traverse all loaded modules.
Definition at line 213 of file ModuleManager.h.
|
inline |
Definition at line 329 of file ModuleManager.h.
Referenced by addModule().
|
inline |
Returns the primary module associated with the manager, that is, the first module loaded.
Definition at line 229 of file ModuleManager.h.
Referenced by clang::FrontendAction::BeginSourceFile().
|
inline |
Returns the primary module associated with the manager, that is, the first module loaded.
Definition at line 233 of file ModuleManager.h.
| ModuleFile * ModuleManager::lookup | ( | ModuleFileKey | Key | ) | const |
Returns the module associated with the given module file key.
Definition at line 57 of file ModuleManager.cpp.
Referenced by addModule(), and lookupByFileName().
| std::unique_ptr< llvm::MemoryBuffer > ModuleManager::lookupBuffer | ( | StringRef | Name | ) |
Returns the in-memory (virtual file) buffer with the given name.
Definition at line 62 of file ModuleManager.cpp.
Referenced by addModule().
| ModuleFile * ModuleManager::lookupByFileName | ( | ModuleFileName | FileName | ) | const |
Returns the module associated with the given module file name.
Definition at line 52 of file ModuleManager.cpp.
References lookup(), and clang::ModuleFileName::makeKey().
Referenced by lookupByModuleName().
| ModuleFile * ModuleManager::lookupByModuleName | ( | StringRef | ModName | ) | const |
Returns the module associated with the given module name.
Definition at line 44 of file ModuleManager.cpp.
References clang::FileName, and lookupByFileName().
| void ModuleManager::moduleFileAccepted | ( | ModuleFile * | MF | ) |
Notification from the AST reader that the given module file has been "accepted", and will not (can not) be unloaded.
Definition at line 363 of file ModuleManager.cpp.
|
inline |
Returns the module associated with the given index.
Definition at line 236 of file ModuleManager.h.
|
inline |
A range covering the PCH and preamble module files loaded.
Definition at line 223 of file ModuleManager.h.
Referenced by clang::ASTReader::getLocalModuleFile(), and clang::ASTReader::getModuleFileID().
|
inline |
Reverse iterator to traverse all loaded modules.
Definition at line 216 of file ModuleManager.h.
Referenced by getTopImportImplicitModule().
| void ModuleManager::removeModules | ( | ModuleIterator | First | ) |
Remove the modules starting from First (to the end).
Definition at line 285 of file ModuleManager.cpp.
References begin(), end(), clang::First, and clang::Last.
|
inline |
Reverse iterator end-point to traverse all loaded modules.
Definition at line 219 of file ModuleManager.h.
| void ModuleManager::setGlobalIndex | ( | GlobalModuleIndex * | Index | ) |
Set the global module index.
Definition at line 349 of file ModuleManager.cpp.
|
inline |
Number of modules loaded.
Definition at line 251 of file ModuleManager.h.
Referenced by clang::PCHValidator::ReadDiagnosticOptions(), and visit().
| void ModuleManager::viewGraph | ( | ) |
View the graphviz representation of the module graph.
Definition at line 517 of file ModuleManager.cpp.
| void ModuleManager::visit | ( | llvm::function_ref< bool(ModuleFile &M)> | Visitor, |
| llvm::SmallPtrSetImpl< ModuleFile * > * | ModuleFilesHit = nullptr ) |
Visit each of the modules.
This routine visits each of the modules, starting with the "root" modules that no other loaded modules depend on, and proceeding to the leaf modules, visiting each module only once during the traversal.
This traversal is intended to support various "lookup" operations that can find data in any of the loaded modules.
| Visitor | A visitor function that will be invoked with each module. The return value must be convertible to bool; when false, the visitation continues to modules that the current module depends on. When true, the visitation skips any modules that the current module depends on. |
| ModuleFilesHit | If non-NULL, contains the set of module files that we know we need to visit because the global module index told us to. Any module that is known to both the global module index and the module manager that is not in this set can be skipped. |
Definition at line 376 of file ModuleManager.cpp.
References clang::serialization::ModuleFile::ImportedBy, clang::serialization::ModuleFile::Imports, clang::serialization::ModuleFile::Index, and size().