16#ifndef LLVM_CLANG_AST_DYNAMIC_RECURSIVE_AST_VISITOR_H
17#define LLVM_CLANG_AST_DYNAMIC_RECURSIVE_AST_VISITOR_H
57 template <
typename ASTNode>
58 using MaybeConst = std::conditional_t<IsConst, const ASTNode, ASTNode>;
243#define DEF_TRAVERSE_TMPL_INST(kind) \
244 virtual bool TraverseTemplateInstantiations( \
245 MaybeConst<kind##TemplateDecl> *D);
249#undef DEF_TRAVERSE_TMPL_INST
252#define ABSTRACT_DECL(DECL)
253#define DECL(CLASS, BASE) \
254 virtual bool Traverse##CLASS##Decl(MaybeConst<CLASS##Decl> *D);
255#include "clang/AST/DeclNodes.inc"
257#define DECL(CLASS, BASE) \
258 bool WalkUpFrom##CLASS##Decl(MaybeConst<CLASS##Decl> *D); \
259 virtual bool Visit##CLASS##Decl(MaybeConst<CLASS##Decl> *D) { return true; }
260#include "clang/AST/DeclNodes.inc"
263#define ABSTRACT_STMT(STMT)
264#define STMT(CLASS, PARENT) virtual bool Traverse##CLASS(MaybeConst<CLASS> *S);
265#include "clang/AST/StmtNodes.inc"
267#define STMT(CLASS, PARENT) \
268 bool WalkUpFrom##CLASS(MaybeConst<CLASS> *S); \
269 virtual bool Visit##CLASS(MaybeConst<CLASS> *S) { return true; }
270#include "clang/AST/StmtNodes.inc"
273#define ABSTRACT_TYPE(CLASS, BASE)
274#define TYPE(CLASS, BASE) \
275 virtual bool Traverse##CLASS##Type(MaybeConst<CLASS##Type> *T);
276#include "clang/AST/TypeNodes.inc"
278#define TYPE(CLASS, BASE) \
279 bool WalkUpFrom##CLASS##Type(MaybeConst<CLASS##Type> *T); \
280 virtual bool Visit##CLASS##Type(MaybeConst<CLASS##Type> *T) { return true; }
281#include "clang/AST/TypeNodes.inc"
284#define ABSTRACT_TYPELOC(CLASS, BASE)
285#define TYPELOC(CLASS, BASE) \
286 virtual bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
287#include "clang/AST/TypeLocNodes.def"
289#define TYPELOC(CLASS, BASE) \
290 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL); \
291 virtual bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
292#include "clang/AST/TypeLocNodes.def"
295extern template class DynamicRecursiveASTVisitorBase<false>;
296extern template class DynamicRecursiveASTVisitorBase<true>;
#define DEF_TRAVERSE_TMPL_INST(kind)
Defines Expressions and AST nodes for C++2a concepts.
Defines the clang::TypeLoc interface and its subclasses.
Represents a base class of a C++ class.
Recursive AST visitor that supports extension via dynamic dispatch.
virtual bool TraverseConceptNestedRequirement(MaybeConst< concepts::NestedRequirement > *R)
virtual ~DynamicRecursiveASTVisitorBase()=default
virtual bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
virtual bool TraverseConstructorInitializer(MaybeConst< CXXCtorInitializer > *Init)
Recursively visit a constructor initializer.
virtual bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
bool WalkUpFromTypeLoc(TypeLoc TL)
bool ShouldVisitLambdaBody
Whether this visitor should recurse into lambda body.
DynamicRecursiveASTVisitorBase & operator=(const DynamicRecursiveASTVisitorBase &)=default
virtual bool TraverseDecl(MaybeConst< Decl > *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
DynamicRecursiveASTVisitorBase(DynamicRecursiveASTVisitorBase &&)=default
bool ShouldVisitTemplateInstantiations
Whether this visitor should recurse into template instantiations.
std::conditional_t< IsConst, const ASTNode, ASTNode > MaybeConst
virtual bool TraverseConceptRequirement(MaybeConst< concepts::Requirement > *R)
DynamicRecursiveASTVisitorBase()=default
bool WalkUpFromStmt(MaybeConst< Stmt > *S)
virtual bool dataTraverseStmtPre(MaybeConst< Stmt > *S)
Invoked before visiting a statement or expression via data recursion.
virtual bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
virtual bool TraverseNestedNameSpecifier(MaybeConst< NestedNameSpecifier > *NNS)
Recursively visit a C++ nested-name-specifier.
virtual bool TraverseConceptExprRequirement(MaybeConst< concepts::ExprRequirement > *R)
virtual bool VisitDecl(MaybeConst< Decl > *D)
bool ShouldVisitImplicitCode
Whether this visitor should recurse into implicit code, e.g.
virtual bool VisitStmt(MaybeConst< Stmt > *S)
virtual bool VisitAttr(MaybeConst< Attr > *A)
Visit a node.
virtual bool TraverseStmt(MaybeConst< Stmt > *S)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
virtual bool TraverseAttr(MaybeConst< Attr > *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...
virtual bool TraverseConceptTypeRequirement(MaybeConst< concepts::TypeRequirement > *R)
virtual bool TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
DynamicRecursiveASTVisitorBase & operator=(DynamicRecursiveASTVisitorBase &&)=default
virtual bool TraverseTypeConstraint(const TypeConstraint *C)
Traverse a concept (requirement).
virtual bool TraverseType(QualType T)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
bool WalkUpFromDecl(MaybeConst< Decl > *D)
Walk up from a node.
virtual bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
virtual bool VisitConceptReference(MaybeConst< ConceptReference > *CR)
bool ShouldWalkTypesOfTypeLocs
Whether this visitor should recurse into the types of TypeLocs.
DynamicRecursiveASTVisitorBase(const DynamicRecursiveASTVisitorBase &)=default
virtual bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
virtual bool dataTraverseStmtPost(MaybeConst< Stmt > *S)
Invoked after visiting a statement or expression via data recursion.
virtual bool dataTraverseNode(MaybeConst< Stmt > *S)
virtual bool VisitType(MaybeConst< Type > *T)
virtual bool TraverseAST(MaybeConst< ASTContext > &AST)
Recursively visits an entire AST, starting from the TranslationUnitDecl.
virtual bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc)
Recursively visit an Objective-C protocol reference with location information.
bool WalkUpFromType(MaybeConst< Type > *T)
virtual bool VisitTypeLoc(TypeLoc TL)
bool TraverseTemplateArguments(ArrayRef< TemplateArgument > Args)
Recursively visit a set of template arguments.
virtual bool TraverseConceptReference(MaybeConst< ConceptReference > *CR)
virtual bool TraverseLambdaCapture(MaybeConst< LambdaExpr > *LE, const LambdaCapture *C, MaybeConst< Expr > *Init)
Recursively visit a lambda capture.
virtual bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ nested-name-specifier augmented with source location information.
A (possibly-)qualified type.
Location wrapper for a TemplateArgument.
Represents a template argument.
Represents a C++ template name within the type system.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Base wrapper for a particular "section" of type source info.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
@ Class
The "class" keyword introduces the elaborated-type-specifier.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...