clang 22.0.0git
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:
[legend]

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
Public Types inherited from clang::ExternalASTSource
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.
DeclgetKeyDeclaration (Decl *D)
 Returns the first key declaration for the given declaration.
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.
const serialization::reader::DeclContextLookupTablegetLoadedLookupTables (DeclContext *Primary) const
 Get the loaded lookup tables for Primary, if any.
const serialization::reader::ModuleLocalLookupTablegetModuleLocalLookupTables (DeclContext *Primary) const
const serialization::reader::DeclContextLookupTablegetTULocalLookupTables (DeclContext *Primary) const
serialization::reader::LazySpecializationInfoLookupTablegetLoadedSpecializationsLookupTables (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< ModuleDeclIteratorgetModuleFileLevelDecls (ModuleFile &Mod)
 ASTReader (Preprocessor &PP, ModuleCache &ModCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, const CodeGenOptions &CodeGenOpts, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ForceValidateUserInputs=true, 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
ASTReaderoperator= (const ASTReader &)=delete
 ~ASTReader () override
SourceManagergetSourceManager () const
FileManagergetFileManager () const
DiagnosticsEnginegetDiags () const
const CodeGenOptionsgetCodeGenOpts () 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< ASTReaderListenertakeListener ()
 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.
ASTDeserializationListenergetDeserializationListener ()
 Get the AST deserialization listener.
bool hasGlobalIndex () const
 Determine whether this AST reader has a global index.
GlobalModuleIndexgetGlobalIndex ()
 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.
ModuleManagergetModuleManager ()
 Retrieve the module manager.
const ModuleManagergetModuleManager () const
PreprocessorgetPreprocessor () 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.
PreprocessedEntityReadPreprocessedEntity (unsigned Index) override
 Read a preallocated preprocessed entity from the external source.
std::pair< unsigned, unsignedfindPreprocessedEntitiesInRange (SourceRange Range) override
 Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
std::optional< boolisPreprocessedEntityInFileID (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 getTotalNumMacros () const
 Returns the number of macros found in the chain.
unsigned getTotalNumTypes () const
 Returns the number of types found in the chain.
unsigned getTotalNumDecls () const
 Returns the number of declarations found in the chain.
unsigned getTotalNumSubmodules () const
 Returns the number of submodules known.
unsigned getTotalNumSelectors () const
 Returns the number of selectors found in the chain.
unsigned getTotalNumPreprocessedEntities () const
 Returns the number of preprocessed entities known to the AST reader.
QualType GetType (serialization::TypeID ID)
 Resolve a type ID into a type, potentially building a new type.
QualType getLocalType (ModuleFile &F, serialization::LocalTypeID LocalID)
 Resolve a local type ID within a given AST file into a type.
serialization::TypeID getGlobalTypeID (ModuleFile &F, serialization::LocalTypeID LocalID) const
 Map a local type ID within a given AST file into a global type ID.
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.
GlobalDeclID getGlobalDeclID (ModuleFile &F, LocalDeclID LocalID) const
 Map from a local declaration ID within a given module to a global declaration ID.
bool isDeclIDFromModule (GlobalDeclID ID, ModuleFile &M) const
 Returns true if global DeclID ID originated from module M.
ModuleFilegetOwningModuleFile (const Decl *D) const
 Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a module file.
ModuleFilegetOwningModuleFile (GlobalDeclID ID) const
SourceLocation getSourceLocationForDeclID (GlobalDeclID ID)
 Returns the source location for the decl ID.
DeclGetDecl (GlobalDeclID ID)
 Resolve a declaration ID into a declaration, potentially building a new declaration.
DeclGetExternalDecl (GlobalDeclID ID) override
 Resolve a declaration ID into a declaration, potentially building a new declaration.
DeclGetExistingDecl (GlobalDeclID ID)
 Resolve a declaration ID into a declaration.
DeclGetLocalDecl (ModuleFile &F, LocalDeclID LocalID)
 Reads a declaration with the given local ID in the given module.
template<typename T>
TGetLocalDeclAs (ModuleFile &F, LocalDeclID LocalID)
 Reads a declaration with the given local ID in the given module.
LocalDeclID mapGlobalIDToModuleFileGlobalID (ModuleFile &M, GlobalDeclID GlobalID)
 Map a global declaration ID into the declaration ID used to refer to this declaration within the given module fule.
GlobalDeclID ReadDeclID (ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
 Reads a declaration ID from the given position in a record in the given module.
DeclReadDecl (ModuleFile &F, const RecordDataImpl &R, unsigned &I)
 Reads a declaration from the given position in a record in the given module.
template<typename T>
TReadDeclAs (ModuleFile &F, const RecordDataImpl &R, unsigned &I)
 Reads a declaration from the given position in a record in the given module.
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.
CXXBaseSpecifierGetExternalCXXBaseSpecifiers (uint64_t Offset) override
 Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.
StmtGetExternalDeclStmt (uint64_t Offset) override
 Resolve the offset of a statement into a statement.
bool LoadExternalSpecializations (const Decl *D, bool OnlyPartial) override
 Load all the external specializations for the Decl.
bool LoadExternalSpecializations (const Decl *D, ArrayRef< TemplateArgument > TemplateArgs) override
 Load all the specializations for the Decl.
bool FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC) override
 Finds all the visible declarations with a given name.
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.
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.
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.
void FinishedDeserializing () override
 Notify ASTReader that we finished the deserialization of a decl or type.
void StartTranslationUnit (ASTConsumer *Consumer) override
 Function that will be invoked when we begin parsing a new translation unit involving this external AST source.
void PrintStats () override
 Print some statistics about AST usage.
void dump ()
 Dump information about the AST reader to standard error.
void getMemoryBufferSizes (MemoryBufferSizes &sizes) const override
 Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
void InitializeSema (Sema &S) override
 Initialize the semantic source with the Sema instance being used to perform semantic analysis on the abstract syntax tree.
void ForgetSema () override
 Inform the semantic consumer that Sema is no longer available.
IdentifierInfoget (StringRef Name) override
 Retrieve the IdentifierInfo for the named identifier.
IdentifierIteratorgetIdentifiers () override
 Retrieve an iterator into the set of all identifiers in all loaded AST files.
void ReadMethodPool (Selector Sel) override
 Load the contents of the global method pool for a given selector.
void updateOutOfDateSelector (Selector Sel) override
 Load the contents of the global method pool for a given selector if necessary.
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.
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.
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.
void ReadUnusedFileScopedDecls (SmallVectorImpl< const DeclaratorDecl * > &Decls) override
 Read the set of unused file-scope declarations known to the external Sema source.
void ReadDelegatingConstructors (SmallVectorImpl< CXXConstructorDecl * > &Decls) override
 Read the set of delegating constructors known to the external Sema source.
void ReadExtVectorDecls (SmallVectorImpl< TypedefNameDecl * > &Decls) override
 Read the set of ext_vector type declarations known to the external Sema source.
void ReadUnusedLocalTypedefNameCandidates (llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
 Read the set of potentially unused typedefs known to the source.
void ReadDeclsToCheckForDeferredDiags (llvm::SmallSetVector< Decl *, 4 > &Decls) override
 Read the set of decls to be checked for deferred diags.
void ReadReferencedSelectors (SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
 Read the set of referenced selectors known to the external Sema source.
void ReadWeakUndeclaredIdentifiers (SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WeakIDs) override
 Read the set of weak, undeclared identifiers known to the external Sema source.
void ReadUsedVTables (SmallVectorImpl< ExternalVTableUse > &VTables) override
 Read the set of used vtables known to the external Sema source.
void ReadPendingInstantiations (SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
 Read the set of pending instantiations known to the external Sema source.
void ReadLateParsedTemplates (llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > &LPTMap) override
 Read the set of late parsed template functions for this source.
void AssignedLambdaNumbering (CXXRecordDecl *Lambda) override
 Notify the external source that a lambda was assigned a mangling number.
void LoadSelector (Selector Sel)
 Load a selector from disk, registering its ID if it exists.
void SetIdentifierInfo (serialization::IdentifierID ID, IdentifierInfo *II)
void SetGloballyVisibleDecls (IdentifierInfo *II, const SmallVectorImpl< GlobalDeclID > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
 Set the globally-visible declarations associated with the given identifier.
DiagnosticBuilder Diag (unsigned DiagID) const
 Report a diagnostic.
DiagnosticBuilder Diag (SourceLocation Loc, unsigned DiagID) const
 Report a diagnostic.
void runWithSufficientStackSpace (SourceLocation Loc, llvm::function_ref< void()> Fn)
IdentifierInfoDecodeIdentifierInfo (serialization::IdentifierID ID)
IdentifierInforeadIdentifier (ModuleFile &M, const RecordData &Record, unsigned &Idx)
IdentifierInfoGetIdentifier (serialization::IdentifierID ID) override
 Return the identifier associated with the given ID number.
IdentifierInfogetLocalIdentifier (ModuleFile &M, uint64_t LocalID)
serialization::IdentifierID getGlobalIdentifierID (ModuleFile &M, uint64_t LocalID)
void resolvePendingMacro (IdentifierInfo *II, const PendingMacroInfo &PMInfo)
MacroInfogetMacro (serialization::MacroID ID)
 Retrieve the macro with the given ID.
serialization::MacroID getGlobalMacroID (ModuleFile &M, unsigned LocalID)
 Retrieve the global macro ID corresponding to the given local ID within the given module file.
bool ReadSLocEntry (int ID) override
 Read the source location entry with index ID.
int getSLocEntryID (SourceLocation::UIntTy SLocOffset) override
 Get the index ID for the loaded SourceLocation offset.
llvm::Expected< SourceLocation::UIntTyreadSLocOffset (ModuleFile *F, unsigned Index)
 Try to read the offset of the SLocEntry at the given index in the given module file.
std::pair< SourceLocation, StringRef > getModuleImportLoc (int ID) override
 Retrieve the module import location and module name for the given source manager entry ID.
serialization::SubmoduleID getGlobalSubmoduleID (ModuleFile &M, unsigned LocalID) const
 Retrieve the global submodule ID given a module and its local ID number.
ModulegetSubmodule (serialization::SubmoduleID GlobalID)
 Retrieve the submodule that corresponds to a global submodule ID.
ModulegetModule (unsigned ID) override
 Retrieve the module that corresponds to the given module ID.
ModuleFilegetLocalModuleFile (ModuleFile &M, unsigned ID) const
 Retrieve the module file with a given local ID within the specified ModuleFile.
unsigned getModuleFileID (ModuleFile *M)
 Get an ID for the given module file.
std::optional< ASTSourceDescriptorgetSourceDescriptor (unsigned ID) override
 Return a descriptor for the corresponding module.
ExtKind hasExternalDefinitions (const Decl *D) override
bool wasThisDeclarationADefinition (const FunctionDecl *FD) override
 True if this function declaration was a definition before in its own module.
Selector getLocalSelector (ModuleFile &M, unsigned LocalID)
 Retrieve a selector from the given module with its local ID number.
Selector DecodeSelector (serialization::SelectorID Idx)
Selector GetExternalSelector (serialization::SelectorID ID) override
 Resolve a selector ID into a selector.
uint32_t GetNumExternalSelectors () override
 Returns the number of selectors known to the external AST source.
Selector ReadSelector (ModuleFile &M, const RecordData &Record, unsigned &Idx)
serialization::SelectorID getGlobalSelectorID (ModuleFile &M, unsigned LocalID) const
 Retrieve the global selector ID that corresponds to this the local selector ID in a given module.
CXXCtorInitializer ** GetExternalCXXCtorInitializers (uint64_t Offset) override
 Read the contents of a CXXCtorInitializer array.
Sema::AlignPackInfo ReadAlignPackInfo (uint32_t Raw) const
 Read a AlignPackInfo from raw form.
std::pair< SourceLocation, unsignedReadUntranslatedSourceLocation (RawLocEncoding Raw) const
 Read a source location from raw form and return it in its originating module file's source location space.
SourceLocation ReadSourceLocation (ModuleFile &MF, RawLocEncoding Raw) const
 Read a source location from raw form.
SourceLocation TranslateSourceLocation (ModuleFile &ModuleFile, SourceLocation Loc) const
 Translate a source location from another module file's source location space into ours.
SourceLocation ReadSourceLocation (ModuleFile &ModuleFile, const RecordDataImpl &Record, unsigned &Idx)
 Read a source location.
FileID ReadFileID (ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx) const
 Read a FileID.
FileID TranslateFileID (ModuleFile &F, FileID FID) const
 Translate a FileID from another module file's FileID space into ours.
SourceRange ReadSourceRange (ModuleFile &F, const RecordData &Record, unsigned &Idx)
 Read a source range.
std::string ReadPath (ModuleFile &F, const RecordData &Record, unsigned &Idx)
std::string ReadPath (StringRef BaseDirectory, const RecordData &Record, unsigned &Idx)
std::string ReadPathBlob (StringRef BaseDirectory, const RecordData &Record, unsigned &Idx, StringRef &Blob)
CXXTemporaryReadCXXTemporary (ModuleFile &F, const RecordData &Record, unsigned &Idx)
StmtReadStmt (ModuleFile &F)
 Reads a statement.
ExprReadExpr (ModuleFile &F)
 Reads an expression.
StmtReadSubStmt ()
 Reads a sub-statement operand during statement reading.
ExprReadSubExpr ()
 Reads a sub-expression operand during statement reading.
Token ReadToken (ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
 Reads a token out of a record.
MacroInfoReadMacroRecord (ModuleFile &F, uint64_t Offset)
 Reads the macro record located at the given offset.
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.
void addPendingMacro (IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
 Add a macro to deserialize its macro directive history.
void ReadDefinedMacros () override
 Read the set of macros defined by this external macro source.
void updateOutOfDateIdentifier (const IdentifierInfo &II) override
 Update an out-of-date identifier.
void markIdentifierUpToDate (const IdentifierInfo *II)
 Note that this identifier is up-to-date.
void completeVisibleDeclsMap (const DeclContext *DC) override
 Load all external visible decls in the given DeclContext.
ASTContextgetContext ()
 Retrieve the AST context that this AST reader supplements.
SemagetSema ()
 Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled header is being imported.
IdentifierResolvergetIdResolver ()
 Get the identifier resolver used for name lookup / updates in the translation unit scope.
IdentifierTablegetIdentifierTable ()
 Retrieve the identifier table associated with the preprocessor.
void RecordSwitchCaseID (SwitchCase *SC, unsigned ID)
 Record that the given ID maps to the given switch-case statement.
SwitchCasegetSwitchCaseWithID (unsigned ID)
 Retrieve the switch-case statement with the given ID.
void ClearSwitchCaseIDs ()
void ReadComments () override
 Loads comments ranges.
void visitInputFileInfos (serialization::ModuleFile &MF, bool IncludeSystem, llvm::function_ref< void(const serialization::InputFileInfo &IFI, bool IsSystem)> Visitor)
 Visit all the input file infos of the given module file.
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.
void visitTopLevelModuleMaps (serialization::ModuleFile &MF, llvm::function_ref< void(FileEntryRef)> Visitor)
 Visit all the top-level module maps loaded when building the given module file.
bool isProcessingUpdateRecords ()
static TemporarilyOwnedStringRef ResolveImportedPath (SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
 Resolve Path in the context of module file M.
static TemporarilyOwnedStringRef ResolveImportedPath (SmallString< 0 > &Buf, StringRef Path, StringRef Prefix)
 Resolve Path in the context of the Prefix directory.
static std::string ResolveImportedPathAndAllocate (SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
 Resolve Path in the context of module file M.
static std::string ResolveImportedPathAndAllocate (SmallString< 0 > &Buf, StringRef Path, StringRef Prefix)
 Resolve Path in the context of the Prefix directory.
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.
static bool readASTFileControlBlock (StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
 Read the control block for the named AST file.
static bool isAcceptableASTFile (StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const CodeGenOptions &CGOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)
 Determine whether the given AST file is acceptable to load into a translation unit with the given language and target options.
static llvm::Error ReadBlockAbbrevs (llvm::BitstreamCursor &Cursor, unsigned BlockID, uint64_t *StartOfBlockOffset=nullptr)
 ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
static llvm::BitVector ReadBitVector (const RecordData &Record, const StringRef Blob)
static std::string ReadString (const RecordDataImpl &Record, unsigned &Idx)
static StringRef ReadStringBlob (const RecordDataImpl &Record, unsigned &Idx, StringRef &Blob)
static VersionTuple ReadVersionTuple (const RecordData &Record, unsigned &Idx)
 Read a version tuple.

Additional Inherited Members

Public Member Functions inherited from clang::ExternalPreprocessorSource
virtual ~ExternalPreprocessorSource ()
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 ()=default
 ~ExternalSemaSource () override
virtual bool LookupUnqualified (LookupResult &R, Scope *S)
 Do last resort, unqualified lookup on a LookupResult that Sema cannot find.
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.
virtual bool MaybeDiagnoseMissingCompleteType (SourceLocation Loc, QualType T)
 Produces a diagnostic note if the external source contains a complete definition for T.
bool isA (const void *ClassID) const override
 LLVM-style RTTI.
Public Member Functions inherited from clang::ExternalASTSource
 ExternalASTSource ()=default
virtual ~ExternalASTSource ()
uint32_t getGeneration () const
 Get the current generation of this AST source.
void FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl * > &Result)
 Finds all declarations lexically contained within the given DeclContext.
virtual void CompleteType (TagDecl *Tag)
 Gives the external AST source an opportunity to complete an incomplete type.
virtual void CompleteType (ObjCInterfaceDecl *Class)
 Gives the external AST source an opportunity to complete an incomplete Objective-C class.
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.
MemoryBufferSizes getMemoryBufferSizes () const
 Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
Public Member Functions inherited from clang::IdentifierInfoLookup
virtual ~IdentifierInfoLookup ()
Public Member Functions inherited from clang::ExternalSLocEntrySource
virtual ~ExternalSLocEntrySource ()
static bool classof (const ExternalASTSource *S)
static bool classof (const ExternalASTSource *S)
Protected Member Functions inherited from clang::ExternalASTSource
uint32_t incrementGeneration (ASTContext &C)
 Increment the current generation.
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 423 of file ASTReader.h.

Member Typedef Documentation

◆ ModuleConstIterator

◆ ModuleFile

◆ ModuleIterator

◆ ModuleKind

◆ ModuleManager

◆ ModuleReverseIterator

◆ RawLocEncoding

◆ RecordData

Definition at line 445 of file ASTReader.h.

◆ RecordDataImpl

Definition at line 446 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 written with a different language/target configuration.

HadErrors 

The AST file has errors.

Definition at line 450 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.

ARR_TreatModuleWithErrorsAsOutOfDate 

If a module file is marked with errors treat it as out-of-date so the caller can rebuild it.

Definition at line 1827 of file ASTReader.h.

Constructor & Destructor Documentation

◆ ASTReader() [1/2]

ASTReader::ASTReader ( Preprocessor & PP,
ModuleCache & ModCache,
ASTContext * Context,
const PCHContainerReader & PCHContainerRdr,
const CodeGenOptions & CodeGenOpts,
ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions,
StringRef isysroot = "",
DisableValidationForModuleKind DisableValidationKind = DisableValidationForModuleKind::None,
bool AllowASTWithCompilerErrors = false,
bool AllowConfigurationMismatch = false,
bool ValidateSystemInputs = false,
bool ForceValidateUserInputs = true,
bool ValidateASTInputFilesContent = 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 "/".
DisableValidationKindIf set, the AST reader will suppress most of its regular consistency checking, allowing the use of precompiled headers and module files 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 11094 of file ASTReader.cpp.

References clang::cast(), getFileManager(), getSourceManager(), clang::PCH, and PCHValidator.

Referenced by ASTReader(), clang::ASTReader::ListenerScope::ListenerScope(), clang::ASTReader::ModuleDeclIterator::ModuleDeclIterator(), and operator=().

◆ ASTReader() [2/2]

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

References ASTReader().

◆ ~ASTReader()

ASTReader::~ASTReader ( )
override

Definition at line 11140 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 1978 of file ASTReader.h.

References clang::FileName.

◆ addListener()

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

Add an AST callback listener.

Takes ownership of L.

Definition at line 1912 of file ASTReader.h.

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

◆ addPendingMacro()

void ASTReader::addPendingMacro ( IdentifierInfo * II,
ModuleFile * M,
uint32_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 2386 of file ASTReader.cpp.

◆ AssignedLambdaNumbering()

void ASTReader::AssignedLambdaNumbering ( CXXRecordDecl * Lambda)
overridevirtual

Notify the external source that a lambda was assigned a mangling number.

This enables the external source to track the correspondence between lambdas and mangling numbers if necessary.

Reimplemented from clang::ExternalSemaSource.

Definition at line 9577 of file ASTReader.cpp.

References clang::cast(), clang::Decl::getCanonicalDecl(), clang::Redeclarable< decl_type >::getFirstDecl(), clang::CXXRecordDecl::getLambdaContextDecl(), clang::CXXRecordDecl::getLambdaIndexInContext(), Previous, and clang::Redeclarable< decl_type >::setPreviousDecl().

◆ ClearSwitchCaseIDs()

void ASTReader::ClearSwitchCaseIDs ( )

Definition at line 10260 of file ASTReader.cpp.

Referenced by GetExternalDeclStmt().

◆ CompleteRedeclChain()

void ASTReader::CompleteRedeclChain ( const Decl * D)
overridevirtual

◆ completeVisibleDeclsMap()

void ASTReader::completeVisibleDeclsMap ( const DeclContext * DC)
overridevirtual

◆ DecodeIdentifierInfo()

◆ DecodeSelector()

◆ Diag() [1/2]

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

Report a diagnostic.

Definition at line 10225 of file ASTReader.cpp.

◆ Diag() [2/2]

DiagnosticBuilder ASTReader::Diag ( unsigned DiagID) const

Report a diagnostic.

Definition at line 10221 of file ASTReader.cpp.

References Diag().

Referenced by Diag(), and ReadPragmaDiagnosticMappings().

◆ dump()

LLVM_DUMP_METHOD void ASTReader::dump ( )

Dump information about the AST reader to standard error.

Definition at line 8945 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 5610 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 8554 of file ASTReader.cpp.

References clang::LocalDeclID::get(), clang::Decl::getKind(), GetLocalDecl(), clang::isa(), clang::DeclContext::isDeclInLexicalTraversal(), and clang::NUM_PREDEF_DECL_IDS.

Referenced by CompleteRedeclChain().

◆ FindExternalVisibleDeclsByName()

bool ASTReader::FindExternalVisibleDeclsByName ( const DeclContext * DC,
DeclarationName Name,
const DeclContext * OriginalDC )
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 8675 of file ASTReader.cpp.

References clang::cast(), clang::Found, GetDecl(), clang::NamedDecl::getDeclName(), clang::DeclContext::getPrimaryContext(), clang::DeclContext::hasExternalVisibleStorage(), and clang::ExternalASTSource::SetExternalVisibleDeclsForName().

◆ 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 8632 of file ASTReader.cpp.

References clang::File, clang::LocalDeclID::get(), GetDecl(), getGlobalDeclID(), clang::SourceLocation::getLocWithOffset(), getSourceManager(), and SM.

◆ 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 6917 of file ASTReader.cpp.

◆ 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 11002 of file ASTReader.cpp.

References clang::ASTContext::adjustDeducedFunctionResultType(), clang::ASTContext::adjustExceptionSpec(), clang::cast(), clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec, getContext(), clang::FunctionProtoType::getExtProtoInfo(), and clang::Update.

◆ 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 1520 of file ASTReader.h.

References clang::Decl::getCanonicalDecl(), GetExistingDecl(), 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 2279 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 9120 of file ASTReader.cpp.

References loadGlobalIndex(), and markIdentifierUpToDate().

◆ getCodeGenOpts()

const CodeGenOptions & clang::ASTReader::getCodeGenOpts ( ) const
inline

Definition at line 1820 of file ASTReader.h.

◆ getContext()

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

◆ GetDecl()

◆ getDeserializationListener()

ASTDeserializationListener * clang::ASTReader::getDeserializationListener ( )
inline

Get the AST deserialization listener.

Definition at line 1949 of file ASTReader.h.

◆ getDiags()

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

Definition at line 1819 of file ASTReader.h.

◆ GetExistingDecl()

Decl * ASTReader::GetExistingDecl ( GlobalDeclID ID)

Resolve a declaration ID into a declaration.

Return 0 if it's not been loaded yet.

Definition at line 8357 of file ASTReader.cpp.

References clang::Error, clang::Decl::getCanonicalDecl(), and clang::NUM_PREDEF_DECL_IDS.

Referenced by forEachImportedKeyDecl(), GetDecl(), getKeyDeclaration(), and getSourceLocationForDeclID().

◆ 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 8126 of file ASTReader.cpp.

References ASTRecordReader, clang::serialization::DECL_CXX_BASE_SPECIFIERS, clang::serialization::ModuleFile::DeclsCursor, and clang::Error.

◆ GetExternalCXXCtorInitializers()

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

◆ GetExternalDecl()

Decl * ASTReader::GetExternalDecl ( GlobalDeclID 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 8020 of file ASTReader.cpp.

References GetDecl().

◆ 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 8448 of file ASTReader.cpp.

References ClearSwitchCaseIDs(), clang::serialization::ModuleFile::DeclsCursor, and clang::Error.

◆ 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 9895 of file ASTReader.cpp.

References DecodeSelector().

◆ getFileManager()

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

◆ getGlobalDeclID()

◆ getGlobalIdentifierID()

◆ getGlobalIndex()

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

Return global module index.

Definition at line 1957 of file ASTReader.h.

◆ getGlobalMacroID()

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

◆ getGlobalPreprocessedEntityID()

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

◆ getGlobalSelectorID()

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

◆ getGlobalSubmoduleID()

◆ getGlobalTypeID()

◆ GetHeaderFileInfo()

HeaderFileInfo ASTReader::GetHeaderFileInfo ( FileEntryRef FE)
overridevirtual

Read the header file information for the given file entry.

Implements clang::ExternalHeaderFileInfoSource.

Definition at line 6980 of file ASTReader.cpp.

◆ GetIdentifier()

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

Return the identifier associated with the given ID number.

The ID 0 is associated with the NULL identifier.

Implements clang::ExternalPreprocessorSource.

Definition at line 2372 of file ASTReader.h.

References DecodeIdentifierInfo().

◆ 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 9245 of file ASTReader.cpp.

References ASTIdentifierIterator, and loadGlobalIndex().

◆ getIdentifierTable()

IdentifierTable & ASTReader::getIdentifierTable ( )

Retrieve the identifier table associated with the preprocessor.

Definition at line 10242 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 11145 of file ASTReader.cpp.

◆ getKeyDeclaration() [1/2]

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

Definition at line 1514 of file ASTReader.h.

References getKeyDeclaration().

◆ getKeyDeclaration() [2/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 1504 of file ASTReader.h.

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

Referenced by getKeyDeclaration().

◆ getLoadedLookupTables()

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

Get the loaded lookup tables for Primary, if any.

Definition at line 8762 of file ASTReader.cpp.

References clang::nullptr.

◆ getLoadedSpecializationsLookupTables()

serialization::reader::LazySpecializationInfoLookupTable * ASTReader::getLoadedSpecializationsLookupTables ( const Decl * D,
bool IsPartial )

Get the loaded specializations lookup tables for D, if any.

Definition at line 8780 of file ASTReader.cpp.

References clang::Decl::isCanonicalDecl(), and clang::nullptr.

◆ GetLocalDecl()

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

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

Definition at line 2147 of file ASTReader.h.

References GetDecl(), getGlobalDeclID(), and LocalDeclID.

Referenced by FindExternalLexicalDecls(), and GetLocalDeclAs().

◆ GetLocalDeclAs()

template<typename T>
T * clang::ASTReader::GetLocalDeclAs ( ModuleFile & F,
LocalDeclID 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 2154 of file ASTReader.h.

References GetLocalDecl(), LocalDeclID, and clang::T.

◆ getLocalIdentifier()

IdentifierInfo * ASTReader::getLocalIdentifier ( ModuleFile & M,
uint64_t LocalID )

◆ getLocalModuleFile()

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

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

Definition at line 9807 of file ASTReader.cpp.

References getGlobalSubmoduleID(), getModuleManager(), clang::nullptr, and clang::serialization::ModuleManager::pch_modules().

◆ getLocalSelector()

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

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

Definition at line 9866 of file ASTReader.cpp.

References DecodeSelector(), and getGlobalSelectorID().

Referenced by ReadSelector().

◆ getLocalType()

QualType ASTReader::getLocalType ( ModuleFile & F,
serialization::LocalTypeID LocalID )

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

Definition at line 7940 of file ASTReader.cpp.

References getGlobalTypeID(), and GetType().

Referenced by readType().

◆ getMacro()

◆ 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 8962 of file ASTReader.cpp.

References bytes(), clang::ExternalASTSource::MemoryBufferSizes::malloc_bytes, and clang::ExternalASTSource::MemoryBufferSizes::mmap_bytes.

◆ 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 9803 of file ASTReader.cpp.

References getSubmodule().

Referenced by clang::DumpModuleInfoAction::ExecuteAction().

◆ getModuleFileID()

◆ getModuleFileLevelDecls()

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

◆ getModuleImportLoc()

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

Retrieve the module import location and module name for the given source manager entry ID.

Implements clang::ExternalSLocEntrySource.

Definition at line 2015 of file ASTReader.cpp.

References clang::Error, getTotalNumSLocs(), clang::serialization::ModuleFile::ImportLoc, clang::serialization::ModuleFile::isModule(), and clang::serialization::ModuleFile::ModuleName.

◆ getModuleLocalLookupTables()

const serialization::reader::ModuleLocalLookupTable * ASTReader::getModuleLocalLookupTables ( DeclContext * Primary) const

Definition at line 8768 of file ASTReader.cpp.

References clang::nullptr.

◆ getModuleManager() [1/2]

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

◆ getModuleManager() [2/2]

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

Definition at line 1992 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 9899 of file ASTReader.cpp.

References getTotalNumSelectors().

◆ 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 1999 of file ASTReader.h.

Referenced by AddImplicitIncludePCH().

◆ 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 5663 of file ASTReader.cpp.

References clang::serialization::CONTROL_BLOCK_ID, doesntStartWithASTFileMagic(), clang::serialization::ORIGINAL_FILE, and SkipCursorToBlock().

◆ getOwningModuleFile() [1/2]

ModuleFile * ASTReader::getOwningModuleFile ( const Decl * D) const

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

Definition at line 8211 of file ASTReader.cpp.

References clang::Decl::getGlobalID(), getOwningModuleFile(), and clang::Decl::isFromASTFile().

Referenced by getOwningModuleFile(), mapGlobalIDToModuleFileGlobalID(), and ReadLateParsedTemplates().

◆ getOwningModuleFile() [2/2]

ModuleFile * ASTReader::getOwningModuleFile ( GlobalDeclID ID) const

Definition at line 8200 of file ASTReader.cpp.

References getModuleManager(), and clang::NUM_PREDEF_DECL_IDS.

◆ getPathBuf()

SmallString< 0 > & clang::ASTReader::getPathBuf ( )
inline

Get the buffer for resolving paths.

Definition at line 1481 of file ASTReader.h.

◆ getPreprocessor()

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

◆ 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 2612 of file ASTReader.h.

Referenced by ReadMethodPool().

◆ getSLocEntryID()

int ASTReader::getSLocEntryID ( SourceLocation::UIntTy SLocOffset)
overridevirtual

Get the index ID for the loaded SourceLocation offset.

Implements clang::ExternalSLocEntrySource.

Definition at line 1796 of file ASTReader.cpp.

References clang::Invalid, and clang::serialization::ModuleFile::LocalNumSLocEntries.

◆ getSourceDescriptor()

std::optional< ASTSourceDescriptor > ASTReader::getSourceDescriptor ( unsigned ID)
overridevirtual

◆ getSourceLocationForDeclID()

SourceLocation ASTReader::getSourceLocationForDeclID ( GlobalDeclID ID)

Returns the source location for the decl ID.

Definition at line 8218 of file ASTReader.cpp.

References GetExistingDecl(), clang::Decl::getLocation(), and clang::NUM_PREDEF_DECL_IDS.

◆ getSourceManager()

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

Definition at line 1817 of file ASTReader.h.

Referenced by ASTReader(), and FindFileRegionDecls().

◆ getSubmodule()

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

Retrieve the submodule that corresponds to a global submodule ID.

Definition at line 9789 of file ASTReader.cpp.

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

Referenced by getModule(), getSourceDescriptor(), InitializeContext(), ReadAST(), resolvePendingMacro(), and UpdateSema().

◆ 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 2032 of file ASTReader.h.

◆ getSwitchCaseWithID()

SwitchCase * ASTReader::getSwitchCaseWithID ( unsigned ID)

Retrieve the switch-case statement with the given ID.

Definition at line 10255 of file ASTReader.cpp.

◆ getTotalNumDecls()

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

Returns the number of declarations found in the chain.

Definition at line 2079 of file ASTReader.h.

◆ getTotalNumIdentifiers()

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

Returns the number of identifiers found in the chain.

Definition at line 2064 of file ASTReader.h.

◆ getTotalNumMacros()

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

Returns the number of macros found in the chain.

Definition at line 2069 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 2095 of file ASTReader.h.

References clang::Result.

◆ getTotalNumSelectors()

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

Returns the number of selectors found in the chain.

Definition at line 2089 of file ASTReader.h.

Referenced by GetNumExternalSelectors().

◆ getTotalNumSLocs()

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

Returns the number of source locations found in the chain.

Definition at line 2059 of file ASTReader.h.

Referenced by getModuleImportLoc(), PrintStats(), and ReadSLocEntry().

◆ getTotalNumSubmodules()

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

Returns the number of submodules known.

Definition at line 2084 of file ASTReader.h.

Referenced by clang::DumpModuleInfoAction::ExecuteAction().

◆ getTotalNumTypes()

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

Returns the number of types found in the chain.

Definition at line 2074 of file ASTReader.h.

◆ getTULocalLookupTables()

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

Definition at line 8774 of file ASTReader.cpp.

References clang::nullptr.

◆ GetType()

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

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

Definition at line 7637 of file ASTReader.cpp.

References clang::Qualifiers::FastMask, clang::serialization::TypeIdx::fromTypeID(), getIndexForTypeID(), isPredefinedType(), clang::serialization::PREDEF_TYPE_ACCUM_ID, clang::serialization::PREDEF_TYPE_ARC_UNBRIDGED_CAST, clang::serialization::PREDEF_TYPE_ARRAY_SECTION, clang::serialization::PREDEF_TYPE_AUTO_DEDUCT, clang::serialization::PREDEF_TYPE_AUTO_RREF_DEDUCT, clang::serialization::PREDEF_TYPE_BFLOAT16_ID, clang::serialization::PREDEF_TYPE_BOOL_ID, clang::serialization::PREDEF_TYPE_BOUND_MEMBER, clang::serialization::PREDEF_TYPE_BUILTIN_FN, clang::serialization::PREDEF_TYPE_CHAR16_ID, clang::serialization::PREDEF_TYPE_CHAR32_ID, clang::serialization::PREDEF_TYPE_CHAR8_ID, clang::serialization::PREDEF_TYPE_CHAR_S_ID, clang::serialization::PREDEF_TYPE_CHAR_U_ID, clang::serialization::PREDEF_TYPE_CLK_EVENT_ID, clang::serialization::PREDEF_TYPE_DEPENDENT_ID, clang::serialization::PREDEF_TYPE_DOUBLE_ID, clang::serialization::PREDEF_TYPE_EVENT_ID, clang::serialization::PREDEF_TYPE_FLOAT128_ID, clang::serialization::PREDEF_TYPE_FLOAT16_ID, clang::serialization::PREDEF_TYPE_FLOAT_ID, clang::serialization::PREDEF_TYPE_FRACT_ID, clang::serialization::PREDEF_TYPE_HALF_ID, clang::serialization::PREDEF_TYPE_IBM128_ID, clang::serialization::PREDEF_TYPE_INCOMPLETE_MATRIX_IDX, clang::serialization::PREDEF_TYPE_INT128_ID, clang::serialization::PREDEF_TYPE_INT_ID, clang::serialization::PREDEF_TYPE_LAST_ID, clang::serialization::PREDEF_TYPE_LONG_ACCUM_ID, clang::serialization::PREDEF_TYPE_LONG_FRACT_ID, clang::serialization::PREDEF_TYPE_LONG_ID, clang::serialization::PREDEF_TYPE_LONGDOUBLE_ID, clang::serialization::PREDEF_TYPE_LONGLONG_ID, clang::serialization::PREDEF_TYPE_NULL_ID, clang::serialization::PREDEF_TYPE_NULLPTR_ID, clang::serialization::PREDEF_TYPE_OBJC_CLASS, clang::serialization::PREDEF_TYPE_OBJC_ID, clang::serialization::PREDEF_TYPE_OBJC_SEL, clang::serialization::PREDEF_TYPE_OMP_ARRAY_SHAPING, clang::serialization::PREDEF_TYPE_OMP_ITERATOR, clang::serialization::PREDEF_TYPE_OVERLOAD_ID, clang::serialization::PREDEF_TYPE_PSEUDO_OBJECT, clang::serialization::PREDEF_TYPE_QUEUE_ID, clang::serialization::PREDEF_TYPE_RESERVE_ID_ID, clang::serialization::PREDEF_TYPE_SAMPLER_ID, clang::serialization::PREDEF_TYPE_SAT_ACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_FRACT_ID, clang::serialization::PREDEF_TYPE_SAT_LONG_ACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_LONG_FRACT_ID, clang::serialization::PREDEF_TYPE_SAT_SHORT_ACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_SHORT_FRACT_ID, clang::serialization::PREDEF_TYPE_SAT_UACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_UFRACT_ID, clang::serialization::PREDEF_TYPE_SAT_ULONG_ACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_ULONG_FRACT_ID, clang::serialization::PREDEF_TYPE_SAT_USHORT_ACCUM_ID, clang::serialization::PREDEF_TYPE_SAT_USHORT_FRACT_ID, clang::serialization::PREDEF_TYPE_SCHAR_ID, clang::serialization::PREDEF_TYPE_SHORT_ACCUM_ID, clang::serialization::PREDEF_TYPE_SHORT_FRACT_ID, clang::serialization::PREDEF_TYPE_SHORT_ID, clang::serialization::PREDEF_TYPE_UACCUM_ID, clang::serialization::PREDEF_TYPE_UCHAR_ID, clang::serialization::PREDEF_TYPE_UFRACT_ID, clang::serialization::PREDEF_TYPE_UINT128_ID, clang::serialization::PREDEF_TYPE_UINT_ID, clang::serialization::PREDEF_TYPE_ULONG_ACCUM_ID, clang::serialization::PREDEF_TYPE_ULONG_FRACT_ID, clang::serialization::PREDEF_TYPE_ULONG_ID, clang::serialization::PREDEF_TYPE_ULONGLONG_ID, clang::serialization::PREDEF_TYPE_UNKNOWN_ANY, clang::serialization::PREDEF_TYPE_UNRESOLVED_TEMPLATE, clang::serialization::PREDEF_TYPE_USHORT_ACCUM_ID, clang::serialization::PREDEF_TYPE_USHORT_FRACT_ID, clang::serialization::PREDEF_TYPE_USHORT_ID, clang::serialization::PREDEF_TYPE_VOID_ID, clang::serialization::PREDEF_TYPE_WCHAR_ID, and clang::T.

Referenced by getLocalType(), and InitializeContext().

◆ hasExternalDefinitions()

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

◆ hasGlobalIndex()

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

Determine whether this AST reader has a global index.

Definition at line 1954 of file ASTReader.h.

Referenced by isGlobalIndexUnavailable().

◆ haveUnloadedSpecializations()

bool ASTReader::haveUnloadedSpecializations ( const Decl * D) const

If we have any unloaded specialization for D.

Definition at line 8788 of file ASTReader.cpp.

References clang::Decl::isCanonicalDecl().

◆ InitializeContext()

◆ 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 8978 of file ASTReader.cpp.

References clang::Sema::addExternalSource(), clang::FPOptionsOverride::applyOverrides(), clang::cast(), GetDecl(), clang::NamedDecl::getDeclName(), clang::FPOptionsOverride::getFromOpaqueInt(), PreloadedDeclIDs, and UpdateSema().

◆ isAcceptableASTFile()

bool ASTReader::isAcceptableASTFile ( StringRef Filename,
FileManager & FileMgr,
const ModuleCache & ModCache,
const PCHContainerReader & PCHContainerRdr,
const LangOptions & LangOpts,
const CodeGenOptions & CGOpts,
const TargetOptions & TargetOpts,
const PreprocessorOptions & PPOpts,
StringRef ExistingModuleCachePath,
bool RequireStrictOptionMatches = false )
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 6108 of file ASTReader.cpp.

References readASTFileControlBlock().

Referenced by clang::FrontendAction::BeginSourceFile().

◆ isDeclIDFromModule()

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

Returns true if global DeclID ID originated from module M.

Definition at line 8191 of file ASTReader.cpp.

References clang::serialization::ModuleFile::Index, and clang::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 4754 of file ASTReader.cpp.

References hasGlobalIndex().

◆ isPreprocessedEntityInFileID()

std::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 6930 of file ASTReader.cpp.

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

◆ isProcessingUpdateRecords()

bool clang::ASTReader::isProcessingUpdateRecords ( )
inline

Definition at line 2657 of file ASTReader.h.

◆ LoadExternalSpecializations() [1/2]

bool ASTReader::LoadExternalSpecializations ( const Decl * D,
ArrayRef< TemplateArgument > TemplateArgs )
overridevirtual

Load all the specializations for the Decl.

Parameters
Dwith the same template args specified by
TemplateArgs.

Return true if any new specializations get loaded. Return false otherwise.

Reimplemented from clang::ExternalASTSource.

Definition at line 8542 of file ASTReader.cpp.

◆ LoadExternalSpecializations() [2/2]

bool ASTReader::LoadExternalSpecializations ( const Decl * D,
bool OnlyPartial )
overridevirtual

Load all the external specializations for the Decl.

Parameters
Dif
OnlyPartialis false. Otherwise, load all the external partial specializations for the
D.

Return true if any new specializations get loaded. Return false otherwise.

Reimplemented from clang::ExternalASTSource.

Definition at line 8493 of file ASTReader.cpp.

References CompleteRedeclChain().

◆ 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 4729 of file ASTReader.cpp.

References getPreprocessor(), clang::GlobalModuleIndex::readIndex(), and clang::Result.

Referenced by get(), getIdentifiers(), and updateOutOfDateIdentifier().

◆ LoadSelector()

void ASTReader::LoadSelector ( Selector Sel)

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

Definition at line 9600 of file ASTReader.cpp.

References ReadMethodPool().

◆ 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 4665 of file ASTReader.cpp.

References clang::Module::getExportedModules(), clang::Module::isUnimportable(), makeNamesVisible(), and clang::Module::NameVisibility.

Referenced by InitializeContext().

◆ makeNamesVisible()

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

◆ mapGlobalIDToModuleFileGlobalID()

LocalDeclID ASTReader::mapGlobalIDToModuleFileGlobalID ( ModuleFile & M,
GlobalDeclID 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 8404 of file ASTReader.cpp.

References clang::LocalDeclID::get(), clang::DeclIDBase::getLocalDeclIndex(), getOwningModuleFile(), clang::DeclIDBase::getRawValue(), LocalDeclID, clang::serialization::ModuleFile::ModuleOffsetMap, clang::NUM_PREDEF_DECL_IDS, and clang::serialization::ModuleFile::TransitiveImports.

◆ markIdentifierUpToDate()

void ASTReader::markIdentifierUpToDate ( const IdentifierInfo * II)

Note that this identifier is up-to-date.

Definition at line 2539 of file ASTReader.cpp.

References getContext(), and clang::ExternalASTSource::getGeneration().

Referenced by get(), and updateOutOfDateIdentifier().

◆ 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 4714 of file ASTReader.cpp.

References getContext(), clang::Decl::getImportedOwningModule(), clang::Decl::isUnconditionallyVisible(), and clang::Decl::setVisibleDespiteOwningModule().

◆ operator=()

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

References ASTReader().

◆ PrintStats()

void ASTReader::PrintStats ( )
overridevirtual

Print some statistics about AST usage.

Reimplemented from clang::ExternalASTSource.

Definition at line 8829 of file ASTReader.cpp.

References dump(), and getTotalNumSLocs().

◆ ReadAlignPackInfo()

Sema::AlignPackInfo clang::ASTReader::ReadAlignPackInfo ( uint32_t Raw) const
inline

Read a AlignPackInfo from raw form.

Definition at line 2456 of file ASTReader.h.

References clang::Sema::AlignPackInfo::getFromRawEncoding().

◆ ReadAST()

ASTReader::ASTReadResult ASTReader::ReadAST ( StringRef FileName,
ModuleKind Type,
SourceLocation ImportLoc,
unsigned ClientLoadCapabilities,
ModuleFile ** NewLoadedModuleFile = 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.
LoadedModuleFileThe optional out-parameter refers to the new loaded modules. In case the module specified by FileName is already loaded, the module file pointer referred by NewLoadedModuleFile wouldn't change. Otherwise if the AST file get loaded successfully, NewLoadedModuleFile would refer to the address of the new loaded top level module. The state of NewLoadedModuleFile is unspecified if the AST file isn't loaded successfully.

Definition at line 4807 of file ASTReader.cpp.

References clang::HeaderSearchOptions::BuildSessionTimestamp, clang::Data, clang::serialization::ModuleFile::DidReadTopLevelSubmodule, clang::serialization::ModuleFile::DirectImportLoc, clang::Error, clang::serialization::EXTENSION_BLOCK_ID, Failure, clang::serialization::ModuleFile::FileName, clang::FileName, getGlobalSubmoduleID(), getModuleManager(), getSubmodule(), clang::serialization::ModuleFile::GlobalBitOffset, clang::serialization::ModuleFile::IdentifierTableData, clang::serialization::ModuleFile::ImportLoc, clang::ExternalASTSource::incrementGeneration(), InitializeContext(), clang::serialization::ModuleFile::InputFilesValidationTimestamp, clang::serialization::ModuleFile::isModule(), clang::FileID::isValid(), clang::serialization::ModuleFile::Kind, markIdentifierFromAST(), clang::Module::Conflict::Message, clang::serialization::MK_ImplicitModule, clang::serialization::MK_MainFile, clang::serialization::MK_PCH, clang::serialization::MK_Preamble, clang::serialization::ModuleFile::ModuleName, clang::HeaderSearchOptions::ModulesValidateOncePerBuildSession, clang::serialization::ModuleFile::OriginalSourceFileID, clang::Module::Conflict::Other, clang::serialization::ModuleFile::PreloadIdentifierOffsets, clang::serialization::reader::ASTIdentifierLookupTrait::ReadIdentifierID(), clang::serialization::reader::ASTIdentifierLookupTraitBase::ReadKey(), clang::serialization::reader::ASTIdentifierLookupTraitBase::ReadKeyDataLength(), serialization::reader::ASTIdentifierLookupTrait, SetIdentifierInfo(), clang::IdentifierInfo::setOutOfDate(), clang::serialization::ModuleFile::SizeInBits, SkipCursorToBlock(), clang::serialization::ModuleFile::Stream, Success, TranslateFileID(), TranslateSourceLocation(), clang::Unresolved, and UpdateSema().

◆ readASTFileControlBlock()

◆ ReadBitVector()

llvm::BitVector ASTReader::ReadBitVector ( const RecordData & Record,
const StringRef Blob )
static

Definition at line 10151 of file ASTReader.cpp.

◆ ReadBlockAbbrevs()

llvm::Error ASTReader::ReadBlockAbbrevs ( llvm::BitstreamCursor & Cursor,
unsigned BlockID,
uint64_t * StartOfBlockOffset = nullptr )
static

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

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 2052 of file ASTReader.cpp.

Referenced by readASTFileControlBlock().

◆ ReadComments()

void ASTReader::ReadComments ( )
overridevirtual

◆ ReadCXXTemporary()

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

Definition at line 10214 of file ASTReader.cpp.

References clang::CXXTemporary::Create(), getContext(), and ReadDeclAs().

◆ ReadDecl()

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

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

Definition at line 2175 of file ASTReader.h.

References GetDecl(), and ReadDeclID().

Referenced by ReadLateParsedTemplates().

◆ ReadDeclAs()

template<typename T>
T * clang::ASTReader::ReadDeclAs ( ModuleFile & F,
const RecordDataImpl & 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 2185 of file ASTReader.h.

References GetDecl(), ReadDeclID(), and clang::T.

Referenced by ReadCXXTemporary(), and ReadLateParsedTemplates().

◆ ReadDeclID()

GlobalDeclID ASTReader::ReadDeclID ( ModuleFile & F,
const RecordDataImpl & 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 8433 of file ASTReader.cpp.

References clang::Error, clang::LocalDeclID::get(), and getGlobalDeclID().

Referenced by ReadDecl(), and ReadDeclAs().

◆ ReadDeclsToCheckForDeferredDiags()

void ASTReader::ReadDeclsToCheckForDeferredDiags ( llvm::SmallSetVector< Decl *, 4 > & Decls)
overridevirtual

Read the set of decls to be checked for deferred diags.

The external source should append its own potentially emitted function and variable decls which may cause deferred diags. 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 9477 of file ASTReader.cpp.

References GetDecl().

◆ ReadDefinedMacros()

void ASTReader::ReadDefinedMacros ( )
overridevirtual

◆ 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 9444 of file ASTReader.cpp.

References GetDecl().

◆ ReadExpr()

Expr * ASTReader::ReadExpr ( ModuleFile & F)

Reads an expression.

Definition at line 2980 of file ASTReaderStmt.cpp.

References ReadStmt().

◆ 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 9455 of file ASTReader.cpp.

References GetDecl().

◆ ReadFileID()

FileID clang::ASTReader::ReadFileID ( ModuleFile & F,
const RecordDataImpl & Record,
unsigned & Idx ) const
inline

Read a FileID.

Definition at line 2508 of file ASTReader.h.

References TranslateFileID().

Referenced by ReadPragmaDiagnosticMappings().

◆ readIdentifier()

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

Definition at line 2367 of file ASTReader.h.

References DecodeIdentifierInfo(), and getGlobalIdentifierID().

◆ 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 9385 of file ASTReader.cpp.

References GetDecl().

◆ 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 9548 of file ASTReader.cpp.

References clang::FPOptions::getFromOpaqueInt(), getOwningModuleFile(), ReadDecl(), ReadDeclAs(), ReadToken(), and clang::T.

◆ ReadMacroRecord()

◆ ReadMethodPool()

◆ ReadMismatchingDeleteExpressions()

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

◆ ReadPath() [1/2]

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

Definition at line 10184 of file ASTReader.cpp.

References clang::serialization::ModuleFile::BaseDirectory, and ReadPath().

Referenced by ReadPath().

◆ ReadPath() [2/2]

std::string ASTReader::ReadPath ( StringRef BaseDirectory,
const RecordData & Record,
unsigned & Idx )

Definition at line 10189 of file ASTReader.cpp.

References ReadString(), and ResolveImportedPathAndAllocate().

◆ ReadPathBlob()

std::string ASTReader::ReadPathBlob ( StringRef BaseDirectory,
const RecordData & Record,
unsigned & Idx,
StringRef & Blob )

Definition at line 10195 of file ASTReader.cpp.

References ReadStringBlob(), and ResolveImportedPathAndAllocate().

◆ ReadPendingInstantiations()

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

Read the set of pending instantiations known to the external Sema source.

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

Reimplemented from clang::ExternalSemaSource.

Definition at line 9536 of file ASTReader.cpp.

References clang::cast(), GetDecl(), and clang::SourceLocation::getFromRawEncoding().

◆ ReadPragmaDiagnosticMappings()

◆ ReadPreprocessedEntity()

◆ ReadReferencedSelectors()

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

Read the set of referenced selectors known to the external Sema source.

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

Reimplemented from clang::ExternalSemaSource.

Definition at line 9487 of file ASTReader.cpp.

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

◆ ReadSelector()

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

Definition at line 2443 of file ASTReader.h.

References getLocalSelector().

◆ ReadSkippedRange()

◆ ReadSLocEntry()

◆ readSLocOffset()

◆ ReadSourceLocation() [1/2]

◆ ReadSourceLocation() [2/2]

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

Read a source location.

Definition at line 2501 of file ASTReader.h.

References ReadSourceLocation().

◆ ReadSourceRange()

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

Read a source range.

Definition at line 10144 of file ASTReader.cpp.

References ReadSourceLocation().

Referenced by ReadComments().

◆ ReadStmt()

Stmt * ASTReader::ReadStmt ( ModuleFile & F)

Reads a statement.

Definition at line 2966 of file ASTReaderStmt.cpp.

References ReadSubStmt().

Referenced by ReadExpr().

◆ ReadString()

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

Definition at line 10169 of file ASTReader.cpp.

References clang::Result.

Referenced by readASTFileControlBlock(), ReadPath(), and ReadToken().

◆ ReadStringBlob()

StringRef ASTReader::ReadStringBlob ( const RecordDataImpl & Record,
unsigned & Idx,
StringRef & Blob )
static

Definition at line 10176 of file ASTReader.cpp.

References clang::Result.

Referenced by readASTFileControlBlock(), and ReadPathBlob().

◆ ReadSubExpr()

Expr * ASTReader::ReadSubExpr ( )

Reads a sub-expression operand during statement reading.

Definition at line 2984 of file ASTReaderStmt.cpp.

References ReadSubStmt().

◆ ReadSubStmt()

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

Reads a sub-statement operand during statement reading.

Definition at line 2555 of file ASTReader.h.

Referenced by ReadStmt(), and ReadSubExpr().

◆ 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 9423 of file ASTReader.cpp.

References GetDecl().

◆ 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 2115 of file ASTReader.h.

References getLocalType().

◆ 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 9396 of file ASTReader.cpp.

References clang::cast(), GetDecl(), clang::SourceLocation::getFromRawEncoding(), and clang::Undefined.

◆ ReadUntranslatedSourceLocation()

std::pair< SourceLocation, unsigned > clang::ASTReader::ReadUntranslatedSourceLocation ( RawLocEncoding 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 2465 of file ASTReader.h.

References clang::SourceLocationEncoding::decode().

Referenced by ReadSourceLocation().

◆ 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 9433 of file ASTReader.cpp.

References GetDecl().

◆ 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 9465 of file ASTReader.cpp.

References GetDecl().

◆ 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 9523 of file ASTReader.cpp.

References clang::ExternalVTableUse::DefinitionRequired, GetDecl(), 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 10202 of file ASTReader.cpp.

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

◆ ReadWeakUndeclaredIdentifiers()

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

Read the set of weak, undeclared identifiers known to the external Sema source.

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

Reimplemented from clang::ExternalSemaSource.

Definition at line 9505 of file ASTReader.cpp.

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

◆ RecordSwitchCaseID()

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

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

Definition at line 10248 of file ASTReader.cpp.

◆ resetForReload()

void clang::ASTReader::resetForReload ( )
inline

Reset reader for a reload try.

Definition at line 1960 of file ASTReader.h.

◆ ResolveImportedPath() [1/2]

ASTReader::TemporarilyOwnedStringRef ASTReader::ResolveImportedPath ( SmallString< 0 > & Buf,
StringRef Path,
ModuleFile & ModF )
static

Resolve Path in the context of module file M.

The return value must go out of scope before the next call to ResolveImportedPath.

Definition at line 2975 of file ASTReader.cpp.

References clang::serialization::ModuleFile::BaseDirectory, and ResolveImportedPath().

Referenced by clang::tooling::dependencies::ModuleDeps::forEachFileDep(), readASTFileControlBlock(), ResolveImportedPath(), and ResolveImportedPathAndAllocate().

◆ ResolveImportedPath() [2/2]

ASTReader::TemporarilyOwnedStringRef ASTReader::ResolveImportedPath ( SmallString< 0 > & Buf,
StringRef Path,
StringRef Prefix )
static

Resolve Path in the context of the Prefix directory.

The return value must go out of scope before the next call to ResolveImportedPath.

Definition at line 2981 of file ASTReader.cpp.

◆ ResolveImportedPathAndAllocate() [1/2]

std::string ASTReader::ResolveImportedPathAndAllocate ( SmallString< 0 > & Buf,
StringRef Path,
ModuleFile & ModF )
static

Resolve Path in the context of module file M.

Definition at line 2995 of file ASTReader.cpp.

References clang::serialization::ModuleFile::BaseDirectory, and ResolveImportedPathAndAllocate().

Referenced by ReadPath(), ReadPathBlob(), and ResolveImportedPathAndAllocate().

◆ ResolveImportedPathAndAllocate() [2/2]

std::string ASTReader::ResolveImportedPathAndAllocate ( SmallString< 0 > & Buf,
StringRef Path,
StringRef Prefix )
static

Resolve Path in the context of the Prefix directory.

Definition at line 3001 of file ASTReader.cpp.

References ResolveImportedPath().

◆ resolvePendingMacro()

◆ runWithSufficientStackSpace()

void ASTReader::runWithSufficientStackSpace ( SourceLocation Loc,
llvm::function_ref< void()> Fn )

Definition at line 10229 of file ASTReader.cpp.

◆ setDeserializationListener()

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

Set the AST deserialization listener.

Definition at line 1009 of file ASTReader.cpp.

◆ SetGloballyVisibleDecls()

void ASTReader::SetGloballyVisibleDecls ( IdentifierInfo * II,
const SmallVectorImpl< GlobalDeclID > & 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 9630 of file ASTReader.cpp.

References clang::cast(), GetDecl(), and PreloadedDeclIDs.

◆ SetIdentifierInfo()

void ASTReader::SetIdentifierInfo ( serialization::IdentifierID ID,
IdentifierInfo * II )

Definition at line 9605 of file ASTReader.cpp.

Referenced by ReadAST().

◆ setListener()

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

Set the AST callbacks listener.

Definition at line 1905 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 10996 of file ASTReader.cpp.

References clang::T.

◆ 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 8819 of file ASTReader.cpp.

◆ takeListener()

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

Take the AST callbacks listener.

Definition at line 1900 of file ASTReader.h.

◆ TranslateFileID()

FileID clang::ASTReader::TranslateFileID ( ModuleFile & F,
FileID FID ) const
inline

Translate a FileID from another module file's FileID space into ours.

Definition at line 2514 of file ASTReader.h.

References clang::FileID::isInvalid(), and clang::serialization::ModuleFile::SLocEntryBaseID.

Referenced by ReadAST(), and ReadFileID().

◆ TranslateSourceLocation()

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

Translate a source location from another module file's source location space into ours.

Definition at line 2486 of file ASTReader.h.

References clang::SourceLocation::getLocWithOffset(), and clang::SourceLocation::isInvalid().

Referenced by ReadAST(), and ReadSourceLocation().

◆ updateOutOfDateIdentifier()

void ASTReader::updateOutOfDateIdentifier ( const IdentifierInfo & II)
overridevirtual

Update an out-of-date identifier.

Implements clang::ExternalPreprocessorSource.

Definition at line 2514 of file ASTReader.cpp.

References getContext(), clang::IdentifierInfo::getName(), loadGlobalIndex(), and markIdentifierUpToDate().

Referenced by CompleteRedeclChain(), and ReadDefinedMacros().

◆ 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 9380 of file ASTReader.cpp.

References ReadMethodPool().

◆ UpdateSema()

void ASTReader::UpdateSema ( )

Update the state of Sema after loading some additional modules.

Definition at line 9015 of file ASTReader.cpp.

References getSubmodule().

Referenced by InitializeSema(), and ReadAST().

◆ visitInputFileInfos()

void ASTReader::visitInputFileInfos ( serialization::ModuleFile & MF,
bool IncludeSystem,
llvm::function_ref< void(const serialization::InputFileInfo &IFI, bool IsSystem)> Visitor )

Visit all the input file infos of the given module file.

Definition at line 10333 of file ASTReader.cpp.

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

◆ 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 10349 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(FileEntryRef)> Visitor )

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

Definition at line 10364 of file ASTReader.cpp.

References clang::serialization::ModuleFile::InputFilesLoaded, clang::serialization::InputFileInfo::ModuleMap, and clang::serialization::InputFileInfo::TopLevel.

Referenced by clang::FrontendAction::BeginSourceFile().

◆ wasThisDeclarationADefinition()

bool ASTReader::wasThisDeclarationADefinition ( const FunctionDecl * FD)
overridevirtual

True if this function declaration was a definition before in its own module.

Reimplemented from clang::ExternalASTSource.

Definition at line 9862 of file ASTReader.cpp.

◆ ASTDeclMerger

friend class ASTDeclMerger
friend

Types of AST files.

Definition at line 433 of file ASTReader.h.

References ASTDeclMerger.

Referenced by ASTDeclMerger.

◆ ASTDeclReader

friend class ASTDeclReader
friend

Definition at line 434 of file ASTReader.h.

References ASTDeclReader.

Referenced by ASTDeclReader.

◆ ASTIdentifierIterator

friend class ASTIdentifierIterator
friend

Definition at line 435 of file ASTReader.h.

References ASTIdentifierIterator.

Referenced by ASTIdentifierIterator, and getIdentifiers().

◆ ASTRecordReader

friend class ASTRecordReader
friend

◆ ASTUnit

friend class ASTUnit
friend

Definition at line 437 of file ASTReader.h.

References ASTUnit.

Referenced by ASTUnit.

◆ ASTWriter

friend class ASTWriter
friend

Definition at line 438 of file ASTReader.h.

References ASTWriter.

Referenced by ASTWriter.

◆ LocalDeclID

◆ PCHValidator

friend class PCHValidator
friend

Definition at line 439 of file ASTReader.h.

References PCHValidator.

Referenced by ASTReader(), and PCHValidator.

◆ serialization::reader::ASTIdentifierLookupTrait

Definition at line 440 of file ASTReader.h.

Referenced by DecodeIdentifierInfo(), and ReadAST().

◆ serialization::ReadMethodPoolVisitor

Definition at line 441 of file ASTReader.h.

Referenced by ReadMethodPool().

◆ TypeLocReader

friend class TypeLocReader
friend

Definition at line 442 of file ASTReader.h.

References TypeLocReader.

Referenced by TypeLocReader.

Member Data Documentation

◆ CommentsCursors

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

Cursors for comments blocks.

Definition at line 2634 of file ASTReader.h.

Referenced by ReadComments().

◆ PreloadedDeclIDs

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

Definition at line 2607 of file ASTReader.h.

Referenced by InitializeSema(), and SetGloballyVisibleDecls().


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