13#ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14#define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
49#include "llvm/ADT/PointerIntPair.h"
50#include "llvm/ADT/SmallVector.h"
51#include "llvm/Support/Casting.h"
62#define TRY_TO(CALL_EXPR) \
64 if (!getDerived().CALL_EXPR) \
70template <
typename T,
typename U>
72template <
typename T,
typename U,
typename R,
typename...
P>
78template <
typename FirstMethodPtrTy,
typename SecondMethodPtrTy>
79LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG
auto
81 [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
84 SecondMethodPtrTy>::value)
85 return FirstMethodPtr == SecondMethodPtr;
167 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
332#define ATTR_VISITOR_DECLS_ONLY
333#include "clang/AST/AttrVisitor.inc"
334#undef ATTR_VISITOR_DECLS_ONLY
346#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
347 (::clang::detail::has_same_member_pointer_type< \
348 decltype(&RecursiveASTVisitor::Traverse##NAME), \
349 decltype(&Derived::Traverse##NAME)>::value \
350 ? static_cast<std::conditional_t< \
351 ::clang::detail::has_same_member_pointer_type< \
352 decltype(&RecursiveASTVisitor::Traverse##NAME), \
353 decltype(&Derived::Traverse##NAME)>::value, \
354 Derived &, RecursiveASTVisitor &>>(*this) \
355 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
356 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
361#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
363 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
369#define ABSTRACT_STMT(STMT)
370#define STMT(CLASS, PARENT) \
371 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
372#include "clang/AST/StmtNodes.inc"
378#define STMT(CLASS, PARENT) \
379 bool WalkUpFrom##CLASS(CLASS *S) { \
380 TRY_TO(WalkUpFrom##PARENT(S)); \
381 TRY_TO(Visit##CLASS(S)); \
384 bool Visit##CLASS(CLASS *S) { return true; }
385#include "clang/AST/StmtNodes.inc"
391#define ABSTRACT_TYPE(CLASS, BASE)
392#define TYPE(CLASS, BASE) \
393 bool Traverse##CLASS##Type(CLASS##Type *T, bool TraverseQualifier);
394#include "clang/AST/TypeNodes.inc"
400#define TYPE(CLASS, BASE) \
401 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
402 TRY_TO(WalkUpFrom##BASE(T)); \
403 TRY_TO(Visit##CLASS##Type(T)); \
406 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
407#include "clang/AST/TypeNodes.inc"
413#define ABSTRACT_TYPELOC(CLASS, BASE)
414#define TYPELOC(CLASS, BASE) \
415 bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL, bool TraverseQualifier);
416#include "clang/AST/TypeLocNodes.def"
435#define TYPE(CLASS, BASE) \
436 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
437 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
438 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
441 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
442#include "clang/AST/TypeNodes.inc"
447#define ABSTRACT_DECL(DECL)
448#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
449#include "clang/AST/DeclNodes.inc"
455#define DECL(CLASS, BASE) \
456 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
457 TRY_TO(WalkUpFrom##BASE(D)); \
458 TRY_TO(Visit##CLASS##Decl(D)); \
461 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
462#include "clang/AST/DeclNodes.inc"
466#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
467 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
471#undef DEF_TRAVERSE_TMPL_INST
487 template <
typename T>
488 bool TraverseDeclTemplateParameterLists(
T *
D);
506 bool TraverseTagType(
TagType *
T,
bool TraverseQualifier);
507 bool TraverseTagTypeLoc(
TagTypeLoc TL,
bool TraverseQualifier);
508#define GEN_CLANG_CLAUSE_CLASS
509#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
510#include "llvm/Frontend/OpenMP/OMP.inc"
512 template <
typename T>
bool VisitOMPClauseList(
T *
Node);
514 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *
Node);
515 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
517 bool PostVisitStmt(Stmt *S);
518 bool TraverseOpenACCConstructStmt(OpenACCConstructStmt *S);
520 TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S);
521 bool VisitOpenACCClauseList(ArrayRef<const OpenACCClause *>);
522 bool VisitOpenACCClause(
const OpenACCClause *);
525template <
typename Derived>
528 if (!getDerived().shouldVisitImplicitCode()) {
529 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
532 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
533 TRY_TO(TraverseStmt(IDC));
539 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
544template <
typename Derived>
549 return getDerived().TraverseConceptTypeRequirement(
550 cast<concepts::TypeRequirement>(R));
553 return getDerived().TraverseConceptExprRequirement(
554 cast<concepts::ExprRequirement>(R));
556 return getDerived().TraverseConceptNestedRequirement(
557 cast<concepts::NestedRequirement>(R));
559 llvm_unreachable(
"unexpected case");
562template <
typename Derived>
566 switch (S->getStmtClass()) {
569#define ABSTRACT_STMT(STMT)
570#define STMT(CLASS, PARENT) \
571 case Stmt::CLASS##Class: \
572 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
573#include "clang/AST/StmtNodes.inc"
581template <
typename Derived>
589template <
typename Derived>
595 if (RetReq.isTypeConstraint()) {
596 if (getDerived().shouldVisitImplicitCode()) {
597 TRY_TO(TraverseTemplateParameterListHelper(
598 RetReq.getTypeConstraintTemplateParameterList()));
601 TRY_TO(TraverseTypeConstraint(RetReq.getTypeConstraint()));
607template <
typename Derived>
615template <
typename Derived>
633 switch (S->getStmtClass()) {
636#define ABSTRACT_STMT(STMT)
637#define STMT(CLASS, PARENT) \
638 case Stmt::CLASS##Class: \
639 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
640 &Derived::Traverse##CLASS)) { \
641 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
644#define INITLISTEXPR(CLASS, PARENT) \
645 case Stmt::CLASS##Class: \
646 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
647 &Derived::Traverse##CLASS)) { \
648 auto ILE = static_cast<CLASS *>(S); \
649 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
650 TRY_TO(WalkUpFrom##CLASS(Syn)); \
651 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
652 TRY_TO(WalkUpFrom##CLASS(Sem)); \
655#include "clang/AST/StmtNodes.inc"
665template <
typename Derived>
666LLVM_ATTRIBUTE_NOINLINE
bool
672 Queue->push_back({S,
false});
677 LocalQueue.push_back({S,
false});
679 while (!LocalQueue.empty()) {
680 auto &CurrSAndVisited = LocalQueue.back();
681 Stmt *CurrS = CurrSAndVisited.getPointer();
682 bool Visited = CurrSAndVisited.getInt();
684 LocalQueue.pop_back();
685 TRY_TO(dataTraverseStmtPost(CurrS));
686 if (getDerived().shouldTraversePostOrder()) {
687 TRY_TO(PostVisitStmt(CurrS));
692 if (getDerived().dataTraverseStmtPre(CurrS)) {
693 CurrSAndVisited.setInt(
true);
694 size_t N = LocalQueue.size();
695 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
697 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
699 LocalQueue.pop_back();
706template <
typename Derived>
708 bool TraverseQualifier) {
713#define ABSTRACT_TYPE(CLASS, BASE)
714#define TYPE(CLASS, BASE) \
716 return getDerived().Traverse##CLASS##Type( \
717 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())), \
719#include "clang/AST/TypeNodes.inc"
725template <
typename Derived>
727 bool TraverseQualifier) {
732#define ABSTRACT_TYPELOC(CLASS, BASE)
733#define TYPELOC(CLASS, BASE) \
734 case TypeLoc::CLASS: \
735 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>(), \
737#include "clang/AST/TypeLocNodes.def"
744#define VISITORCLASS RecursiveASTVisitor
745#include "clang/AST/AttrVisitor.inc"
748template <
typename Derived>
755 if (!getDerived().shouldVisitImplicitCode()) {
760 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(
D))
761 return TraverseTemplateTypeParamDeclConstraints(TTPD);
772 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
D))
773 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
774 FTD->getDeclName().getCXXDeductionGuideTemplate()))
779#define ABSTRACT_DECL(DECL)
780#define DECL(CLASS, BASE) \
782 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
785#include "clang/AST/DeclNodes.inc"
790template <
typename Derived>
808 llvm_unreachable(
"unhandled kind");
811template <
typename Derived>
826 TRY_TO(TraverseTypeLoc(TL,
false));
834template <
typename Derived>
842 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
846 TRY_TO(TraverseTemplateName(
863template <
typename Derived>
866 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
868 Template.getAsQualifiedTemplateName()) {
869 if (QTN->getQualifier()) {
870 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
877template <
typename Derived>
889 return getDerived().TraverseType(Arg.
getAsType());
893 return getDerived().TraverseTemplateName(
897 return getDerived().TraverseStmt(Arg.
getAsExpr());
900 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
908template <
typename Derived>
924 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
926 return getDerived().TraverseType(Arg.
getAsType());
932 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
934 return getDerived().TraverseTemplateName(
941 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
947template <
typename Derived>
951 TRY_TO(TraverseTemplateArgument(Arg));
956template <
typename Derived>
960 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
962 if (
Init->isWritten() || getDerived().shouldVisitImplicitCode())
968template <
typename Derived>
973 if (LE->isInitCapture(
C))
974 TRY_TO(TraverseDecl(
C->getCapturedVar()));
983#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
984 template <typename Derived> \
985 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T, \
986 bool TraverseQualifier) { \
987 if (!getDerived().shouldTraversePostOrder()) \
988 TRY_TO(WalkUpFrom##TYPE(T)); \
992 if (getDerived().shouldTraversePostOrder()) \
993 TRY_TO(WalkUpFrom##TYPE(T)); \
1013 NestedNameSpecifier Qualifier =
1016 :
T->getQualifier();
1017 TRY_TO(TraverseNestedNameSpecifier(Qualifier));
1026 TRY_TO(TraverseType(
T->getElementType()));
1027 if (
T->getSizeExpr())
1028 TRY_TO(TraverseStmt(
const_cast<Expr*
>(
T->getSizeExpr())));
1032 TRY_TO(TraverseType(
T->getElementType()));
1033 if (
T->getSizeExpr())
1034 TRY_TO(TraverseStmt(
const_cast<Expr *
>(
T->getSizeExpr())));
1038 {
TRY_TO(TraverseType(
T->getElementType())); })
1041 TRY_TO(TraverseType(
T->getElementType()));
1046 TRY_TO(TraverseType(
T->getElementType()));
1047 if (
T->getSizeExpr())
1048 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1052 TRY_TO(TraverseStmt(
T->getAddrSpaceExpr()));
1057 if (
T->getSizeExpr())
1058 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1059 TRY_TO(TraverseType(
T->getElementType()));
1063 if (
T->getSizeExpr())
1064 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1073 {
TRY_TO(TraverseType(
T->getElementType())); })
1076 if (
T->getRowExpr())
1077 TRY_TO(TraverseStmt(
T->getRowExpr()));
1078 if (
T->getColumnExpr())
1079 TRY_TO(TraverseStmt(
T->getColumnExpr()));
1080 TRY_TO(TraverseType(
T->getElementType()));
1098 TRY_TO(TraverseStmt(NE));
1102 if (TraverseQualifier)
1103 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1106 if (TraverseQualifier)
1107 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1110 if (TraverseQualifier)
1111 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1115 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1120 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1123 TRY_TO(TraverseType(
T->getPattern()));
1124 TRY_TO(TraverseStmt(
T->getIndexExpr()));
1128 TRY_TO(TraverseType(
T->getBaseType()));
1133 TRY_TO(TraverseType(
T->getDeducedType()));
1134 if (
T->isConstrained()) {
1135 TRY_TO(TraverseTemplateArguments(
T->getTypeConstraintArguments()));
1141 TRY_TO(TraverseType(
T->getReplacementType()));
1144 {
TRY_TO(TraverseSubstPackTypeHelper(
T)); })
1146 {
TRY_TO(TraverseSubstPackTypeHelper(
T)); })
1149 {
TRY_TO(TraverseType(
T->getModifiedType())); })
1152 if (
T->getCountExpr())
1153 TRY_TO(TraverseStmt(
T->getCountExpr()));
1158 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1161 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1164 for (
auto &Operand :
T->getOperands()) {
1165 if (Operand.isConstant() || Operand.isType()) {
1166 TRY_TO(TraverseType(Operand.getResultType()));
1174 {
TRY_TO(TraverseType(
T->getUnderlyingType())); })
1176template <typename Derived>
1177bool RecursiveASTVisitor<Derived>::TraverseTagType(TagType *
T,
1178 bool TraverseQualifier) {
1179 if (TraverseQualifier)
1180 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1186 {
TRY_TO(TraverseTagType(
T, TraverseQualifier)); })
1188 {
TRY_TO(TraverseTagType(
T, TraverseQualifier)); })
1191 if (TraverseQualifier)
1192 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1197 if (TraverseQualifier)
1198 TRY_TO(TraverseNestedNameSpecifier(S.getQualifier()));
1199 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1203 if (TraverseQualifier) {
1204 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1208 T->getTemplateName().getAsTemplateDecl(
true))));
1210 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1214 if (TraverseQualifier) {
1215 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1219 T->getTemplateName().getAsTemplateDecl(
true))));
1221 TRY_TO(TraverseType(
T->getDeducedType()));
1233 if (
T->getBaseType().getTypePtr() !=
T)
1234 TRY_TO(TraverseType(
T->getBaseType()));
1235 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1236 TRY_TO(TraverseType(typeArg));
1249 {
TRY_TO(TraverseStmt(
T->getNumBitsExpr())); })
1263 template <
typename Derived> \
1264 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##
Loc( \
1265 TYPE##
Loc TL,
bool TraverseQualifier) { \
1266 if (!getDerived().shouldTraversePostOrder()) { \
1267 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1268 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1269 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1274 if (getDerived().shouldTraversePostOrder()) { \
1275 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1276 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1277 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1282template <
typename Derived>
1283bool RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(
1284 QualifiedTypeLoc TL,
bool TraverseQualifier) {
1285 assert(TraverseQualifier &&
1286 "Qualifiers should never occur within NestedNameSpecifiers");
1302 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1309 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1313 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1316 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1319 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1322 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1327 if (NestedNameSpecifierLoc QL = TL.getQualifierLoc())
1328 TRY_TO(TraverseNestedNameSpecifierLoc(QL));
1330 TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
1335 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1338 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1340template <typename Derived>
1341bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1343 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1348 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1349 TRY_TO(TraverseArrayTypeLocHelper(TL));
1353 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1358 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1359 TRY_TO(TraverseArrayTypeLocHelper(TL));
1363 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1364 TRY_TO(TraverseArrayTypeLocHelper(TL));
1368 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1369 TRY_TO(TraverseArrayTypeLocHelper(TL));
1373 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1374 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1380 if (TL.getTypePtr()->getSizeExpr())
1381 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1382 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1387 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1391 if (TL.getTypePtr()->getSizeExpr())
1392 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1393 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1399 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1403 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1404 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1405 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1409 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1410 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1411 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1415 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1419 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1423 for (
unsigned I = 0,
E = TL.getNumParams(); I !=
E; ++I) {
1424 if (TL.getParam(I)) {
1425 TRY_TO(TraverseDecl(TL.getParam(I)));
1426 }
else if (I < T->getNumParams()) {
1436 TRY_TO(TraverseStmt(NE));
1441 TraverseQualifier && QualifierLoc)
1442 TRY_TO(TraverseNestedNameSpecifierLoc(QualifierLoc));
1445 if (NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
1446 TraverseQualifier && QualifierLoc)
1447 TRY_TO(TraverseNestedNameSpecifierLoc(QualifierLoc));
1451 TraverseQualifier && QualifierLoc)
1452 TRY_TO(TraverseNestedNameSpecifierLoc(QualifierLoc));
1456 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1459 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1464 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1468 TRY_TO(TraverseType(TL.getPattern()));
1469 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1473 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1477 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1478 if (TL.isConstrained()) {
1479 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1485 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1488template <typename Derived>
1489bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeLocHelper(
1490 SubstPackTypeLoc TL) {
1491 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1495template <
typename Derived>
1496bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeHelper(
1498 TRY_TO(TraverseTemplateArgument(
T->getArgumentPack()));
1503 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1506 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1511 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1514 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1517 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1520 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1523 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1526 {
TRY_TO(TraverseType(TL.getType())); })
1528template <typename Derived>
1529bool RecursiveASTVisitor<Derived>::TraverseTagTypeLoc(TagTypeLoc TL,
1530 bool TraverseQualifier) {
1531 if (NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
1532 TraverseQualifier && QualifierLoc)
1533 TRY_TO(TraverseNestedNameSpecifierLoc(QualifierLoc));
1538 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1540 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1542 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1545 if (TraverseQualifier)
1546 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1550 if (TraverseQualifier)
1551 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1553 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1554 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1559 if (TraverseQualifier)
1560 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1564 TemplateName(TL.getTypePtr()->getTemplateName().getAsTemplateDecl(
1567 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1568 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1573 if (TraverseQualifier)
1574 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1576 const auto *
T = TL.getTypePtr();
1579 TraverseTemplateName(
TemplateName(
T->getTemplateName().getAsTemplateDecl(
1582 TRY_TO(TraverseType(
T->getDeducedType()));
1586 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1589 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1591 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1600 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1601 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1602 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1603 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1604 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1606 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1611 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1619 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1633template <typename Derived>
1635 const Decl *Child) {
1638 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1641 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1642 return Cls->isLambda();
1646template <
typename Derived>
1651 for (
auto *Child : DC->
decls()) {
1652 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1653 TRY_TO(TraverseDecl(Child));
1660#define DEF_TRAVERSE_DECL(DECL, CODE) \
1661 template <typename Derived> \
1662 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1663 bool ShouldVisitChildren = true; \
1664 bool ReturnValue = true; \
1665 if (!getDerived().shouldTraversePostOrder()) \
1666 TRY_TO(WalkUpFrom##DECL(D)); \
1668 if (ReturnValue && ShouldVisitChildren) \
1669 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1670 if (ReturnValue) { \
1672 for (auto *I : D->attrs()) \
1673 TRY_TO(getDerived().TraverseAttr(I)); \
1675 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1676 TRY_TO(WalkUpFrom##DECL(D)); \
1677 return ReturnValue; \
1684 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1686 for (
const auto &I :
D->captures()) {
1687 if (I.hasCopyExpr()) {
1688 TRY_TO(TraverseStmt(I.getCopyExpr()));
1695 TRY_TO(TraverseStmt(
D->getBody()));
1700 TRY_TO(TraverseStmt(
D->getBody()));
1711 TRY_TO(TraverseStmt(
D->getTemporaryExpr()));
1715 {
TRY_TO(TraverseStmt(
D->getAsmStringExpr())); })
1723 if (
D->getFriendType()) {
1724 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1727 if (
auto *TT =
D->getFriendType()->getType()->getAs<
TagType>();
1729 TRY_TO(TraverseDecl(TT->getOriginalDecl()));
1731 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1736 if (
D->getFriendType())
1737 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1740 for (
unsigned I = 0,
E =
D->getNumTemplateParameters(); I <
E; ++I) {
1743 ITPL != ETPL; ++ITPL) {
1744 TRY_TO(TraverseDecl(*ITPL));
1757 TRY_TO(TraverseStmt(
D->getAssertExpr()));
1768 auto Scope =
D->getASTContext().getTraversalScope();
1769 bool HasLimitedScope =
1770 Scope.size() != 1 || !isa<TranslationUnitDecl>(
Scope.front());
1771 if (HasLimitedScope) {
1773 for (
auto *Child :
Scope) {
1774 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1775 TRY_TO(TraverseDecl(Child));
1787 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1808 if (ObjCTypeParamList *typeParamList =
D->getTypeParamList()) {
1809 for (
auto typeParam : *typeParamList) {
1810 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1813 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1814 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1815 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1826 if (ObjCTypeParamList *typeParamList =
D->getTypeParamListAsWritten()) {
1827 for (
auto typeParam : *typeParamList) {
1828 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1832 if (TypeSourceInfo *superTInfo =
D->getSuperClassTInfo()) {
1833 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1835 if (
D->isThisDeclarationADefinition()) {
1836 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1837 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1838 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1844 if (
D->isThisDeclarationADefinition()) {
1845 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1846 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1847 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1853 if (
D->getReturnTypeSourceInfo()) {
1854 TRY_TO(TraverseTypeLoc(
D->getReturnTypeSourceInfo()->getTypeLoc()));
1856 for (ParmVarDecl *Parameter :
D->parameters()) {
1857 TRY_TO(TraverseDecl(Parameter));
1859 if (
D->isThisDeclarationADefinition()) {
1860 TRY_TO(TraverseStmt(
D->getBody()));
1866 if (
D->hasExplicitBound()) {
1867 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1875 if (
D->getTypeSourceInfo())
1876 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1878 TRY_TO(TraverseType(
D->getType()));
1883 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1884 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
1888 {
TRY_TO(TraverseTypeLoc(
D->getEnumTypeLoc())); })
1893 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1901 for (
auto *I :
D->varlist()) {
1907 for (
auto *C :
D->clauselists()) {
1908 TRY_TO(TraverseOMPClause(C));
1913 TRY_TO(TraverseStmt(
D->getCombiner()));
1914 if (
auto *Initializer =
D->getInitializer())
1915 TRY_TO(TraverseStmt(Initializer));
1916 TRY_TO(TraverseType(
D->getType()));
1921 for (
auto *C :
D->clauselists())
1922 TRY_TO(TraverseOMPClause(C));
1923 TRY_TO(TraverseType(
D->getType()));
1930 for (
auto *I :
D->varlist())
1932 for (
auto *C :
D->clauselists())
1933 TRY_TO(TraverseOMPClause(C));
1937 {
TRY_TO(VisitOpenACCClauseList(
D->clauses())); })
1940 TRY_TO(TraverseStmt(
D->getFunctionReference()));
1941 TRY_TO(VisitOpenACCClauseList(
D->clauses()));
1945template <typename Derived>
1946bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1947 TemplateParameterList *TPL) {
1949 for (NamedDecl *
D : *TPL) {
1952 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1953 TRY_TO(TraverseStmt(RequiresClause));
1959template <
typename Derived>
1960template <
typename T>
1961bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *
D) {
1962 for (
unsigned i = 0; i <
D->getNumTemplateParameterLists(); i++) {
1963 TemplateParameterList *TPL =
D->getTemplateParameterList(i);
1964 TraverseTemplateParameterListHelper(TPL);
1969template <
typename Derived>
1970bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1971 ClassTemplateDecl *
D) {
1972 for (
auto *SD :
D->specializations()) {
1973 for (
auto *RD : SD->redecls()) {
1974 assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName());
1976 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1980 TRY_TO(TraverseDecl(RD));
1997template <
typename Derived>
1998bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1999 VarTemplateDecl *
D) {
2000 for (
auto *SD :
D->specializations()) {
2001 for (
auto *RD : SD->redecls()) {
2003 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
2006 TRY_TO(TraverseDecl(RD));
2022template <
typename Derived>
2023bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
2024 FunctionTemplateDecl *
D) {
2025 for (
auto *FD :
D->specializations()) {
2026 for (
auto *RD : FD->redecls()) {
2027 switch (RD->getTemplateSpecializationKind()) {
2031 TRY_TO(TraverseDecl(RD));
2038 TRY_TO(TraverseDecl(RD));
2052#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
2053 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
2054 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2055 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
2063 if (getDerived().shouldVisitTemplateInstantiations() && \
2064 D == D->getCanonicalDecl()) \
2065 TRY_TO(TraverseTemplateInstantiations(D)); \
2079 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
2080 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2081 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2082 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2086 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2089template <typename Derived>
2090bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
2091 const TemplateTypeParmDecl *
D) {
2092 if (
const auto *TC =
D->getTypeConstraint())
2093 TRY_TO(TraverseTypeConstraint(TC));
2099 if (
D->getTypeForDecl())
2100 TRY_TO(TraverseType(QualType(
D->getTypeForDecl(), 0)));
2101 TRY_TO(TraverseTemplateTypeParamDeclConstraints(
D));
2102 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2103 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2107 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2114 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2121 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
2122 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2126 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2127 TRY_TO(TraverseStmt(
D->getConstraintExpr()));
2133 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2142 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2144 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2145 if (
auto *TSI =
D->getIntegerTypeSourceInfo())
2146 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2152template <typename Derived>
2153bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *
D) {
2157 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2158 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2162template <
typename Derived>
2163bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
2164 const CXXBaseSpecifier &
Base) {
2165 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2169template <
typename Derived>
2170bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *
D) {
2171 if (!TraverseRecordHelper(
D))
2173 if (
D->isCompleteDefinition()) {
2174 for (
const auto &I :
D->bases()) {
2175 TRY_TO(TraverseCXXBaseSpecifier(I));
2187template <typename Derived>
2188bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2189 const TemplateArgumentLoc *TAL,
unsigned Count) {
2190 for (
unsigned I = 0; I < Count; ++I) {
2191 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2196#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2197 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2206 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2208 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2209 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2212 if (getDerived().shouldVisitTemplateInstantiations() || \
2213 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2215 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2217 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2230#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2231 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2233 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2235 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2236 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2237 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2242 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2255 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2256 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2261template <typename Derived>
2262bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *
D) {
2263 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2264 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2265 if (
D->getTypeSourceInfo())
2266 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2268 TRY_TO(TraverseType(
D->getType()));
2274 for (
auto *Binding :
D->bindings()) {
2275 TRY_TO(TraverseDecl(Binding));
2280 if (getDerived().shouldVisitImplicitCode()) {
2281 TRY_TO(TraverseStmt(
D->getBinding()));
2282 if (
const auto HoldingVar =
D->getHoldingVar())
2283 TRY_TO(TraverseDecl(HoldingVar));
2295 TRY_TO(TraverseDeclaratorHelper(
D));
2296 if (
D->isBitField())
2297 TRY_TO(TraverseStmt(
D->getBitWidth()));
2298 if (
D->hasInClassInitializer())
2299 TRY_TO(TraverseStmt(
D->getInClassInitializer()));
2303 TRY_TO(TraverseDeclaratorHelper(
D));
2304 if (
D->isBitField())
2305 TRY_TO(TraverseStmt(
D->getBitWidth()));
2310 TRY_TO(TraverseDeclaratorHelper(
D));
2311 if (
D->isBitField())
2312 TRY_TO(TraverseStmt(
D->getBitWidth()));
2316template <typename Derived>
2317bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *
D) {
2318 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2319 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2320 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2327 if (
const FunctionTemplateSpecializationInfo *FTSI =
2328 D->getTemplateSpecializationInfo()) {
2329 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2330 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2333 if (
const ASTTemplateArgumentListInfo *TALI =
2334 FTSI->TemplateArgumentsAsWritten) {
2335 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2336 TALI->NumTemplateArgs));
2339 }
else if (
const DependentFunctionTemplateSpecializationInfo *DFSI =
2340 D->getDependentSpecializationInfo()) {
2341 if (
const ASTTemplateArgumentListInfo *TALI =
2342 DFSI->TemplateArgumentsAsWritten) {
2343 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2344 TALI->NumTemplateArgs));
2352 if (TypeSourceInfo *TSI =
D->getTypeSourceInfo()) {
2353 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2354 }
else if (getDerived().shouldVisitImplicitCode()) {
2359 for (ParmVarDecl *Parameter :
D->parameters()) {
2360 TRY_TO(TraverseDecl(Parameter));
2365 if (
const AssociatedConstraint &TrailingRequiresClause =
2366 D->getTrailingRequiresClause()) {
2368 const_cast<Expr *
>(TrailingRequiresClause.ConstraintExpr)));
2371 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(
D)) {
2373 for (
auto *I : Ctor->inits()) {
2374 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2375 TRY_TO(TraverseConstructorInitializer(I));
2380 D->isThisDeclarationADefinition() &&
2383 (!
D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2385 if (
const auto *MD = dyn_cast<CXXMethodDecl>(
D)) {
2386 if (
const CXXRecordDecl *RD = MD->getParent()) {
2387 if (RD->isLambda() &&
2389 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2395 TRY_TO(TraverseStmt(
D->getBody()));
2398 for (
auto *Child :
D->decls()) {
2399 if (isa<UsingShadowDecl>(Child))
2400 TRY_TO(TraverseDecl(Child));
2450template <typename Derived>
2451bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *
D) {
2452 TRY_TO(TraverseDeclaratorHelper(
D));
2454 if (!isa<ParmVarDecl>(
D) &&
2455 (!
D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2456 TRY_TO(TraverseStmt(
D->getInit()));
2466 TRY_TO(TraverseDeclaratorHelper(
D));
2467 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2468 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2474 if (
D->hasDefaultArg() &&
D->hasUninstantiatedDefaultArg() &&
2475 !
D->hasUnparsedDefaultArg())
2476 TRY_TO(TraverseStmt(
D->getUninstantiatedDefaultArg()));
2478 if (
D->hasDefaultArg() && !
D->hasUninstantiatedDefaultArg() &&
2479 !
D->hasUnparsedDefaultArg())
2480 TRY_TO(TraverseStmt(
D->getDefaultArg()));
2486 TRY_TO(TraverseTemplateArguments(
D->getTemplateArguments()));
2502 template <
typename Derived> \
2503 bool RecursiveASTVisitor<Derived>::Traverse##
STMT( \
2504 STMT *S, DataRecursionQueue *Queue) { \
2507 if (!getDerived().shouldTraversePostOrder()) \
2508 TRY_TO(WalkUpFrom##
STMT(S)); \
2510 if (ShouldVisitChildren) { \
2511 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2512 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2519 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2520 TRY_TO(WalkUpFrom##
STMT(S)); \
2527 for (
unsigned I = 0,
E = S->getNumInputs(); I <
E; ++I) {
2530 for (
unsigned I = 0,
E = S->getNumOutputs(); I <
E; ++I) {
2533 for (
unsigned I = 0,
E = S->getNumClobbers(); I <
E; ++I) {
2546 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2551 for (
auto *I : S->decls()) {
2587 if (!getDerived().shouldVisitImplicitCode()) {
2599 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2600 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2610 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2611 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2612 if (S->hasExplicitTemplateArgs()) {
2613 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2614 S->getNumTemplateArgs()));
2619 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2620 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2621 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2622 S->getNumTemplateArgs()));
2626 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2627 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2628 if (S->hasExplicitTemplateArgs()) {
2629 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2630 S->getNumTemplateArgs()));
2635 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2636 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2637 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2638 S->getNumTemplateArgs()));
2648 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2652 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2656 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2660 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2664 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2668 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2672 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2676 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2679template <typename Derived>
2680bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2681 InitListExpr *S, DataRecursionQueue *Queue) {
2685 if (!getDerived().shouldTraversePostOrder())
2686 TRY_TO(WalkUpFromInitListExpr(S));
2689 for (Stmt *SubStmt : S->children()) {
2693 if (!Queue && getDerived().shouldTraversePostOrder())
2694 TRY_TO(WalkUpFromInitListExpr(S));
2699template <
typename Derived>
2700bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
2701 ObjCProtocolLoc ProtocolLoc) {
2705template <
typename Derived>
2706bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2707 ConceptReference *CR) {
2708 if (!getDerived().shouldTraversePostOrder())
2709 TRY_TO(VisitConceptReference(CR));
2710 TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
2711 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2712 if (CR->hasExplicitTemplateArgs())
2713 TRY_TO(TraverseTemplateArgumentLocsHelper(
2714 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2715 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2716 if (getDerived().shouldTraversePostOrder())
2717 TRY_TO(VisitConceptReference(CR));
2729template <
typename Derived>
2730bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2731 InitListExpr *S, DataRecursionQueue *Queue) {
2732 if (S->isSemanticForm() && S->isSyntacticForm()) {
2734 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2737 TRY_TO(TraverseSynOrSemInitListExpr(
2738 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2739 if (getDerived().shouldVisitImplicitCode()) {
2742 TRY_TO(TraverseSynOrSemInitListExpr(
2743 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2752 if (S->isExprPredicate())
2753 TRY_TO(TraverseStmt(S->getControllingExpr()));
2755 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2757 for (
const GenericSelectionExpr::Association Assoc : S->associations()) {
2758 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2759 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2760 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2762 ShouldVisitChildren =
false;
2769 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2770 e = S->semantics_end();
2773 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2774 sub = OVE->getSourceExpr();
2783 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2788 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2796 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2802 if (S->isArgumentType())
2803 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2809 if (S->isTypeOperand())
2810 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2814 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2822 if (S->isTypeOperand())
2823 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2827 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2828 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2832 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2840 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2845 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2851 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2852 const LambdaCapture *
C = S->capture_begin() + I;
2853 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2854 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2858 if (getDerived().shouldVisitImplicitCode()) {
2860 TRY_TO(TraverseDecl(S->getLambdaClass()));
2863 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2864 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2866 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2867 if (S->hasExplicitParameters()) {
2869 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2870 TRY_TO(TraverseDecl(Proto.getParam(I)));
2873 auto *
T = Proto.getTypePtr();
2880 if (S->hasExplicitResultType())
2881 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2883 const_cast<Expr *
>(S->getTrailingRequiresClause().ConstraintExpr));
2892 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2911 TRY_TO(TraverseDecl(S->getBlockDecl()));
2917 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2923 if (getDerived().shouldVisitImplicitCode())
2924 TRY_TO(TraverseStmt(S->getExpr()));
2928 if (getDerived().shouldVisitImplicitCode())
2929 TRY_TO(TraverseStmt(S->getExpr()));
2939 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2940 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2941 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2942 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2943 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2958 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2965 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2966 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2973 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2974 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2978 if (S->isClassReceiver()) {
2979 ObjCInterfaceDecl *IDecl = S->getClassReceiver();
2980 QualType
Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2981 ObjCInterfaceLocInfo
Data;
2982 Data.NameLoc = S->getReceiverLocation();
2993 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
3000 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
3009 for (IntegerLiteral *IL : S->underlying_data_elements()) {
3015 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
3016 if (S->hasExplicitTemplateArgs()) {
3017 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3018 S->getNumTemplateArgs()));
3023 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
3024 if (S->hasExplicitTemplateArgs()) {
3025 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3026 S->getNumTemplateArgs()));
3037 if (getDerived().shouldVisitImplicitCode()) {
3038 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3039 TRY_TO(TraverseDecl(S->getOutlinedFunctionDecl()));
3046 if (!getDerived().shouldVisitImplicitCode()) {
3047 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
3048 S->getDecomposedForm();
3049 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
3050 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
3077 if (S->getLifetimeExtendedTemporaryDecl()) {
3078 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
3079 S->getLifetimeExtendedTemporaryDecl()));
3087 if (!getDerived().shouldVisitImplicitCode()) {
3093 if (!getDerived().shouldVisitImplicitCode()) {
3099 if (!getDerived().shouldVisitImplicitCode()) {
3105 if (!getDerived().shouldVisitImplicitCode()) {
3111 if (!getDerived().shouldVisitImplicitCode()) {
3118 TRY_TO(TraverseConceptReference(S->getConceptReference()));
3122 TRY_TO(TraverseDecl(S->getBody()));
3123 for (ParmVarDecl *Parm : S->getLocalParameters())
3124 TRY_TO(TraverseDecl(Parm));
3125 for (concepts::Requirement *Req : S->getRequirements())
3126 TRY_TO(TraverseConceptRequirement(Req));
3145template <typename Derived>
3146bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3147 OMPExecutableDirective *S) {
3148 for (
auto *C : S->clauses()) {
3149 TRY_TO(TraverseOMPClause(C));
3155 if (!getDerived().shouldVisitImplicitCode()) {
3157 TRY_TO(TraverseStmt(S->getLoopStmt()));
3162template <typename Derived>
3164RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3165 return TraverseOMPExecutableDirective(S);
3169 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3172 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3175 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3178 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3181 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3184 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3187 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3190 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3193 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3196 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3199 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3202 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3205 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3208 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3211 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3214 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3215 TRY_TO(TraverseOMPExecutableDirective(S));
3219 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3222 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3225 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3228 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3231 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3234 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3237 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3240 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3243 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3246 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3249 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3252 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3255 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3258 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3261 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3264 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3267 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3270 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3273 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3276 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3279 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3282 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3285 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3288 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3291 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3294 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3297 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3300 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3303 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3306 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3309 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3312 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3315 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3318 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3321 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3324 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3327 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3330 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3333 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3336 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3339 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3342 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3345 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3348 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3351 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3354 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3357 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3360 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3363 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3366 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3369 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3372 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3375 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3378 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3381 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3384 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3387 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3390 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3393 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3396 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3399template <typename Derived>
3400bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
3403 switch (
C->getClauseKind()) {
3404#define GEN_CLANG_CLAUSE_CLASS
3405#define CLAUSE_CLASS(Enum, Str, Class) \
3406 case llvm::omp::Clause::Enum: \
3407 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3409#define CLAUSE_NO_CLASS(Enum, Str) \
3410 case llvm::omp::Clause::Enum: \
3412#include "llvm/Frontend/OpenMP/OMP.inc"
3417template <
typename Derived>
3418bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3419 OMPClauseWithPreInit *
Node) {
3420 TRY_TO(TraverseStmt(
Node->getPreInitStmt()));
3424template <
typename Derived>
3425bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3426 OMPClauseWithPostUpdate *
Node) {
3428 TRY_TO(TraverseStmt(
Node->getPostUpdateExpr()));
3432template <
typename Derived>
3433bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
3434 OMPAllocatorClause *C) {
3435 TRY_TO(TraverseStmt(
C->getAllocator()));
3439template <
typename Derived>
3440bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
3441 TRY_TO(TraverseStmt(
C->getAllocator()));
3442 TRY_TO(VisitOMPClauseList(C));
3446template <
typename Derived>
3447bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
3448 TRY_TO(VisitOMPClauseWithPreInit(C));
3449 TRY_TO(TraverseStmt(
C->getCondition()));
3453template <
typename Derived>
3454bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
3455 TRY_TO(VisitOMPClauseWithPreInit(C));
3456 TRY_TO(TraverseStmt(
C->getCondition()));
3460template <
typename Derived>
3462RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3463 TRY_TO(VisitOMPClauseWithPreInit(C));
3464 TRY_TO(TraverseStmt(
C->getNumThreads()));
3468template <
typename Derived>
3469bool RecursiveASTVisitor<Derived>::VisitOMPAlignClause(OMPAlignClause *C) {
3470 TRY_TO(TraverseStmt(
C->getAlignment()));
3474template <
typename Derived>
3475bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3476 TRY_TO(TraverseStmt(
C->getSafelen()));
3480template <
typename Derived>
3481bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3482 TRY_TO(TraverseStmt(
C->getSimdlen()));
3486template <
typename Derived>
3487bool RecursiveASTVisitor<Derived>::VisitOMPSizesClause(OMPSizesClause *C) {
3488 for (Expr *
E :
C->getSizesRefs())
3493template <
typename Derived>
3494bool RecursiveASTVisitor<Derived>::VisitOMPPermutationClause(
3495 OMPPermutationClause *C) {
3496 for (Expr *
E :
C->getArgsRefs())
3501template <
typename Derived>
3502bool RecursiveASTVisitor<Derived>::VisitOMPFullClause(OMPFullClause *C) {
3506template <
typename Derived>
3507bool RecursiveASTVisitor<Derived>::VisitOMPPartialClause(OMPPartialClause *C) {
3508 TRY_TO(TraverseStmt(
C->getFactor()));
3512template <
typename Derived>
3514RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3515 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3519template <
typename Derived>
3520bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3524template <
typename Derived>
3525bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3529template <
typename Derived>
3530bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3531 OMPUnifiedAddressClause *) {
3535template <
typename Derived>
3536bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3537 OMPUnifiedSharedMemoryClause *) {
3541template <
typename Derived>
3542bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3543 OMPReverseOffloadClause *) {
3547template <
typename Derived>
3548bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3549 OMPDynamicAllocatorsClause *) {
3553template <
typename Derived>
3554bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3555 OMPAtomicDefaultMemOrderClause *) {
3559template <
typename Derived>
3560bool RecursiveASTVisitor<Derived>::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {
3564template <
typename Derived>
3565bool RecursiveASTVisitor<Derived>::VisitOMPAtClause(OMPAtClause *) {
3569template <
typename Derived>
3570bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
3574template <
typename Derived>
3575bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
3576 TRY_TO(TraverseStmt(
C->getMessageString()));
3580template <
typename Derived>
3582RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3583 TRY_TO(VisitOMPClauseWithPreInit(C));
3584 TRY_TO(TraverseStmt(
C->getChunkSize()));
3588template <
typename Derived>
3589bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3590 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3594template <
typename Derived>
3595bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3599template <
typename Derived>
3600bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3604template <
typename Derived>
3606RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3610template <
typename Derived>
3611bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3615template <
typename Derived>
3616bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3620template <
typename Derived>
3621bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3625template <
typename Derived>
3626bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3630template <
typename Derived>
3631bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
3635template <
typename Derived>
3636bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3640template <
typename Derived>
3641bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3645template <
typename Derived>
3646bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
3650template <
typename Derived>
3651bool RecursiveASTVisitor<Derived>::VisitOMPAbsentClause(OMPAbsentClause *) {
3655template <
typename Derived>
3656bool RecursiveASTVisitor<Derived>::VisitOMPHoldsClause(OMPHoldsClause *) {
3660template <
typename Derived>
3661bool RecursiveASTVisitor<Derived>::VisitOMPContainsClause(OMPContainsClause *) {
3665template <
typename Derived>
3666bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
3670template <
typename Derived>
3671bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPRoutinesClause(
3672 OMPNoOpenMPRoutinesClause *) {
3676template <
typename Derived>
3677bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPConstructsClause(
3678 OMPNoOpenMPConstructsClause *) {
3682template <
typename Derived>
3683bool RecursiveASTVisitor<Derived>::VisitOMPNoParallelismClause(
3684 OMPNoParallelismClause *) {
3688template <
typename Derived>
3689bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
3693template <
typename Derived>
3694bool RecursiveASTVisitor<Derived>::VisitOMPReleaseClause(OMPReleaseClause *) {
3698template <
typename Derived>
3699bool RecursiveASTVisitor<Derived>::VisitOMPRelaxedClause(OMPRelaxedClause *) {
3703template <
typename Derived>
3704bool RecursiveASTVisitor<Derived>::VisitOMPWeakClause(OMPWeakClause *) {
3708template <
typename Derived>
3709bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3713template <
typename Derived>
3714bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3718template <
typename Derived>
3719bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3723template <
typename Derived>
3724bool RecursiveASTVisitor<Derived>::VisitOMPInitClause(OMPInitClause *C) {
3725 TRY_TO(VisitOMPClauseList(C));
3729template <
typename Derived>
3730bool RecursiveASTVisitor<Derived>::VisitOMPUseClause(OMPUseClause *C) {
3731 TRY_TO(TraverseStmt(
C->getInteropVar()));
3735template <
typename Derived>
3736bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *C) {
3737 TRY_TO(TraverseStmt(
C->getInteropVar()));
3741template <
typename Derived>
3742bool RecursiveASTVisitor<Derived>::VisitOMPNovariantsClause(
3743 OMPNovariantsClause *C) {
3744 TRY_TO(VisitOMPClauseWithPreInit(C));
3745 TRY_TO(TraverseStmt(
C->getCondition()));
3749template <
typename Derived>
3750bool RecursiveASTVisitor<Derived>::VisitOMPNocontextClause(
3751 OMPNocontextClause *C) {
3752 TRY_TO(VisitOMPClauseWithPreInit(C));
3753 TRY_TO(TraverseStmt(
C->getCondition()));
3757template <
typename Derived>
3758template <
typename T>
3759bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *
Node) {
3760 for (
auto *
E :
Node->varlist()) {
3766template <
typename Derived>
3767bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
3768 OMPInclusiveClause *C) {
3769 TRY_TO(VisitOMPClauseList(C));
3773template <
typename Derived>
3774bool RecursiveASTVisitor<Derived>::VisitOMPExclusiveClause(
3775 OMPExclusiveClause *C) {
3776 TRY_TO(VisitOMPClauseList(C));
3780template <
typename Derived>
3781bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3782 TRY_TO(VisitOMPClauseList(C));
3783 for (
auto *
E :
C->private_copies()) {
3789template <
typename Derived>
3790bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3791 OMPFirstprivateClause *C) {
3792 TRY_TO(VisitOMPClauseList(C));
3793 TRY_TO(VisitOMPClauseWithPreInit(C));
3794 for (
auto *
E :
C->private_copies()) {
3797 for (
auto *
E :
C->inits()) {
3803template <
typename Derived>
3804bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3805 OMPLastprivateClause *C) {
3806 TRY_TO(VisitOMPClauseList(C));
3807 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3808 for (
auto *
E :
C->private_copies()) {
3811 for (
auto *
E :
C->source_exprs()) {
3814 for (
auto *
E :
C->destination_exprs()) {
3817 for (
auto *
E :
C->assignment_ops()) {
3823template <
typename Derived>
3824bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3825 TRY_TO(VisitOMPClauseList(C));
3829template <
typename Derived>
3830bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3831 TRY_TO(TraverseStmt(
C->getStep()));
3832 TRY_TO(TraverseStmt(
C->getCalcStep()));
3833 TRY_TO(VisitOMPClauseList(C));
3834 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3835 for (
auto *
E :
C->privates()) {
3838 for (
auto *
E :
C->inits()) {
3841 for (
auto *
E :
C->updates()) {
3844 for (
auto *
E :
C->finals()) {
3850template <
typename Derived>
3851bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3852 TRY_TO(TraverseStmt(
C->getAlignment()));
3853 TRY_TO(VisitOMPClauseList(C));
3857template <
typename Derived>
3858bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3859 TRY_TO(VisitOMPClauseList(C));
3860 for (
auto *
E :
C->source_exprs()) {
3863 for (
auto *
E :
C->destination_exprs()) {
3866 for (
auto *
E :
C->assignment_ops()) {
3872template <
typename Derived>
3873bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3874 OMPCopyprivateClause *C) {
3875 TRY_TO(VisitOMPClauseList(C));
3876 for (
auto *
E :
C->source_exprs()) {
3879 for (
auto *
E :
C->destination_exprs()) {
3882 for (
auto *
E :
C->assignment_ops()) {
3888template <
typename Derived>
3890RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3891 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3892 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3893 TRY_TO(VisitOMPClauseList(C));
3894 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3895 for (
auto *
E :
C->privates()) {
3898 for (
auto *
E :
C->lhs_exprs()) {
3901 for (
auto *
E :
C->rhs_exprs()) {
3904 for (
auto *
E :
C->reduction_ops()) {
3907 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3908 for (
auto *
E :
C->copy_ops()) {
3911 for (
auto *
E :
C->copy_array_temps()) {
3914 for (
auto *
E :
C->copy_array_elems()) {
3921template <
typename Derived>
3922bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3923 OMPTaskReductionClause *C) {
3924 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3925 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3926 TRY_TO(VisitOMPClauseList(C));
3927 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3928 for (
auto *
E :
C->privates()) {
3931 for (
auto *
E :
C->lhs_exprs()) {
3934 for (
auto *
E :
C->rhs_exprs()) {
3937 for (
auto *
E :
C->reduction_ops()) {
3943template <
typename Derived>
3944bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3945 OMPInReductionClause *C) {
3946 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3947 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3948 TRY_TO(VisitOMPClauseList(C));
3949 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3950 for (
auto *
E :
C->privates()) {
3953 for (
auto *
E :
C->lhs_exprs()) {
3956 for (
auto *
E :
C->rhs_exprs()) {
3959 for (
auto *
E :
C->reduction_ops()) {
3962 for (
auto *
E :
C->taskgroup_descriptors())
3967template <
typename Derived>
3968bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3969 TRY_TO(VisitOMPClauseList(C));
3973template <
typename Derived>
3974bool RecursiveASTVisitor<Derived>::VisitOMPDepobjClause(OMPDepobjClause *C) {
3975 TRY_TO(TraverseStmt(
C->getDepobj()));
3979template <
typename Derived>
3980bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3981 TRY_TO(VisitOMPClauseList(C));
3985template <
typename Derived>
3986bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3987 TRY_TO(VisitOMPClauseWithPreInit(C));
3988 TRY_TO(TraverseStmt(
C->getDevice()));
3992template <
typename Derived>
3993bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3994 TRY_TO(VisitOMPClauseList(C));
3998template <
typename Derived>
3999bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
4000 OMPNumTeamsClause *C) {
4001 TRY_TO(VisitOMPClauseList(C));
4002 TRY_TO(VisitOMPClauseWithPreInit(C));
4006template <
typename Derived>
4007bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
4008 OMPThreadLimitClause *C) {
4009 TRY_TO(VisitOMPClauseList(C));
4010 TRY_TO(VisitOMPClauseWithPreInit(C));
4014template <
typename Derived>
4015bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
4016 OMPPriorityClause *C) {
4017 TRY_TO(VisitOMPClauseWithPreInit(C));
4018 TRY_TO(TraverseStmt(
C->getPriority()));
4022template <
typename Derived>
4023bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
4024 OMPGrainsizeClause *C) {
4025 TRY_TO(VisitOMPClauseWithPreInit(C));
4026 TRY_TO(TraverseStmt(
C->getGrainsize()));
4030template <
typename Derived>
4031bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
4032 OMPNumTasksClause *C) {
4033 TRY_TO(VisitOMPClauseWithPreInit(C));
4034 TRY_TO(TraverseStmt(
C->getNumTasks()));
4038template <
typename Derived>
4039bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
4040 TRY_TO(TraverseStmt(
C->getHint()));
4044template <
typename Derived>
4045bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
4046 OMPDistScheduleClause *C) {
4047 TRY_TO(VisitOMPClauseWithPreInit(C));
4048 TRY_TO(TraverseStmt(
C->getChunkSize()));
4052template <
typename Derived>
4054RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
4058template <
typename Derived>
4059bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
4060 TRY_TO(VisitOMPClauseList(C));
4064template <
typename Derived>
4065bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
4066 TRY_TO(VisitOMPClauseList(C));
4070template <
typename Derived>
4071bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
4072 OMPUseDevicePtrClause *C) {
4073 TRY_TO(VisitOMPClauseList(C));
4077template <
typename Derived>
4078bool RecursiveASTVisitor<Derived>::VisitOMPUseDeviceAddrClause(
4079 OMPUseDeviceAddrClause *C) {
4080 TRY_TO(VisitOMPClauseList(C));
4084template <
typename Derived>
4085bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
4086 OMPIsDevicePtrClause *C) {
4087 TRY_TO(VisitOMPClauseList(C));
4091template <
typename Derived>
4092bool RecursiveASTVisitor<Derived>::VisitOMPHasDeviceAddrClause(
4093 OMPHasDeviceAddrClause *C) {
4094 TRY_TO(VisitOMPClauseList(C));
4098template <
typename Derived>
4099bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
4100 OMPNontemporalClause *C) {
4101 TRY_TO(VisitOMPClauseList(C));
4102 for (
auto *
E :
C->private_refs()) {
4108template <
typename Derived>
4109bool RecursiveASTVisitor<Derived>::VisitOMPOrderClause(OMPOrderClause *) {
4113template <
typename Derived>
4114bool RecursiveASTVisitor<Derived>::VisitOMPDetachClause(OMPDetachClause *C) {
4115 TRY_TO(TraverseStmt(
C->getEventHandler()));
4119template <
typename Derived>
4120bool RecursiveASTVisitor<Derived>::VisitOMPUsesAllocatorsClause(
4121 OMPUsesAllocatorsClause *C) {
4122 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
4123 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
4130template <
typename Derived>
4131bool RecursiveASTVisitor<Derived>::VisitOMPAffinityClause(
4132 OMPAffinityClause *C) {
4133 TRY_TO(TraverseStmt(
C->getModifier()));
4134 for (Expr *
E :
C->varlist())
4139template <
typename Derived>
4140bool RecursiveASTVisitor<Derived>::VisitOMPFilterClause(OMPFilterClause *C) {
4141 TRY_TO(VisitOMPClauseWithPreInit(C));
4142 TRY_TO(TraverseStmt(
C->getThreadID()));
4146template <
typename Derived>
4147bool RecursiveASTVisitor<Derived>::VisitOMPBindClause(OMPBindClause *C) {
4151template <
typename Derived>
4152bool RecursiveASTVisitor<Derived>::VisitOMPXDynCGroupMemClause(
4153 OMPXDynCGroupMemClause *C) {
4154 TRY_TO(VisitOMPClauseWithPreInit(C));
4155 TRY_TO(TraverseStmt(
C->getSize()));
4159template <
typename Derived>
4160bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
4161 OMPDoacrossClause *C) {
4162 TRY_TO(VisitOMPClauseList(C));
4166template <
typename Derived>
4167bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
4168 OMPXAttributeClause *C) {
4172template <
typename Derived>
4173bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
4177template <
typename Derived>
4178bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4179 OpenACCConstructStmt *C) {
4180 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4184template <
typename Derived>
4185bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4186 OpenACCAssociatedStmtConstruct *S) {
4187 TRY_TO(TraverseOpenACCConstructStmt(S));
4188 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4192template <
typename Derived>
4193bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *C) {
4194 for (
const Stmt *Child :
C->children())
4195 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4199template <
typename Derived>
4200bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4201 ArrayRef<const OpenACCClause *> Clauses) {
4203 for (
const auto *C : Clauses)
4204 TRY_TO(VisitOpenACCClause(C));
4209 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4211 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4213 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4215 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4217 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4219 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4221 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4223 if (S->hasDevNumExpr())
4224 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4225 for (
auto *
E : S->getQueueIdExprs())
4227 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4230 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4232 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4234 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4236 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4238 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4240 for (
auto *
E : S->getVarList())
This file provides AST data structures related to concepts.
#define TYPE(DERIVED, BASE)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenACC nodes for declarative directives.
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
#define DEF_TRAVERSE_TMPL_INST(kind)
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::DenseSet< const void * > Visited
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
#define STMT(CLASS, PARENT)
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define DEF_TRAVERSE_DECL(DECL, CODE)
#define DEF_TRAVERSE_STMT(STMT, CODE)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
#define TRY_TO(CALL_EXPR)
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Wrapper for source info for arrays.
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Represents a C++ struct/union/class.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Complex values, per C99 6.2.5p11.
A reference to a concept and its template args, as it appears in the code.
Represents the canonical version of C arrays with a specified constant size.
Represents a concrete matrix type with constant number of rows and columns.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Represents a C++17 deduced template specialization type.
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a template specialization type whose template cannot be resolved, e.g.
Represents a dependent template name that cannot be resolved prior to template instantiation.
Represents a vector type where either the type or size is dependent.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
QualType getParamType(unsigned i) const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > exceptions() const
ArrayRef< QualType > param_types() const
QualType getReturnType() const
Represents an arbitrary, user-specified SPIR-V type instruction.
Represents a C array with an unspecified size.
Describes an C or C++ initializer list.
The injected class name of a C++ class template or class template partial specialization.
Represents the declaration of a label.
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...
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
This represents a decl that may have a name.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
NamespaceAndPrefixLoc castAsNamespaceAndPrefix() const
For a nested-name-specifier that refers to a namespace, retrieve the namespace and its prefix.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
const Type * getAsType() const
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents a type parameter type in Objective C.
Sugar for parentheses used when specifying types.
A (possibly-)qualified type.
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type.
bool WalkUpFromDecl(Decl *D)
bool TraverseConceptRequirement(concepts::Requirement *R)
bool dataTraverseStmtPre(Stmt *S)
Invoked before visiting a statement or expression via data recursion.
bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc)
Recursively visit an Objective-C protocol reference with location information.
bool VisitUnqualTypeLoc(UnqualTypeLoc TL)
bool TraverseConceptExprRequirement(concepts::ExprRequirement *R)
bool TraverseNestedNameSpecifier(NestedNameSpecifier NNS)
Recursively visit a C++ nested-name-specifier.
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the TranslationUnitDecl.
bool shouldVisitTemplateInstantiations() const
Return whether this visitor should recurse into template instantiations.
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool WalkUpFromType(Type *T)
bool dataTraverseStmtPost(Stmt *S)
Invoked after visiting a statement or expression via data recursion.
bool WalkUpFromTypeLoc(TypeLoc TL)
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
Stmt::child_range getStmtChildren(Stmt *S)
bool shouldVisitImplicitCode() const
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destru...
bool TraverseConceptReference(ConceptReference *CR)
Recursively visit concept reference with location information.
bool TraverseTemplateArguments(ArrayRef< TemplateArgument > Args)
Recursively visit a set of template arguments.
bool TraverseTypeLoc(TypeLoc TL, bool TraverseQualifier=true)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL)
bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
bool WalkUpFromStmt(Stmt *S)
bool TraverseTypeConstraint(const TypeConstraint *C)
bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL)
bool VisitTypeLoc(TypeLoc TL)
bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)
Recursively visit a lambda capture.
bool VisitConceptReference(ConceptReference *CR)
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
bool shouldVisitLambdaBody() const
Return whether this visitor should recurse into lambda body.
bool TraverseSynOrSemInitListExpr(InitListExpr *S, DataRecursionQueue *Queue=nullptr)
Recursively visit the syntactic or semantic form of an initialization list.
bool TraverseAttr(Attr *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...
bool TraverseType(QualType T, bool TraverseQualifier=true)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R)
bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL)
bool shouldWalkTypesOfTypeLocs() const
Return whether this visitor should recurse into the types of TypeLocs.
bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
Derived & getDerived()
Return a reference to the derived class.
bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R)
bool TraverseConstructorInitializer(CXXCtorInitializer *Init)
Recursively visit a constructor initializer.
Scope - A scope is a transient data structure that is used while parsing the program.
Stmt - This represents one statement.
llvm::iterator_range< child_iterator > child_range
Abstract type representing delayed type pack expansions.
Represents the result of substituting a set of types as a template argument that needs to be expanded...
Represents the result of substituting a set of types for a template type parameter pack.
bool isTagOwned() const
Does the TagType own this declaration of the Tag?
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Declaration of a template type parameter.
The top declaration context.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
NestedNameSpecifierLoc getPrefix() const
If this type represents a qualified-id, this returns it's nested name specifier.
TypeLocClass getTypeLocClass() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CanQualType getCanonicalTypeUnqualified() const
NestedNameSpecifier getPrefix() const
If this type represents a qualified-id, this returns its nested name specifier.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
TypeClass getTypeClass() const
Wrapper of type source information for a type with no direct qualifiers.
Represents a variable declaration or definition.
Represents a GCC generic vector type.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
TypeSourceInfo * getType() const
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...
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.
for(const auto &A :T->param_types())
const FunctionProtoType * T
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
@ Class
The "class" keyword introduces the elaborated-type-specifier.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
NestedNameSpecifierLoc Prefix
NestedNameSpecifier Prefix