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"
22 #include "llvm/ADT/iterator.h"
26 class GlobalModuleIndex;
27 class MemoryBufferCache;
29 class PCHContainerReader;
31 namespace serialization {
49 llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
62 llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
87 explicit VisitState(
unsigned N)
88 : VisitNumber(N, 0), NextVisitNumber(1), NextState(
nullptr)
106 unsigned NextVisitNumber;
109 VisitState *NextState;
113 VisitState *FirstVisitState;
115 VisitState *allocateVisitState();
116 void returnVisitState(VisitState *
State);
119 typedef llvm::pointee_iterator<
122 typedef llvm::pointee_iterator<
125 typedef llvm::pointee_iterator<
150 llvm::iterator_range<SmallVectorImpl<ModuleFile *>::const_iterator>
152 return llvm::make_range(PCHChain.begin(), PCHChain.end());
176 unsigned size()
const {
return Chain.size(); }
229 off_t ExpectedSize, time_t ExpectedModTime,
233 std::string &ErrorStr);
237 llvm::SmallPtrSetImpl<ModuleFile *> &LoadedSuccessfully,
242 std::unique_ptr<llvm::MemoryBuffer>
Buffer);
271 llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit =
nullptr);
292 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.
Manage memory buffers across multiple users.
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.
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...
The signature of a module, which is a hash of the AST content.
void setGlobalIndex(GlobalModuleIndex *Index)
Set the global module index.
Describes a module or submodule.
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.
llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
std::vector< bool > & Stack
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
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.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::const_iterator > ModuleConstIterator
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.
ModuleManager(FileManager &FileMgr, MemoryBufferCache &PCMCache, const PCHContainerReader &PCHContainerRdr)
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.
MemoryBufferCache & getPCMCache() const
void removeModules(ModuleIterator First, llvm::SmallPtrSetImpl< ModuleFile * > &LoadedSuccessfully, ModuleMap *modMap)
Remove the modules starting from First (to the end).
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::reverse_iterator > ModuleReverseIterator
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
ASTFileSignature(* ASTFileSignatureReader)(StringRef)
void moduleFileAccepted(ModuleFile *MF)
Notification from the AST reader that the given module file has been "accepted", and will not (can no...
ModuleFile * lookup(StringRef Name) const
Returns the module associated with the given name.
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.
std::unique_ptr< llvm::MemoryBuffer > lookupBuffer(StringRef Name)
Returns the in-memory (virtual file) buffer with the given name.