clang  6.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
clang::ExternalSemaSource Class Reference

An abstract interface that should be implemented by external AST sources that also provide information for semantic analysis. More...

#include "clang/Sema/ExternalSemaSource.h"

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

Public Member Functions

 ExternalSemaSource ()
 
 ~ExternalSemaSource () override
 
virtual void InitializeSema (Sema &S)
 Initialize the semantic source with the Sema instance being used to perform semantic analysis on the abstract syntax tree. More...
 
virtual void ForgetSema ()
 Inform the semantic consumer that Sema is no longer available. More...
 
virtual void ReadMethodPool (Selector Sel)
 Load the contents of the global method pool for a given selector. More...
 
virtual void updateOutOfDateSelector (Selector Sel)
 Load the contents of the global method pool for a given selector if necessary. More...
 
virtual void ReadKnownNamespaces (SmallVectorImpl< NamespaceDecl *> &Namespaces)
 Load the set of namespaces that are known to the external source, which will be used during typo correction. More...
 
virtual void ReadUndefinedButUsed (llvm::MapVector< NamedDecl *, SourceLocation > &Undefined)
 Load the set of used but not defined functions or variables with internal linkage, or used but not defined internal functions. More...
 
virtual void ReadMismatchingDeleteExpressions (llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &)
 
virtual bool LookupUnqualified (LookupResult &R, Scope *S)
 Do last resort, unqualified lookup on a LookupResult that Sema cannot find. More...
 
virtual void ReadTentativeDefinitions (SmallVectorImpl< VarDecl *> &TentativeDefs)
 Read the set of tentative definitions known to the external Sema source. More...
 
virtual void ReadUnusedFileScopedDecls (SmallVectorImpl< const DeclaratorDecl *> &Decls)
 Read the set of unused file-scope declarations known to the external Sema source. More...
 
virtual void ReadDelegatingConstructors (SmallVectorImpl< CXXConstructorDecl *> &Decls)
 Read the set of delegating constructors known to the external Sema source. More...
 
virtual void ReadExtVectorDecls (SmallVectorImpl< TypedefNameDecl *> &Decls)
 Read the set of ext_vector type declarations known to the external Sema source. More...
 
virtual void ReadUnusedLocalTypedefNameCandidates (llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls)
 Read the set of potentially unused typedefs known to the source. More...
 
virtual void ReadReferencedSelectors (SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels)
 Read the set of referenced selectors known to the external Sema source. More...
 
virtual void ReadWeakUndeclaredIdentifiers (SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI)
 Read the set of weak, undeclared identifiers known to the external Sema source. More...
 
virtual void ReadUsedVTables (SmallVectorImpl< ExternalVTableUse > &VTables)
 Read the set of used vtables known to the external Sema source. More...
 
virtual void ReadPendingInstantiations (SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending)
 Read the set of pending instantiations known to the external Sema source. More...
 
virtual void ReadLateParsedTemplates (llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &LPTMap)
 Read the set of late parsed template functions for this source. More...
 
virtual TypoCorrection CorrectTypo (const DeclarationNameInfo &Typo, int LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT)
 Try to "correct" a typo in the source code by finding visible declarations whose names are similar to the name that was present in the source code. More...
 
virtual bool MaybeDiagnoseMissingCompleteType (SourceLocation Loc, QualType T)
 Produces a diagnostic note if the external source contains a complete definition for T. More...
 
- Public Member Functions inherited from clang::ExternalASTSource
 ExternalASTSource ()=default
 
virtual ~ExternalASTSource ()
 
uint32_t getGeneration () const
 Get the current generation of this AST source. More...
 
virtual DeclGetExternalDecl (uint32_t ID)
 Resolve a declaration ID into a declaration, potentially building a new declaration. More...
 
virtual Selector GetExternalSelector (uint32_t ID)
 Resolve a selector ID into a selector. More...
 
virtual uint32_t GetNumExternalSelectors ()
 Returns the number of selectors known to the external AST source. More...
 
virtual StmtGetExternalDeclStmt (uint64_t Offset)
 Resolve the offset of a statement in the decl stream into a statement. More...
 
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. More...
 
virtual CXXBaseSpecifierGetExternalCXXBaseSpecifiers (uint64_t Offset)
 Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers. More...
 
virtual void updateOutOfDateIdentifier (IdentifierInfo &II)
 Update an out-of-date identifier. More...
 
virtual bool FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name)
 Find all declarations with the given name in the given context, and add them to the context by calling SetExternalVisibleDeclsForName or SetNoExternalVisibleDeclsForName. More...
 
virtual void completeVisibleDeclsMap (const DeclContext *DC)
 Ensures that the table of all visible declarations inside this context is up to date. More...
 
virtual ModulegetModule (unsigned ID)
 Retrieve the module that corresponds to the given module ID. More...
 
virtual llvm::Optional< ASTSourceDescriptorgetSourceDescriptor (unsigned ID)
 Return a descriptor for the corresponding module, if one exists. More...
 
virtual ExtKind hasExternalDefinitions (const Decl *D)
 
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. More...
 
void FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl *> &Result)
 Finds all declarations lexically contained within the given DeclContext. More...
 
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. More...
 
virtual void CompleteRedeclChain (const Decl *D)
 Gives the external AST source an opportunity to complete the redeclaration chain for a declaration. More...
 
virtual void CompleteType (TagDecl *Tag)
 Gives the external AST source an opportunity to complete an incomplete type. More...
 
virtual void CompleteType (ObjCInterfaceDecl *Class)
 Gives the external AST source an opportunity to complete an incomplete Objective-C class. More...
 
virtual void ReadComments ()
 Loads comment ranges. More...
 
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. More...
 
virtual void FinishedDeserializing ()
 Notify ExternalASTSource that we finished the deserialization of a decl or type. More...
 
virtual void StartTranslationUnit (ASTConsumer *Consumer)
 Function that will be invoked when we begin parsing a new translation unit involving this external AST source. More...
 
virtual void PrintStats ()
 Print any statistics that have been gathered regarding the external AST source. More...
 
virtual bool layoutRecordType (const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &BaseOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &VirtualBaseOffsets)
 Perform layout on the given record. More...
 
MemoryBufferSizes getMemoryBufferSizes () const
 Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory. More...
 
virtual void getMemoryBufferSizes (MemoryBufferSizes &sizes) const
 

Static Public Member Functions

static bool classof (const ExternalASTSource *Source)
 

Additional Inherited Members

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

Detailed Description

An abstract interface that should be implemented by external AST sources that also provide information for semantic analysis.

Definition at line 53 of file ExternalSemaSource.h.

Constructor & Destructor Documentation

◆ ExternalSemaSource()

clang::ExternalSemaSource::ExternalSemaSource ( )
inline

Definition at line 55 of file ExternalSemaSource.h.

◆ ~ExternalSemaSource()

ExternalSemaSource::~ExternalSemaSource ( )
override

Definition at line 1489 of file Sema.cpp.

Member Function Documentation

◆ classof()

static bool clang::ExternalSemaSource::classof ( const ExternalASTSource Source)
inlinestatic

Definition at line 227 of file ExternalSemaSource.h.

◆ CorrectTypo()

virtual TypoCorrection clang::ExternalSemaSource::CorrectTypo ( const DeclarationNameInfo Typo,
int  LookupKind,
Scope S,
CXXScopeSpec SS,
CorrectionCandidateCallback CCC,
DeclContext MemberContext,
bool  EnteringContext,
const ObjCObjectPointerType OPT 
)
inlinevirtual

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.

Parameters
TypoNamethe DeclarationNameInfo structure that contains the name that was present in the source code along with its location.
LookupKindthe name-lookup criteria used to search for the name.
Sthe scope in which name lookup occurs.
SSthe nested-name-specifier that precedes the name we're looking for, if present.
CCCA CorrectionCandidateCallback object that provides further validation of typo correction candidates. It also provides flags for determining the set of keywords permitted.
MemberContextif non-NULL, the context in which to look for a member access expression.
EnteringContextwhether we're entering the context described by the nested-name-specifier SS.
OPTwhen non-NULL, the search for visible declarations will also walk the protocols in the qualified interfaces of OPT.
Returns
a TypoCorrection containing the corrected name if the typo along with information such as the NamedDecl where the corrected name was declared, and any additional NestedNameSpecifier needed to access it (C++ only). The TypoCorrection is empty if there is no correction.
Note
LookupKind must correspond to a valid Sema::LookupNameKind

ExternalSemaSource::CorrectTypo is always given the first chance to correct a typo (really, to offer suggestions to repair a failed lookup). It will even be called when SpellChecking is turned off or after a fatal error has already been detected.

Reimplemented in clang::MultiplexExternalSemaSource.

Definition at line 203 of file ExternalSemaSource.h.

◆ ForgetSema()

virtual void clang::ExternalSemaSource::ForgetSema ( )
inlinevirtual

Inform the semantic consumer that Sema is no longer available.

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 67 of file ExternalSemaSource.h.

◆ InitializeSema()

virtual void clang::ExternalSemaSource::InitializeSema ( Sema S)
inlinevirtual

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

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 64 of file ExternalSemaSource.h.

◆ LookupUnqualified()

virtual bool clang::ExternalSemaSource::LookupUnqualified ( LookupResult R,
Scope S 
)
inlinevirtual

Do last resort, unqualified lookup on a LookupResult that Sema cannot find.

Parameters
Ra LookupResult that is being recovered.
Sthe Scope of the identifier occurrence.
Returns
true to tell Sema to recover using the LookupResult.

Reimplemented in clang::MultiplexExternalSemaSource.

Definition at line 98 of file ExternalSemaSource.h.

◆ MaybeDiagnoseMissingCompleteType()

virtual bool clang::ExternalSemaSource::MaybeDiagnoseMissingCompleteType ( SourceLocation  Loc,
QualType  T 
)
inlinevirtual

Produces a diagnostic note if the external source contains a complete definition for T.

Parameters
Locthe location at which a complete type was required but not provided
Tthe QualType that should have been complete at Loc
Returns
true if a diagnostic was produced, false otherwise.

Reimplemented in clang::MultiplexExternalSemaSource.

Definition at line 221 of file ExternalSemaSource.h.

◆ ReadDelegatingConstructors()

virtual void clang::ExternalSemaSource::ReadDelegatingConstructors ( SmallVectorImpl< CXXConstructorDecl *> &  Decls)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 127 of file ExternalSemaSource.h.

◆ ReadExtVectorDecls()

virtual void clang::ExternalSemaSource::ReadExtVectorDecls ( SmallVectorImpl< TypedefNameDecl *> &  Decls)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 137 of file ExternalSemaSource.h.

◆ ReadKnownNamespaces()

void ExternalSemaSource::ReadKnownNamespaces ( SmallVectorImpl< NamespaceDecl *> &  Namespaces)
virtual

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

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 1494 of file Sema.cpp.

◆ ReadLateParsedTemplates()

virtual void clang::ExternalSemaSource::ReadLateParsedTemplates ( llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &  LPTMap)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 192 of file ExternalSemaSource.h.

◆ ReadMethodPool()

void ExternalSemaSource::ReadMethodPool ( Selector  Sel)
virtual

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

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 1491 of file Sema.cpp.

◆ ReadMismatchingDeleteExpressions()

void ExternalSemaSource::ReadMismatchingDeleteExpressions ( llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &  )
virtual

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 1501 of file Sema.cpp.

◆ ReadPendingInstantiations()

virtual void clang::ExternalSemaSource::ReadPendingInstantiations ( SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &  Pending)
inlinevirtual

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 in clang::MultiplexExternalSemaSource.

Definition at line 182 of file ExternalSemaSource.h.

Referenced by clang::Sema::ActOnEndOfTranslationUnit().

◆ ReadReferencedSelectors()

virtual void clang::ExternalSemaSource::ReadReferencedSelectors ( SmallVectorImpl< std::pair< Selector, SourceLocation > > &  Sels)
inlinevirtual

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 in clang::MultiplexExternalSemaSource.

Definition at line 155 of file ExternalSemaSource.h.

◆ ReadTentativeDefinitions()

virtual void clang::ExternalSemaSource::ReadTentativeDefinitions ( SmallVectorImpl< VarDecl *> &  TentativeDefs)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 107 of file ExternalSemaSource.h.

◆ ReadUndefinedButUsed()

void ExternalSemaSource::ReadUndefinedButUsed ( llvm::MapVector< NamedDecl *, SourceLocation > &  Undefined)
virtual

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

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 1498 of file Sema.cpp.

Referenced by clang::Sema::ActOnEndOfTranslationUnit().

◆ ReadUnusedFileScopedDecls()

virtual void clang::ExternalSemaSource::ReadUnusedFileScopedDecls ( SmallVectorImpl< const DeclaratorDecl *> &  Decls)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 117 of file ExternalSemaSource.h.

◆ ReadUnusedLocalTypedefNameCandidates()

virtual void clang::ExternalSemaSource::ReadUnusedLocalTypedefNameCandidates ( llvm::SmallSetVector< const TypedefNameDecl *, 4 > &  Decls)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 145 of file ExternalSemaSource.h.

Referenced by clang::Sema::emitAndClearUnusedLocalTypedefWarnings().

◆ ReadUsedVTables()

virtual void clang::ExternalSemaSource::ReadUsedVTables ( SmallVectorImpl< ExternalVTableUse > &  VTables)
inlinevirtual

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 in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 173 of file ExternalSemaSource.h.

◆ ReadWeakUndeclaredIdentifiers()

virtual void clang::ExternalSemaSource::ReadWeakUndeclaredIdentifiers ( SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &  WI)
inlinevirtual

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 in clang::MultiplexExternalSemaSource.

Definition at line 165 of file ExternalSemaSource.h.

Referenced by clang::Sema::LoadExternalWeakUndeclaredIdentifiers().

◆ updateOutOfDateSelector()

void ExternalSemaSource::updateOutOfDateSelector ( Selector  Sel)
virtual

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

Reimplemented in clang::ASTReader, and clang::MultiplexExternalSemaSource.

Definition at line 1492 of file Sema.cpp.


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