13 using namespace clang;
14 using namespace index;
30 : IndexCtx(indexCtx), Parent(parent), ParentDC(DC), IsBase(isBase) {
41 bool shouldWalkTypesOfTypeLocs()
const {
return false; }
43 #define TRY_TO(CALL_EXPR) \
54 return IndexCtx.handleReference(Underlying, Loc, Parent,
58 TRY_TO(IndexCtx.handleReference(ND, Loc,
61 TRY_TO(IndexCtx.handleReference(CD, Loc, Parent, ParentDC,
66 TRY_TO(IndexCtx.handleReference(ND, Loc,
88 if (FD->isThisDeclarationADefinition()) {
89 return traverseParamVarHelper(D);
93 return base::TraverseParmVarDecl(D);
97 IndexCtx.indexNestedNameSpecifierLoc(NNS, Parent, ParentDC);
107 IndexCtx.indexTagDecl(D);
111 return IndexCtx.handleReference(D, TL.
getNameLoc(),
131 if (IndexCtx.shouldIndexImplicitTemplateInsts()) {
136 if (
const TemplateDecl *D = T->getTemplateName().getAsTemplateDecl())
165 Name, [](
const NamedDecl *ND) {
return isa<TypeDecl>(ND); });
166 if (Symbols.size() != 1)
168 return IndexCtx.handleReference(Symbols[0], TL.
getNameLoc(), Parent,
172 bool TraverseStmt(
Stmt *
S) {
173 IndexCtx.indexBody(S, Parent, ParentDC);
201 TypeIndexer(*
this, Parent, DC, isBase, isIBType).TraverseTypeLoc(TL);
249 if (
auto CXXRD = dyn_cast<CXXRecordDecl>(D)) {
250 for (
const auto &
I : CXXRD->bases()) {
Wrapper for source info for tag types.
SourceLocation getNameLoc() const
Stmt - This represents one statement.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Represents a qualified type name for which the type name is dependent.
void indexTypeLoc(TypeLoc TL, const NamedDecl *Parent, const DeclContext *DC=nullptr, bool isBase=false, bool isIBType=false)
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
QualType getUnderlyingType() const
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
bool hasDefinition() const
The base class of the type hierarchy.
Wrapper for source info for typedefs.
A container of type source information.
An identifier, stored as an IdentifierInfo*.
TRY_TO(TraverseType(T->getPointeeType()))
A namespace, stored as a NamespaceDecl*.
ParmVarDecl - Represents a parameter to a function.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
std::vector< const NamedDecl * > lookupDependentName(const DeclarationName &Name, llvm::function_ref< bool(const NamedDecl *ND)> Filter)
Performs an imprecise lookup of a dependent name in this class.
Base wrapper for a particular "section" of type source info.
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
bool isDefinition() const
True if the tag was defined in this type specifier.
A C++ nested-name-specifier augmented with source location information.
bool isFunctionLocalSymbol(const Decl *D)
CXXRecordDecl * getDefinition() const
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
unsigned getNumProtocols() const
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Wrapper for source info for ObjC interfaces.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
A class that does preordor or postorder depth-first traversal on the entire Clang AST and visits each...
detail::InMemoryDirectory::const_iterator I
TypedefNameDecl * getTypedefNameDecl() const
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
TagDecl * getDecl() const
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
bool indexDeclContext(const DeclContext *DC)
DeclContext * getDeclContext()
Represents a C++ template name within the type system.
A namespace alias, stored as a NamespaceAliasDecl*.
bool isTransparentTag() const
Determines if this typedef shares a name and spelling location with its underlying tag type...
SourceLocation getTemplateNameLoc() const
QualType getType() const
Get the type for which this source info wrapper provides information.
bool handleReference(const NamedDecl *D, SourceLocation Loc, const NamedDecl *Parent, const DeclContext *DC, SymbolRoleSet Roles=SymbolRoleSet(), ArrayRef< SymbolRelation > Relations=None, const Expr *RefE=nullptr, const Decl *RefD=nullptr)
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
A type, stored as a Type*.
TypeSourceInfo * getTypeSourceInfo() const
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Encodes a location in the source.
TagDecl - Represents the declaration of a struct/union/class/enum.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceLocation getNameLoc() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
SourceLocation getNameLoc() const
Base class for declarations which introduce a typedef-name.
bool shouldIndex(const Decl *D)
bool handleDecl(const Decl *D, SymbolRoleSet Roles=SymbolRoleSet(), ArrayRef< SymbolRelation > Relations=None)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
DeclarationName - The name of a declaration.
ObjCInterfaceDecl * getIFaceDecl() const
A type that was preceded by the 'template' keyword, stored as a Type*.
void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent, const DeclContext *DC=nullptr, bool isBase=false, bool isIBType=false)
const T * getAs() const
Member-template getAs<specific type>'.
void indexNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const NamedDecl *Parent, const DeclContext *DC=nullptr)
void indexTagDecl(const TagDecl *D, ArrayRef< SymbolRelation > Relations=None)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool shouldIndexFunctionLocalSymbols() const
ObjCProtocolDecl * getProtocol(unsigned i) const
const TypeClass * getTypePtr() const
SourceLocation getProtocolLoc(unsigned i) const
Represents a C++ struct/union/class.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Declaration of a class template.
Represents a type template specialization; the template must be a class template, a type alias templa...
NamedDecl - This represents a decl with a name.
The global specifier '::'. There is no stored value.