15 #ifndef LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H 16 #define LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H 22 #include "llvm/ADT/DenseMap.h" 23 #include "llvm/ADT/IntrusiveRefCntPtr.h" 24 #include "llvm/ADT/STLExtras.h" 25 #include "llvm/ADT/SmallPtrSet.h" 26 #include "llvm/ADT/SmallVector.h" 27 #include "llvm/ADT/StringRef.h" 28 #include "llvm/ADT/iterator.h" 29 #include "llvm/ADT/iterator_range.h" 40 class GlobalModuleIndex;
42 class MemoryBufferCache;
44 class PCHContainerReader;
46 namespace serialization {
64 llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
80 llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
105 explicit VisitState(
unsigned N) : VisitNumber(N, 0) {
122 unsigned NextVisitNumber = 1;
125 VisitState *NextState =
nullptr;
129 VisitState *FirstVisitState =
nullptr;
131 VisitState *allocateVisitState();
132 void returnVisitState(VisitState *
State);
167 llvm::iterator_range<SmallVectorImpl<ModuleFile *>::const_iterator>
169 return llvm::make_range(PCHChain.begin(), PCHChain.end());
193 std::unique_ptr<llvm::MemoryBuffer>
lookupBuffer(StringRef Name);
196 unsigned size()
const {
return Chain.size(); }
252 off_t ExpectedSize, time_t ExpectedModTime,
256 std::string &ErrorStr);
260 llvm::SmallPtrSetImpl<ModuleFile *> &LoadedSuccessfully,
265 std::unique_ptr<llvm::MemoryBuffer> Buffer);
294 llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit =
nullptr);
315 time_t ExpectedModTime,
328 #endif // LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H std::pair< uint32_t, StringRef > ModuleOffset
Implements support for file system lookup, file system caching, and directory search management...
ModuleFile * lookup(const FileEntry *File) const
Returns the module associated with the given module file.
Defines the clang::Module class, which describes a module in the source code.
ModuleFile & getPrimaryModule() const
Returns the primary module associated with the manager, that is, the first module loaded...
The module file is out-of-date.
The base class of the type hierarchy.
ModuleFile * lookupByFileName(StringRef FileName) const
Returns the module associated with the given file name.
Manages the set of modules loaded by an AST reader.
Manage memory buffers across multiple users.
AddModuleResult
The result of attempting to add a new module.
ModuleIterator begin()
Forward iterator to traverse all loaded modules.
ModuleManager(FileManager &FileMgr, MemoryBufferCache &PCMCache, const PCHContainerReader &PCHContainerRdr, const HeaderSearch &HeaderSearchInfo)
void viewGraph()
View the graphviz representation of the module graph.
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile *> *ModuleFilesHit=nullptr)
Visit each of the modules.
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.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
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...
ASTFileSignature(*)(StringRef) ASTFileSignatureReader
ModuleReverseIterator rend()
Reverse iterator end-point to traverse all loaded modules.
ModuleKind
Specifies the kind of module that has been loaded.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::reverse_iterator > ModuleReverseIterator
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.
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.
MemoryBufferCache & getPCMCache() const
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 & operator[](unsigned Index) const
Returns the module associated with the given index.
llvm::iterator_range< SmallVectorImpl< ModuleFile * >::const_iterator > pch_modules() const
A range covering the PCH and preamble module files loaded.
Dataflow Directional Tag Classes.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
ModuleFile * lookupByModuleName(StringRef ModName) const
Returns the module associated with the given module name.
void removeModules(ModuleIterator First, llvm::SmallPtrSetImpl< ModuleFile *> &LoadedSuccessfully, ModuleMap *modMap)
Remove the modules starting from First (to the end).
void moduleFileAccepted(ModuleFile *MF)
Notification from the AST reader that the given module file has been "accepted", and will not (can no...
unsigned size() const
Number of modules loaded.
Defines the clang::SourceLocation class and associated facilities.
ModuleConstIterator end() const
Const forward iterator end-point to traverse all loaded modules.
ModuleConstIterator begin() const
Const forward iterator to traverse all loaded modules.
The module file had already been loaded.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
std::unique_ptr< llvm::MemoryBuffer > lookupBuffer(StringRef Name)
Returns the in-memory (virtual file) buffer with the given name.