clang 22.0.0git
|
Abstract interface for external sources of AST nodes. More...
#include "clang/AST/ExternalASTSource.h"
Classes | |
class | Deserializing |
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing. More... | |
struct | MemoryBufferSizes |
Public Types | |
enum | ExtKind { EK_Always , EK_Never , EK_ReplyHazy } |
Public Member Functions | |
ExternalASTSource ()=default | |
virtual | ~ExternalASTSource () |
uint32_t | getGeneration () const |
Get the current generation of this AST source. | |
virtual Decl * | GetExternalDecl (GlobalDeclID ID) |
Resolve a declaration ID into a declaration, potentially building a new declaration. | |
virtual Selector | GetExternalSelector (uint32_t ID) |
Resolve a selector ID into a selector. | |
virtual uint32_t | GetNumExternalSelectors () |
Returns the number of selectors known to the external AST source. | |
virtual Stmt * | GetExternalDeclStmt (uint64_t Offset) |
Resolve the offset of a statement in the decl stream into a statement. | |
virtual CXXCtorInitializer ** | GetExternalCXXCtorInitializers (uint64_t Offset) |
Resolve the offset of a set of C++ constructor initializers in the decl stream into an array of initializers. | |
virtual CXXBaseSpecifier * | GetExternalCXXBaseSpecifiers (uint64_t Offset) |
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers. | |
virtual void | updateOutOfDateIdentifier (const IdentifierInfo &II) |
Update an out-of-date identifier. | |
virtual bool | FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC) |
Find all declarations with the given name in the given context, and add them to the context by calling SetExternalVisibleDeclsForName or SetNoExternalVisibleDeclsForName. | |
virtual bool | LoadExternalSpecializations (const Decl *D, bool OnlyPartial) |
Load all the external specializations for the Decl. | |
virtual bool | LoadExternalSpecializations (const Decl *D, ArrayRef< TemplateArgument > TemplateArgs) |
Load all the specializations for the Decl. | |
virtual void | completeVisibleDeclsMap (const DeclContext *DC) |
Ensures that the table of all visible declarations inside this context is up to date. | |
virtual Module * | getModule (unsigned ID) |
Retrieve the module that corresponds to the given module ID. | |
virtual std::optional< ASTSourceDescriptor > | getSourceDescriptor (unsigned ID) |
Return a descriptor for the corresponding module, if one exists. | |
virtual ExtKind | hasExternalDefinitions (const Decl *D) |
virtual bool | wasThisDeclarationADefinition (const FunctionDecl *FD) |
True if this function declaration was a definition before in its own module. | |
virtual void | FindExternalLexicalDecls (const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Result) |
Finds all declarations lexically contained within the given DeclContext, after applying an optional filter predicate. | |
void | FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl * > &Result) |
Finds all declarations lexically contained within the given DeclContext. | |
virtual void | FindFileRegionDecls (FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) |
Get the decls that are contained in a file in the Offset/Length range. | |
virtual void | CompleteRedeclChain (const Decl *D) |
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration. | |
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 void | ReadComments () |
Loads comment ranges. | |
virtual void | StartedDeserializing () |
Notify ExternalASTSource that we started deserialization of a decl or type so until FinishedDeserializing is called there may be decls that are initializing. | |
virtual void | FinishedDeserializing () |
Notify ExternalASTSource that we finished the deserialization of a decl or type. | |
virtual void | StartTranslationUnit (ASTConsumer *Consumer) |
Function that will be invoked when we begin parsing a new translation unit involving this external AST source. | |
virtual void | PrintStats () |
Print any statistics that have been gathered regarding the external AST source. | |
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. | |
virtual void | getMemoryBufferSizes (MemoryBufferSizes &sizes) const |
Protected Member Functions | |
uint32_t | incrementGeneration (ASTContext &C) |
Increment the current generation. |
Static Protected Member Functions | |
static DeclContextLookupResult | SetExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name, ArrayRef< NamedDecl * > Decls) |
static DeclContextLookupResult | SetNoExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name) |
Friends | |
class | ExternalSemaSource |
virtual bool | isA (const void *ClassID) const |
LLVM-style RTTI. | |
static bool | classof (const ExternalASTSource *S) |
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.
Definition at line 63 of file ExternalASTSource.h.
Enumerator | |
---|---|
EK_Always | |
EK_Never | |
EK_ReplyHazy |
Definition at line 191 of file ExternalASTSource.h.
|
default |
|
virtualdefault |
|
inlinestatic |
Definition at line 329 of file ExternalASTSource.h.
References ExternalASTSource(), and isA().
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 49 of file ExternalASTSource.cpp.
|
virtual |
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 ObjCInterfaceDecl::setExternallyCompleted()
.
Reimplemented in clang::ExternalASTMerger, clang::HLSLExternalSemaSource, and clang::MultiplexExternalSemaSource.
Definition at line 53 of file ExternalASTSource.cpp.
References clang::Class.
|
virtual |
Gives the external AST source an opportunity to complete an incomplete type.
Reimplemented in clang::ExternalASTMerger, clang::HLSLExternalSemaSource, and clang::MultiplexExternalSemaSource.
Definition at line 51 of file ExternalASTSource.cpp.
Referenced by clang::ExternalASTMerger::CompleteType(), clang::ExternalASTMerger::CompleteType(), and clang::ASTNodeImporter::VisitRecordDecl().
|
virtual |
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.
Reimplemented in clang::ASTReader, clang::ExternalSource, and clang::MultiplexExternalSemaSource.
Definition at line 112 of file ExternalASTSource.cpp.
Referenced by clang::DeclContext::lookups().
|
virtual |
Finds all declarations lexically contained within the given DeclContext, after applying an optional filter predicate.
IsKindWeWant | a predicate function that returns true if the passed declaration kind is one we are looking for. |
The default implementation of this method is a no-op.
Reimplemented in clang::ASTReader, clang::ExternalASTMerger, and clang::MultiplexExternalSemaSource.
Definition at line 114 of file ExternalASTSource.cpp.
References clang::Result.
Referenced by FindExternalLexicalDecls().
|
inline |
Finds all declarations lexically contained within the given DeclContext.
Definition at line 213 of file ExternalASTSource.h.
References FindExternalLexicalDecls(), and clang::Result.
|
virtual |
Find all declarations with the given name in the given context, and add them to the context by calling SetExternalVisibleDeclsForName or SetNoExternalVisibleDeclsForName.
DC | The context for lookup in. DC should be a primary context. |
Name | The name to look for. |
OriginalDC | The original context for lookup. OriginalDC can provide more information than DC . e.g., The same namespace can appear in multiple module units. So we need the OriginalDC to tell us what the module the lookup come from. |
true
if any declarations might have been found, false
if we definitely have no declarations with tbis name.The default implementation of this method is a no-op returning false
.
Reimplemented in clang::ASTReader, clang::ExternalASTMerger, clang::ExternalSource, and clang::MultiplexExternalSemaSource.
Definition at line 97 of file ExternalASTSource.cpp.
|
virtual |
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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 45 of file ExternalASTSource.cpp.
References clang::File.
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 59 of file ExternalASTSource.cpp.
|
virtual |
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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 93 of file ExternalASTSource.cpp.
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 88 of file ExternalASTSource.cpp.
|
virtual |
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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 73 of file ExternalASTSource.cpp.
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 83 of file ExternalASTSource.cpp.
|
virtual |
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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 75 of file ExternalASTSource.cpp.
Referenced by AddClassMessageCompletions().
|
inline |
Get the current generation of this AST source.
This number is incremented each time the AST source lazily extends an existing entity.
Definition at line 96 of file ExternalASTSource.h.
Referenced by clang::ASTReader::markIdentifierUpToDate(), and clang::ASTReader::ReadMethodPool().
|
inline |
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
Definition at line 318 of file ExternalASTSource.h.
References getMemoryBufferSizes().
Referenced by getMemoryBufferSizes(), and clang::MultiplexExternalSemaSource::getMemoryBufferSizes().
|
virtual |
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 118 of file ExternalASTSource.cpp.
Retrieve the module that corresponds to the given module ID.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 186 of file ExternalASTSource.h.
|
virtual |
Returns the number of selectors known to the external AST source.
The default implementation of this method is a no-op.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 79 of file ExternalASTSource.cpp.
Referenced by AddClassMessageCompletions().
|
virtual |
Return a descriptor for the corresponding module, if one exists.
Reimplemented in clang::ASTReader.
Definition at line 32 of file ExternalASTSource.cpp.
|
virtual |
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 37 of file ExternalASTSource.cpp.
References EK_ReplyHazy.
Referenced by clang::Decl::shouldEmitInExternalSource().
|
protected |
Increment the current generation.
Definition at line 120 of file ExternalASTSource.cpp.
References clang::C.
Referenced by clang::ASTReader::ReadAST().
|
inlinevirtual |
LLVM-style RTTI.
Reimplemented in clang::ExternalSemaSource, and clang::MultiplexExternalSemaSource.
Definition at line 328 of file ExternalASTSource.h.
Referenced by classof(), clang::ExternalSemaSource::classof(), clang::MultiplexExternalSemaSource::classof(), and clang::ExternalSemaSource::isA().
|
virtual |
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.
Record | The record whose layout is being requested. |
Size | The final size of the record, in bits. |
Alignment | The final alignment of the record, in bits. |
FieldOffsets | The offset of each of the fields within the record, expressed in bits. All of the fields must be provided with offsets. |
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. |
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. |
Reimplemented in clang::LayoutOverrideSource, and clang::MultiplexExternalSemaSource.
Definition at line 65 of file ExternalASTSource.cpp.
|
virtual |
Load all the specializations for the Decl.
D | with the same template args specified by |
TemplateArgs. |
Return true if any new specializations get loaded. Return false otherwise.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 107 of file ExternalASTSource.cpp.
Load all the external specializations for the Decl.
D | if |
OnlyPartial | is false. Otherwise, load all the external partial specializations for the |
D. |
Return true if any new specializations get loaded. Return false otherwise.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 103 of file ExternalASTSource.cpp.
Referenced by clang::RedeclarableTemplateDecl::loadLazySpecializationsImpl(), and clang::RedeclarableTemplateDecl::loadLazySpecializationsImpl().
|
virtual |
Print any statistics that have been gathered regarding the external AST source.
The default implementation of this method is a no-op.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 63 of file ExternalASTSource.cpp.
|
virtual |
Loads comment ranges.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 55 of file ExternalASTSource.cpp.
|
staticprotected |
Definition at line 1634 of file DeclBase.cpp.
References clang::StoredDeclsList::getLookupResult(), clang::DeclContext::getParentASTContext(), clang::DeclContext::LookupPtr, and clang::StoredDeclsList::replaceExternalDecls().
Referenced by clang::ASTReader::completeVisibleDeclsMap(), clang::ExternalSource::completeVisibleDeclsMap(), clang::ASTReader::FindExternalVisibleDeclsByName(), and clang::ExternalASTMerger::FindExternalVisibleDeclsByName().
|
staticprotected |
Definition at line 1619 of file DeclBase.cpp.
References clang::DeclContext::getParentASTContext(), and clang::DeclContext::LookupPtr.
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 57 of file ExternalASTSource.cpp.
|
virtual |
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.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 61 of file ExternalASTSource.cpp.
|
inlinevirtual |
Update an out-of-date identifier.
Reimplemented in clang::ASTReader.
Definition at line 144 of file ExternalASTSource.h.
|
virtual |
True if this function declaration was a definition before in its own module.
Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.
Definition at line 41 of file ExternalASTSource.cpp.
|
friend |
Definition at line 64 of file ExternalASTSource.h.
References ExternalSemaSource.
Referenced by ExternalSemaSource.