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 return Visitor.TraverseTemplateName(
Template);
142 bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc) {
143 return Visitor.TraverseObjCProtocolLoc(ProtocolLoc);
146 bool TraverseTypeConstraint(
const TypeConstraint *
C) {
147 return Visitor.TraverseTypeConstraint(
C);
149 bool TraverseConceptRequirement(concepts::Requirement *R) {
150 return Visitor.TraverseConceptRequirement(R);
152 bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R) {
153 return Visitor.TraverseConceptTypeRequirement(R);
155 bool TraverseConceptExprRequirement(concepts::ExprRequirement *R) {
156 return Visitor.TraverseConceptExprRequirement(R);
158 bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R) {
159 return Visitor.TraverseConceptNestedRequirement(R);
162 bool TraverseConceptReference(ConceptReference *CR) {
163 return Visitor.TraverseConceptReference(CR);
166 bool TraverseOffsetOfNode(
const OffsetOfNode *Node) {
167 return Visitor.TraverseOffsetOfNode(Node);
169 bool VisitOffsetOfNode(
const OffsetOfNode *Node) {
170 return Visitor.VisitOffsetOfNode(Node);
173 bool TraverseCXXBaseSpecifier(
const CXXBaseSpecifier &Base) {
174 return Visitor.TraverseCXXBaseSpecifier(Base);
177 bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo) {
178 return Visitor.TraverseDeclarationNameInfo(NameInfo);
181 bool TraverseLambdaCapture(
LambdaExpr *LE,
const LambdaCapture *
C,
183 return Visitor.TraverseLambdaCapture(LE,
C,
Init);
186 bool TraverseNestedNameSpecifier(NestedNameSpecifier NNS) {
187 return Visitor.TraverseNestedNameSpecifier(NNS);
191 return Visitor.TraverseNestedNameSpecifierLoc(NNS);
194 bool VisitConceptReference(ConceptReference *CR) {
195 return Visitor.VisitConceptReference(CR);
198 bool dataTraverseStmtPre(Stmt *S) {
return Visitor.dataTraverseStmtPre(S); }
199 bool dataTraverseStmtPost(Stmt *S) {
return Visitor.dataTraverseStmtPost(S); }
203 bool dataTraverseNode(
209 return Visitor.dataTraverseNode(S);
213 bool VisitAttr(Attr *A) {
return Visitor.VisitAttr(A); }
214 bool VisitDecl(Decl *D) {
return Visitor.VisitDecl(D); }
215 bool VisitStmt(Stmt *S) {
return Visitor.VisitStmt(S); }
216 bool VisitType(
Type *T) {
return Visitor.VisitType(T); }
217 bool VisitTypeLoc(TypeLoc TL) {
return Visitor.VisitTypeLoc(TL); }
219#define DEF_TRAVERSE_TMPL_INST(kind) \
220 bool TraverseTemplateInstantiations(kind##TemplateDecl *D) { \
221 return Visitor.TraverseTemplateInstantiations(D); \
226#undef DEF_TRAVERSE_TMPL_INST
229#define ABSTRACT_DECL(DECL)
230#define DECL(CLASS, BASE) \
231 bool Traverse##CLASS##Decl(CLASS##Decl *D) { \
232 return Visitor.Traverse##CLASS##Decl(D); \
234#include "clang/AST/DeclNodes.inc"
236#define DECL(CLASS, BASE) \
237 bool Visit##CLASS##Decl(CLASS##Decl *D) { \
238 return Visitor.Visit##CLASS##Decl(D); \
240#include "clang/AST/DeclNodes.inc"
243#define ABSTRACT_STMT(STMT)
244#define STMT(CLASS, PARENT) \
245 bool Traverse##CLASS(CLASS *S) { return Visitor.Traverse##CLASS(S); }
246#include "clang/AST/StmtNodes.inc"
248#define STMT(CLASS, PARENT) \
249 bool Visit##CLASS(CLASS *S) { return Visitor.Visit##CLASS(S); }
250#include "clang/AST/StmtNodes.inc"
253#define ABSTRACT_TYPE(CLASS, BASE)
254#define TYPE(CLASS, BASE) \
255 bool Traverse##CLASS##Type(CLASS##Type *T, bool TraverseQualifier) { \
256 return Visitor.Traverse##CLASS##Type(T, TraverseQualifier); \
258#include "clang/AST/TypeNodes.inc"
260#define TYPE(CLASS, BASE) \
261 bool Visit##CLASS##Type(CLASS##Type *T) { \
262 return Visitor.Visit##CLASS##Type(T); \
264#include "clang/AST/TypeNodes.inc"
267#define ABSTRACT_TYPELOC(CLASS, BASE)
268#define TYPELOC(CLASS, BASE) \
269 bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL, bool TraverseQualifier) { \
270 return Visitor.Traverse##CLASS##TypeLoc(TL, TraverseQualifier); \
272#include "clang/AST/TypeLocNodes.def"
274#define TYPELOC(CLASS, BASE) \
275 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
276 return Visitor.Visit##CLASS##TypeLoc(TL); \
278#include "clang/AST/TypeLocNodes.def"
290#define FORWARD_TO_BASE(Function, Type, RefOrPointer) \
291 template <bool Const> \
292 bool DynamicRecursiveASTVisitorBase<Const>::Function( \
293 MaybeConst<Type> RefOrPointer Param) { \
294 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>::Function( \
295 const_cast<Type RefOrPointer>(Param)); \
299#define FORWARD_TO_BASE_EXACT(Function, Type) \
300 template <bool Const> \
301 bool DynamicRecursiveASTVisitorBase<Const>::Function(Type Param) { \
302 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>::Function( \
333 QualType T,
bool TraverseQualifier) {
334 return Impl<Const>(*this).RecursiveASTVisitor<Impl<Const>>::TraverseType(
335 T, TraverseQualifier);
340 TypeLoc TL,
bool TraverseQualifier) {
342 TL, TraverseQualifier);
353 return Impl<Const>(*
this)
362 const_cast<Stmt *
>(S),
nullptr);
366#define ABSTRACT_DECL(DECL)
367#define DECL(CLASS, BASE) \
368 FORWARD_TO_BASE(Traverse##CLASS##Decl, CLASS##Decl, *) \
369 FORWARD_TO_BASE(WalkUpFrom##CLASS##Decl, CLASS##Decl, *)
370#include "clang/AST/DeclNodes.inc"
373#define ABSTRACT_STMT(STMT)
374#define STMT(CLASS, PARENT) FORWARD_TO_BASE(Traverse##CLASS, CLASS, *)
375#include "clang/AST/StmtNodes.inc"
377#define STMT(CLASS, PARENT) FORWARD_TO_BASE(WalkUpFrom##CLASS, CLASS, *)
378#include "clang/AST/StmtNodes.inc"
381#define ABSTRACT_TYPE(CLASS, BASE)
382#define TYPE(CLASS, BASE) \
383 template <bool Const> \
384 bool DynamicRecursiveASTVisitorBase<Const>::Traverse##CLASS##Type( \
385 MaybeConst<CLASS##Type> *T, bool TraverseQualifier) { \
386 return Impl<Const>(*this) \
387 .RecursiveASTVisitor<Impl<Const>>::Traverse##CLASS##Type( \
388 const_cast<CLASS##Type *>(T), TraverseQualifier); \
390 FORWARD_TO_BASE(WalkUpFrom##CLASS##Type, CLASS##Type, *)
391#include "clang/AST/TypeNodes.inc"
393#define ABSTRACT_TYPELOC(CLASS, BASE)
394#define TYPELOC(CLASS, BASE) \
395 template <bool Const> \
396 bool DynamicRecursiveASTVisitorBase<Const>::Traverse##CLASS##TypeLoc( \
397 CLASS##TypeLoc TL, bool TraverseQualifier) { \
398 return Impl<Const>(*this) \
399 .RecursiveASTVisitor<Impl<Const>>::Traverse##CLASS##TypeLoc( \
400 TL, TraverseQualifier); \
402#include "clang/AST/TypeLocNodes.def"
404#define TYPELOC(CLASS, BASE) \
405 FORWARD_TO_BASE_EXACT(WalkUpFrom##CLASS##TypeLoc, CLASS##TypeLoc)
406#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 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.
The JSON file list parser is used to communicate input to InstallAPI.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ 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...