clang 20.0.0git
|
Reads an AST files chain containing the contents of a translation unit. More...
#include "clang/Serialization/ASTReader.h"
Classes | |
class | ListenerScope |
RAII object to temporarily add an AST callback listener. More... | |
class | ModuleDeclIterator |
Public Types | |
enum | ASTReadResult { Success , Failure , Missing , OutOfDate , VersionMismatch , ConfigurationMismatch , HadErrors } |
The result of reading the control block of an AST file, which can fail for various reasons. More... | |
using | RecordData = SmallVector< uint64_t, 64 > |
using | RecordDataImpl = SmallVectorImpl< uint64_t > |
using | ModuleFile = serialization::ModuleFile |
using | ModuleKind = serialization::ModuleKind |
using | ModuleManager = serialization::ModuleManager |
using | ModuleIterator = ModuleManager::ModuleIterator |
using | ModuleConstIterator = ModuleManager::ModuleConstIterator |
using | ModuleReverseIterator = ModuleManager::ModuleReverseIterator |
![]() | |
enum | ExtKind { EK_Always , EK_Never , EK_ReplyHazy } |
Friends | |
class | ASTDeclMerger |
Types of AST files. | |
class | ASTDeclReader |
class | ASTIdentifierIterator |
class | ASTRecordReader |
class | ASTUnit |
class | ASTWriter |
class | PCHValidator |
class | serialization::reader::ASTIdentifierLookupTrait |
class | serialization::ReadMethodPoolVisitor |
class | TypeLocReader |
class | LocalDeclID |
Sema-relevant special data | |
Fields containing data that is used for semantic analysis | |
enum | LoadFailureCapabilities { ARR_None = 0 , ARR_Missing = 0x1 , ARR_OutOfDate = 0x2 , ARR_VersionMismatch = 0x4 , ARR_ConfigurationMismatch = 0x8 , ARR_TreatModuleWithErrorsAsOutOfDate = 0x10 } |
Flags that indicate what kind of AST loading failures the client of the AST reader can directly handle. More... | |
using | RawLocEncoding = SourceLocationEncoding::RawLocEncoding |
SmallVector< GlobalDeclID, 16 > | PreloadedDeclIDs |
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > | CommentsCursors |
Cursors for comments blocks. | |
SmallString< 0 > & | getPathBuf () |
Get the buffer for resolving paths. | |
Decl * | getKeyDeclaration (Decl *D) |
Returns the first key declaration for the given declaration. | |
const Decl * | getKeyDeclaration (const Decl *D) |
template<typename Fn > | |
void | forEachImportedKeyDecl (const Decl *D, Fn Visit) |
Run a callback on each imported key declaration of D . | |
const serialization::reader::DeclContextLookupTable * | getLoadedLookupTables (DeclContext *Primary) const |
Get the loaded lookup tables for Primary , if any. | |
const serialization::reader::ModuleLocalLookupTable * | getModuleLocalLookupTables (DeclContext *Primary) const |
const serialization::reader::DeclContextLookupTable * | getTULocalLookupTables (DeclContext *Primary) const |
serialization::reader::LazySpecializationInfoLookupTable * | getLoadedSpecializationsLookupTables (const Decl *D, bool IsPartial) |
Get the loaded specializations lookup tables for D , if any. | |
bool | haveUnloadedSpecializations (const Decl *D) const |
If we have any unloaded specialization for D . | |
llvm::iterator_range< ModuleDeclIterator > | getModuleFileLevelDecls (ModuleFile &Mod) |
ASTReader (Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={}) | |
Load the AST file and validate its contents against the given Preprocessor. | |
ASTReader (const ASTReader &)=delete | |
ASTReader & | operator= (const ASTReader &)=delete |
~ASTReader () override | |
SourceManager & | getSourceManager () const |
FileManager & | getFileManager () const |
DiagnosticsEngine & | getDiags () const |
ASTReadResult | ReadAST (StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, ModuleFile **NewLoadedModuleFile=nullptr) |
Load the AST file designated by the given file name. | |
void | makeModuleVisible (Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc) |
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup. | |
void | makeNamesVisible (const HiddenNames &Names, Module *Owner) |
Make the names within this set of hidden names visible. | |
void | mergeDefinitionVisibility (NamedDecl *Def, NamedDecl *MergedDef) |
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whenever MergedDef is. | |
std::unique_ptr< ASTReaderListener > | takeListener () |
Take the AST callbacks listener. | |
void | setListener (std::unique_ptr< ASTReaderListener > Listener) |
Set the AST callbacks listener. | |
void | addListener (std::unique_ptr< ASTReaderListener > L) |
Add an AST callback listener. | |
void | setDeserializationListener (ASTDeserializationListener *Listener, bool TakeOwnership=false) |
Set the AST deserialization listener. | |
ASTDeserializationListener * | getDeserializationListener () |
Get the AST deserialization listener. | |
bool | hasGlobalIndex () const |
Determine whether this AST reader has a global index. | |
GlobalModuleIndex * | getGlobalIndex () |
Return global module index. | |
void | resetForReload () |
Reset reader for a reload try. | |
bool | loadGlobalIndex () |
Attempts to load the global index. | |
bool | isGlobalIndexUnavailable () const |
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or does not exist. | |
void | InitializeContext () |
Initializes the ASTContext. | |
void | UpdateSema () |
Update the state of Sema after loading some additional modules. | |
void | addInMemoryBuffer (StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer) |
Add in-memory (virtual file) buffer. | |
void | finalizeForWriting () |
Finalizes the AST reader's state before writing an AST file to disk. | |
ModuleManager & | getModuleManager () |
Retrieve the module manager. | |
const ModuleManager & | getModuleManager () const |
Preprocessor & | getPreprocessor () const |
Retrieve the preprocessor. | |
StringRef | getOriginalSourceFile () |
Retrieve the name of the original source file name for the primary module file. | |
const std::string & | getSuggestedPredefines () |
Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of the predefines build prior to including the precompiled header. | |
PreprocessedEntity * | ReadPreprocessedEntity (unsigned Index) override |
Read a preallocated preprocessed entity from the external source. | |
std::pair< unsigned, unsigned > | findPreprocessedEntitiesInRange (SourceRange Range) override |
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses. | |
std::optional< bool > | isPreprocessedEntityInFileID (unsigned Index, FileID FID) override |
Optionally returns true or false if the preallocated preprocessed entity with index Index came from file FID . | |
SourceRange | ReadSkippedRange (unsigned Index) override |
Read a preallocated skipped range from the external source. | |
HeaderFileInfo | GetHeaderFileInfo (FileEntryRef FE) override |
Read the header file information for the given file entry. | |
void | ReadPragmaDiagnosticMappings (DiagnosticsEngine &Diag) |
unsigned | getTotalNumSLocs () const |
Returns the number of source locations found in the chain. | |
unsigned | getTotalNumIdentifiers () const |
Returns the number of identifiers found in the chain. | |
unsigned |