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 {
42 llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
44 typedef llvm::SetVector<const FileEntry *> AdditionalKnownModuleFileSet;
48 AdditionalKnownModuleFileSet AdditionalKnownModuleFiles;
58 llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
83 explicit VisitState(
unsigned N)
84 : VisitNumber(N, 0), NextVisitNumber(1), NextState(
nullptr)
102 unsigned NextVisitNumber;
105 VisitState *NextState;
109 VisitState *FirstVisitState;
111 VisitState *allocateVisitState();
112 void returnVisitState(VisitState *
State);
160 std::unique_ptr<llvm::MemoryBuffer>
lookupBuffer(StringRef Name);
163 unsigned size()
const {
return Chain.size(); }
216 off_t ExpectedSize, time_t ExpectedModTime,
220 std::string &ErrorStr);
224 llvm::SmallPtrSetImpl<ModuleFile *> &LoadedSuccessfully,
229 std::unique_ptr<llvm::MemoryBuffer> Buffer);
245 llvm::iterator_range<AdditionalKnownModuleFileSet::const_iterator>
247 return llvm::make_range(AdditionalKnownModuleFiles.begin(),
248 AdditionalKnownModuleFiles.end());
274 void visit(
bool (*Visitor)(
ModuleFile &M,
void *UserData),
void *UserData,
275 llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit =
nullptr);
304 bool (*PostorderVisitor)(
ModuleFile &M,
void *UserData),
326 time_t ExpectedModTime,
bool addKnownModuleFile(StringRef FileName)
Notification from the frontend that the given module file is part of this compilation (even if not im...
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.
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. This is in reverse source-order.
AddModuleResult
The result of attempting to add a new module.
ModuleIterator begin()
Forward iterator to traverse all loaded modules. This is reverse source-order.
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.
void visitDepthFirst(DFSPreorderControl(*PreorderVisitor)(ModuleFile &M, void *UserData), bool(*PostorderVisitor)(ModuleFile &M, void *UserData), void *UserData)
Visit each of the modules with a depth-first traversal.
Stop the visitation immediately.
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.
llvm::iterator_range< AdditionalKnownModuleFileSet::const_iterator > getAdditionalKnownModuleFiles()
Get a list of additional module files that are not currently loaded but are considered to be part of ...
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.
DFSPreorderControl
Control DFS behavior during preorder visitation.
void visit(bool(*Visitor)(ModuleFile &M, void *UserData), void *UserData, llvm::SmallPtrSetImpl< ModuleFile * > *ModuleFilesHit=nullptr)
Visit each of the modules.
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. The SourceManager can decode this to get at the full include stack...
Cached information about one file (either on disk or in the virtual file system). ...
ModuleReverseIterator rbegin()
Reverse iterator to traverse all loaded modules. This is in source order.
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.
Continue visiting all nodes.
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.