14 #ifndef LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H 15 #define LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H 21 #include "llvm/ADT/DenseMap.h" 22 #include "llvm/ADT/IntrusiveRefCntPtr.h" 23 #include "llvm/ADT/STLExtras.h" 24 #include "llvm/ADT/SmallPtrSet.h" 25 #include "llvm/ADT/SmallVector.h" 26 #include "llvm/ADT/StringRef.h" 27 #include "llvm/ADT/iterator.h" 28 #include "llvm/ADT/iterator_range.h" 39 class GlobalModuleIndex;
41 class InMemoryModuleCache;
43 class PCHContainerReader;
45 namespace serialization {
63 llvm::DenseMap<const FileEntry *, ModuleFile *> Modules;
79 llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
104 explicit VisitState(
unsigned N) : VisitNumber(N, 0) {
121 unsigned NextVisitNumber = 1;
124 VisitState *NextState =
nullptr;
128 VisitState *FirstVisitState =
nullptr;
130 VisitState *allocateVisitState();
131 void returnVisitState(VisitState *
State);
166 llvm::iterator_range<SmallVectorImpl<ModuleFile *>::const_iterator>
168 return llvm::make_range(PCHChain.begin(), PCHChain.end());
192 std::unique_ptr<llvm::MemoryBuffer>
lookupBuffer(StringRef Name);
195 unsigned size()
const {
return Chain.size(); }
251 off_t ExpectedSize, time_t ExpectedModTime,
255 std::string &ErrorStr);
262 std::unique_ptr<llvm::MemoryBuffer> Buffer);
291 llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit =
nullptr);
312 time_t ExpectedModTime,
325 #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.
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.
void removeModules(ModuleIterator First, ModuleMap *modMap)
Remove the modules starting from First (to the end).
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.
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
InMemoryModuleCache & getModuleCache() const
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
In-memory cache for modules.
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.
Defines the clang::Module class, which describes a module in the source code.
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.
ModuleManager(FileManager &FileMgr, InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, const HeaderSearch &HeaderSearchInfo)
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 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.