93 DynamicRecursiveASTVisitorBase<Const> &Visitor;
94 Impl(DynamicRecursiveASTVisitorBase<Const> &Visitor) : Visitor(Visitor) {}
96 bool shouldVisitTemplateInstantiations()
const {
97 return Visitor.ShouldVisitTemplateInstantiations;
100 bool shouldWalkTypesOfTypeLocs()
const {
101 return Visitor.ShouldWalkTypesOfTypeLocs;
104 bool shouldVisitImplicitCode()
const {
105 return Visitor.ShouldVisitImplicitCode;
108 bool shouldVisitLambdaBody()
const {
return Visitor.ShouldVisitLambdaBody; }
113 bool shouldTraversePostOrder()
const {
return false; }
115 bool TraverseAST(ASTContext &AST) {
return Visitor.TraverseAST(AST); }
116 bool TraverseAttr(Attr *At) {
return Visitor.TraverseAttr(At); }
117 bool TraverseDecl(Decl *D) {
return Visitor.TraverseDecl(D); }
118 bool TraverseType(QualType
T,
bool TraverseQualifier =
true) {
119 return Visitor.TraverseType(
T, TraverseQualifier);
121 bool TraverseTypeLoc(TypeLoc TL,
bool TraverseQualifier =
true) {
122 return Visitor.TraverseTypeLoc(TL, TraverseQualifier);
124 bool TraverseStmt(Stmt *S) {
return Visitor.TraverseStmt(S); }
126 bool TraverseConstructorInitializer(CXXCtorInitializer *
Init) {
127 return Visitor.TraverseConstructorInitializer(
Init);
130 bool TraverseTemplateArgument(
const TemplateArgument &Arg) {
131 return Visitor.TraverseTemplateArgument(Arg);
134 bool TraverseTemplateArgumentLoc(
const TemplateArgumentLoc &ArgLoc) {
135 return Visitor.TraverseTemplateArgumentLoc(ArgLoc);
139 bool TraverseQualifier =
true) {
140 return Visitor.TraverseTemplateName(
Template, TraverseQualifier);
143 bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc) {
144 return Visitor.TraverseObjCProtocolLoc(ProtocolLoc);
147 bool TraverseTypeConstraint(
const TypeConstraint *
C) {
148 return Visitor.TraverseTypeConstraint(
C);
150 bool TraverseConceptRequirement(concepts::Requirement *R) {
151 return Visitor.TraverseConceptRequirement(R);
153 bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R) {
154 return Visitor.TraverseConceptTypeRequirement(R);
156 bool TraverseConceptExprRequirement(concepts::ExprRequirement *R) {
157 return Visitor.TraverseConceptExprRequirement(R);
159 bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R) {
160 return Visitor.TraverseConceptNestedRequirement(R);
163 bool TraverseConceptReference(ConceptReference *CR) {
164 return Visitor.TraverseConceptReference(CR);
167 bool TraverseOffsetOfNode(
const OffsetOfNode *Node) {
168 return Visitor.TraverseOffsetOfNode(Node);
170 bool VisitOffsetOfNode(
const OffsetOfNode *Node) {
171 return Visitor.VisitOffsetOfNode(Node);
174 bool TraverseCXXBaseSpecifier(
const CXXBaseSpecifier &Base) {
175 return Visitor.TraverseCXXBaseSpecifier(Base);
178 bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo) {
179 return Visitor.TraverseDeclarationNameInfo(NameInfo);
182 bool TraverseLambdaCapture(
LambdaExpr *LE,
const LambdaCapture *
C,
184 return Visitor.TraverseLambdaCapture(LE,
C,
Init);
187 bool TraverseNestedNameSpecifier(NestedNameSpecifier NNS) {
188 return Visitor.TraverseNestedNameSpecifier(NNS);
192 return Visitor.TraverseNestedNameSpecifierLoc(NNS);
195 bool VisitConceptReference(ConceptReference *CR) {
196 return Visitor.VisitConceptReference(CR);
199 bool dataTraverseStmtPre(Stmt *S) {
return Visitor.dataTraverseStmtPre(S); }
200 bool dataTraverseStmtPost(Stmt *S) {
return Visitor.dataTraverseStmtPost(S); }
204 bool dataTraverseNode(
210 return Visitor.dataTraverseNode(S);
214 bool VisitAttr(Attr *A) {
return Visitor.VisitAttr(A); }
215 bool VisitDecl(Decl *D) {
return Visitor.VisitDecl(D); }
216 bool VisitStmt(Stmt *S) {
return Visitor.VisitStmt(S); }
217 bool VisitType(
Type *
T) {
return Visitor.VisitType(
T); }
218 bool VisitTypeLoc(TypeLoc TL) {
return Visitor.VisitTypeLoc(TL); }
220#define DEF_TRAVERSE_TMPL_INST(kind) \
221 bool TraverseTemplateInstantiations(kind##TemplateDecl *D) { \
222 return Visitor.TraverseTemplateInstantiations(D); \
227#undef DEF_TRAVERSE_TMPL_INST
230#define ABSTRACT_DECL(DECL)
231#define DECL(CLASS, BASE) \
232 bool Traverse##CLASS##Decl(CLASS##Decl *D) { \
233 return Visitor.Traverse##CLASS##Decl(D); \
235#include "clang/AST/DeclNodes.inc"
237#define DECL(CLASS, BASE) \
238 bool Visit##CLASS##Decl(CLASS##Decl *D) { \
239 return Visitor.Visit##CLASS##Decl(D); \
241#include "clang/AST/DeclNodes.inc"
244#define ABSTRACT_STMT(STMT)
245#define STMT(CLASS, PARENT) \
246 bool Traverse##CLASS(CLASS *S) { return Visitor.Traverse##CLASS(S); }
247#include "clang/AST/StmtNodes.inc"
249#define STMT(CLASS, PARENT) \
250 bool Visit##CLASS(CLASS *S) { return Visitor.Visit##CLASS(S); }
251#include "clang/AST/StmtNodes.inc"
254#define ABSTRACT_TYPE(CLASS, BASE)
255#define TYPE(CLASS, BASE) \
256 bool Traverse##CLASS##Type(CLASS##Type *T, bool TraverseQualifier) { \
257 return Visitor.Traverse##CLASS##Type(T, TraverseQualifier); \
259#include "clang/AST/TypeNodes.inc"
261#define TYPE(CLASS, BASE) \
262 bool Visit##CLASS##Type(CLASS##Type *T) { \
263 return Visitor.Visit##CLASS##Type(T); \
265#include "clang/AST/TypeNodes.inc"
268#define ABSTRACT_TYPELOC(CLASS, BASE)
269#define TYPELOC(CLASS, BASE) \
270 bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL, bool TraverseQualifier) { \
271 return Visitor.Traverse##CLASS##TypeLoc(TL, TraverseQualifier); \
273#include "clang/AST/TypeLocNodes.def"
275#define TYPELOC(CLASS, BASE) \
276 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
277 return Visitor.Visit##CLASS##TypeLoc(TL); \
279#include "clang/AST/TypeLocNodes.def"
291#define FORWARD_TO_BASE(Function, Type, RefOrPointer) \
292 template <bool Const> \
293 bool DynamicRecursiveASTVisitorBase<Const>::Function( \
294 MaybeConst<Type> RefOrPointer Param) { \
295 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>::Function( \
296 const_cast<Type RefOrPointer>(Param)); \
300#define FORWARD_TO_BASE_EXACT(Function, Type) \
301 template <bool Const> \
302 bool DynamicRecursiveASTVisitorBase<Const>::Function(Type Param) { \
303 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>::Function( \
334 return Impl<Const>(*
this)
335 .RecursiveASTVisitor<Impl<Const>>::TraverseTemplateName(
342 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>
::TraverseType(
343 T, TraverseQualifier);
348 TypeLoc TL,
bool TraverseQualifier) {
350 TL, TraverseQualifier);
361 return Impl<Const>(*
this)
370 const_cast<Stmt *
>(S),
nullptr);
374#define ABSTRACT_DECL(DECL)
375#define DECL(CLASS, BASE) \
376 FORWARD_TO_BASE(Traverse##CLASS##Decl, CLASS##Decl, *) \
377 FORWARD_TO_BASE(WalkUpFrom##CLASS##Decl, CLASS##Decl, *)
378#include "clang/AST/DeclNodes.inc"
381#define ABSTRACT_STMT(STMT)
382#define STMT(CLASS, PARENT) FORWARD_TO_BASE(Traverse##CLASS, CLASS, *)
383#include "clang/AST/StmtNodes.inc"
385#define STMT(CLASS, PARENT) FORWARD_TO_BASE(WalkUpFrom##CLASS, CLASS, *)
386#include "clang/AST/StmtNodes.inc"
389#define ABSTRACT_TYPE(CLASS, BASE)
390#define TYPE(CLASS, BASE) \
391 template <bool Const> \
392 bool DynamicRecursiveASTVisitorBase<Const>::Traverse##CLASS##Type( \
393 MaybeConst<CLASS##Type> *T, bool TraverseQualifier) { \
394 return Impl<Const>(*this) \
395 .RecursiveASTVisitor<Impl<Const>>::Traverse##CLASS##Type( \
396 const_cast<CLASS##Type *>(T), TraverseQualifier); \
398 FORWARD_TO_BASE(WalkUpFrom##CLASS##Type, CLASS##Type, *)
399#include "clang/AST/TypeNodes.inc"
401#define ABSTRACT_TYPELOC(CLASS, BASE)
402#define TYPELOC(CLASS, BASE) \
403 template <bool Const> \
404 bool DynamicRecursiveASTVisitorBase<Const>::Traverse##CLASS##TypeLoc( \
405 CLASS##TypeLoc TL, bool TraverseQualifier) { \
406 return Impl<Const>(*this) \
407 .RecursiveASTVisitor<Impl<Const>>::Traverse##CLASS##TypeLoc( \
408 TL, TraverseQualifier); \
410#include "clang/AST/TypeLocNodes.def"
412#define TYPELOC(CLASS, BASE) \
413 FORWARD_TO_BASE_EXACT(WalkUpFrom##CLASS##TypeLoc, CLASS##TypeLoc)
414#include "clang/AST/TypeLocNodes.def"
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc QualifierLoc)
#define FORWARD_TO_BASE_EXACT(Function, Type)
#define FORWARD_TO_BASE(Function, Type, RefOrPointer)
#define DEF_TRAVERSE_TMPL_INST(kind)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Attr - This represents one attribute.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Declaration of a class template.
A reference to a concept and its template args, as it appears in the code.
Decl - This represents one declaration (or definition), e.g.
Recursive AST visitor that supports extension via dynamic dispatch.
std::conditional_t< IsConst, const ASTNode, ASTNode > MaybeConst
virtual bool TraverseTypeLoc(TypeLoc TL, bool TraverseQualifier=true)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
virtual bool TraverseLambdaCapture(MaybeConst< LambdaExpr > *LE, const LambdaCapture *C, MaybeConst< Expr > *Init)
Recursively visit a lambda capture.
virtual bool TraverseType(QualType T, bool TraverseQualifier=true)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
virtual bool dataTraverseNode(MaybeConst< Stmt > *S)
This represents one expression.
Declaration of a template function.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Helper class for OffsetOfExpr.
A (possibly-)qualified type.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
Stmt - This represents one statement.
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.
Declaration of a variable template.
Top level wrappers for InstallAPI frontend operations.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
@ Type
The name was classified as a type.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...