clang 18.0.0git
Classes | Namespaces | Macros | Functions | Variables
RecursiveASTVisitor.h File Reference
#include "clang/AST/ASTConcept.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprConcepts.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
#include "clang/AST/LambdaCapture.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include <algorithm>
#include <cstddef>
#include <type_traits>
#include "clang/AST/AttrVisitor.inc"
#include "clang/AST/StmtNodes.inc"
#include "clang/AST/TypeNodes.inc"
#include "clang/AST/TypeLocNodes.def"
#include "clang/AST/DeclNodes.inc"
#include "llvm/Frontend/OpenMP/OMP.inc"

Go to the source code of this file.

Classes

struct  clang::detail::has_same_member_pointer_type< T, U >
 
struct  clang::detail::has_same_member_pointer_type< R(T::*)(P...), R(U::*)(P...)>
 
class  clang::RecursiveASTVisitor< Derived >
 A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each node. More...
 

Namespaces

namespace  clang
 
namespace  clang::detail
 

Macros

#define TRY_TO(CALL_EXPR)
 
#define ATTR_VISITOR_DECLS_ONLY
 
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
 
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
 
#define ABSTRACT_STMT(STMT)
 
#define STMT(CLASS, PARENT)    bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
 
#define STMT(CLASS, PARENT)
 
#define ABSTRACT_TYPE(CLASS, BASE)
 
#define TYPE(CLASS, BASE)   bool Traverse##CLASS##Type(CLASS##Type *T);
 
#define TYPE(CLASS, BASE)
 
#define ABSTRACT_TYPELOC(CLASS, BASE)
 
#define TYPELOC(CLASS, BASE)   bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
 
#define TYPE(CLASS, BASE)
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(CLASS, BASE)   bool Traverse##CLASS##Decl(CLASS##Decl *D);
 
#define DECL(CLASS, BASE)
 
#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND)    bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
 
#define GEN_CLANG_CLAUSE_CLASS
 
#define CLAUSE_CLASS(Enum, Str, Class)   bool Visit##Class(Class *C);
 
#define ABSTRACT_STMT(STMT)
 
#define STMT(CLASS, PARENT)
 
#define ABSTRACT_STMT(STMT)
 
#define STMT(CLASS, PARENT)
 
#define INITLISTEXPR(CLASS, PARENT)
 
#define ABSTRACT_TYPE(CLASS, BASE)
 
#define TYPE(CLASS, BASE)
 
#define ABSTRACT_TYPELOC(CLASS, BASE)
 
#define TYPELOC(CLASS, BASE)
 
#define VISITORCLASS   RecursiveASTVisitor
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(CLASS, BASE)
 
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
 
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
 
#define DEF_TRAVERSE_DECL(DECL, CODE)
 
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
 
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
 
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
 
#define DEF_TRAVERSE_STMT(STMT, CODE)
 
#define GEN_CLANG_CLAUSE_CLASS
 
#define CLAUSE_CLASS(Enum, Str, Class)
 
#define CLAUSE_NO_CLASS(Enum, Str)
 

Functions

template<typename FirstMethodPtrTy , typename SecondMethodPtrTy >
LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto clang::detail::isSameMethod (FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr) -> bool
 Returns true if and only if FirstMethodPtr and SecondMethodPtr are pointers to the same non-static member function.
 
 clang::DEF_TRAVERSE_TYPE (ComplexType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(PointerType
 
 clang::DEF_TRAVERSE_TYPE (BlockPointerType, { TRY_TO(TraverseType(T->getPointeeType()));}) DEF_TRAVERSE_TYPE(LValueReferenceType
 
 clang::DEF_TRAVERSE_TYPE (RValueReferenceType, { TRY_TO(TraverseType(T->getPointeeType()));}) DEF_TRAVERSE_TYPE(MemberPointerType
 
 clang::TRY_TO (TraverseType(T->getPointeeType()))
 
 clang::DEF_TRAVERSE_TYPE (AdjustedType, { TRY_TO(TraverseType(T->getOriginalType()));}) DEF_TRAVERSE_TYPE(DecayedType
 
 clang::DEF_TRAVERSE_TYPE (ConstantArrayType, { TRY_TO(TraverseType(T->getElementType()));if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T->getSizeExpr())));}) DEF_TRAVERSE_TYPE(IncompleteArrayType
 
 clang::DEF_TRAVERSE_TYPE (VariableArrayType, { TRY_TO(TraverseType(T->getElementType()));TRY_TO(TraverseStmt(T->getSizeExpr()));}) DEF_TRAVERSE_TYPE(DependentSizedArrayType
 
 clang::if (T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
 
 clang::DEF_TRAVERSE_TYPE (DependentAddressSpaceType, { TRY_TO(TraverseStmt(T->getAddrSpaceExpr()));TRY_TO(TraverseType(T->getPointeeType()));}) DEF_TRAVERSE_TYPE(DependentVectorType
 
 clang::TRY_TO (TraverseType(T->getElementType()))
 
 clang::DEF_TRAVERSE_TYPE (DependentSizedExtVectorType, { if(T->getSizeExpr()) TRY_TO(TraverseStmt(T->getSizeExpr()));TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(VectorType
 
 clang::DEF_TRAVERSE_TYPE (ExtVectorType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(ConstantMatrixType
 
 clang::DEF_TRAVERSE_TYPE (DependentSizedMatrixType, { if(T->getRowExpr()) TRY_TO(TraverseStmt(T->getRowExpr()));if(T->getColumnExpr()) TRY_TO(TraverseStmt(T->getColumnExpr()));TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(FunctionNoProtoType
 
 clang::DEF_TRAVERSE_TYPE (FunctionProtoType, { TRY_TO(TraverseType(T->getReturnType()));for(const auto &A :T->param_types()) { TRY_TO(TraverseType(A));} for(const auto &E :T->exceptions()) { TRY_TO(TraverseType(E));} if(Expr *NE=T->getNoexceptExpr()) TRY_TO(TraverseStmt(NE));}) DEF_TRAVERSE_TYPE(TypeOfExprType
 
 clang::DEF_TRAVERSE_TYPE (TypeOfType, { TRY_TO(TraverseType(T->getUnmodifiedType()));}) DEF_TRAVERSE_TYPE(DecltypeType
 
 clang::DEF_TRAVERSE_TYPE (UnaryTransformType, { TRY_TO(TraverseType(T->getBaseType()));TRY_TO(TraverseType(T->getUnderlyingType()));}) DEF_TRAVERSE_TYPE(AutoType
 
 clang::DEF_TRAVERSE_TYPE (DeducedTemplateSpecializationType, { TRY_TO(TraverseTemplateName(T->getTemplateName()));TRY_TO(TraverseType(T->getDeducedType()));}) DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType
 
 clang::DEF_TRAVERSE_TYPE (SubstTemplateTypeParmPackType, { TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));}) DEF_TRAVERSE_TYPE(TemplateSpecializationType
 
 clang::TRY_TO (TraverseTemplateArguments(T->template_arguments()))
 
 clang::DEF_TRAVERSE_TYPE (AttributedType, { TRY_TO(TraverseType(T->getModifiedType()));}) DEF_TRAVERSE_TYPE(BTFTagAttributedType
 
 clang::DEF_TRAVERSE_TYPE (ParenType, { TRY_TO(TraverseType(T->getInnerType()));}) DEF_TRAVERSE_TYPE(MacroQualifiedType
 
 clang::DEF_TRAVERSE_TYPE (ElaboratedType, { if(T->getQualifier()) { TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));} TRY_TO(TraverseType(T->getNamedType()));}) DEF_TRAVERSE_TYPE(DependentNameType
 
 clang::DEF_TRAVERSE_TYPE (DependentTemplateSpecializationType, { TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));TRY_TO(TraverseTemplateArguments(T->template_arguments()));}) DEF_TRAVERSE_TYPE(PackExpansionType
 
 clang::DEF_TRAVERSE_TYPE (ObjCObjectType, { if(T->getBaseType().getTypePtr() !=T) TRY_TO(TraverseType(T->getBaseType()));for(auto typeArg :T->getTypeArgsAsWritten()) { TRY_TO(TraverseType(typeArg));} }) DEF_TRAVERSE_TYPE(ObjCObjectPointerType
 
 clang::DEF_TRAVERSE_TYPE (AtomicType, { TRY_TO(TraverseType(T->getValueType()));}) DEF_TRAVERSE_TYPE(PipeType
 
 clang::DEF_TRAVERSE_TYPE (DependentBitIntType, { TRY_TO(TraverseStmt(T->getNumBitsExpr()));}) template< typename Derived > bool RecursiveASTVisitor< Derived >
 
 clang::DEF_TRAVERSE_TYPELOC (ComplexType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(PointerType
 
 clang::DEF_TRAVERSE_TYPELOC (BlockPointerType, { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));}) DEF_TRAVERSE_TYPELOC(LValueReferenceType
 
 clang::DEF_TRAVERSE_TYPELOC (RValueReferenceType, { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));}) DEF_TRAVERSE_TYPELOC(MemberPointerType
 
else clang::TRY_TO (TraverseType(QualType(TL.getTypePtr() ->getClass(), 0)))
 
 clang::TRY_TO (TraverseTypeLoc(TL.getPointeeLoc()))
 
 clang::DEF_TRAVERSE_TYPELOC (AdjustedType, { TRY_TO(TraverseTypeLoc(TL.getOriginalLoc()));}) DEF_TRAVERSE_TYPELOC(DecayedType
 
 clang::DEF_TRAVERSE_TYPELOC (ConstantArrayType, { TRY_TO(TraverseTypeLoc(TL.getElementLoc()));TRY_TO(TraverseArrayTypeLocHelper(TL));}) DEF_TRAVERSE_TYPELOC(IncompleteArrayType
 
 clang::TRY_TO (TraverseArrayTypeLocHelper(TL))
 
 clang::DEF_TRAVERSE_TYPELOC (VariableArrayType, { TRY_TO(TraverseTypeLoc(TL.getElementLoc()));TRY_TO(TraverseArrayTypeLocHelper(TL));}) DEF_TRAVERSE_TYPELOC(DependentSizedArrayType
 
 clang::DEF_TRAVERSE_TYPELOC (DependentAddressSpaceType, { TRY_TO(TraverseStmt(TL.getTypePtr() ->getAddrSpaceExpr()));TRY_TO(TraverseType(TL.getTypePtr() ->getPointeeType()));}) DEF_TRAVERSE_TYPELOC(DependentSizedExtVectorType
 
 clang::TRY_TO (TraverseType(TL.getTypePtr() ->getElementType()))
 
 clang::DEF_TRAVERSE_TYPELOC (VectorType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(DependentVectorType
 
 clang::DEF_TRAVERSE_TYPELOC (ExtVectorType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(ConstantMatrixType
 
 clang::TRY_TO (TraverseStmt(TL.getAttrColumnOperand()))
 
 clang::DEF_TRAVERSE_TYPELOC (DependentSizedMatrixType, { TRY_TO(TraverseStmt(TL.getAttrRowOperand()));TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(FunctionNoProtoType
 
 clang::DEF_TRAVERSE_TYPELOC (FunctionProtoType, { TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));const FunctionProtoType *T=TL.getTypePtr();for(unsigned I=0, E=TL.getNumParams();I !=E;++I) { if(TL.getParam(I)) { TRY_TO(TraverseDecl(TL.getParam(I)));} else if(I< T->getNumParams()) { TRY_TO(TraverseType(T->getParamType(I)));} } for(const auto &E :T->exceptions()) { TRY_TO(TraverseType(E));} if(Expr *NE=T->getNoexceptExpr()) TRY_TO(TraverseStmt(NE));}) DEF_TRAVERSE_TYPELOC(TypeOfExprType
 
 clang::DEF_TRAVERSE_TYPELOC (TypeOfType, { TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo() ->getTypeLoc()));}) DEF_TRAVERSE_TYPELOC(DecltypeType
 
 clang::DEF_TRAVERSE_TYPELOC (UnaryTransformType, { TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo() ->getTypeLoc()));}) DEF_TRAVERSE_TYPELOC(AutoType
 
 clang::if (TL.isConstrained())
 
 clang::DEF_TRAVERSE_TYPELOC (DeducedTemplateSpecializationType, { TRY_TO(TraverseTemplateName(TL.getTypePtr() ->getTemplateName()));TRY_TO(TraverseType(TL.getTypePtr() ->getDeducedType()));}) DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType
 
 clang::DEF_TRAVERSE_TYPELOC (SubstTemplateTypeParmPackType, { TRY_TO(TraverseTemplateArgument(TL.getTypePtr() ->getArgumentPack()));}) DEF_TRAVERSE_TYPELOC(TemplateSpecializationType
 
 clang::for (unsigned I=0, E=TL.getNumArgs();I !=E;++I)
 
 clang::DEF_TRAVERSE_TYPELOC (ParenType, { TRY_TO(TraverseTypeLoc(TL.getInnerLoc()));}) DEF_TRAVERSE_TYPELOC(MacroQualifiedType
 
 clang::DEF_TRAVERSE_TYPELOC (AttributedType, { TRY_TO(TraverseTypeLoc(TL.getModifiedLoc()));}) DEF_TRAVERSE_TYPELOC(BTFTagAttributedType
 
 clang::DEF_TRAVERSE_TYPELOC (ElaboratedType, { if(TL.getQualifierLoc()) { TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));} TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));}) DEF_TRAVERSE_TYPELOC(DependentNameType
 
 clang::DEF_TRAVERSE_TYPELOC (DependentTemplateSpecializationType, { if(TL.getQualifierLoc()) { TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));} for(unsigned I=0, E=TL.getNumArgs();I !=E;++I) { TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));} }) DEF_TRAVERSE_TYPELOC(PackExpansionType
 
 clang::DEF_TRAVERSE_TYPELOC (ObjCTypeParamType, { for(unsigned I=0, N=TL.getNumProtocols();I !=N;++I) { ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));} }) DEF_TRAVERSE_TYPELOC(ObjCObjectType
 
 clang::for (unsigned i=0, n=TL.getNumTypeArgs();i !=n;++i) TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i) -> getTypeLoc()))
 
 clang::for (unsigned I=0, N=TL.getNumProtocols();I !=N;++I)
 
 clang::DEF_TRAVERSE_TYPELOC (ObjCObjectPointerType, { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));}) DEF_TRAVERSE_TYPELOC(AtomicType
 
 clang::DEF_TRAVERSE_TYPELOC (PipeType, { TRY_TO(TraverseTypeLoc(TL.getValueLoc()));}) DEF_TRAVERSE_TYPELOC(DependentBitIntType
 
 clang::DEF_TRAVERSE_DECL (BlockDecl, { if(TypeSourceInfo *TInfo=D->getSignatureAsWritten()) TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));TRY_TO(TraverseStmt(D->getBody()));for(const auto &I :D->captures()) { if(I.hasCopyExpr()) { TRY_TO(TraverseStmt(I.getCopyExpr()));} } ShouldVisitChildren=false;}) DEF_TRAVERSE_DECL(CapturedDecl
 
 clang::DEF_TRAVERSE_DECL (LifetimeExtendedTemporaryDecl, { TRY_TO(TraverseStmt(D->getTemporaryExpr()));}) DEF_TRAVERSE_DECL(FileScopeAsmDecl
 
 clang::DEF_TRAVERSE_DECL (TopLevelStmtDecl, { TRY_TO(TraverseStmt(D->getStmt()));}) DEF_TRAVERSE_DECL(FriendDecl
 

Variables

 clang::ShouldVisitChildren = false
 

Macro Definition Documentation

◆ ABSTRACT_DECL [1/2]

#define ABSTRACT_DECL (   DECL)

Definition at line 441 of file RecursiveASTVisitor.h.

◆ ABSTRACT_DECL [2/2]

#define ABSTRACT_DECL (   DECL)

Definition at line 441 of file RecursiveASTVisitor.h.

◆ ABSTRACT_STMT [1/3]

#define ABSTRACT_STMT (   STMT)

Definition at line 365 of file RecursiveASTVisitor.h.

◆ ABSTRACT_STMT [2/3]

#define ABSTRACT_STMT (   STMT)

Definition at line 365 of file RecursiveASTVisitor.h.

◆ ABSTRACT_STMT [3/3]

#define ABSTRACT_STMT (   STMT)

Definition at line 365 of file RecursiveASTVisitor.h.

◆ ABSTRACT_TYPE [1/2]

#define ABSTRACT_TYPE (   CLASS,
  BASE 
)

Definition at line 387 of file RecursiveASTVisitor.h.

◆ ABSTRACT_TYPE [2/2]

#define ABSTRACT_TYPE (   CLASS,
  BASE 
)

Definition at line 387 of file RecursiveASTVisitor.h.

◆ ABSTRACT_TYPELOC [1/2]

#define ABSTRACT_TYPELOC (   CLASS,
  BASE 
)

Definition at line 408 of file RecursiveASTVisitor.h.

◆ ABSTRACT_TYPELOC [2/2]

#define ABSTRACT_TYPELOC (   CLASS,
  BASE 
)

Definition at line 408 of file RecursiveASTVisitor.h.

◆ ATTR_VISITOR_DECLS_ONLY

#define ATTR_VISITOR_DECLS_ONLY

Definition at line 328 of file RecursiveASTVisitor.h.

◆ CLAUSE_CLASS [1/2]

#define CLAUSE_CLASS (   Enum,
  Str,
  Class 
)    bool Visit##Class(Class *C);

Definition at line 499 of file RecursiveASTVisitor.h.

◆ CLAUSE_CLASS [2/2]

#define CLAUSE_CLASS (   Enum,
  Str,
  Class 
)
Value:
case llvm::omp::Clause::Enum: \
TRY_TO(Visit##Class(static_cast<Class *>(C))); \
break;

Definition at line 499 of file RecursiveASTVisitor.h.

◆ CLAUSE_NO_CLASS

#define CLAUSE_NO_CLASS (   Enum,
  Str 
)
Value:
case llvm::omp::Clause::Enum: \
break;

◆ DECL [1/3]

#define DECL (   CLASS,
  BASE 
)    bool Traverse##CLASS##Decl(CLASS##Decl *D);

Definition at line 449 of file RecursiveASTVisitor.h.

◆ DECL [2/3]

#define DECL (   CLASS,
  BASE 
)
Value:
bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
TRY_TO(WalkUpFrom##BASE(D)); \
TRY_TO(Visit##CLASS##Decl(D)); \
return true; \
} \
bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }

Definition at line 449 of file RecursiveASTVisitor.h.

◆ DECL [3/3]

#define DECL (   CLASS,
  BASE 
)
Value:
case Decl::CLASS: \
if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
return false; \
break;

Definition at line 449 of file RecursiveASTVisitor.h.

◆ DEF_TRAVERSE_DECL

#define DEF_TRAVERSE_DECL (   DECL,
  CODE 
)
Value:
template <typename Derived> \
bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
bool ShouldVisitChildren = true; \
bool ReturnValue = true; \
if (!getDerived().shouldTraversePostOrder()) \
TRY_TO(WalkUpFrom##DECL(D)); \
{ CODE; } \
if (ReturnValue && ShouldVisitChildren) \
TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
if (ReturnValue) { \
/* Visit any attributes attached to this declaration. */ \
for (auto *I : D->attrs()) \
TRY_TO(getDerived().TraverseAttr(I)); \
} \
if (ReturnValue && getDerived().shouldTraversePostOrder()) \
TRY_TO(WalkUpFrom##DECL(D)); \
return ReturnValue; \
}
#define DECL(CLASS, BASE)
bool ReturnValue(const T &V, APValue &R)
Convert a value to an APValue.
Definition: Interp.h:44

Definition at line 1485 of file RecursiveASTVisitor.h.

◆ DEF_TRAVERSE_STMT

#define DEF_TRAVERSE_STMT (   STMT,
  CODE 
)
Value:
template <typename Derived> \
bool RecursiveASTVisitor<Derived>::Traverse##STMT( \
STMT *S, DataRecursionQueue *Queue) { \
bool ShouldVisitChildren = true; \
bool ReturnValue = true; \
if (!getDerived().shouldTraversePostOrder()) \
TRY_TO(WalkUpFrom##STMT(S)); \
{ CODE; } \
if (ShouldVisitChildren) { \
for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
} \
} \
/* Call WalkUpFrom if TRY_TO_TRAVERSE_OR_ENQUEUE_STMT has traversed the \
* children already. If TRY_TO_TRAVERSE_OR_ENQUEUE_STMT only enqueued the \
* children, PostVisitStmt will call WalkUpFrom after we are done visiting \
* children. */ \
if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
TRY_TO(WalkUpFrom##STMT(S)); \
} \
return ReturnValue; \
}
#define STMT(CLASS, PARENT)

◆ DEF_TRAVERSE_TMPL_DECL

#define DEF_TRAVERSE_TMPL_DECL (   TMPLDECLKIND)
Value:
DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
\
/* By default, we do not traverse the instantiations of \
class templates since they do not appear in the user code. The \
following code optionally traverses them. \
\
We only traverse the class instantiations when we see the canonical \
declaration of the template, to ensure we only visit them once. */ \
if (getDerived().shouldVisitTemplateInstantiations() && \
D == D->getCanonicalDecl()) \
TRY_TO(TraverseTemplateInstantiations(D)); \
\
/* Note that getInstantiatedFromMemberTemplate() is just a link \
from a template instantiation back to the template from which \
it was instantiated, and thus should not be traversed. */ \
})
#define DEF_TRAVERSE_DECL(DECL, CODE)

◆ DEF_TRAVERSE_TMPL_INST

#define DEF_TRAVERSE_TMPL_INST (   TMPLDECLKIND)     bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);

Definition at line 460 of file RecursiveASTVisitor.h.

◆ DEF_TRAVERSE_TMPL_PART_SPEC_DECL

#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL (   TMPLDECLKIND,
  DECLKIND 
)
Value:
DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
/* The partial specialization. */ \
if (TemplateParameterList *TPL = D->getTemplateParameters()) { \
for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \
I != E; ++I) { \
TRY_TO(TraverseDecl(*I)); \
} \
} \
/* The args that remains unspecialized. */ \
TRY_TO(TraverseTemplateArgumentLocsHelper( \
D->getTemplateArgsAsWritten()->getTemplateArgs(), \
D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
\
/* Don't need the *TemplatePartialSpecializationHelper, even \
though that's our parent class -- we already visit all the \
template args here. */ \
TRY_TO(Traverse##DECLKIND##Helper(D)); \
\
/* Instantiations will have been visited with the primary template. */ \
})

◆ DEF_TRAVERSE_TMPL_SPEC_DECL

#define DEF_TRAVERSE_TMPL_SPEC_DECL (   TMPLDECLKIND,
  DECLKIND 
)
Value:
DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
/* For implicit instantiations ("set<int> x;"), we don't want to \
recurse at all, since the instatiated template isn't written in \
the source code anywhere. (Note the instatiated *type* -- \
set<int> -- is written, and will still get a callback of \
TemplateSpecializationType). For explicit instantiations \
("template set<int>;"), we do need a callback, since this \
is the only callback that's made for this instantiation. \
We use getTypeAsWritten() to distinguish. */ \
if (TypeSourceInfo *TSI = D->getTypeAsWritten()) \
TRY_TO(TraverseTypeLoc(TSI->getTypeLoc())); \
\
if (getDerived().shouldVisitTemplateInstantiations() || \
D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
/* Traverse base definition for explicit specializations */ \
TRY_TO(Traverse##DECLKIND##Helper(D)); \
} else { \
TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
\
/* Returning from here skips traversing the \
declaration context of the *TemplateSpecializationDecl \
(embedded in the DEF_TRAVERSE_DECL() macro) \
which contains the instantiated members of the template. */ \
return true; \
} \
})

◆ DEF_TRAVERSE_TYPE

#define DEF_TRAVERSE_TYPE (   TYPE,
  CODE 
)
Value:
template <typename Derived> \
bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
if (!getDerived().shouldTraversePostOrder()) \
TRY_TO(WalkUpFrom##TYPE(T)); \
{ CODE; } \
if (getDerived().shouldTraversePostOrder()) \
TRY_TO(WalkUpFrom##TYPE(T)); \
return true; \
}
#define TYPE(CLASS, BASE)

Definition at line 949 of file RecursiveASTVisitor.h.

◆ DEF_TRAVERSE_TYPELOC

#define DEF_TRAVERSE_TYPELOC (   TYPE,
  CODE 
)
Value:
template <typename Derived> \
bool RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) { \
if (!getDerived().shouldTraversePostOrder()) { \
TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
if (getDerived().shouldWalkTypesOfTypeLocs()) \
TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
} \
{ CODE; } \
if (getDerived().shouldTraversePostOrder()) { \
TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
if (getDerived().shouldWalkTypesOfTypeLocs()) \
TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
} \
return true; \
}

◆ GEN_CLANG_CLAUSE_CLASS [1/2]

#define GEN_CLANG_CLAUSE_CLASS

Definition at line 498 of file RecursiveASTVisitor.h.

◆ GEN_CLANG_CLAUSE_CLASS [2/2]

#define GEN_CLANG_CLAUSE_CLASS

Definition at line 498 of file RecursiveASTVisitor.h.

◆ INITLISTEXPR

#define INITLISTEXPR (   CLASS,
  PARENT 
)
Value:
case Stmt::CLASS##Class: \
if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
&Derived::Traverse##CLASS)) { \
auto ILE = static_cast<CLASS *>(S); \
if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
TRY_TO(WalkUpFrom##CLASS(Syn)); \
if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
TRY_TO(WalkUpFrom##CLASS(Sem)); \
} \
break;
LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr) -> bool
Returns true if and only if FirstMethodPtr and SecondMethodPtr are pointers to the same non-static me...

◆ STMT [1/4]

#define STMT (   CLASS,
  PARENT 
)     bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);

Definition at line 374 of file RecursiveASTVisitor.h.

◆ STMT [2/4]

#define STMT (   CLASS,
  PARENT 
)
Value:
bool WalkUpFrom##CLASS(CLASS *S) { \
TRY_TO(WalkUpFrom##PARENT(S)); \
TRY_TO(Visit##CLASS(S)); \
return true; \
} \
bool Visit##CLASS(CLASS *S) { return true; }

Definition at line 374 of file RecursiveASTVisitor.h.

◆ STMT [3/4]

#define STMT (   CLASS,
  PARENT 
)
Value:
case Stmt::CLASS##Class: \
return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)

Definition at line 374 of file RecursiveASTVisitor.h.

◆ STMT [4/4]

#define STMT (   CLASS,
  PARENT 
)
Value:
case Stmt::CLASS##Class: \
if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
&Derived::Traverse##CLASS)) { \
TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
} \
break;

Definition at line 374 of file RecursiveASTVisitor.h.

◆ TRAVERSE_STMT_BASE

#define TRAVERSE_STMT_BASE (   NAME,
  CLASS,
  VAR,
  QUEUE 
)
Value:
decltype(&RecursiveASTVisitor::Traverse##NAME), \
decltype(&Derived::Traverse##NAME)>::value \
? static_cast<std::conditional_t< \
decltype(&RecursiveASTVisitor::Traverse##NAME), \
decltype(&Derived::Traverse##NAME)>::value, \
Derived &, RecursiveASTVisitor &>>(*this) \
.Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
: getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))

Definition at line 342 of file RecursiveASTVisitor.h.

◆ TRY_TO

#define TRY_TO (   CALL_EXPR)
Value:
do { \
if (!getDerived().CALL_EXPR) \
return false; \
} while (false)

Definition at line 58 of file RecursiveASTVisitor.h.

◆ TRY_TO_TRAVERSE_OR_ENQUEUE_STMT

#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT (   S)
Value:
do { \
if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
return false; \
} while (false)

Definition at line 357 of file RecursiveASTVisitor.h.

◆ TYPE [1/4]

#define TYPE (   CLASS,
  BASE 
)    bool Traverse##CLASS##Type(CLASS##Type *T);

Definition at line 429 of file RecursiveASTVisitor.h.

◆ TYPE [2/4]

#define TYPE (   CLASS,
  BASE 
)
Value:
bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
TRY_TO(WalkUpFrom##BASE(T)); \
TRY_TO(Visit##CLASS##Type(T)); \
return true; \
} \
bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
MatchType Type

Definition at line 429 of file RecursiveASTVisitor.h.

◆ TYPE [3/4]

#define TYPE (   CLASS,
  BASE 
)
Value:
bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
TRY_TO(Visit##CLASS##TypeLoc(TL)); \
return true; \
} \
bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }

Definition at line 429 of file RecursiveASTVisitor.h.

◆ TYPE [4/4]

#define TYPE (   CLASS,
  BASE 
)
Value:
case Type::CLASS: \
return getDerived().Traverse##CLASS##Type( \
static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));

Definition at line 429 of file RecursiveASTVisitor.h.

◆ TYPELOC [1/2]

#define TYPELOC (   CLASS,
  BASE 
)    bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);

Definition at line 409 of file RecursiveASTVisitor.h.

◆ TYPELOC [2/2]

#define TYPELOC (   CLASS,
  BASE 
)
Value:
case TypeLoc::CLASS: \
return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());

Definition at line 409 of file RecursiveASTVisitor.h.

◆ VISITORCLASS

#define VISITORCLASS   RecursiveASTVisitor

Definition at line 723 of file RecursiveASTVisitor.h.