clang API Documentation
Abstract interface for external sources of AST nodes. More...
#include <ExternalASTSource.h>

Classes | |
| class | Deserializing |
| RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing. More... | |
| struct | MemoryBufferSizes |
Public Member Functions | |
| ExternalASTSource () | |
| virtual | ~ExternalASTSource () |
| virtual Decl * | GetExternalDecl (uint32_t 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 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 DeclContextLookupResult | FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name) |
| Finds all declarations with the given name in the given context. | |
| virtual void | completeVisibleDeclsMap (const DeclContext *DC) |
| Ensures that the table of all visible declarations inside this context is up to date. | |
| virtual ExternalLoadResult | FindExternalLexicalDecls (const DeclContext *DC, bool(*isKindWeWant)(Decl::Kind), SmallVectorImpl< Decl * > &Result) |
| Finds all declarations lexically contained within the given DeclContext, after applying an optional filter predicate. | |
| ExternalLoadResult | FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl * > &Result) |
| Finds all declarations lexically contained within the given DeclContext. | |
| template<typename DeclTy > | |
| ExternalLoadResult | FindExternalLexicalDeclsBy (const DeclContext *DC, SmallVectorImpl< Decl * > &Result) |
| 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 | 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 | StartedDeserializing () |
| 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. | |
| virtual void | FinishedDeserializing () |
| Notify ExternalASTSource that we finished the deserialization of a decl or type. Must be paired with StartedDeserializing. | |
| 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 |
| virtual void | getMemoryBufferSizes (MemoryBufferSizes &sizes) const |
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 |
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 53 of file ExternalASTSource.h.
| clang::ExternalASTSource::ExternalASTSource | ( | ) | [inline] |
Definition at line 61 of file ExternalASTSource.h.
| ExternalASTSource::~ExternalASTSource | ( | ) | [virtual] |
Definition at line 21 of file ExternalASTSource.cpp.
| virtual void clang::ExternalASTSource::CompleteType | ( | TagDecl * | Tag | ) | [inline, virtual] |
Gives the external AST source an opportunity to complete an incomplete type.
Reimplemented in clang::ChainedIncludesSource.
Definition at line 172 of file ExternalASTSource.h.
Referenced by clang::ChainedIncludesSource::CompleteType(), clang::ASTContext::getASTRecordLayout(), and clang::Sema::RequireCompleteType().
| virtual void clang::ExternalASTSource::CompleteType | ( | ObjCInterfaceDecl * | Class | ) | [inline, 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::ChainedIncludesSource.
Definition at line 180 of file ExternalASTSource.h.
| void ExternalASTSource::completeVisibleDeclsMap | ( | const DeclContext * | DC | ) | [virtual] |
Ensures that the table of all visible declarations inside this context is up to date.
The default implementation of this functino is a no-op.
Reimplemented in clang::ASTReader.
Definition at line 52 of file ExternalASTSource.cpp.
Referenced by clang::DeclContext::lookups_begin(), and clang::DeclContext::lookups_end().
| ExternalLoadResult ExternalASTSource::FindExternalLexicalDecls | ( | const DeclContext * | DC, |
| bool(*)(Decl::Kind) | isKindWeWant, | ||
| SmallVectorImpl< Decl * > & | Result | ||
| ) | [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. If NULL, all declarations are returned. |
The default implementation of this method is a no-op.
Reimplemented in clang::ASTReader, and clang::ChainedIncludesSource.
Definition at line 56 of file ExternalASTSource.cpp.
References clang::ELR_AlreadyLoaded.
Referenced by clang::ChainedIncludesSource::FindExternalLexicalDecls(), FindExternalLexicalDecls(), and FindExternalLexicalDeclsBy().
| ExternalLoadResult clang::ExternalASTSource::FindExternalLexicalDecls | ( | const DeclContext * | DC, |
| SmallVectorImpl< Decl * > & | Result | ||
| ) | [inline] |
Finds all declarations lexically contained within the given DeclContext.
Definition at line 153 of file ExternalASTSource.h.
References FindExternalLexicalDecls().
| ExternalLoadResult clang::ExternalASTSource::FindExternalLexicalDeclsBy | ( | const DeclContext * | DC, |
| SmallVectorImpl< Decl * > & | Result | ||
| ) | [inline] |
Definition at line 159 of file ExternalASTSource.h.
References FindExternalLexicalDecls().
| DeclContextLookupResult ExternalASTSource::FindExternalVisibleDeclsByName | ( | const DeclContext * | DC, |
| DeclarationName | Name | ||
| ) | [virtual] |
Finds all declarations with the given name in the given context.
Generally the final step of this method is either to call SetExternalVisibleDeclsForName or to recursively call lookup on the DeclContext after calling SetExternalVisibleDecls.
The default implementation of this method is a no-op.
Reimplemented in clang::ASTReader, and clang::ChainedIncludesSource.
Definition at line 47 of file ExternalASTSource.cpp.
Referenced by clang::ChainedIncludesSource::FindExternalVisibleDeclsByName(), and clang::DeclContext::lookup().
| virtual void clang::ExternalASTSource::FindFileRegionDecls | ( | FileID | File, |
| unsigned | Offset, | ||
| unsigned | Length, | ||
| SmallVectorImpl< Decl * > & | Decls | ||
| ) | [inline, virtual] |
Get the decls that are contained in a file in the Offset/Length range.
Reimplemented in clang::ASTReader.
Definition at line 167 of file ExternalASTSource.h.
Referenced by clang::ASTUnit::findFileRegionDecls().
| virtual void clang::ExternalASTSource::FinishedDeserializing | ( | ) | [inline, 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::ChainedIncludesSource.
Definition at line 193 of file ExternalASTSource.h.
Referenced by clang::ChainedIncludesSource::FinishedDeserializing(), and clang::ExternalASTSource::Deserializing::~Deserializing().
| CXXBaseSpecifier * ExternalASTSource::GetExternalCXXBaseSpecifiers | ( | uint64_t | Offset | ) | [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::ChainedIncludesSource.
Definition at line 42 of file ExternalASTSource.cpp.
Referenced by clang::ChainedIncludesSource::GetExternalCXXBaseSpecifiers().
| Decl * ExternalASTSource::GetExternalDecl | ( | uint32_t | ID | ) | [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::ChainedIncludesSource.
Definition at line 25 of file ExternalASTSource.cpp.
Referenced by clang::ChainedIncludesSource::GetExternalDecl(), and clang::ClassTemplateDecl::LoadLazySpecializations().
| Stmt * ExternalASTSource::GetExternalDeclStmt | ( | uint64_t | Offset | ) | [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::ChainedIncludesSource.
Definition at line 37 of file ExternalASTSource.cpp.
Referenced by clang::ChainedIncludesSource::GetExternalDeclStmt().
| Selector ExternalASTSource::GetExternalSelector | ( | uint32_t | ID | ) | [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::ChainedIncludesSource.
Definition at line 29 of file ExternalASTSource.cpp.
Referenced by AddObjCExpressionResults(), and clang::ChainedIncludesSource::GetExternalSelector().
| MemoryBufferSizes clang::ExternalASTSource::getMemoryBufferSizes | ( | ) | const [inline] |
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
Definition at line 259 of file ExternalASTSource.h.
Referenced by clang::ChainedIncludesSource::getMemoryBufferSizes().
| void ExternalASTSource::getMemoryBufferSizes | ( | MemoryBufferSizes & | sizes | ) | const [virtual] |
Reimplemented in clang::ASTReader, and clang::ChainedIncludesSource.
Definition at line 62 of file ExternalASTSource.cpp.
| uint32_t ExternalASTSource::GetNumExternalSelectors | ( | ) | [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::ChainedIncludesSource.
Definition at line 33 of file ExternalASTSource.cpp.
Referenced by AddObjCExpressionResults(), and clang::ChainedIncludesSource::GetNumExternalSelectors().
| virtual bool clang::ExternalASTSource::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 | ||
| ) | [inline, 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.
Definition at line 236 of file ExternalASTSource.h.
| void ExternalASTSource::PrintStats | ( | ) | [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::ChainedIncludesSource.
Definition at line 23 of file ExternalASTSource.cpp.
Referenced by clang::ChainedIncludesSource::PrintStats().
| DeclContext::lookup_result ExternalASTSource::SetExternalVisibleDeclsForName | ( | const DeclContext * | DC, |
| DeclarationName | Name, | ||
| ArrayRef< NamedDecl * > | Decls | ||
| ) | [static, protected] |
Definition at line 952 of file DeclBase.cpp.
References clang::StoredDeclsList::AddSubsequentDecl(), clang::StoredDeclsList::getLookupResult(), clang::DeclContext::getParentASTContext(), clang::StoredDeclsList::isNull(), and clang::StoredDeclsList::setOnlyValue().
| DeclContext::lookup_result ExternalASTSource::SetNoExternalVisibleDeclsForName | ( | const DeclContext * | DC, |
| DeclarationName | Name | ||
| ) | [static, protected] |
Definition at line 937 of file DeclBase.cpp.
References clang::DeclContext::getParentASTContext(), and clang::StoredDeclsList::isNull().
| virtual void clang::ExternalASTSource::StartedDeserializing | ( | ) | [inline, 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::ChainedIncludesSource.
Definition at line 187 of file ExternalASTSource.h.
Referenced by clang::ExternalASTSource::Deserializing::Deserializing(), and clang::ChainedIncludesSource::StartedDeserializing().
| virtual void clang::ExternalASTSource::StartTranslationUnit | ( | ASTConsumer * | Consumer | ) | [inline, 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::ChainedIncludesSource.
Definition at line 199 of file ExternalASTSource.h.
Referenced by clang::ChainedIncludesSource::StartTranslationUnit().
friend class ExternalSemaSource [friend] |
Definition at line 58 of file ExternalASTSource.h.