clang  6.0.0svn
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
clang::ASTReader Class Reference

Reads an AST files chain containing the contents of a translation unit. More...

#include "clang/Serialization/ASTReader.h"

Inheritance diagram for clang::ASTReader:
Inheritance graph
[legend]
Collaboration diagram for clang::ASTReader:
Collaboration graph
[legend]

Classes

struct  ImportedSubmodule
 
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...
 
enum  LoadFailureCapabilities {
  ARR_None = 0, ARR_Missing = 0x1, ARR_OutOfDate = 0x2, ARR_VersionMismatch = 0x4,
  ARR_ConfigurationMismatch = 0x8
}
 Flags that indicate what kind of AST loading failures the client of the AST reader can directly handle. 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
 
- Public Types inherited from clang::ExternalASTSource
enum  ExtKind { EK_Always, EK_Never, EK_ReplyHazy }
 

Public Member Functions

void ResolveImportedPath (ModuleFile &M, std::string &Filename)
 If we are loading a relocatable PCH or module file, and the filename is not an absolute path, add the system or module root to the beginning of the file name. More...
 
DeclgetKeyDeclaration (Decl *D)
 Returns the first key declaration for the given declaration. More...
 
const DeclgetKeyDeclaration (const Decl *D)
 
template<typename Fn >
void forEachImportedKeyDecl (const Decl *D, Fn Visit)
 Run a callback on each imported key declaration of D. More...
 
const serialization::reader::DeclContextLookupTablegetLoadedLookupTables (DeclContext *Primary) const
 Get the loaded lookup tables for Primary, if any. More...
 
llvm::iterator_range< ModuleDeclIteratorgetModuleFileLevelDecls (ModuleFile &Mod)
 
 ASTReader (Preprocessor &PP, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, StringRef isysroot="", bool DisableValidation=false, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
 Load the AST file and validate its contents against the given Preprocessor. More...
 
 ASTReader (const ASTReader &)=delete
 
ASTReaderoperator= (const ASTReader &)=delete
 
 ~ASTReader () override
 
SourceManagergetSourceManager () const
 
FileManagergetFileManager () const
 
DiagnosticsEnginegetDiags () const
 
ASTReadResult ReadAST (StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, SmallVectorImpl< ImportedSubmodule > *Imported=nullptr)
 Load the AST file designated by the given file name. More...
 
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. More...
 
void makeNamesVisible (const HiddenNames &Names, Module *Owner)
 Make the names within this set of hidden names visible. More...
 
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. More...
 
std::unique_ptr< ASTReaderListenertakeListener ()
 Take the AST callbacks listener. More...
 
void setListener (std::unique_ptr< ASTReaderListener > Listener)
 Set the AST callbacks listener. More...
 
void addListener (std::unique_ptr< ASTReaderListener > L)
 Add an AST callback listener. More...
 
void setDeserializationListener (ASTDeserializationListener *Listener, bool TakeOwnership=false)
 Set the AST deserialization listener. More...
 
bool hasGlobalIndex () const
 Determine whether this AST reader has a global index. More...
 
GlobalModuleIndexgetGlobalIndex ()
 Return global module index. More...
 
void resetForReload ()
 Reset reader for a reload try. More...
 
bool loadGlobalIndex ()
 Attempts to load the global index. More...
 
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. More...
 
void InitializeContext ()
 Initializes the ASTContext. More...
 
void UpdateSema ()
 Update the state of Sema after loading some additional modules. More...
 
void addInMemoryBuffer (StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
 Add in-memory (virtual file) buffer. More...
 
void finalizeForWriting ()
 Finalizes the AST reader's state before writing an AST file to disk. More...
 
ModuleManagergetModuleManager ()
 Retrieve the module manager. More...
 
PreprocessorgetPreprocessor () const
 Retrieve the preprocessor. More...
 
StringRef getOriginalSourceFile ()
 Retrieve the name of the original source file name for the primary module file. More...
 
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. More...
 
PreprocessedEntityReadPreprocessedEntity (unsigned Index) override
 Read a preallocated preprocessed entity from the external source. More...
 
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange (SourceRange Range) override
 Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses. More...
 
Optional< boolisPreprocessedEntityInFileID (unsigned Index, FileID FID) override
 Optionally returns true or false if the preallocated preprocessed entity with index Index came from file FID. More...
 
HeaderFileInfo GetHeaderFileInfo (const FileEntry *FE) override
 Read the header file information for the given file entry. More...
 
void ReadPragmaDiagnosticMappings (DiagnosticsEngine &Diag)
 
unsigned getTotalNumSLocs () const
 Returns the number of source locations found in the chain. More...
 
unsigned getTotalNumIdentifiers () const
 Returns the number of identifiers found in the chain. More...
 
unsigned getTotalNumMacros () const
 Returns the number of macros found in the chain. More...
 
unsigned getTotalNumTypes () const
 Returns the number of types found in the chain. More...
 
unsigned getTotalNumDecls () const
 Returns the number of declarations found in the chain. More...
 
unsigned getTotalNumSubmodules () const
 Returns the number of submodules known. More...
 
unsigned getTotalNumSelectors () const
 Returns the number of selectors found in the chain. More...
 
unsigned getTotalNumPreprocessedEntities () const
 Returns the number of preprocessed entities known to the AST reader. More...
 
TemplateArgumentLocInfo GetTemplateArgumentLocInfo (ModuleFile &F, TemplateArgument::ArgKind Kind, const RecordData &Record, unsigned &Idx)
 Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind. More...
 
TemplateArgumentLoc ReadTemplateArgumentLoc (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Reads a TemplateArgumentLoc. More...
 
const ASTTemplateArgumentListInfoReadASTTemplateArgumentListInfo (ModuleFile &F, const RecordData &Record, unsigned &Index)
 
TypeSourceInfoGetTypeSourceInfo (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Reads a declarator info from the given record. More...
 
QualType GetType (serialization::TypeID ID)
 Resolve a type ID into a type, potentially building a new type. More...
 
QualType getLocalType (ModuleFile &F, unsigned LocalID)
 Resolve a local type ID within a given AST file into a type. More...
 
serialization::TypeID getGlobalTypeID (ModuleFile &F, unsigned LocalID) const
 Map a local type ID within a given AST file into a global type ID. More...
 
QualType readType (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a type from the current position in the given record, which was read from the given AST file. More...
 
serialization::DeclID getGlobalDeclID (ModuleFile &F, serialization::LocalDeclID LocalID) const
 Map from a local declaration ID within a given module to a global declaration ID. More...
 
bool isDeclIDFromModule (serialization::GlobalDeclID ID, ModuleFile &M) const
 Returns true if global DeclID ID originated from module M. More...
 
ModuleFilegetOwningModuleFile (const Decl *D)
 Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a module file. More...
 
std::string getOwningModuleNameForDiagnostic (const Decl *D)
 Get the best name we know for the module that owns the given declaration, or an empty string if the declaration is not from a module. More...
 
SourceLocation getSourceLocationForDeclID (serialization::GlobalDeclID ID)
 Returns the source location for the decl ID. More...
 
DeclGetDecl (serialization::DeclID ID)
 Resolve a declaration ID into a declaration, potentially building a new declaration. More...
 
DeclGetExternalDecl (uint32_t ID) override
 Resolve a declaration ID into a declaration, potentially building a new declaration. More...
 
DeclGetExistingDecl (serialization::DeclID ID)
 Resolve a declaration ID into a declaration. More...
 
DeclGetLocalDecl (ModuleFile &F, uint32_t LocalID)
 Reads a declaration with the given local ID in the given module. More...
 
template<typename T >
TGetLocalDeclAs (ModuleFile &F, uint32_t LocalID)
 Reads a declaration with the given local ID in the given module. More...
 
serialization::DeclID mapGlobalIDToModuleFileGlobalID (ModuleFile &M, serialization::DeclID GlobalID)
 Map a global declaration ID into the declaration ID used to refer to this declaration within the given module fule. More...
 
serialization::DeclID ReadDeclID (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Reads a declaration ID from the given position in a record in the given module. More...
 
DeclReadDecl (ModuleFile &F, const RecordData &R, unsigned &I)
 Reads a declaration from the given position in a record in the given module. More...
 
template<typename T >
TReadDeclAs (ModuleFile &F, const RecordData &R, unsigned &I)
 Reads a declaration from the given position in a record in the given module. More...
 
void CompleteRedeclChain (const Decl *D) override
 If any redeclarations of D have been imported since it was last checked, this digs out those redeclarations and adds them to the redeclaration chain for D. More...
 
CXXBaseSpecifierGetExternalCXXBaseSpecifiers (uint64_t Offset) override
 Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers. More...
 
StmtGetExternalDeclStmt (uint64_t Offset) override
 Resolve the offset of a statement into a statement. More...
 
bool FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name) override
 Finds all the visible declarations with a given name. More...
 
void FindExternalLexicalDecls (const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl *> &Decls) override
 Read all of the declarations lexically stored in a declaration context. More...
 
void FindFileRegionDecls (FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl *> &Decls) override
 Get the decls that are contained in a file in the Offset/Length range. More...
 
void StartedDeserializing () override
 Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is called there may be decls that are initializing. More...
 
void FinishedDeserializing () override
 Notify ASTReader that we finished the deserialization of a decl or type. More...
 
void StartTranslationUnit (ASTConsumer *Consumer) override
 Function that will be invoked when we begin parsing a new translation unit involving this external AST source. More...
 
void PrintStats () override
 Print some statistics about AST usage. More...
 
void dump ()
 Dump information about the AST reader to standard error. More...
 
void getMemoryBufferSizes (MemoryBufferSizes &sizes) const override
 Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory. More...
 
void InitializeSema (Sema &S) override
 Initialize the semantic source with the Sema instance being used to perform semantic analysis on the abstract syntax tree. More...
 
void ForgetSema () override
 Inform the semantic consumer that Sema is no longer available. More...
 
IdentifierInfoget (StringRef Name) override
 Retrieve the IdentifierInfo for the named identifier. More...
 
IdentifierIteratorgetIdentifiers () override
 Retrieve an iterator into the set of all identifiers in all loaded AST files. More...
 
void ReadMethodPool (Selector Sel) override
 Load the contents of the global method pool for a given selector. More...
 
void updateOutOfDateSelector (Selector Sel) override
 Load the contents of the global method pool for a given selector if necessary. More...
 
void ReadKnownNamespaces (SmallVectorImpl< NamespaceDecl *> &Namespaces) override
 Load the set of namespaces that are known to the external source, which will be used during typo correction. More...
 
void ReadUndefinedButUsed (llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
 Load the set of used but not defined functions or variables with internal linkage, or used but not defined internal functions. More...
 
void ReadMismatchingDeleteExpressions (llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &Exprs) override
 
void ReadTentativeDefinitions (SmallVectorImpl< VarDecl *> &TentativeDefs) override
 Read the set of tentative definitions known to the external Sema source. More...
 
void ReadUnusedFileScopedDecls (SmallVectorImpl< const DeclaratorDecl *> &Decls) override
 Read the set of unused file-scope declarations known to the external Sema source. More...
 
void ReadDelegatingConstructors (SmallVectorImpl< CXXConstructorDecl *> &Decls) override
 Read the set of delegating constructors known to the external Sema source. More...
 
void ReadExtVectorDecls (SmallVectorImpl< TypedefNameDecl *> &Decls) override
 Read the set of ext_vector type declarations known to the external Sema source. More...
 
void ReadUnusedLocalTypedefNameCandidates (llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
 Read the set of potentially unused typedefs known to the source. More...
 
void ReadReferencedSelectors (SmallVectorImpl< std::pair< Selector, SourceLocation >> &Sels) override
 
void ReadWeakUndeclaredIdentifiers (SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo >> &WI) override
 
void ReadUsedVTables (SmallVectorImpl< ExternalVTableUse > &VTables) override
 Read the set of used vtables known to the external Sema source. More...
 
void ReadPendingInstantiations (SmallVectorImpl< std::pair< ValueDecl *, SourceLocation >> &Pending) override
 
void ReadLateParsedTemplates (llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &LPTMap) override
 Read the set of late parsed template functions for this source. More...
 
void LoadSelector (Selector Sel)
 Load a selector from disk, registering its ID if it exists. More...
 
void SetIdentifierInfo (unsigned ID, IdentifierInfo *II)
 
void SetGloballyVisibleDecls (IdentifierInfo *II, const SmallVectorImpl< uint32_t > &DeclIDs, SmallVectorImpl< Decl *> *Decls=nullptr)
 Set the globally-visible declarations associated with the given identifier. More...
 
DiagnosticBuilder Diag (unsigned DiagID) const
 Report a diagnostic. More...
 
DiagnosticBuilder Diag (SourceLocation Loc, unsigned DiagID) const
 Report a diagnostic. More...
 
IdentifierInfoDecodeIdentifierInfo (serialization::IdentifierID ID)
 
IdentifierInfoGetIdentifierInfo (ModuleFile &M, const RecordData &Record, unsigned &Idx)
 
IdentifierInfoGetIdentifier (serialization::IdentifierID ID) override
 
IdentifierInfogetLocalIdentifier (ModuleFile &M, unsigned LocalID)
 
serialization::IdentifierID getGlobalIdentifierID (ModuleFile &M, unsigned LocalID)
 
void resolvePendingMacro (IdentifierInfo *II, const PendingMacroInfo &PMInfo)
 
MacroInfogetMacro (serialization::MacroID ID)
 Retrieve the macro with the given ID. More...
 
serialization::MacroID getGlobalMacroID (ModuleFile &M, unsigned LocalID)
 Retrieve the global macro ID corresponding to the given local ID within the given module file. More...
 
bool ReadSLocEntry (int ID) override
 Read the source location entry with index ID. More...
 
std::pair< SourceLocation, StringRef > getModuleImportLoc (int ID) override
 Retrieve the module import location and module name for the given source manager entry ID. More...
 
serialization::SubmoduleID getGlobalSubmoduleID (ModuleFile &M, unsigned LocalID)
 Retrieve the global submodule ID given a module and its local ID number. More...
 
ModulegetSubmodule (serialization::SubmoduleID GlobalID)
 Retrieve the submodule that corresponds to a global submodule ID. More...
 
ModulegetModule (unsigned ID) override
 Retrieve the module that corresponds to the given module ID. More...
 
ModuleFilegetLocalModuleFile (ModuleFile &M, unsigned ID)
 Retrieve the module file with a given local ID within the specified ModuleFile. More...
 
unsigned getModuleFileID (ModuleFile *M)
 Get an ID for the given module file. More...
 
llvm::Optional< ASTSourceDescriptorgetSourceDescriptor (unsigned ID) override
 Return a descriptor for the corresponding module. More...
 
ExtKind hasExternalDefinitions (const Decl *D) override
 
Selector getLocalSelector (ModuleFile &M, unsigned LocalID)
 Retrieve a selector from the given module with its local ID number. More...
 
Selector DecodeSelector (serialization::SelectorID Idx)
 
Selector GetExternalSelector (serialization::SelectorID ID) override
 Resolve a selector ID into a selector. More...
 
uint32_t GetNumExternalSelectors () override
 Returns the number of selectors known to the external AST source. More...
 
Selector ReadSelector (ModuleFile &M, const RecordData &Record, unsigned &Idx)
 
serialization::SelectorID getGlobalSelectorID (ModuleFile &F, unsigned LocalID) const
 Retrieve the global selector ID that corresponds to this the local selector ID in a given module. More...
 
DeclarationName ReadDeclarationName (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a declaration name. More...
 
void ReadDeclarationNameLoc (ModuleFile &F, DeclarationNameLoc &DNLoc, DeclarationName Name, const RecordData &Record, unsigned &Idx)
 
void ReadDeclarationNameInfo (ModuleFile &F, DeclarationNameInfo &NameInfo, const RecordData &Record, unsigned &Idx)
 
void ReadQualifierInfo (ModuleFile &F, QualifierInfo &Info, const RecordData &Record, unsigned &Idx)
 
NestedNameSpecifierReadNestedNameSpecifier (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 
TemplateName ReadTemplateName (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a template name. More...
 
TemplateArgument ReadTemplateArgument (ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
 Read a template argument. More...
 
TemplateParameterListReadTemplateParameterList (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a template parameter list. More...
 
void ReadTemplateArgumentList (SmallVectorImpl< TemplateArgument > &TemplArgs, ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
 Read a template argument array. More...
 
void ReadUnresolvedSet (ModuleFile &F, LazyASTUnresolvedSet &Set, const RecordData &Record, unsigned &Idx)
 Read a UnresolvedSet structure. More...
 
CXXBaseSpecifier ReadCXXBaseSpecifier (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a C++ base specifier. More...
 
CXXCtorInitializer ** ReadCXXCtorInitializers (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a CXXCtorInitializer array. More...
 
CXXCtorInitializer ** GetExternalCXXCtorInitializers (uint64_t Offset) override
 Read the contents of a CXXCtorInitializer array. More...
 
SourceLocation ReadUntranslatedSourceLocation (uint32_t Raw) const
 Read a source location from raw form and return it in its originating module file's source location space. More...
 
SourceLocation ReadSourceLocation (ModuleFile &ModuleFile, uint32_t Raw) const
 Read a source location from raw form. More...
 
SourceLocation TranslateSourceLocation (ModuleFile &ModuleFile, SourceLocation Loc) const
 Translate a source location from another module file's source location space into ours. More...
 
SourceLocation ReadSourceLocation (ModuleFile &ModuleFile, const RecordDataImpl &Record, unsigned &Idx)
 Read a source location. More...
 
SourceRange ReadSourceRange (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a source range. More...
 
llvm::APInt ReadAPInt (const RecordData &Record, unsigned &Idx)
 Read an integral value. More...
 
llvm::APSInt ReadAPSInt (const RecordData &Record, unsigned &Idx)
 Read a signed integral value. More...
 
llvm::APFloat ReadAPFloat (const RecordData &Record, const llvm::fltSemantics &Sem, unsigned &Idx)
 Read a floating-point value. More...
 
std::string ReadPath (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 
CXXTemporaryReadCXXTemporary (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 
void ReadAttributes (ASTRecordReader &Record, AttrVec &Attrs)
 Reads attributes from the current stream position. More...
 
StmtReadStmt (ModuleFile &F)
 Reads a statement. More...
 
ExprReadExpr (ModuleFile &F)
 Reads an expression. More...
 
StmtReadSubStmt ()
 Reads a sub-statement operand during statement reading. More...
 
ExprReadSubExpr ()
 Reads a sub-expression operand during statement reading. More...
 
Token ReadToken (ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
 Reads a token out of a record. More...
 
MacroInfoReadMacroRecord (ModuleFile &F, uint64_t Offset)
 Reads the macro record located at the given offset. More...
 
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID (ModuleFile &M, unsigned LocalID) const
 Determine the global preprocessed entity ID that corresponds to the given local ID within the given module. More...
 
void addPendingMacro (IdentifierInfo *II, ModuleFile *M, uint64_t MacroDirectivesOffset)
 Add a macro to deserialize its macro directive history. More...
 
void ReadDefinedMacros () override
 Read the set of macros defined by this external macro source. More...
 
void updateOutOfDateIdentifier (IdentifierInfo &II) override
 Update an out-of-date identifier. More...
 
void markIdentifierUpToDate (IdentifierInfo *II)
 Note that this identifier is up-to-date. More...
 
void completeVisibleDeclsMap (const DeclContext *DC) override
 Load all external visible decls in the given DeclContext. More...
 
ASTContextgetContext ()
 Retrieve the AST context that this AST reader supplements. More...
 
SemagetSema ()
 Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled header is being imported. More...
 
IdentifierResolvergetIdResolver ()
 Get the identifier resolver used for name lookup / updates in the translation unit scope. More...
 
IdentifierTablegetIdentifierTable ()
 Retrieve the identifier table associated with the preprocessor. More...
 
void RecordSwitchCaseID (SwitchCase *SC, unsigned ID)
 Record that the given ID maps to the given switch-case statement. More...
 
SwitchCasegetSwitchCaseWithID (unsigned ID)
 Retrieve the switch-case statement with the given ID. More...
 
void ClearSwitchCaseIDs ()
 
void ReadComments () override
 Loads comments ranges. More...
 
void visitInputFiles (serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
 Visit all the input files of the given module file. More...
 
void visitTopLevelModuleMaps (serialization::ModuleFile &MF, llvm::function_ref< void(const FileEntry *)> Visitor)
 Visit all the top-level module maps loaded when building the given module file. More...
 
bool isProcessingUpdateRecords ()
 
- Public Member Functions inherited from clang::ExternalPreprocessorSource
virtual ~ExternalPreprocessorSource ()
 
virtual IdentifierInfoGetIdentifier (unsigned ID)=0
 Return the identifier associated with the given ID number. More...
 
- Public Member Functions inherited from clang::ExternalPreprocessingRecordSource
virtual ~ExternalPreprocessingRecordSource ()
 
- Public Member Functions inherited from clang::ExternalHeaderFileInfoSource
virtual ~ExternalHeaderFileInfoSource ()
 
- Public Member Functions inherited from clang::ExternalSemaSource
 ExternalSemaSource ()
 
 ~ExternalSemaSource () override
 
virtual bool LookupUnqualified (LookupResult &R, Scope *S)
 Do last resort, unqualified lookup on a LookupResult that Sema cannot find. More...
 
virtual void ReadReferencedSelectors (SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels)
 Read the set of referenced selectors known to the external Sema source. More...
 
virtual void ReadWeakUndeclaredIdentifiers (SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI)
 Read the set of weak, undeclared identifiers known to the external Sema source. More...
 
virtual void ReadPendingInstantiations (SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending)
 Read the set of pending instantiations known to the external Sema source. More...
 
virtual TypoCorrection CorrectTypo (const DeclarationNameInfo &Typo, int LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT)
 Try to "correct" a typo in the source code by finding visible declarations whose names are similar to the name that was present in the source code. More...
 
virtual bool MaybeDiagnoseMissingCompleteType (SourceLocation Loc, QualType T)
 Produces a diagnostic note if the external source contains a complete definition for T. More...
 
- Public Member Functions inherited from clang::ExternalASTSource
 ExternalASTSource ()=default
 
virtual ~ExternalASTSource ()
 
uint32_t getGeneration () const
 Get the current generation of this AST source. More...
 
void FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl *> &Result)
 Finds all declarations lexically contained within the given DeclContext. More...
 
virtual void CompleteType (TagDecl *Tag)
 Gives the external AST source an opportunity to complete an incomplete type. More...
 
virtual void CompleteType (ObjCInterfaceDecl *Class)
 Gives the external AST source an opportunity to complete an incomplete Objective-C class. More...
 
virtual bool layoutRecordType (const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &BaseOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &VirtualBaseOffsets)
 Perform layout on the given record. More...
 
MemoryBufferSizes getMemoryBufferSizes () const
 Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory. More...
 
- Public Member Functions inherited from clang::IdentifierInfoLookup
virtual ~IdentifierInfoLookup ()
 
- Public Member Functions inherited from clang::ExternalSLocEntrySource
virtual ~ExternalSLocEntrySource ()
 

Static Public Member Functions

static void ResolveImportedPath (std::string &Filename, StringRef Prefix)
 
static std::string getOriginalSourceFile (const std::string &ASTFileName, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, DiagnosticsEngine &Diags)
 Retrieve the name of the original source file name directly from the AST file, without actually loading the AST file. More...
 
static bool readASTFileControlBlock (StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions)
 Read the control block for the named AST file. More...
 
static bool isAcceptableASTFile (StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath)
 Determine whether the given AST file is acceptable to load into a translation unit with the given language and target options. More...
 
static bool ReadBlockAbbrevs (llvm::BitstreamCursor &Cursor, unsigned BlockID)
 ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor. More...
 
static std::string ReadString (const RecordData &Record, unsigned &Idx)
 
static void SkipString (const RecordData &Record, unsigned &Idx)
 
static void SkipPath (const RecordData &Record, unsigned &Idx)
 
static VersionTuple ReadVersionTuple (const RecordData &Record, unsigned &Idx)
 Read a version tuple. More...
 
- Static Public Member Functions inherited from clang::ExternalSemaSource
static bool classof (const ExternalASTSource *Source)
 

Public Attributes

SmallVector< uint64_t, 16 > PreloadedDeclIDs
 
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
 Cursors for comments blocks. More...
 

Friends

class ASTDeclReader
 Types of AST files. More...
 
class ASTIdentifierIterator
 
class ASTRecordReader
 
class ASTStmtReader
 
class ASTUnit
 
class ASTWriter
 
class PCHValidator
 
class serialization::reader::ASTIdentifierLookupTrait
 
class serialization::ReadMethodPoolVisitor
 
class TypeLocReader
 

Additional Inherited Members

- Protected Member Functions inherited from clang::ExternalASTSource
uint32_t incrementGeneration (ASTContext &C)
 Increment the current generation. More...
 
- Static Protected Member Functions inherited from clang::ExternalASTSource
static DeclContextLookupResult SetExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name, ArrayRef< NamedDecl *> Decls)
 
static DeclContextLookupResult SetNoExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name)
 

Detailed Description

Reads an AST files chain containing the contents of a translation unit.

The ASTReader class reads bitstreams (produced by the ASTWriter class) containing the serialized representation of a given abstract syntax tree and its supporting data structures. An instance of the ASTReader can be attached to an ASTContext object, which will provide access to the contents of the AST files.

The AST reader provides lazy de-serialization of declarations, as required when traversing the AST. Only those AST nodes that are actually required will be de-serialized.

Definition at line 358 of file ASTReader.h.

Member Typedef Documentation

◆ ModuleConstIterator

Definition at line 414 of file ASTReader.h.

◆ ModuleFile

Definition at line 410 of file ASTReader.h.

◆ ModuleIterator

Definition at line 413 of file ASTReader.h.

◆ ModuleKind

Definition at line 411 of file ASTReader.h.

◆ ModuleManager

Definition at line 412 of file ASTReader.h.

◆ ModuleReverseIterator

Definition at line 415 of file ASTReader.h.

◆ RecordData

Definition at line 379 of file ASTReader.h.

◆ RecordDataImpl

Definition at line 380 of file ASTReader.h.

Member Enumeration Documentation

◆ ASTReadResult

The result of reading the control block of an AST file, which can fail for various reasons.

Enumerator
Success 

The control block was read successfully.

Aside from failures, the AST file is safe to read into the current context.

Failure 

The AST file itself appears corrupted.

Missing 

The AST file was missing.

OutOfDate 

The AST file is out-of-date relative to its input files, and needs to be regenerated.

VersionMismatch 

The AST file was written by a different version of Clang.

ConfigurationMismatch 

The AST file was writtten with a different language/target configuration.

HadErrors 

The AST file has errors.

Definition at line 384 of file ASTReader.h.

◆ LoadFailureCapabilities

Flags that indicate what kind of AST loading failures the client of the AST reader can directly handle.

When a client states that it can handle a particular kind of failure, the AST reader will not emit errors when producing that kind of failure.

Enumerator
ARR_None 

The client can't handle any AST loading failures.

ARR_Missing 

The client can handle an AST file that cannot load because it is missing.

ARR_OutOfDate 

The client can handle an AST file that cannot load because it is out-of-date relative to its input files.

ARR_VersionMismatch 

The client can handle an AST file that cannot load because it was built with a different version of Clang.

ARR_ConfigurationMismatch 

The client can handle an AST file that cannot load because it's compiled configuration doesn't match that of the context it was loaded into.

Definition at line 1484 of file ASTReader.h.

Constructor & Destructor Documentation

◆ ASTReader() [1/2]

ASTReader::ASTReader ( Preprocessor PP,
ASTContext Context,
const PCHContainerReader PCHContainerRdr,
ArrayRef< std::shared_ptr< ModuleFileExtension >>  Extensions,
StringRef  isysroot = "",
bool  DisableValidation = false,
bool  AllowASTWithCompilerErrors = false,
bool  AllowConfigurationMismatch = false,
bool  ValidateSystemInputs = false,
bool  UseGlobalIndex = true,
std::unique_ptr< llvm::Timer >  ReadTimer = {} 
)

Load the AST file and validate its contents against the given Preprocessor.

Parameters
PPthe preprocessor associated with the context in which this precompiled header will be loaded.
Contextthe AST context that this precompiled header will be loaded into, if any.
PCHContainerRdrthe PCHContainerOperations to use for loading and creating modules.
Extensionsthe list of module file extensions that can be loaded from the AST files.
isysrootIf non-NULL, the system include path specified by the user. This is only used with relocatable PCH files. If non-NULL, a relocatable PCH file will use the default path "/".
DisableValidationIf true, the AST reader will suppress most of its regular consistency checking, allowing the use of precompiled headers that cannot be determined to be compatible.
AllowASTWithCompilerErrorsIf true, the AST reader will accept an AST file the was created out of an AST with compiler errors, otherwise it will reject it.
AllowConfigurationMismatchIf true, the AST reader will not check for configuration differences between the AST file and the invocation.
ValidateSystemInputsIf true, the AST reader will validate system input files in addition to user input files. This is only meaningful if DisableValidation is false.
UseGlobalIndexIf true, the AST reader will try to load and use the global module index.
ReadTimerIf non-null, a timer used to track the time spent deserializing.

Definition at line 10562 of file ASTReader.cpp.

◆ ASTReader() [2/2]

clang::ASTReader::ASTReader ( const ASTReader )
delete

◆ ~ASTReader()

ASTReader::~ASTReader ( )
override

Definition at line 10600 of file ASTReader.cpp.

Member Function Documentation

◆ addInMemoryBuffer()

void clang::ASTReader::addInMemoryBuffer ( StringRef &  FileName,
std::unique_ptr< llvm::MemoryBuffer >  Buffer 
)
inline

Add in-memory (virtual file) buffer.

Definition at line 1621 of file ASTReader.h.

◆ addListener()

void clang::ASTReader::addListener ( std::unique_ptr< ASTReaderListener L)
inline

Add an AST callback listener.

Takes ownership of L.

Definition at line 1560 of file ASTReader.h.

Referenced by clang::DependencyCollector::attachToASTReader(), and clang::ModuleDependencyCollector::attachToASTReader().

◆ addPendingMacro()

void ASTReader::addPendingMacro ( IdentifierInfo II,
ModuleFile M,
uint64_t  MacroDirectivesOffset 
)

Add a macro to deserialize its macro directive history.

Parameters
IIThe name of the macro.
MThe module file.
MacroDirectivesOffsetOffset of the serialized macro directive history.

Definition at line 1799 of file ASTReader.cpp.

◆ ClearSwitchCaseIDs()

void ASTReader::ClearSwitchCaseIDs ( )

Definition at line 8990 of file ASTReader.cpp.

◆ CompleteRedeclChain()

void ASTReader::CompleteRedeclChain ( const Decl D)
overridevirtual

If any redeclarations of D have been imported since it was last checked, this digs out those redeclarations and adds them to the redeclaration chain for D.

Reimplemented from clang::ExternalASTSource.

Definition at line 6962 of file ASTReader.cpp.

References clang::Decl::getDeclContext(), and clang::DeclContext::getRedeclContext().

◆ completeVisibleDeclsMap()

void ASTReader::completeVisibleDeclsMap ( const DeclContext DC)
overridevirtual

Load all external visible decls in the given DeclContext.

Reimplemented from clang::ExternalASTSource.

Definition at line 7406 of file ASTReader.cpp.

References clang::NamedDecl::getDeclName(), and clang::DeclContext::hasExternalVisibleStorage().

◆ DecodeIdentifierInfo()

IdentifierInfo * ASTReader::DecodeIdentifierInfo ( serialization::IdentifierID  ID)

Definition at line 8203 of file ASTReader.cpp.

References clang::Error.

◆ DecodeSelector()

Selector ASTReader::DecodeSelector ( serialization::SelectorID  Idx)

Definition at line 8390 of file ASTReader.cpp.

References clang::Error.

◆ Diag() [1/2]

DiagnosticBuilder ASTReader::Diag ( unsigned  DiagID) const

Report a diagnostic.

Definition at line 8962 of file ASTReader.cpp.

References Diag().

◆ Diag() [2/2]

DiagnosticBuilder ASTReader::Diag ( SourceLocation  Loc,
unsigned  DiagID 
) const

Report a diagnostic.

Definition at line 8966 of file ASTReader.cpp.

◆ dump()

LLVM_DUMP_METHOD void ASTReader::dump ( )

Dump information about the AST reader to standard error.

Definition at line 7578 of file ASTReader.cpp.

References clang::serialization::ModuleFile::dump(), and dumpModuleIDMap().

◆ finalizeForWriting()

void ASTReader::finalizeForWriting ( )

Finalizes the AST reader's state before writing an AST file to disk.

This operation may undo temporary state in the AST that should not be emitted.

Definition at line 4558 of file ASTReader.cpp.

◆ FindExternalLexicalDecls()

void ASTReader::FindExternalLexicalDecls ( const DeclContext DC,
llvm::function_ref< bool(Decl::Kind)>  IsKindWeWant,
SmallVectorImpl< Decl *> &  Decls 
)
overridevirtual

Read all of the declarations lexically stored in a declaration context.

Parameters
DCThe declaration context whose declarations will be read.
IsKindWeWantA predicate indicating which declaration kinds we are interested in.
DeclsVector that will contain the declarations loaded from the external source. The caller is responsible for merging these declarations with any declarations already stored in the declaration context.

Reimplemented from clang::ExternalASTSource.

Definition at line 7260 of file ASTReader.cpp.

References clang::serialization::NUM_PREDEF_DECL_IDS.

◆ FindExternalVisibleDeclsByName()

bool ASTReader::FindExternalVisibleDeclsByName ( const DeclContext DC,
DeclarationName  Name 
)
overridevirtual

Finds all the visible declarations with a given name.

The current implementation of this method just loads the entire lookup table as unmaterialized references.

Reimplemented from clang::ExternalASTSource.

Definition at line 7380 of file ASTReader.cpp.

◆ FindFileRegionDecls()

void ASTReader::FindFileRegionDecls ( FileID  File,
unsigned  Offset,
unsigned  Length,
SmallVectorImpl< Decl *> &  Decls 
)
overridevirtual

Get the decls that are contained in a file in the Offset/Length range.

Length can be 0 to indicate a point at Offset instead of a range.

Reimplemented from clang::ExternalASTSource.

Definition at line 7336 of file ASTReader.cpp.

◆ findPreprocessedEntitiesInRange()

std::pair< unsigned, unsigned > ASTReader::findPreprocessedEntitiesInRange ( SourceRange  Range)
overridevirtual

Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.

Returns a pair of [Begin, End) indices of preallocated preprocessed entities that.

  • Range encompasses.

Implements clang::ExternalPreprocessingRecordSource.

Definition at line 5583 of file ASTReader.cpp.

References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), and clang::SourceRange::isInvalid().

◆ FinishedDeserializing()

void ASTReader::FinishedDeserializing ( )
overridevirtual

Notify ASTReader that we finished the deserialization of a decl or type.

Must be paired with StartedDeserializing.

Reimplemented from clang::ExternalASTSource.

Definition at line 10498 of file ASTReader.cpp.

References clang::diff::Update, and Updates.

◆ forEachImportedKeyDecl()

template<typename Fn >
void clang::ASTReader::forEachImportedKeyDecl ( const Decl D,
Fn  Visit 
)
inline

Run a callback on each imported key declaration of D.

Definition at line 1225 of file ASTReader.h.

References clang::Decl::getCanonicalDecl(), and clang::Decl::isFromASTFile().

◆ ForgetSema()

void clang::ASTReader::ForgetSema ( )
inlineoverridevirtual

Inform the semantic consumer that Sema is no longer available.

Reimplemented from clang::ExternalSemaSource.

Definition at line 1933 of file ASTReader.h.

◆ get()

IdentifierInfo * ASTReader::get ( StringRef  Name)
overridevirtual

Retrieve the IdentifierInfo for the named identifier.

This routine builds a new IdentifierInfo for the given identifier. If any declarations with this name are visible from translation unit scope, their declarations will be deserialized and introduced into the declaration chain of the identifier.

Implements clang::IdentifierInfoLookup.

Definition at line 7701 of file ASTReader.cpp.

◆ getContext()

ASTContext& clang::ASTReader::getContext ( )
inline

Retrieve the AST context that this AST reader supplements.

Definition at line 2268 of file ASTReader.h.

Referenced by clang::ASTDeclReader::attachPreviousDecl(), clang::ASTRecordReader::getContext(), clang::index::indexModuleFile(), isSameEntity(), and clang::ASTDeclReader::UpdateDecl().

◆ GetDecl()

Decl * ASTReader::GetDecl ( serialization::DeclID  ID)

Resolve a declaration ID into a declaration, potentially building a new declaration.

Definition at line 7193 of file ASTReader.cpp.

References clang::serialization::NUM_PREDEF_DECL_IDS.

Referenced by clang::ASTReader::ModuleDeclIterator::operator*().

◆ getDiags()

DiagnosticsEngine& clang::ASTReader::getDiags ( ) const
inline

Definition at line 1477 of file ASTReader.h.

Referenced by clang::TestModuleFileExtension::createExtensionReader().

◆ GetExistingDecl()

Decl * ASTReader::GetExistingDecl ( serialization::DeclID  ID)

Resolve a declaration ID into a declaration.

Return 0 if it's not been loaded yet.

Definition at line 7168 of file ASTReader.cpp.

References clang::Decl::getCanonicalDecl(), getPredefinedDecl(), and clang::serialization::NUM_PREDEF_DECL_IDS.

◆ GetExternalCXXBaseSpecifiers()

CXXBaseSpecifier * ASTReader::GetExternalCXXBaseSpecifiers ( uint64_t  Offset)
overridevirtual

Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.

The default implementation of this method is a no-op.

Reimplemented from clang::ExternalASTSource.

Definition at line 7034 of file ASTReader.cpp.

◆ GetExternalCXXCtorInitializers()

CXXCtorInitializer ** ASTReader::GetExternalCXXCtorInitializers ( uint64_t  Offset)
overridevirtual

Read the contents of a CXXCtorInitializer array.

Reimplemented from clang::ExternalASTSource.

Definition at line 7015 of file ASTReader.cpp.

References clang::serialization::DECL_CXX_CTOR_INITIALIZERS.

◆ GetExternalDecl()

Decl * ASTReader::GetExternalDecl ( uint32_t  ID)
overridevirtual

Resolve a declaration ID into a declaration, potentially building a new declaration.

This method only needs to be implemented if the AST source ever passes back decl sets as VisibleDeclaration objects.

The default implementation of this method is a no-op.

Reimplemented from clang::ExternalASTSource.

Definition at line 6958 of file ASTReader.cpp.

◆ GetExternalDeclStmt()

Stmt * ASTReader::GetExternalDeclStmt ( uint64_t  Offset)
overridevirtual

Resolve the offset of a statement into a statement.

This operation will read a new statement from the external source each time it is called, and is meant to be used via a LazyOffsetPtr (which is used by Decls for the body of functions, etc).

Reimplemented from clang::ExternalASTSource.

Definition at line 7247 of file ASTReader.cpp.

◆ GetExternalSelector()

Selector ASTReader::GetExternalSelector ( serialization::SelectorID  ID)
overridevirtual

Resolve a selector ID into a selector.

This operation only needs to be implemented if the AST source returns non-zero for GetNumKnownSelectors().

The default implementation of this method is a no-op.

Reimplemented from clang::ExternalASTSource.

Definition at line 8415 of file ASTReader.cpp.

◆ getFileManager()

FileManager& clang::ASTReader::getFileManager ( ) const
inline

Definition at line 1476 of file ASTReader.h.

◆ getGlobalDeclID()

serialization::DeclID ASTReader::getGlobalDeclID ( ModuleFile F,
serialization::LocalDeclID  LocalID 
) const

Map from a local declaration ID within a given module to a global declaration ID.

Definition at line 7061 of file ASTReader.cpp.

References clang::serialization::ModuleFile::ModuleOffsetMap, and clang::serialization::NUM_PREDEF_DECL_IDS.

Referenced by clang::ASTReader::ModuleDeclIterator::operator*().

◆ getGlobalIdentifierID()

IdentifierID ASTReader::getGlobalIdentifierID ( ModuleFile M,
unsigned  LocalID 
)

◆ getGlobalIndex()

GlobalModuleIndex* clang::ASTReader::getGlobalIndex ( )
inline

Return global module index.

Definition at line 1600 of file ASTReader.h.

◆ getGlobalMacroID()

MacroID ASTReader::getGlobalMacroID ( ModuleFile M,
unsigned  LocalID 
)

Retrieve the global macro ID corresponding to the given local ID within the given module file.

Definition at line 8283 of file ASTReader.cpp.

References clang::serialization::ModuleFile::ModuleOffsetMap, and clang::serialization::NUM_PREDEF_MACRO_IDS.

◆ getGlobalPreprocessedEntityID()

PreprocessedEntityID ASTReader::getGlobalPreprocessedEntityID ( ModuleFile M,
unsigned  LocalID 
) const

Determine the global preprocessed entity ID that corresponds to the given local ID within the given module.

Definition at line 1671 of file ASTReader.cpp.

References clang::serialization::ModuleFile::ModuleOffsetMap.

◆ getGlobalSelectorID()

serialization::SelectorID ASTReader::getGlobalSelectorID ( ModuleFile F,
unsigned  LocalID 
) const

Retrieve the global selector ID that corresponds to this the local selector ID in a given module.

Definition at line 8425 of file ASTReader.cpp.

References clang::serialization::ModuleFile::ModuleOffsetMap, and clang::serialization::NUM_PREDEF_SELECTOR_IDS.

◆ getGlobalSubmoduleID()

serialization::SubmoduleID ASTReader::getGlobalSubmoduleID ( ModuleFile M,
unsigned  LocalID 
)

Retrieve the global submodule ID given a module and its local ID number.

Definition at line 8298 of file ASTReader.cpp.

References clang::serialization::ModuleFile::ModuleOffsetMap, and clang::serialization::NUM_PREDEF_SUBMODULE_IDS.

Referenced by clang::ASTRecordReader::getGlobalSubmoduleID().

◆ getGlobalTypeID()

serialization::TypeID ASTReader::getGlobalTypeID ( ModuleFile F,
unsigned  LocalID 
) const

Map a local type ID within a given AST file into a global type ID.

Definition at line 6878 of file ASTReader.cpp.

References clang::Qualifiers::FastMask, clang::Qualifiers::FastWidth, clang::serialization::ModuleFile::ModuleOffsetMap, and clang::serialization::NUM_PREDEF_TYPE_IDS.

Referenced by clang::ASTRecordReader::getGlobalTypeID().

◆ GetHeaderFileInfo()

HeaderFileInfo ASTReader::GetHeaderFileInfo ( const FileEntry FE)
overridevirtual

Read the header file information for the given file entry.

Implements clang::ExternalHeaderFileInfoSource.

Definition at line 5646 of file ASTReader.cpp.

◆ GetIdentifier()

IdentifierInfo* clang::ASTReader::GetIdentifier ( serialization::IdentifierID  ID)
inlineoverride

Definition at line 2018 of file ASTReader.h.

◆ GetIdentifierInfo()

IdentifierInfo* clang::ASTReader::GetIdentifierInfo ( ModuleFile M,
const RecordData Record,
unsigned &  Idx 
)
inline

Definition at line 2013 of file ASTReader.h.

Referenced by clang::ASTRecordReader::getIdentifierInfo().

◆ getIdentifiers()

IdentifierIterator * ASTReader::getIdentifiers ( )
overridevirtual

Retrieve an iterator into the set of all identifiers in all loaded AST files.

Reimplemented from clang::IdentifierInfoLookup.

Definition at line 7826 of file ASTReader.cpp.

References clang::ASTIdentifierIterator::ASTIdentifierIterator().

◆ getIdentifierTable()

IdentifierTable & ASTReader::getIdentifierTable ( )

Retrieve the identifier table associated with the preprocessor.

Definition at line 8972 of file ASTReader.cpp.

◆ getIdResolver()

IdentifierResolver & ASTReader::getIdResolver ( )

Get the identifier resolver used for name lookup / updates in the translation unit scope.

We have one of these even if we don't have a Sema object.

Definition at line 10605 of file ASTReader.cpp.

References clang::Sema::IdResolver.

◆ getKeyDeclaration() [1/2]

Decl* clang::ASTReader::getKeyDeclaration ( Decl D)
inline

Returns the first key declaration for the given declaration.

This is one that is formerly-canonical (or still canonical) and whose module did not import any other key declaration of the entity.

Definition at line 1209 of file ASTReader.h.

References clang::Decl::getCanonicalDecl(), and clang::Decl::isFromASTFile().

◆ getKeyDeclaration() [2/2]

const Decl* clang::ASTReader::getKeyDeclaration ( const Decl D)
inline

Definition at line 1219 of file ASTReader.h.

◆ getLoadedLookupTables()

const serialization::reader::DeclContextLookupTable * ASTReader::getLoadedLookupTables ( DeclContext Primary) const

Get the loaded lookup tables for Primary, if any.

Definition at line 7430 of file ASTReader.cpp.

◆ GetLocalDecl()

Decl* clang::ASTReader::GetLocalDecl ( ModuleFile F,
uint32_t  LocalID 
)
inline

Reads a declaration with the given local ID in the given module.

Definition at line 1808 of file ASTReader.h.

Referenced by clang::ASTRecordReader::GetLocalDeclAs().

◆ GetLocalDeclAs()

template<typename T >
T* clang::ASTReader::GetLocalDeclAs ( ModuleFile F,
uint32_t  LocalID 
)
inline

Reads a declaration with the given local ID in the given module.

Returns
The requested declaration, casted to the given return type.

Definition at line 1816 of file ASTReader.h.

◆ getLocalIdentifier()

IdentifierInfo * ASTReader::getLocalIdentifier ( ModuleFile M,
unsigned  LocalID 
)

Definition at line 8238 of file ASTReader.cpp.

◆ getLocalModuleFile()

ModuleFile * ASTReader::getLocalModuleFile ( ModuleFile M,
unsigned  ID 
)

Retrieve the module file with a given local ID within the specified ModuleFile.

Definition at line 8331 of file ASTReader.cpp.

◆ getLocalSelector()

Selector ASTReader::getLocalSelector ( ModuleFile M,
unsigned  LocalID 
)

Retrieve a selector from the given module with its local ID number.

Definition at line 8386 of file ASTReader.cpp.

◆ getLocalType()

QualType ASTReader::getLocalType ( ModuleFile F,
unsigned  LocalID 
)

Resolve a local type ID within a given AST file into a type.

Definition at line 6873 of file ASTReader.cpp.

◆ getMacro()

MacroInfo * ASTReader::getMacro ( serialization::MacroID  ID)

Retrieve the macro with the given ID.

Definition at line 8257 of file ASTReader.cpp.

References clang::Error, and clang::serialization::NUM_PREDEF_MACRO_IDS.

◆ getMemoryBufferSizes()

void ASTReader::getMemoryBufferSizes ( MemoryBufferSizes sizes) const
overridevirtual

Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.

Reimplemented from clang::ExternalASTSource.

Definition at line 7598 of file ASTReader.cpp.

◆ getModule()

Module * ASTReader::getModule ( unsigned  ID)
overridevirtual

Retrieve the module that corresponds to the given module ID.

Note: overrides method in ExternalASTSource

Implements clang::ExternalPreprocessorSource.

Definition at line 8327 of file ASTReader.cpp.

◆ getModuleFileID()

unsigned ASTReader::getModuleFileID ( ModuleFile M)

◆ getModuleFileLevelDecls()

llvm::iterator_range< ASTReader::ModuleDeclIterator > ASTReader::getModuleFileLevelDecls ( ModuleFile Mod)

◆ getModuleImportLoc()

std::pair< SourceLocation, StringRef > ASTReader::getModuleImportLoc ( int  ID)
overridevirtual

◆ getModuleManager()

ModuleManager& clang::ASTReader::getModuleManager ( )
inline

Retrieve the module manager.

Definition at line 1634 of file ASTReader.h.

◆ GetNumExternalSelectors()

uint32_t ASTReader::GetNumExternalSelectors ( )
overridevirtual

Returns the number of selectors known to the external AST source.

The default implementation of this method is a no-op.

Reimplemented from clang::ExternalASTSource.

Definition at line 8419 of file ASTReader.cpp.

◆ getOriginalSourceFile() [1/2]

StringRef clang::ASTReader::getOriginalSourceFile ( )
inline

Retrieve the name of the original source file name for the primary module file.

Definition at line 1641 of file ASTReader.h.

References clang::serialization::ModuleManager::getPrimaryModule(), and clang::serialization::ModuleFile::OriginalSourceFileName.

Referenced by createInvocationForMigration().

◆ getOriginalSourceFile() [2/2]

std::string ASTReader::getOriginalSourceFile ( const std::string &  ASTFileName,
FileManager FileMgr,
const PCHContainerReader PCHContainerRdr,
DiagnosticsEngine Diags 
)
static

Retrieve the name of the original source file name directly from the AST file, without actually loading the AST file.

Definition at line 4591 of file ASTReader.cpp.

◆ getOwningModuleFile()

ModuleFile * ASTReader::getOwningModuleFile ( const Decl D)

Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a module file.

Definition at line 7085 of file ASTReader.cpp.

References clang::Decl::isFromASTFile().

Referenced by clang::ASTDeclWriter::AddFirstDeclFromEachModule().

◆ getOwningModuleNameForDiagnostic()

std::string ASTReader::getOwningModuleNameForDiagnostic ( const Decl D)

Get the best name we know for the module that owns the given declaration, or an empty string if the declaration is not from a module.

Definition at line 9078 of file ASTReader.cpp.

References clang::Decl::getImportedOwningModule(), and clang::serialization::ModuleFile::ModuleName.

◆ getPreprocessor()

Preprocessor& clang::ASTReader::getPreprocessor ( ) const
inline

Retrieve the preprocessor.

Definition at line 1637 of file ASTReader.h.

Referenced by isInterestingIdentifier(), and markIdentifierFromAST().

◆ getSema()

Sema* clang::ASTReader::getSema ( )
inline

Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled header is being imported.

Definition at line 2280 of file ASTReader.h.

◆ getSourceDescriptor()

llvm::Optional< ExternalASTSource::ASTSourceDescriptor > ASTReader::getSourceDescriptor ( unsigned  ID)
overridevirtual

Return a descriptor for the corresponding module.

Reimplemented from clang::ExternalASTSource.

Definition at line 8362 of file ASTReader.cpp.

References distance(), and clang::serialization::ModuleFile::OriginalSourceFileName.

◆ getSourceLocationForDeclID()

SourceLocation ASTReader::getSourceLocationForDeclID ( serialization::GlobalDeclID  ID)

Returns the source location for the decl ID.

Definition at line 7093 of file ASTReader.cpp.

References clang::serialization::NUM_PREDEF_DECL_IDS.

◆ getSourceManager()

SourceManager& clang::ASTReader::getSourceManager ( ) const
inline

Definition at line 1475 of file ASTReader.h.

◆ getSubmodule()

Module * ASTReader::getSubmodule ( serialization::SubmoduleID  GlobalID)

Retrieve the submodule that corresponds to a global submodule ID.

Definition at line 8313 of file ASTReader.cpp.

References clang::Error, and clang::serialization::NUM_PREDEF_SUBMODULE_IDS.

Referenced by clang::ASTRecordReader::getSubmodule(), and clang::ASTDeclReader::UpdateDecl().

◆ getSuggestedPredefines()

const std::string& clang::ASTReader::getSuggestedPredefines ( )
inline

Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of the predefines build prior to including the precompiled header.

Definition at line 1674 of file ASTReader.h.

References Diag().

◆ getSwitchCaseWithID()

SwitchCase * ASTReader::getSwitchCaseWithID ( unsigned  ID)

Retrieve the switch-case statement with the given ID.

Definition at line 8985 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::getSwitchCaseWithID().

◆ GetTemplateArgumentLocInfo()

TemplateArgumentLocInfo ASTReader::GetTemplateArgumentLocInfo ( ModuleFile F,
TemplateArgument::ArgKind  Kind,
const RecordData Record,
unsigned &  Idx 
)

◆ getTotalNumDecls()

unsigned clang::ASTReader::getTotalNumDecls ( ) const
inline

Returns the number of declarations found in the chain.

Definition at line 1718 of file ASTReader.h.

◆ getTotalNumIdentifiers()

unsigned clang::ASTReader::getTotalNumIdentifiers ( ) const
inline

Returns the number of identifiers found in the chain.

Definition at line 1703 of file ASTReader.h.

◆ getTotalNumMacros()

unsigned clang::ASTReader::getTotalNumMacros ( ) const
inline

Returns the number of macros found in the chain.

Definition at line 1708 of file ASTReader.h.

◆ getTotalNumPreprocessedEntities()

unsigned clang::ASTReader::getTotalNumPreprocessedEntities ( ) const
inline

Returns the number of preprocessed entities known to the AST reader.

Definition at line 1734 of file ASTReader.h.

References clang::serialization::ModuleFile::NumPreprocessedEntities, and clang::Result.

◆ getTotalNumSelectors()

unsigned clang::ASTReader::getTotalNumSelectors ( ) const
inline

Returns the number of selectors found in the chain.

Definition at line 1728 of file ASTReader.h.

◆ getTotalNumSLocs()

unsigned clang::ASTReader::getTotalNumSLocs ( ) const
inline

Returns the number of source locations found in the chain.

Definition at line 1698 of file ASTReader.h.

◆ getTotalNumSubmodules()

unsigned clang::ASTReader::getTotalNumSubmodules ( ) const
inline

Returns the number of submodules known.

Definition at line 1723 of file ASTReader.h.

◆ getTotalNumTypes()

unsigned clang::ASTReader::getTotalNumTypes ( ) const
inline

Returns the number of types found in the chain.

Definition at line 1713 of file ASTReader.h.

◆ GetType()

QualType ASTReader::GetType ( serialization::TypeID  ID)

Resolve a type ID into a type, potentially building a new type.

Definition at line 6703 of file ASTReader.cpp.

◆ GetTypeSourceInfo()

TypeSourceInfo * ASTReader::GetTypeSourceInfo ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

◆ hasExternalDefinitions()

ExternalASTSource::ExtKind ASTReader::hasExternalDefinitions ( const Decl D)
overridevirtual

Reimplemented from clang::ExternalASTSource.

Definition at line 8379 of file ASTReader.cpp.

◆ hasGlobalIndex()

bool clang::ASTReader::hasGlobalIndex ( ) const
inline

Determine whether this AST reader has a global index.

Definition at line 1597 of file ASTReader.h.

◆ InitializeContext()

void ASTReader::InitializeContext ( )

Initializes the ASTContext.

Definition at line 4419 of file ASTReader.cpp.

◆ InitializeSema()

void ASTReader::InitializeSema ( Sema S)
overridevirtual

Initialize the semantic source with the Sema instance being used to perform semantic analysis on the abstract syntax tree.

Reimplemented from clang::ExternalSemaSource.

Definition at line 7614 of file ASTReader.cpp.

◆ isAcceptableASTFile()

bool ASTReader::isAcceptableASTFile ( StringRef  Filename,
FileManager FileMgr,
const PCHContainerReader PCHContainerRdr,
const LangOptions LangOpts,
const TargetOptions TargetOpts,
const PreprocessorOptions PPOpts,
StringRef  ExistingModuleCachePath 
)
static

Determine whether the given AST file is acceptable to load into a translation unit with the given language and target options.

Definition at line 4901 of file ASTReader.cpp.

References clang::serialized_diags::Error, clang::serialization::ModuleFile::Stream, clang::serialization::SUBMODULE_BLOCK_ID, clang::serialization::SUBMODULE_DEFINITION, and clang::serialization::SUBMODULE_METADATA.

◆ isDeclIDFromModule()

bool ASTReader::isDeclIDFromModule ( serialization::GlobalDeclID  ID,
ModuleFile M 
) const

Returns true if global DeclID ID originated from module M.

Definition at line 7075 of file ASTReader.cpp.

References clang::serialization::ModuleFile::BaseDeclID, clang::serialization::ModuleFile::LocalNumDecls, and clang::serialization::NUM_PREDEF_DECL_IDS.

◆ isGlobalIndexUnavailable()

bool ASTReader::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.

Definition at line 3787 of file ASTReader.cpp.

◆ isPreprocessedEntityInFileID()

Optional< bool > ASTReader::isPreprocessedEntityInFileID ( unsigned  Index,
FileID  FID 
)
overridevirtual

Optionally returns true or false if the preallocated preprocessed entity with index Index came from file FID.

Optionally returns true or false if the preallocated preprocessed entity with index.

  • Index came from file
  • FID.

Reimplemented from clang::ExternalPreprocessingRecordSource.

Definition at line 5596 of file ASTReader.cpp.

References clang::serialization::PPEntityOffset::getBegin(), clang::serialization::ModuleFile::HeaderFileInfoTable, clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), and clang::serialization::ModuleFile::PreprocessedEntityOffsets.

◆ isProcessingUpdateRecords()

bool clang::ASTReader::isProcessingUpdateRecords ( )
inline

Definition at line 2319 of file ASTReader.h.

◆ loadGlobalIndex()

bool ASTReader::loadGlobalIndex ( )

Attempts to load the global index.

Returns
true if loading the global index has failed for any reason.

Definition at line 3765 of file ASTReader.cpp.

References clang::GlobalModuleIndex::readIndex().

◆ LoadSelector()

void ASTReader::LoadSelector ( Selector  Sel)

Load a selector from disk, registering its ID if it exists.

Definition at line 8141 of file ASTReader.cpp.

◆ makeModuleVisible()

void ASTReader::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.

Parameters
ModThe module whose names should be made visible.
NameVisibilityThe level of visibility to give the names in the module. Visibility can only be increased over time.
ImportLocThe location at which the import occurs.

Definition at line 3694 of file ASTReader.cpp.

◆ makeNamesVisible()

void ASTReader::makeNamesVisible ( const HiddenNames Names,
Module Owner 
)

Make the names within this set of hidden names visible.

Definition at line 3680 of file ASTReader.cpp.

References clang::Module::Hidden, moveMethodToBackOfGlobalList(), and clang::Module::NameVisibility.

◆ mapGlobalIDToModuleFileGlobalID()

DeclID ASTReader::mapGlobalIDToModuleFileGlobalID ( ModuleFile M,
serialization::DeclID  GlobalID 
)

Map a global declaration ID into the declaration ID used to refer to this declaration within the given module fule.

Returns
the global ID of the given declaration as known in the given module file.

Definition at line 7214 of file ASTReader.cpp.

References clang::serialization::NUM_PREDEF_DECL_IDS.

◆ markIdentifierUpToDate()

void ASTReader::markIdentifierUpToDate ( IdentifierInfo II)

Note that this identifier is up-to-date.

Definition at line 1935 of file ASTReader.cpp.

References clang::IdentifierInfo::setOutOfDate().

◆ mergeDefinitionVisibility()

void ASTReader::mergeDefinitionVisibility ( NamedDecl Def,
NamedDecl MergedDef 
)

Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whenever MergedDef is.

We've merged the definition MergedDef into the existing definition Def.

Ensure that Def is made visible whenever MergedDef is made visible.

Definition at line 3743 of file ASTReader.cpp.

References clang::Decl::getImportedOwningModule(), clang::Decl::getOwningModuleID(), clang::Decl::isHidden(), and clang::Decl::setVisibleDespiteOwningModule().

Referenced by clang::ASTDeclReader::attachPreviousDeclImpl().

◆ operator=()

ASTReader& clang::ASTReader::operator= ( const ASTReader )
delete

◆ PrintStats()

void ASTReader::PrintStats ( )
overridevirtual

Print some statistics about AST usage.

Reimplemented from clang::ExternalASTSource.

Definition at line 7466 of file ASTReader.cpp.

References dump().

◆ ReadAPFloat()

llvm::APFloat ASTReader::ReadAPFloat ( const RecordData Record,
const llvm::fltSemantics &  Sem,
unsigned &  Idx 
)

Read a floating-point value.

Definition at line 8922 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readAPFloat().

◆ ReadAPInt()

llvm::APInt ASTReader::ReadAPInt ( const RecordData Record,
unsigned &  Idx 
)

Read an integral value.

Definition at line 8907 of file ASTReader.cpp.

References clang::Result.

Referenced by clang::ASTRecordReader::readAPInt().

◆ ReadAPSInt()

llvm::APSInt ASTReader::ReadAPSInt ( const RecordData Record,
unsigned &  Idx 
)

Read a signed integral value.

Definition at line 8916 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readAPSInt().

◆ ReadAST()

ASTReader::ASTReadResult ASTReader::ReadAST ( StringRef  FileName,
ModuleKind  Type,
SourceLocation  ImportLoc,
unsigned  ClientLoadCapabilities,
SmallVectorImpl< ImportedSubmodule > *  Imported = nullptr 
)

Load the AST file designated by the given file name.

Parameters
FileNameThe name of the AST file to load.
TypeThe kind of AST being loaded, e.g., PCH, module, main file, or preamble.
ImportLocthe location where the module file will be considered as imported from. For non-module AST types it should be invalid.
ClientLoadCapabilitiesThe set of client load-failure capabilities, represented as a bitset of the enumerators of LoadFailureCapabilities.
Importedoptional out-parameter to append the list of modules that were imported by precompiled headers or any other non-module AST file

Definition at line 3834 of file ASTReader.cpp.

◆ readASTFileControlBlock()

bool ASTReader::readASTFileControlBlock ( StringRef  Filename,
FileManager FileMgr,
const PCHContainerReader PCHContainerRdr,
bool  FindModuleFileExtensions,
ASTReaderListener Listener,
bool  ValidateDiagnosticOptions 
)
static

Read the control block for the named AST file.

Returns
true if an error occurred, false otherwise.

Definition at line 4687 of file ASTReader.cpp.

Referenced by collectIncludePCH().

◆ ReadASTTemplateArgumentListInfo()

const ASTTemplateArgumentListInfo * ASTReader::ReadASTTemplateArgumentListInfo ( ModuleFile F,
const RecordData Record,
unsigned &  Index 
)

◆ ReadAttributes()

void ASTReader::ReadAttributes ( ASTRecordReader Record,
AttrVec Attrs 
)

Reads attributes from the current stream position.

Definition at line 2539 of file ASTReaderDecl.cpp.

References clang::ASTRecordReader::readInt(), and clang::ASTRecordReader::readSourceRange().

Referenced by clang::ASTRecordReader::readAttributes().

◆ ReadBlockAbbrevs()

bool ASTReader::ReadBlockAbbrevs ( llvm::BitstreamCursor &  Cursor,
unsigned  BlockID 
)
static

ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.

Read the abbreviations that are at the top of the block and then leave the cursor pointing into the block.

Definition at line 1531 of file ASTReader.cpp.

◆ ReadComments()

void ASTReader::ReadComments ( )
overridevirtual

Loads comments ranges.

Reimplemented from clang::ExternalASTSource.

Definition at line 8994 of file ASTReader.cpp.

◆ ReadCXXBaseSpecifier()

CXXBaseSpecifier ASTReader::ReadCXXBaseSpecifier ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a C++ base specifier.

Definition at line 8698 of file ASTReader.cpp.

References clang::Result, and clang::CXXBaseSpecifier::setInheritConstructors().

Referenced by clang::ASTRecordReader::readCXXBaseSpecifier().

◆ ReadCXXCtorInitializers()

CXXCtorInitializer ** ASTReader::ReadCXXCtorInitializers ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a CXXCtorInitializer array.

Definition at line 8714 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readCXXCtorInitializers().

◆ ReadCXXTemporary()

CXXTemporary * ASTReader::ReadCXXTemporary ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Definition at line 8955 of file ASTReader.cpp.

References clang::CXXTemporary::Create().

Referenced by clang::ASTRecordReader::readCXXTemporary().

◆ ReadDecl()

Decl* clang::ASTReader::ReadDecl ( ModuleFile F,
const RecordData R,
unsigned &  I 
)
inline

Reads a declaration from the given position in a record in the given module.

Definition at line 1838 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readDecl().

◆ ReadDeclarationName()

DeclarationName ASTReader::ReadDeclarationName ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a declaration name.

Definition at line 8441 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readDeclarationName().

◆ ReadDeclarationNameInfo()

void ASTReader::ReadDeclarationNameInfo ( ModuleFile F,
DeclarationNameInfo NameInfo,
const RecordData Record,
unsigned &  Idx 
)

◆ ReadDeclarationNameLoc()

void ASTReader::ReadDeclarationNameLoc ( ModuleFile F,
DeclarationNameLoc DNLoc,
DeclarationName  Name,
const RecordData Record,
unsigned &  Idx 
)

Definition at line 8485 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readDeclarationNameLoc().

◆ ReadDeclAs()

template<typename T >
T* clang::ASTReader::ReadDeclAs ( ModuleFile F,
const RecordData R,
unsigned &  I 
)
inline

Reads a declaration from the given position in a record in the given module.

Returns
The declaration read from this location, casted to the given result type.

Definition at line 1848 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readDeclAs().

◆ ReadDeclID()

serialization::DeclID ASTReader::ReadDeclID ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Reads a declaration ID from the given position in a record in the given module.

Returns
The declaration ID read from the record, adjusted to a global ID.

Definition at line 7231 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readDeclID().

◆ ReadDefinedMacros()

void ASTReader::ReadDefinedMacros ( )
overridevirtual

Read the set of macros defined by this external macro source.

Implements clang::ExternalPreprocessorSource.

Definition at line 1806 of file ASTReader.cpp.

◆ ReadDelegatingConstructors()

void ASTReader::ReadDelegatingConstructors ( SmallVectorImpl< CXXConstructorDecl *> &  Decls)
overridevirtual

Read the set of delegating constructors known to the external Sema source.

The external source should append its own delegating constructors to the given vector of declarations. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same declarations repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8022 of file ASTReader.cpp.

◆ ReadExpr()

Expr * ASTReader::ReadExpr ( ModuleFile F)

Reads an expression.

Definition at line 3012 of file ASTReaderStmt.cpp.

Referenced by clang::ASTRecordReader::readExpr().

◆ ReadExtVectorDecls()

void ASTReader::ReadExtVectorDecls ( SmallVectorImpl< TypedefNameDecl *> &  Decls)
overridevirtual

Read the set of ext_vector type declarations known to the external Sema source.

The external source should append its own ext_vector type declarations to the given vector of declarations. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same declarations repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8033 of file ASTReader.cpp.

◆ ReadKnownNamespaces()

void ASTReader::ReadKnownNamespaces ( SmallVectorImpl< NamespaceDecl *> &  Namespaces)
overridevirtual

Load the set of namespaces that are known to the external source, which will be used during typo correction.

Reimplemented from clang::ExternalSemaSource.

Definition at line 7965 of file ASTReader.cpp.

◆ ReadLateParsedTemplates()

void ASTReader::ReadLateParsedTemplates ( llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &  LPTMap)
overridevirtual

Read the set of late parsed template functions for this source.

The external source should insert its own late parsed template functions into the map. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same map entries repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8117 of file ASTReader.cpp.

References clang::T.

◆ ReadMacroRecord()

MacroInfo * ASTReader::ReadMacroRecord ( ModuleFile F,
uint64_t  Offset 
)

◆ ReadMethodPool()

void ASTReader::ReadMethodPool ( Selector  Sel)
overridevirtual

Load the contents of the global method pool for a given selector.

Reimplemented from clang::ExternalSemaSource.

Definition at line 7923 of file ASTReader.cpp.

References clang::serialization::ReadMethodPoolVisitor::getFactoryMethods(), and clang::serialization::ReadMethodPoolVisitor::getInstanceMethods().

◆ ReadMismatchingDeleteExpressions()

void ASTReader::ReadMismatchingDeleteExpressions ( llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &  Exprs)
overridevirtual

Reimplemented from clang::ExternalSemaSource.

Definition at line 7986 of file ASTReader.cpp.

References clang::C, and clang::SourceLocation::getFromRawEncoding().

◆ ReadNestedNameSpecifier()

NestedNameSpecifier * ASTReader::ReadNestedNameSpecifier ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Definition at line 8780 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readNestedNameSpecifier().

◆ ReadNestedNameSpecifierLoc()

NestedNameSpecifierLoc ASTReader::ReadNestedNameSpecifierLoc ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Definition at line 8835 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readNestedNameSpecifierLoc().

◆ ReadPath()

std::string ASTReader::ReadPath ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Definition at line 8936 of file ASTReader.cpp.

References Filename.

Referenced by clang::ASTRecordReader::readPath().

◆ ReadPendingInstantiations()

void ASTReader::ReadPendingInstantiations ( SmallVectorImpl< std::pair< ValueDecl *, SourceLocation >> &  Pending)
override

Definition at line 8105 of file ASTReader.cpp.

References clang::SourceLocation::getFromRawEncoding().

◆ ReadPragmaDiagnosticMappings()

void ASTReader::ReadPragmaDiagnosticMappings ( DiagnosticsEngine Diag)

◆ ReadPreprocessedEntity()

PreprocessedEntity * ASTReader::ReadPreprocessedEntity ( unsigned  Index)
overridevirtual

◆ ReadQualifierInfo()

void ASTReader::ReadQualifierInfo ( ModuleFile F,
QualifierInfo Info,
const RecordData Record,
unsigned &  Idx 
)

◆ ReadReferencedSelectors()

void ASTReader::ReadReferencedSelectors ( SmallVectorImpl< std::pair< Selector, SourceLocation >> &  Sels)
override

Definition at line 8055 of file ASTReader.cpp.

◆ ReadSelector()

Selector clang::ASTReader::ReadSelector ( ModuleFile M,
const RecordData Record,
unsigned &  Idx 
)
inline

Definition at line 2081 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readSelector().

◆ ReadSLocEntry()

bool ASTReader::ReadSLocEntry ( int  ID)
overridevirtual

Read the source location entry with index ID.

Implements clang::ExternalSLocEntrySource.

Definition at line 1351 of file ASTReader.cpp.

◆ ReadSourceLocation() [1/2]

SourceLocation clang::ASTReader::ReadSourceLocation ( ModuleFile ModuleFile,
uint32_t  Raw 
) const
inline

Read a source location from raw form.

Definition at line 2152 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readSourceLocation().

◆ ReadSourceLocation() [2/2]

SourceLocation clang::ASTReader::ReadSourceLocation ( ModuleFile ModuleFile,
const RecordDataImpl Record,
unsigned &  Idx 
)
inline

Read a source location.

Definition at line 2171 of file ASTReader.h.

◆ ReadSourceRange()

SourceRange ASTReader::ReadSourceRange ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a source range.

Definition at line 8899 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readSourceRange().

◆ ReadStmt()

Stmt * ASTReader::ReadStmt ( ModuleFile F)

Reads a statement.

Definition at line 2998 of file ASTReaderStmt.cpp.

Referenced by clang::ASTRecordReader::readStmt().

◆ ReadString()

std::string ASTReader::ReadString ( const RecordData Record,
unsigned &  Idx 
)
static

Definition at line 8929 of file ASTReader.cpp.

References clang::Result.

Referenced by clang::ASTRecordReader::readString().

◆ ReadSubExpr()

Expr * ASTReader::ReadSubExpr ( )

Reads a sub-expression operand during statement reading.

Definition at line 3016 of file ASTReaderStmt.cpp.

References clang::serialization::ModuleFile::DeclsCursor, and clang::serialized_diags::Error.

Referenced by clang::ASTRecordReader::readSubExpr().

◆ ReadSubStmt()

Stmt* clang::ASTReader::ReadSubStmt ( )
inline

Reads a sub-statement operand during statement reading.

Definition at line 2223 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readSubStmt().

◆ ReadTemplateArgument()

TemplateArgument ASTReader::ReadTemplateArgument ( ModuleFile F,
const RecordData Record,
unsigned &  Idx,
bool  Canonicalize = false 
)

Read a template argument.

Definition at line 8601 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readTemplateArgument().

◆ ReadTemplateArgumentList()

void ASTReader::ReadTemplateArgumentList ( SmallVectorImpl< TemplateArgument > &  TemplArgs,
ModuleFile F,
const RecordData Record,
unsigned &  Idx,
bool  Canonicalize = false 
)

Read a template argument array.

Definition at line 8676 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readTemplateArgumentList(), and ReadTemplateParameterList().

◆ ReadTemplateArgumentLoc()

TemplateArgumentLoc ASTReader::ReadTemplateArgumentLoc ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

◆ ReadTemplateName()

TemplateName ASTReader::ReadTemplateName ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a template name.

Definition at line 8542 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readTemplateName().

◆ ReadTemplateParameterList()

TemplateParameterList * ASTReader::ReadTemplateParameterList ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)

Read a template parameter list.

Definition at line 8656 of file ASTReader.cpp.

References clang::TemplateParameterList::Create(), and ReadTemplateArgumentList().

Referenced by clang::ASTRecordReader::readTemplateParameterList().

◆ ReadTentativeDefinitions()

void ASTReader::ReadTentativeDefinitions ( SmallVectorImpl< VarDecl *> &  TentativeDefs)
overridevirtual

Read the set of tentative definitions known to the external Sema source.

The external source should append its own tentative definitions to the given vector of tentative definitions. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same declarations repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8001 of file ASTReader.cpp.

◆ ReadToken()

Token ASTReader::ReadToken ( ModuleFile M,
const RecordDataImpl Record,
unsigned &  Idx 
)

◆ readType()

QualType clang::ASTReader::readType ( ModuleFile F,
const RecordData Record,
unsigned &  Idx 
)
inline

Read a type from the current position in the given record, which was read from the given AST file.

Definition at line 1772 of file ASTReader.h.

Referenced by clang::ASTRecordReader::readType().

◆ ReadUndefinedButUsed()

void ASTReader::ReadUndefinedButUsed ( llvm::MapVector< NamedDecl *, SourceLocation > &  Undefined)
overridevirtual

Load the set of used but not defined functions or variables with internal linkage, or used but not defined internal functions.

Reimplemented from clang::ExternalSemaSource.

Definition at line 7976 of file ASTReader.cpp.

References clang::SourceLocation::getFromRawEncoding().

◆ ReadUnresolvedSet()

void ASTReader::ReadUnresolvedSet ( ModuleFile F,
LazyASTUnresolvedSet Set,
const RecordData Record,
unsigned &  Idx 
)

◆ ReadUntranslatedSourceLocation()

SourceLocation clang::ASTReader::ReadUntranslatedSourceLocation ( uint32_t  Raw) const
inline

Read a source location from raw form and return it in its originating module file's source location space.

Definition at line 2147 of file ASTReader.h.

References clang::SourceLocation::getFromRawEncoding().

◆ ReadUnusedFileScopedDecls()

void ASTReader::ReadUnusedFileScopedDecls ( SmallVectorImpl< const DeclaratorDecl *> &  Decls)
overridevirtual

Read the set of unused file-scope declarations known to the external Sema source.

The external source should append its own unused, filed-scope to the given vector of declarations. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same declarations repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8011 of file ASTReader.cpp.

◆ ReadUnusedLocalTypedefNameCandidates()

void ASTReader::ReadUnusedLocalTypedefNameCandidates ( llvm::SmallSetVector< const TypedefNameDecl *, 4 > &  Decls)
overridevirtual

Read the set of potentially unused typedefs known to the source.

The external source should append its own potentially unused local typedefs to the given vector of declarations. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same declarations repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8043 of file ASTReader.cpp.

◆ ReadUsedVTables()

void ASTReader::ReadUsedVTables ( SmallVectorImpl< ExternalVTableUse > &  VTables)
overridevirtual

Read the set of used vtables known to the external Sema source.

The external source should append its own used vtables to the given vector. Note that this routine may be invoked multiple times; the external source should take care not to introduce the same vtables repeatedly.

Reimplemented from clang::ExternalSemaSource.

Definition at line 8093 of file ASTReader.cpp.

References clang::ExternalVTableUse::DefinitionRequired, clang::SourceLocation::getFromRawEncoding(), clang::ExternalVTableUse::Location, and clang::ExternalVTableUse::Record.

◆ ReadVersionTuple()

VersionTuple ASTReader::ReadVersionTuple ( const RecordData Record,
unsigned &  Idx 
)
static

Read a version tuple.

Definition at line 8943 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::readVersionTuple().

◆ ReadWeakUndeclaredIdentifiers()

void ASTReader::ReadWeakUndeclaredIdentifiers ( SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo >> &  WI)
override

Definition at line 8073 of file ASTReader.cpp.

◆ RecordSwitchCaseID()

void ASTReader::RecordSwitchCaseID ( SwitchCase SC,
unsigned  ID 
)

Record that the given ID maps to the given switch-case statement.

Definition at line 8978 of file ASTReader.cpp.

Referenced by clang::ASTRecordReader::recordSwitchCaseID().

◆ resetForReload()

void clang::ASTReader::resetForReload ( )
inline

Reset reader for a reload try.

Definition at line 1603 of file ASTReader.h.

◆ ResolveImportedPath() [1/2]

void ASTReader::ResolveImportedPath ( ModuleFile M,
std::string &  Filename 
)

If we are loading a relocatable PCH or module file, and the filename is not an absolute path, add the system or module root to the beginning of the file name.

Definition at line 2214 of file ASTReader.cpp.

References clang::serialization::ModuleFile::BaseDirectory.

◆ ResolveImportedPath() [2/2]

void ASTReader::ResolveImportedPath ( std::string &  Filename,
StringRef  Prefix 
)
static

Definition at line 2220 of file ASTReader.cpp.

◆ resolvePendingMacro()

void ASTReader::resolvePendingMacro ( IdentifierInfo II,
const PendingMacroInfo &  PMInfo 
)

◆ setDeserializationListener()

void ASTReader::setDeserializationListener ( ASTDeserializationListener Listener,
bool  TakeOwnership = false 
)

Set the AST deserialization listener.

Definition at line 796 of file ASTReader.cpp.

Referenced by clang::CompilerInstance::createModuleManager().

◆ SetGloballyVisibleDecls()

void ASTReader::SetGloballyVisibleDecls ( IdentifierInfo II,
const SmallVectorImpl< uint32_t > &  DeclIDs,
SmallVectorImpl< Decl *> *  Decls = nullptr 
)

Set the globally-visible declarations associated with the given identifier.

If the AST reader is currently in a state where the given declaration IDs cannot safely be resolved, they are queued until it is safe to resolve them.

Parameters
IIan IdentifierInfo that refers to one or more globally-visible declarations.
DeclIDsthe set of declaration IDs with the name II that are visible at global scope.
Declsif non-null, this vector will be populated with the set of deserialized declarations. These declarations will not be pushed into scope.

Definition at line 8171 of file ASTReader.cpp.

◆ SetIdentifierInfo()

void ASTReader::SetIdentifierInfo ( unsigned  ID,
IdentifierInfo II 
)

Definition at line 8146 of file ASTReader.cpp.

◆ setListener()

void clang::ASTReader::setListener ( std::unique_ptr< ASTReaderListener Listener)
inline

◆ SkipPath()

static void clang::ASTReader::SkipPath ( const RecordData Record,
unsigned &  Idx 
)
inlinestatic

Definition at line 2203 of file ASTReader.h.

◆ SkipString()

static void clang::ASTReader::SkipString ( const RecordData Record,
unsigned &  Idx 
)
inlinestatic

Definition at line 2195 of file ASTReader.h.

◆ StartedDeserializing()

void ASTReader::StartedDeserializing ( )
overridevirtual

Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is called there may be decls that are initializing.

Must be paired with FinishedDeserializing.

Reimplemented from clang::ExternalASTSource.

Definition at line 10493 of file ASTReader.cpp.

◆ StartTranslationUnit()

void ASTReader::StartTranslationUnit ( ASTConsumer Consumer)
overridevirtual

Function that will be invoked when we begin parsing a new translation unit involving this external AST source.

This function will provide all of the external definitions to the ASTConsumer.

Reimplemented from clang::ExternalASTSource.

Definition at line 7456 of file ASTReader.cpp.

◆ takeListener()

std::unique_ptr<ASTReaderListener> clang::ASTReader::takeListener ( )
inline

Take the AST callbacks listener.

Definition at line 1548 of file ASTReader.h.

Referenced by clang::ASTReader::ListenerScope::ListenerScope(), and clang::ASTReader::ListenerScope::~ListenerScope().

◆ TranslateSourceLocation()

SourceLocation clang::ASTReader::TranslateSourceLocation ( ModuleFile ModuleFile,
SourceLocation  Loc 
) const
inline

◆ updateOutOfDateIdentifier()

void ASTReader::updateOutOfDateIdentifier ( IdentifierInfo II)
overridevirtual

Update an out-of-date identifier.

Implements clang::ExternalPreprocessorSource.

Definition at line 1910 of file ASTReader.cpp.

References clang::IdentifierInfo::getName().

◆ updateOutOfDateSelector()

void ASTReader::updateOutOfDateSelector ( Selector  Sel)
overridevirtual

Load the contents of the global method pool for a given selector if necessary.

Reimplemented from clang::ExternalSemaSource.

Definition at line 7960 of file ASTReader.cpp.

◆ UpdateSema()

void ASTReader::UpdateSema ( )

Update the state of Sema after loading some additional modules.

Definition at line 7639 of file ASTReader.cpp.

◆ visitInputFiles()

void ASTReader::visitInputFiles ( serialization::ModuleFile MF,
bool  IncludeSystem,
bool  Complain,
llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)>  Visitor 
)

Visit all the input files of the given module file.

Definition at line 9050 of file ASTReader.cpp.

References clang::serialization::ModuleFile::InputFilesLoaded, and clang::serialization::ModuleFile::NumUserInputFiles.

◆ visitTopLevelModuleMaps()

void ASTReader::visitTopLevelModuleMaps ( serialization::ModuleFile MF,
llvm::function_ref< void(const FileEntry *)>  Visitor 
)

Visit all the top-level module maps loaded when building the given module file.

Definition at line 9065 of file ASTReader.cpp.

References clang::serialization::ModuleFile::InputFilesLoaded.

Friends And Related Function Documentation

◆ ASTDeclReader

friend class ASTDeclReader
friend

Types of AST files.

Definition at line 368 of file ASTReader.h.

◆ ASTIdentifierIterator

friend class ASTIdentifierIterator
friend

Definition at line 369 of file ASTReader.h.

◆ ASTRecordReader

friend class ASTRecordReader
friend

Definition at line 370 of file ASTReader.h.

◆ ASTStmtReader

friend class ASTStmtReader
friend

Definition at line 371 of file ASTReader.h.

◆ ASTUnit

friend class ASTUnit
friend

Definition at line 372 of file ASTReader.h.

◆ ASTWriter

friend class ASTWriter
friend

Definition at line 373 of file ASTReader.h.

◆ PCHValidator

friend class PCHValidator
friend

Definition at line 374 of file ASTReader.h.

◆ serialization::reader::ASTIdentifierLookupTrait

Definition at line 375 of file ASTReader.h.

◆ serialization::ReadMethodPoolVisitor

Definition at line 376 of file ASTReader.h.

◆ TypeLocReader

friend class TypeLocReader
friend

Definition at line 377 of file ASTReader.h.

Member Data Documentation

◆ CommentsCursors

SmallVector<std::pair<llvm::BitstreamCursor, serialization::ModuleFile *>, 8> clang::ASTReader::CommentsCursors

Cursors for comments blocks.

Definition at line 2302 of file ASTReader.h.

◆ PreloadedDeclIDs

SmallVector<uint64_t, 16> clang::ASTReader::PreloadedDeclIDs

Definition at line 2275 of file ASTReader.h.


The documentation for this class was generated from the following files: