15 #ifndef LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H
16 #define LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/SmallPtrSet.h"
25 class GlobalModuleIndex;
27 class PCHContainerReader;
29 namespace serialization {
47 llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
57 llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
82 explicit VisitState(
unsigned N)
83 : VisitNumber(N, 0), NextVisitNumber(1), NextState(
nullptr)
101 unsigned NextVisitNumber;
104 VisitState *NextState;
108 VisitState *FirstVisitState;
110 VisitState *allocateVisitState();
111 void returnVisitState(VisitState *
State);
140 return llvm::make_range(PCHChain.begin(), PCHChain.end());
164 unsigned size()
const {
return Chain.size(); }
217 off_t ExpectedSize, time_t ExpectedModTime,
221 std::string &ErrorStr);
225 llvm::SmallPtrSetImpl<ModuleFile *> &LoadedSuccessfully,
230 std::unique_ptr<llvm::MemoryBuffer>
Buffer);
259 llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit =
nullptr);
280 time_t ExpectedModTime,
Implements support for file system lookup, file system caching, and directory search management...
Defines the clang::FileManager interface and associated types.
unsigned size() const
Number of modules loaded.
The module file is out-of-date.
The base class of the type hierarchy.
std::unique_ptr< llvm::MemoryBuffer > Buffer
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr)
Visit each of the modules.
Manages the set of modules loaded by an AST reader.
SmallVectorImpl< ModuleFile * >::const_iterator ModuleConstIterator
ModuleConstIterator begin() const
Const forward iterator to traverse all loaded modules.
AddModuleResult
The result of attempting to add a new module.
ModuleIterator begin()
Forward iterator to traverse all loaded modules.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
void viewGraph()
View the graphviz representation of the module graph.
ModuleFile & getPrimaryModule() const
Returns the primary module associated with the manager, that is, the first module loaded...
unsigned ASTFileSignature
void setGlobalIndex(GlobalModuleIndex *Index)
Set the global module index.
Describes a module or submodule.
ASTFileSignature(* ASTFileSignatureReader)(llvm::BitstreamReader &)
bool lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, const FileEntry *&File)
Attempt to resolve the given module file name to a file entry.
ModuleIterator end()
Forward iterator end-point to traverse all loaded modules.
The module file is missing.
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
ModuleReverseIterator rend()
Reverse iterator end-point to traverse all loaded modules.
ModuleKind
Specifies the kind of module that has been loaded.
std::vector< bool > & Stack
SmallVectorImpl< ModuleFile * >::reverse_iterator ModuleReverseIterator
ModuleFile * lookup(StringRef Name)
Returns the module associated with the given name.
Information about a module that has been loaded by the ASTReader.
AddModuleResult addModule(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, ModuleFile *ImportedBy, unsigned Generation, off_t ExpectedSize, time_t ExpectedModTime, ASTFileSignature ExpectedSignature, ASTFileSignatureReader ReadSignature, ModuleFile *&Module, std::string &ErrorStr)
Attempts to create a new module and add it to the list of known modules.
ModuleManager(FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr)
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
ModuleFile & operator[](unsigned Index) const
Returns the module associated with the given index.
Encodes a location in the source.
Cached information about one file (either on disk or in the virtual file system). ...
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules.
A global index for a set of module files, providing information about the identifiers within those mo...
The module file was just loaded in response to this call.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
void moduleFileAccepted(ModuleFile *MF)
Notification from the AST reader that the given module file has been "accepted", and will not (can no...
void removeModules(ModuleIterator first, ModuleIterator last, llvm::SmallPtrSetImpl< ModuleFile * > &LoadedSuccessfully, ModuleMap *modMap)
Remove the given set of modules.
llvm::iterator_range< ModuleConstIterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
std::pair< uint32_t, StringRef > ModuleOffset
ModuleConstIterator end() const
Const forward iterator end-point to traverse all loaded modules.
The module file had already been loaded.
SmallVectorImpl< ModuleFile * >::iterator ModuleIterator
std::unique_ptr< llvm::MemoryBuffer > lookupBuffer(StringRef Name)
Returns the in-memory (virtual file) buffer with the given name.