class ExternalASTSource

Declaration

class ExternalASTSource : public RefCountedBase { /* full declaration omitted */ };

Description

Abstract interface for external sources of AST nodes. External AST sources provide AST nodes constructed from some external source, such as a precompiled header. External AST sources can resolve types and declarations from abstract IDs into actual type and declaration nodes, and read parts of declaration contexts.

Declared at: clang/include/clang/AST/ExternalASTSource.h:60

Inherits from: RefCountedBase

Member Variables

private uint32_t CurrentGeneration = 0
Generation number for this external AST source. Must be increased whenever we might have added new redeclarations for existing decls.
private static char ID
LLVM-style RTTI.

Method Overview

Methods

virtual void CompleteRedeclChain(
    const clang::Decl* D)

Description

Gives the external AST source an opportunity to complete the redeclaration chain for a declaration. Called each time we need the most recent declaration of a declaration after the generation count is incremented.

Declared at: clang/include/clang/AST/ExternalASTSource.h:199

Parameters

const clang::Decl* D

virtual void CompleteType(
    clang::ObjCInterfaceDecl* Class)

Description

Gives the external AST source an opportunity to complete an incomplete Objective-C class. This routine will only be invoked if the "externally completed" bit is set on the ObjCInterfaceDecl via the function\c ObjCInterfaceDecl::setExternallyCompleted().

Declared at: clang/include/clang/AST/ExternalASTSource.h:211

Parameters

clang::ObjCInterfaceDecl* Class

virtual void CompleteType(clang::TagDecl* Tag)

Description

Gives the external AST source an opportunity to complete an incomplete type.

Declared at: clang/include/clang/AST/ExternalASTSource.h:203

Parameters

clang::TagDecl* Tag

ExternalASTSource()

Declared at: clang/include/clang/AST/ExternalASTSource.h:71

virtual void FindExternalLexicalDecls(
    const clang::DeclContext* DC,
    llvm::function_ref<bool(Decl::Kind)>
        IsKindWeWant,
    SmallVectorImpl<clang::Decl*>& Result)

Description

Finds all declarations lexically contained within the given DeclContext, after applying an optional filter predicate. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:177

Parameters

const clang::DeclContext* DC
llvm::function_ref<bool(Decl::Kind)> IsKindWeWant
a predicate function that returns true if the passed declaration kind is one we are looking for.
SmallVectorImpl<clang::Decl*>& Result

void FindExternalLexicalDecls(
    const clang::DeclContext* DC,
    SmallVectorImpl<clang::Decl*>& Result)

Description

Finds all declarations lexically contained within the given DeclContext.

Declared at: clang/include/clang/AST/ExternalASTSource.h:183

Parameters

const clang::DeclContext* DC
SmallVectorImpl<clang::Decl*>& Result

virtual bool FindExternalVisibleDeclsByName(
    const clang::DeclContext* DC,
    clang::DeclarationName Name)

Description

Find all declarations with the given name in the given context, and add them to the context by calling SetExternalVisibleDeclsForName or SetNoExternalVisibleDeclsForName. The default implementation of this method is a no-op returning \c false.

Declared at: clang/include/clang/AST/ExternalASTSource.h:151

Parameters

const clang::DeclContext* DC
clang::DeclarationName Name

Returns

\c true if any declarations might have been found, \c false if we definitely have no declarations with tbis name.

virtual void FindFileRegionDecls(
    clang::FileID File,
    unsigned int Offset,
    unsigned int Length,
    SmallVectorImpl<clang::Decl*>& Decls)

Description

Get the decls that are contained in a file in the Offset/Length range. \p Length can be 0 to indicate a point at \p Offset instead of a range.

Declared at: clang/include/clang/AST/ExternalASTSource.h:191

Parameters

clang::FileID File
unsigned int Offset
unsigned int Length
SmallVectorImpl<clang::Decl*>& Decls

virtual void FinishedDeserializing()

Description

Notify ExternalASTSource that we finished the deserialization of a decl or type. Must be paired with StartedDeserializing. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:227

virtual clang::CXXBaseSpecifier*
GetExternalCXXBaseSpecifiers(uint64_t Offset)

Description

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.

Declared at: clang/include/clang/AST/ExternalASTSource.h:138

Parameters

uint64_t Offset

virtual clang::CXXCtorInitializer**
GetExternalCXXCtorInitializers(uint64_t Offset)

Description

Resolve the offset of a set of C++ constructor initializers in the decl stream into an array of initializers. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:132

Parameters

uint64_t Offset

virtual clang::Decl* GetExternalDecl(uint32_t ID)

Description

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.

Declared at: clang/include/clang/AST/ExternalASTSource.h:102

Parameters

uint32_t ID

virtual clang::Stmt* GetExternalDeclStmt(
    uint64_t Offset)

Description

Resolve the offset of a statement in the decl stream into a statement. This operation is meant to be used via a LazyOffsetPtr. It only needs to be implemented if the AST source uses methods like FunctionDecl::setLazyBody when building decls. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:126

Parameters

uint64_t Offset

virtual clang::Selector GetExternalSelector(
    uint32_t ID)

Description

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.

Declared at: clang/include/clang/AST/ExternalASTSource.h:110

Parameters

uint32_t ID

virtual uint32_t GetNumExternalSelectors()

Description

Returns the number of selectors known to the external AST source. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:116

virtual void PrintStats()

Description

Print any statistics that have been gathered regarding the external AST source. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:239

virtual void ReadComments()

Description

Loads comment ranges.

Declared at: clang/include/clang/AST/ExternalASTSource.h:214

static clang::DeclContextLookupResult
SetExternalVisibleDeclsForName(
    const clang::DeclContext* DC,
    clang::DeclarationName Name,
    ArrayRef<clang::NamedDecl*> Decls)

Description

\ }

Declared at: clang/include/clang/AST/ExternalASTSource.h:304

Parameters

const clang::DeclContext* DC
clang::DeclarationName Name
ArrayRef<clang::NamedDecl*> Decls

static clang::DeclContextLookupResult
SetNoExternalVisibleDeclsForName(
    const clang::DeclContext* DC,
    clang::DeclarationName Name)

Declared at: clang/include/clang/AST/ExternalASTSource.h:309

Parameters

const clang::DeclContext* DC
clang::DeclarationName Name

virtual void StartTranslationUnit(
    clang::ASTConsumer* Consumer)

Description

Function that will be invoked when we begin parsing a new translation unit involving this external AST source. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:233

Parameters

clang::ASTConsumer* Consumer

virtual void StartedDeserializing()

Description

Notify ExternalASTSource 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. The default implementation of this method is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:221

static bool classof(
    const clang::ExternalASTSource* S)

Declared at: clang/include/clang/AST/ExternalASTSource.h:299

Parameters

const clang::ExternalASTSource* S

virtual void completeVisibleDeclsMap(
    const clang::DeclContext* DC)

Description

Ensures that the table of all visible declarations inside this context is up to date. The default implementation of this function is a no-op.

Declared at: clang/include/clang/AST/ExternalASTSource.h:157

Parameters

const clang::DeclContext* DC

uint32_t getGeneration() const

Description

Get the current generation of this AST source. This number is incremented each time the AST source lazily extends an existing entity.

Declared at: clang/include/clang/AST/ExternalASTSource.h:93

clang::ExternalASTSource::MemoryBufferSizes
getMemoryBufferSizes() const

Description

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

Declared at: clang/include/clang/AST/ExternalASTSource.h:288

virtual void getMemoryBufferSizes(
    clang::ExternalASTSource::MemoryBufferSizes&
        sizes) const

Declared at: clang/include/clang/AST/ExternalASTSource.h:294

Parameters

clang::ExternalASTSource::MemoryBufferSizes& sizes

virtual clang::Module* getModule(unsigned int ID)

Description

Retrieve the module that corresponds to the given module ID.

Declared at: clang/include/clang/AST/ExternalASTSource.h:160

Parameters

unsigned int ID

virtual llvm::Optional<ASTSourceDescriptor>
getSourceDescriptor(unsigned int ID)

Description

Return a descriptor for the corresponding module, if one exists.

Declared at: clang/include/clang/AST/ExternalASTSource.h:163

Parameters

unsigned int ID

virtual clang::ExternalASTSource::ExtKind
hasExternalDefinitions(const clang::Decl* D)

Declared at: clang/include/clang/AST/ExternalASTSource.h:167

Parameters

const clang::Decl* D

uint32_t incrementGeneration(clang::ASTContext& C)

Description

Increment the current generation.

Declared at: clang/include/clang/AST/ExternalASTSource.h:313

Parameters

clang::ASTContext& C

virtual bool isA(const void* ClassID) const

Description

LLVM-style RTTI. \ {

Declared at: clang/include/clang/AST/ExternalASTSource.h:298

Parameters

const void* ClassID

virtual bool layoutRecordType(
    const clang::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)

Description

Perform layout on the given record. This routine allows the external AST source to provide an specific layout for a record, overriding the layout that would normally be constructed. It is intended for clients who receive specific layout details rather than source code (such as LLDB). The client is expected to fill in the field offsets, base offsets, virtual base offsets, and complete object size.

Declared at: clang/include/clang/AST/ExternalASTSource.h:268

Parameters

const clang::RecordDecl* Record
The record whose layout is being requested.
uint64_t& Size
The final size of the record, in bits.
uint64_t& Alignment
The final alignment of the record, in bits.
llvm::DenseMap<const FieldDecl*, uint64_t>& FieldOffsets
The offset of each of the fields within the record, expressed in bits. All of the fields must be provided with offsets.
llvm::DenseMap<const CXXRecordDecl*, CharUnits>& BaseOffsets
The offset of each of the direct, non-virtual base classes. If any bases are not given offsets, the bases will be laid out according to the ABI.
llvm::DenseMap<const CXXRecordDecl*, CharUnits>& VirtualBaseOffsets
The offset of each of the virtual base classes (either direct or not). If any bases are not given offsets, the bases will be laid out according to the ABI.

Returns

true if the record layout was provided, false otherwise.

virtual void updateOutOfDateIdentifier(
    clang::IdentifierInfo& II)

Description

Update an out-of-date identifier.

Declared at: clang/include/clang/AST/ExternalASTSource.h:141

Parameters

clang::IdentifierInfo& II

virtual ~ExternalASTSource()

Declared at: clang/include/clang/AST/ExternalASTSource.h:72