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) \ 88 if (FD->isThisDeclarationADefinition()) {
89 return traverseParamVarHelper(D);
93 return base::TraverseParmVarDecl(D);
129 template<
typename TypeLocType>
130 bool HandleTemplateSpecializationTypeLoc(TypeLocType TL) {
131 if (
const auto *T = TL.getTypePtr()) {
137 if (
const TemplateDecl *D = T->getTemplateName().getAsTemplateDecl())
146 return HandleTemplateSpecializationTypeLoc(TL);
150 return HandleTemplateSpecializationTypeLoc(TL);
174 Name, [](
const NamedDecl *ND) {
return isa<TypeDecl>(ND); });
175 if (Symbols.size() != 1)
181 bool TraverseStmt(
Stmt *S) {
210 TypeIndexer(*
this, Parent, DC, isBase, isIBType).TraverseTypeLoc(TL);
220 indexNestedNameSpecifierLoc(Prefix, Parent, DC);
258 if (
auto CXXRD = dyn_cast<CXXRecordDecl>(D)) {
259 for (
const auto &I : CXXRD->bases()) {
260 indexTypeSourceInfo(I.getTypeSourceInfo(), CXXRD, CXXRD,
true);
ObjCInterfaceDecl * getIFaceDecl() const
Wrapper for source info for tag types.
const TypeClass * getTypePtr() const
Stmt - This represents one statement.
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.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
void indexTypeLoc(TypeLoc TL, const NamedDecl *Parent, const DeclContext *DC=nullptr, bool isBase=false, bool isIBType=false)
The base class of the type hierarchy.
Wrapper for source info for typedefs.
A container of type source information.
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
An identifier, stored as an IdentifierInfo*.
TRY_TO(TraverseType(T->getPointeeType()))
const T * getAs() const
Member-template getAs<specific type>'.
A namespace, stored as a NamespaceDecl*.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
bool hasDefinition() const
Represents a parameter to a function.
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.
A C++ nested-name-specifier augmented with source location information.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isFunctionLocalSymbol(const Decl *D)
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
SourceLocation getProtocolLoc(unsigned i) const
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Wrapper for source info for ObjC interfaces.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
SourceLocation getNameLoc() const
bool isDefinition() const
True if the tag was defined in this type specifier.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
ObjCProtocolDecl * getProtocol(unsigned i) const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
SourceLocation getNameLoc() const
bool isTransparentTag() const
Determines if this typedef shares a name and spelling location with its underlying tag type...
TagDecl * getDecl() const
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
DeclContext * getDeclContext()
CXXRecordDecl * getDefinition() const
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
Represents a C++ template name within the type system.
A namespace alias, stored as a NamespaceAliasDecl*.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
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)
A type, stored as a Type*.
Encodes a location in the source.
Represents the declaration of a struct/union/class/enum.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool shouldIndexImplicitInstantiation() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Base class for declarations which introduce a typedef-name.
Dataflow Directional Tag Classes.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
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.).
QualType getType() const
Get the type for which this source info wrapper provides information.
QualType getUnderlyingType() const
DeclarationName - The name of a declaration.
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)
TypedefNameDecl * getTypedefNameDecl() const
void indexNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const NamedDecl *Parent, const DeclContext *DC=nullptr)
void indexTagDecl(const TagDecl *D, ArrayRef< SymbolRelation > Relations=None)
TypeSourceInfo * getTypeSourceInfo() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Represents a C++ struct/union/class.
unsigned getNumProtocols() const
Declaration of a class template.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
SourceLocation getNameLoc() const
Represents a type template specialization; the template must be a class template, a type alias templa...
void indexBody(const Stmt *S, const NamedDecl *Parent, const DeclContext *DC=nullptr)
This represents a decl that may have a name.
The global specifier '::'. There is no stored value.