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); }
342#define ATTR_VISITOR_DECLS_ONLY
343#include "clang/AST/AttrVisitor.inc"
344#undef ATTR_VISITOR_DECLS_ONLY
356#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
357 (::clang::detail::has_same_member_pointer_type< \
358 decltype(&RecursiveASTVisitor::Traverse##NAME), \
359 decltype(&Derived::Traverse##NAME)>::value \
360 ? static_cast<std::conditional_t< \
361 ::clang::detail::has_same_member_pointer_type< \
362 decltype(&RecursiveASTVisitor::Traverse##NAME), \
363 decltype(&Derived::Traverse##NAME)>::value, \
364 Derived &, RecursiveASTVisitor &>>(*this) \
365 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
366 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
371#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
373 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
379#define ABSTRACT_STMT(STMT)
380#define STMT(CLASS, PARENT) \
381 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
382#include "clang/AST/StmtNodes.inc"
388#define STMT(CLASS, PARENT) \
389 bool WalkUpFrom##CLASS(CLASS *S) { \
390 TRY_TO(WalkUpFrom##PARENT(S)); \
391 TRY_TO(Visit##CLASS(S)); \
394 bool Visit##CLASS(CLASS *S) { return true; }
395#include "clang/AST/StmtNodes.inc"
401#define ABSTRACT_TYPE(CLASS, BASE)
402#define TYPE(CLASS, BASE) \
403 bool Traverse##CLASS##Type(CLASS##Type *T, bool TraverseQualifier);
404#include "clang/AST/TypeNodes.inc"
410#define TYPE(CLASS, BASE) \
411 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
412 TRY_TO(WalkUpFrom##BASE(T)); \
413 TRY_TO(Visit##CLASS##Type(T)); \
416 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
417#include "clang/AST/TypeNodes.inc"
423#define ABSTRACT_TYPELOC(CLASS, BASE)
424#define TYPELOC(CLASS, BASE) \
425 bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL, bool TraverseQualifier);
426#include "clang/AST/TypeLocNodes.def"
445#define TYPE(CLASS, BASE) \
446 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
447 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
448 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
451 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
452#include "clang/AST/TypeNodes.inc"
457#define ABSTRACT_DECL(DECL)
458#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
459#include "clang/AST/DeclNodes.inc"
465#define DECL(CLASS, BASE) \
466 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
467 TRY_TO(WalkUpFrom##BASE(D)); \
468 TRY_TO(Visit##CLASS##Decl(D)); \
471 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
472#include "clang/AST/DeclNodes.inc"
476#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
477 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
481#undef DEF_TRAVERSE_TMPL_INST
497 template <
typename T>
498 bool TraverseDeclTemplateParameterLists(T *D);
505 bool TraverseSubstPackTypeHelper(SubstPackType *T);
512 bool TraverseVarHelper(
VarDecl *D);
516 bool TraverseTagType(TagType *T,
bool TraverseQualifier);
517 bool TraverseTagTypeLoc(
TagTypeLoc TL,
bool TraverseQualifier);
518#define GEN_CLANG_CLAUSE_CLASS
519#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
520#include "llvm/Frontend/OpenMP/OMP.inc"
522 template <
typename T>
bool VisitOMPClauseList(T *Node);
525 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node);
527 bool PostVisitStmt(Stmt *S);
532 bool VisitOpenACCClause(
const OpenACCClause *);
535template <
typename Derived>
542 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
554template <
typename Derived>
557 switch (R->getKind()) {
559 return getDerived().TraverseConceptTypeRequirement(
563 return getDerived().TraverseConceptExprRequirement(
566 return getDerived().TraverseConceptNestedRequirement(
569 llvm_unreachable(
"unexpected case");
572template <
typename Derived>
579#define ABSTRACT_STMT(STMT)
580#define STMT(CLASS, PARENT) \
581 case Stmt::CLASS##Class: \
582 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
583#include "clang/AST/StmtNodes.inc"
591template <
typename Derived>
594 if (R->isSubstitutionFailure())
596 return getDerived().TraverseTypeLoc(R->getType()->getTypeLoc());
599template <
typename Derived>
602 if (!R->isExprSubstitutionFailure())
604 auto &RetReq = R->getReturnTypeRequirement();
605 if (RetReq.isTypeConstraint()) {
607 TRY_TO(TraverseTemplateParameterListHelper(
608 RetReq.getTypeConstraintTemplateParameterList()));
617template <
typename Derived>
620 if (!R->hasInvalidConstraint())
621 return getDerived().TraverseStmt(R->getConstraintExpr());
625template <
typename Derived>
626bool RecursiveASTVisitor<Derived>::PostVisitStmt(
Stmt *S) {
646#define ABSTRACT_STMT(STMT)
647#define STMT(CLASS, PARENT) \
648 case Stmt::CLASS##Class: \
649 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
650 &Derived::Traverse##CLASS)) { \
651 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
654#define INITLISTEXPR(CLASS, PARENT) \
655 case Stmt::CLASS##Class: \
656 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
657 &Derived::Traverse##CLASS)) { \
658 auto ILE = static_cast<CLASS *>(S); \
659 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
660 TRY_TO(WalkUpFrom##CLASS(Syn)); \
661 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
662 TRY_TO(WalkUpFrom##CLASS(Sem)); \
665#include "clang/AST/StmtNodes.inc"
675template <
typename Derived>
676LLVM_ATTRIBUTE_NOINLINE
bool
682 Queue->push_back({S,
false});
687 LocalQueue.push_back({S,
false});
689 while (!LocalQueue.empty()) {
690 auto &CurrSAndVisited = LocalQueue.back();
691 Stmt *CurrS = CurrSAndVisited.getPointer();
692 bool Visited = CurrSAndVisited.getInt();
694 LocalQueue.pop_back();
697 TRY_TO(PostVisitStmt(CurrS));
703 CurrSAndVisited.setInt(
true);
704 size_t N = LocalQueue.size();
707 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
709 LocalQueue.pop_back();
716template <
typename Derived>
718 bool TraverseQualifier) {
722 switch (T->getTypeClass()) {
723#define ABSTRACT_TYPE(CLASS, BASE)
724#define TYPE(CLASS, BASE) \
726 return getDerived().Traverse##CLASS##Type( \
727 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())), \
729#include "clang/AST/TypeNodes.inc"
735template <
typename Derived>
737 bool TraverseQualifier) {
742#define ABSTRACT_TYPELOC(CLASS, BASE)
743#define TYPELOC(CLASS, BASE) \
744 case TypeLoc::CLASS: \
745 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>(), \
747#include "clang/AST/TypeLocNodes.def"
754#define VISITORCLASS RecursiveASTVisitor
755#include "clang/AST/AttrVisitor.inc"
758template <
typename Derived>
770 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(D))
771 return TraverseTemplateTypeParamDeclConstraints(TTPD);
782 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
783 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
784 FTD->getDeclName().getCXXDeductionGuideTemplate()))
789#define ABSTRACT_DECL(DECL)
790#define DECL(CLASS, BASE) \
792 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
795#include "clang/AST/DeclNodes.inc"
800template <
typename Derived>
818 llvm_unreachable(
"unhandled kind");
821template <
typename Derived>
844template <
typename Derived>
873template <
typename Derived>
878 Template.getAsQualifiedTemplateName()) {
879 if (QTN->getQualifier()) {
887template <
typename Derived>
918template <
typename Derived>
934 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
957template <
typename Derived>
966template <
typename Derived>
978template <
typename Derived>
983 if (LE->isInitCapture(
C))
993#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
994 template <typename Derived> \
995 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T, \
996 bool TraverseQualifier) { \
997 if (!getDerived().shouldTraversePostOrder()) \
998 TRY_TO(WalkUpFrom##TYPE(T)); \
1002 if (getDerived().shouldTraversePostOrder()) \
1003 TRY_TO(WalkUpFrom##TYPE(T)); \
1014 {
TRY_TO(TraverseType(T->getPointeeType())); })
1017 {
TRY_TO(TraverseType(T->getPointeeType())); })
1020 {
TRY_TO(TraverseType(T->getPointeeType())); })
1023 NestedNameSpecifier Qualifier =
1026 : T->getQualifier();
1027 TRY_TO(TraverseNestedNameSpecifier(Qualifier));
1036 TRY_TO(TraverseType(T->getElementType()));
1037 if (T->getSizeExpr())
1038 TRY_TO(TraverseStmt(
const_cast<Expr*
>(T->getSizeExpr())));
1042 TRY_TO(TraverseType(T->getElementType()));
1043 if (T->getSizeExpr())
1044 TRY_TO(TraverseStmt(
const_cast<Expr *
>(T->getSizeExpr())));
1048 {
TRY_TO(TraverseType(T->getElementType())); })
1051 TRY_TO(TraverseType(T->getElementType()));
1056 TRY_TO(TraverseType(T->getElementType()));
1057 if (T->getSizeExpr())
1058 TRY_TO(TraverseStmt(T->getSizeExpr()));
1062 TRY_TO(TraverseStmt(T->getAddrSpaceExpr()));
1063 TRY_TO(TraverseType(T->getPointeeType()));
1067 if (T->getSizeExpr())
1068 TRY_TO(TraverseStmt(T->getSizeExpr()));
1069 TRY_TO(TraverseType(T->getElementType()));
1073 if (T->getSizeExpr())
1074 TRY_TO(TraverseStmt(T->getSizeExpr()));
1083 {
TRY_TO(TraverseType(T->getElementType())); })
1086 if (T->getRowExpr())
1087 TRY_TO(TraverseStmt(T->getRowExpr()));
1088 if (T->getColumnExpr())
1089 TRY_TO(TraverseStmt(T->getColumnExpr()));
1090 TRY_TO(TraverseType(T->getElementType()));
1094 {
TRY_TO(TraverseType(T->getReturnType())); })
1097 TRY_TO(TraverseType(T->getReturnType()));
1099 for (
const auto &A : T->param_types()) {
1103 for (
const auto &E : T->exceptions()) {
1107 if (
Expr *NE = T->getNoexceptExpr())
1108 TRY_TO(TraverseStmt(NE));
1112 if (TraverseQualifier)
1113 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1116 if (TraverseQualifier)
1117 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1120 if (TraverseQualifier)
1121 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1125 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1130 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1133 TRY_TO(TraverseType(T->getPattern()));
1134 TRY_TO(TraverseStmt(T->getIndexExpr()));
1138 TRY_TO(TraverseType(T->getBaseType()));
1139 TRY_TO(TraverseType(T->getUnderlyingType()));
1143 TRY_TO(TraverseType(T->getDeducedType()));
1144 if (T->isConstrained()) {
1145 TRY_TO(TraverseTemplateArguments(T->getTypeConstraintArguments()));
1151 TRY_TO(TraverseType(T->getReplacementType()));
1154 {
TRY_TO(TraverseSubstPackTypeHelper(T)); })
1156 {
TRY_TO(TraverseSubstPackTypeHelper(T)); })
1159 {
TRY_TO(TraverseType(T->getModifiedType())); })
1162 if (T->getCountExpr())
1163 TRY_TO(TraverseStmt(T->getCountExpr()));
1168 {
TRY_TO(TraverseType(T->getWrappedType())); })
1171 {
TRY_TO(TraverseType(T->getUnderlyingType())); })
1174 {
TRY_TO(TraverseType(T->getWrappedType())); })
1177 for (
auto &Operand : T->getOperands()) {
1178 if (Operand.isConstant() || Operand.isType()) {
1179 TRY_TO(TraverseType(Operand.getResultType()));
1187 {
TRY_TO(TraverseType(T->getUnderlyingType())); })
1189template <typename Derived>
1190bool RecursiveASTVisitor<Derived>::TraverseTagType(TagType *T,
1191 bool TraverseQualifier) {
1192 if (TraverseQualifier)
1193 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1199 {
TRY_TO(TraverseTagType(T, TraverseQualifier)); })
1201 {
TRY_TO(TraverseTagType(T, TraverseQualifier)); })
1204 if (TraverseQualifier)
1205 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1209 if (TraverseQualifier) {
1210 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1214 T->getTemplateName().getAsTemplateDecl(
true))));
1216 TRY_TO(TraverseTemplateArguments(T->template_arguments()));
1220 if (TraverseQualifier) {
1221 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1225 T->getTemplateName().getAsTemplateDecl(
true))));
1227 TRY_TO(TraverseType(T->getDeducedType()));
1239 if (T->getBaseType().getTypePtr() != T)
1240 TRY_TO(TraverseType(T->getBaseType()));
1241 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1242 TRY_TO(TraverseType(typeArg));
1247 {
TRY_TO(TraverseType(T->getPointeeType())); })
1255 {
TRY_TO(TraverseStmt(T->getNumBitsExpr())); })
1269 template <
typename Derived> \
1271 TYPE##Loc TL,
bool TraverseQualifier) { \
1272 if (!getDerived().shouldTraversePostOrder()) { \
1273 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1274 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1275 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1280 if (getDerived().shouldTraversePostOrder()) { \
1281 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1282 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1283 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1288template <
typename Derived>
1291 assert(TraverseQualifier &&
1292 "Qualifiers should never occur within NestedNameSpecifiers");
1308 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1315 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1319 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1322 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1325 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1328 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1336 TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
1337 TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
1341 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1344 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1346template <typename Derived>
1347bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(
ArrayTypeLoc TL) {
1349 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1354 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1355 TRY_TO(TraverseArrayTypeLocHelper(TL));
1359 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1360 TRY_TO(TraverseArrayTypeLocHelper(TL));
1364 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1365 TRY_TO(TraverseArrayTypeLocHelper(TL));
1369 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1370 TRY_TO(TraverseArrayTypeLocHelper(TL));
1374 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1375 TRY_TO(TraverseArrayTypeLocHelper(TL));
1379 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1380 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1386 if (TL.getTypePtr()->getSizeExpr())
1387 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1388 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1393 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1397 if (TL.getTypePtr()->getSizeExpr())
1398 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1399 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
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(TraverseStmt(TL.getAttrRowOperand()));
1416 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1417 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1421 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1425 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1429 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1430 if (TL.getParam(I)) {
1431 TRY_TO(TraverseDecl(TL.getParam(I)));
1432 }
else if (I < T->getNumParams()) {
1433 TRY_TO(TraverseType(T->getParamType(I)));
1437 for (
const auto &E : T->exceptions()) {
1441 if (
Expr *NE = T->getNoexceptExpr())
1442 TRY_TO(TraverseStmt(NE));
1447 TraverseQualifier && QualifierLoc)
1452 TraverseQualifier && QualifierLoc)
1457 TraverseQualifier && QualifierLoc)
1462 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1465 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1470 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1474 TRY_TO(TraverseType(TL.getPattern()));
1475 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1479 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1483 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1484 if (TL.isConstrained()) {
1485 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1491 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1494template <typename Derived>
1495bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeLocHelper(
1497 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1501template <
typename Derived>
1502bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeHelper(
1504 TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
1509 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1512 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1517 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1520 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1523 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1526 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1529 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1532 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1535 {
TRY_TO(TraverseType(TL.getType())); })
1537template <typename Derived>
1538bool RecursiveASTVisitor<Derived>::TraverseTagTypeLoc(
TagTypeLoc TL,
1539 bool TraverseQualifier) {
1541 TraverseQualifier && QualifierLoc)
1547 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1549 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1551 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1554 if (TraverseQualifier)
1559 if (TraverseQualifier)
1563 TRY_TO(TraverseTemplateName(
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)
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) {
1641 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1642 return Cls->isLambda();
1646template <
typename Derived>
1647bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(
DeclContext *DC) {
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()));
1685 TRY_TO(TraverseStmt(D->getBody()));
1686 for (
const auto &I : D->captures()) {
1687 if (I.hasCopyExpr()) {
1688 TRY_TO(TraverseStmt(I.getCopyExpr()));
1691 ShouldVisitChildren =
false;
1695 TRY_TO(TraverseStmt(D->getBody()));
1696 ShouldVisitChildren =
false;
1700 TRY_TO(TraverseStmt(D->getBody()));
1701 ShouldVisitChildren =
false;
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>();
1728 TT && TT->isTagOwned())
1729 TRY_TO(TraverseDecl(TT->getDecl()));
1731 TRY_TO(TraverseDecl(D->getFriendDecl()));
1736 if (D->getFriendType())
1737 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1739 TRY_TO(TraverseDecl(D->getFriendDecl()));
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()));
1758 TRY_TO(TraverseStmt(D->getMessage()));
1764 if (D->getQualifierLoc())
1767 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1768 for (
unsigned I = 0, E = D->getNumTemplateArgs(); I != E; ++I)
1769 TRY_TO(TraverseTemplateArgumentLoc(D->getTemplateArg(I)));
1779 auto Scope = D->getASTContext().getTraversalScope();
1780 bool HasLimitedScope =
1782 if (HasLimitedScope) {
1783 ShouldVisitChildren =
false;
1784 for (
auto *Child :
Scope) {
1785 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1786 TRY_TO(TraverseDecl(Child));
1802 ShouldVisitChildren =
false;
1820 for (
auto typeParam : *typeParamList) {
1821 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1824 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1826 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1838 for (
auto typeParam : *typeParamList) {
1839 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1844 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1846 if (D->isThisDeclarationADefinition()) {
1847 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1849 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1855 if (D->isThisDeclarationADefinition()) {
1856 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1858 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1864 if (D->getReturnTypeSourceInfo()) {
1865 TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
1870 if (D->isThisDeclarationADefinition()) {
1871 TRY_TO(TraverseStmt(D->getBody()));
1873 ShouldVisitChildren =
false;
1877 if (D->hasExplicitBound()) {
1878 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1886 if (D->getTypeSourceInfo())
1887 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1889 TRY_TO(TraverseType(D->getType()));
1890 ShouldVisitChildren =
false;
1895 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1899 {
TRY_TO(TraverseTypeLoc(D->getEnumTypeLoc())); })
1912 for (
auto *I : D->varlist()) {
1918 for (
auto *I : D->varlist()) {
1924 for (
auto *
C : D->clauselists()) {
1930 TRY_TO(TraverseStmt(D->getCombiner()));
1933 TRY_TO(TraverseType(D->getType()));
1938 for (
auto *
C : D->clauselists())
1940 TRY_TO(TraverseType(D->getType()));
1947 for (
auto *I : D->varlist())
1949 for (
auto *
C : D->clauselists())
1954 {
TRY_TO(VisitOpenACCClauseList(D->clauses())); })
1957 TRY_TO(TraverseStmt(D->getFunctionReference()));
1958 TRY_TO(VisitOpenACCClauseList(D->clauses()));
1962template <typename Derived>
1963bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1969 if (
Expr *RequiresClause = TPL->getRequiresClause()) {
1970 TRY_TO(TraverseStmt(RequiresClause));
1976template <
typename Derived>
1977template <
typename T>
1978bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *D) {
1980 TraverseTemplateParameterListHelper(TPL);
1984template <
typename Derived>
1987 for (
auto *SD : D->specializations()) {
1988 for (
auto *RD : SD->redecls()) {
1995 TRY_TO(TraverseDecl(RD));
2012template <
typename Derived>
2015 for (
auto *SD : D->specializations()) {
2016 for (
auto *RD : SD->redecls()) {
2021 TRY_TO(TraverseDecl(RD));
2037template <
typename Derived>
2040 for (
auto *FD : D->specializations()) {
2041 for (
auto *RD : FD->redecls()) {
2042 switch (RD->getTemplateSpecializationKind()) {
2046 TRY_TO(TraverseDecl(RD));
2055 TRY_TO(TraverseDecl(RD));
2069#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
2070 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
2071 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2072 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
2080 if (getDerived().shouldVisitTemplateInstantiations() && \
2081 D == D->getCanonicalDecl()) \
2082 TRY_TO(TraverseTemplateInstantiations(D)); \
2096 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2097 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2098 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2099 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2103 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2106template <typename Derived>
2107bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
2109 if (
const auto *TC = D->getTypeConstraint())
2110 TRY_TO(TraverseTypeConstraint(TC));
2116 if (D->getTypeForDecl())
2118 TRY_TO(TraverseTemplateTypeParamDeclConstraints(D));
2119 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2120 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2124 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2131 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2138 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2139 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2143 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2144 TRY_TO(TraverseStmt(D->getConstraintExpr()));
2159 TRY_TO(TraverseDeclTemplateParameterLists(D));
2162 if (
auto *TSI = D->getIntegerTypeSourceInfo())
2163 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2169template <typename Derived>
2170bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(
RecordDecl *D) {
2174 TRY_TO(TraverseDeclTemplateParameterLists(D));
2179template <
typename Derived>
2182 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2186template <
typename Derived>
2187bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(
CXXRecordDecl *D) {
2188 if (!TraverseRecordHelper(D))
2190 if (D->isCompleteDefinition()) {
2191 for (
const auto &I : D->bases()) {
2192 TRY_TO(TraverseCXXBaseSpecifier(I));
2204template <typename Derived>
2205bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2207 for (
unsigned I = 0; I < Count; ++I) {
2208 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2213#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2214 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2224 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2225 assert(D->getTemplateSpecializationKind() != TSK_ImplicitInstantiation); \
2226 if (D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2227 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2228 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2232 if (getDerived().shouldVisitTemplateInstantiations() || \
2233 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2235 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2248#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2249 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2251 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2253 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2254 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2255 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2260 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2274 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2279template <typename Derived>
2280bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(
DeclaratorDecl *D) {
2281 TRY_TO(TraverseDeclTemplateParameterLists(D));
2283 if (D->getTypeSourceInfo())
2284 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2286 TRY_TO(TraverseType(D->getType()));
2291 TRY_TO(TraverseVarHelper(D));
2292 for (
auto *Binding : D->bindings()) {
2293 TRY_TO(TraverseDecl(Binding));
2298 if (getDerived().shouldVisitImplicitCode()) {
2299 TRY_TO(TraverseStmt(D->getBinding()));
2300 if (
const auto HoldingVar = D->getHoldingVar())
2301 TRY_TO(TraverseDecl(HoldingVar));
2313 TRY_TO(TraverseDeclaratorHelper(D));
2314 if (D->isBitField())
2315 TRY_TO(TraverseStmt(D->getBitWidth()));
2316 if (D->hasInClassInitializer())
2317 TRY_TO(TraverseStmt(D->getInClassInitializer()));
2321 TRY_TO(TraverseDeclaratorHelper(D));
2322 if (D->isBitField())
2323 TRY_TO(TraverseStmt(D->getBitWidth()));
2328 TRY_TO(TraverseDeclaratorHelper(D));
2329 if (D->isBitField())
2330 TRY_TO(TraverseStmt(D->getBitWidth()));
2334template <typename Derived>
2335bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(
FunctionDecl *D) {
2336 TRY_TO(TraverseDeclTemplateParameterLists(D));
2338 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2346 D->getTemplateSpecializationInfo()) {
2352 FTSI->TemplateArgumentsAsWritten) {
2353 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2354 TALI->NumTemplateArgs));
2358 D->getDependentSpecializationInfo()) {
2360 DFSI->TemplateArgumentsAsWritten) {
2361 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2362 TALI->NumTemplateArgs));
2371 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2372 }
else if (getDerived().shouldVisitImplicitCode()) {
2384 D->getTrailingRequiresClause()) {
2386 const_cast<Expr *
>(TrailingRequiresClause.ConstraintExpr)));
2391 for (
auto *I : Ctor->inits()) {
2392 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2393 TRY_TO(TraverseConstructorInitializer(I));
2398 D->isThisDeclarationADefinition() &&
2401 (!D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2403 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
2405 if (RD->isLambda() &&
2407 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2413 TRY_TO(TraverseStmt(D->getBody()));
2416 for (
auto *Child : D->decls()) {
2418 TRY_TO(TraverseDecl(Child));
2427 ShouldVisitChildren =
false;
2434 ShouldVisitChildren =
false;
2441 ShouldVisitChildren =
false;
2448 ShouldVisitChildren =
false;
2457 ShouldVisitChildren =
false;
2464 ShouldVisitChildren =
false;
2468template <typename Derived>
2469bool RecursiveASTVisitor<Derived>::TraverseVarHelper(
VarDecl *D) {
2470 TRY_TO(TraverseDeclaratorHelper(D));
2473 (!D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2474 TRY_TO(TraverseStmt(D->getInit()));
2484 TRY_TO(TraverseDeclaratorHelper(D));
2485 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2486 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2490 TRY_TO(TraverseVarHelper(D));
2492 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2493 !D->hasUnparsedDefaultArg())
2494 TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
2496 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2497 !D->hasUnparsedDefaultArg())
2498 TRY_TO(TraverseStmt(D->getDefaultArg()));
2504 TRY_TO(TraverseTemplateArguments(D->getTemplateArguments()));
2520 template <
typename Derived> \
2522 STMT *S, DataRecursionQueue *Queue) { \
2523 bool ShouldVisitChildren =
true; \
2525 if (!getDerived().shouldTraversePostOrder()) \
2526 TRY_TO(WalkUpFrom##
STMT(S)); \
2528 if (ShouldVisitChildren) { \
2529 for (
Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2530 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2537 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2538 TRY_TO(WalkUpFrom##
STMT(S)); \
2545 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2548 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2551 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2564 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2569 for (
auto *I : S->decls()) {
2577 ShouldVisitChildren =
false;
2606 if (!getDerived().shouldVisitImplicitCode()) {
2613 ShouldVisitChildren =
false;
2619 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2630 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2631 if (S->hasExplicitTemplateArgs()) {
2632 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2633 S->getNumTemplateArgs()));
2639 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2640 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2641 S->getNumTemplateArgs()));
2646 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2647 if (S->hasExplicitTemplateArgs()) {
2648 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2649 S->getNumTemplateArgs()));
2655 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2656 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2657 S->getNumTemplateArgs()));
2667 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2671 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2675 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2679 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2683 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2687 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2691 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2695 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2698template <typename Derived>
2704 if (!getDerived().shouldTraversePostOrder())
2705 TRY_TO(WalkUpFromInitListExpr(S));
2712 if (!Queue && getDerived().shouldTraversePostOrder())
2713 TRY_TO(WalkUpFromInitListExpr(S));
2718template <
typename Derived>
2724template <
typename Derived>
2727 if (!getDerived().shouldTraversePostOrder())
2728 TRY_TO(VisitConceptReference(CR));
2730 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2731 if (CR->hasExplicitTemplateArgs())
2732 TRY_TO(TraverseTemplateArgumentLocsHelper(
2733 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2734 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2735 if (getDerived().shouldTraversePostOrder())
2736 TRY_TO(VisitConceptReference(CR));
2740template <
typename Derived>
2743 TRY_TO(VisitOffsetOfNode(Node));
2755template <
typename Derived>
2758 if (S->isSemanticForm() && S->isSyntacticForm()) {
2760 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2763 TRY_TO(TraverseSynOrSemInitListExpr(
2764 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2765 if (getDerived().shouldVisitImplicitCode()) {
2768 TRY_TO(TraverseSynOrSemInitListExpr(
2769 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2778 if (S->isExprPredicate())
2779 TRY_TO(TraverseStmt(S->getControllingExpr()));
2781 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2785 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2788 ShouldVisitChildren =
false;
2796 e = S->semantics_end();
2800 sub = OVE->getSourceExpr();
2803 ShouldVisitChildren =
false;
2809 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2814 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2818 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2822 for (
unsigned I = 0, E = S->getNumComponents(); I != E; ++I)
2823 TRY_TO(TraverseOffsetOfNode(&S->getComponent(I)));
2829 if (S->isArgumentType())
2830 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2836 if (S->isTypeOperand())
2837 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2849 if (S->isTypeOperand())
2850 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2854 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2855 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2859 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2867 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2872 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2878 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2880 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2881 TRY_TO(TraverseLambdaCapture(S,
C, S->capture_init_begin()[I]));
2885 if (getDerived().shouldVisitImplicitCode()) {
2887 TRY_TO(TraverseDecl(S->getLambdaClass()));
2890 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2893 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2894 if (S->hasExplicitParameters()) {
2896 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2897 TRY_TO(TraverseDecl(Proto.getParam(I)));
2900 auto *T = Proto.getTypePtr();
2901 for (
const auto &E : T->exceptions())
2904 if (
Expr *NE = T->getNoexceptExpr())
2907 if (S->hasExplicitResultType())
2908 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2910 const_cast<Expr *
>(S->getTrailingRequiresClause().ConstraintExpr));
2914 ShouldVisitChildren =
false;
2919 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2941 TRY_TO(TraverseDecl(S->getBlockDecl()));
2947 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2953 if (getDerived().shouldVisitImplicitCode())
2954 TRY_TO(TraverseStmt(S->getExpr()));
2958 if (getDerived().shouldVisitImplicitCode())
2959 TRY_TO(TraverseStmt(S->getExpr()));
2971 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2972 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2973 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2997 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
3005 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
3009 if (S->isClassReceiver()) {
3011 QualType Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
3013 Data.NameLoc = S->getReceiverLocation();
3024 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
3031 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
3034 if (getDerived().shouldVisitImplicitCode()) {
3035 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3036 TRY_TO(TraverseStmt(S->getKernelLaunchIdExpr()));
3037 ShouldVisitChildren =
false;
3054 if (S->hasExplicitTemplateArgs()) {
3055 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3056 S->getNumTemplateArgs()));
3062 if (S->hasExplicitTemplateArgs()) {
3063 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3064 S->getNumTemplateArgs()));
3075 if (getDerived().shouldVisitImplicitCode()) {
3076 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3077 TRY_TO(TraverseStmt(S->getKernelLaunchStmt()));
3078 TRY_TO(TraverseDecl(S->getOutlinedFunctionDecl()));
3079 ShouldVisitChildren =
false;
3085 if (!getDerived().shouldVisitImplicitCode()) {
3087 S->getDecomposedForm();
3088 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
3089 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
3090 ShouldVisitChildren =
false;
3116 if (S->getLifetimeExtendedTemporaryDecl()) {
3117 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
3118 S->getLifetimeExtendedTemporaryDecl()));
3119 ShouldVisitChildren =
false;
3126 if (!getDerived().shouldVisitImplicitCode()) {
3128 ShouldVisitChildren =
false;
3132 if (!getDerived().shouldVisitImplicitCode()) {
3134 ShouldVisitChildren =
false;
3138 if (!getDerived().shouldVisitImplicitCode()) {
3140 ShouldVisitChildren =
false;
3144 if (!getDerived().shouldVisitImplicitCode()) {
3146 ShouldVisitChildren =
false;
3150 if (!getDerived().shouldVisitImplicitCode()) {
3152 ShouldVisitChildren =
false;
3157 TRY_TO(TraverseConceptReference(S->getConceptReference()));
3161 TRY_TO(TraverseDecl(S->getBody()));
3163 TRY_TO(TraverseDecl(Parm));
3165 TRY_TO(TraverseConceptRequirement(Req));
3184template <typename Derived>
3185bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3186 OMPExecutableDirective *S) {
3187 for (
auto *
C : S->clauses()) {
3194 if (!getDerived().shouldVisitImplicitCode()) {
3196 TRY_TO(TraverseStmt(S->getLoopStmt()));
3197 ShouldVisitChildren =
false;
3201template <typename Derived>
3203RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3204 return TraverseOMPExecutableDirective(S);
3208 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3211 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3214 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3217 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3220 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3223 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3226 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3229 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3232 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3235 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3238 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3241 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3244 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3247 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3250 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3253 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3256 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3259 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3260 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)); })
3399 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3402 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3405 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3408 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3411 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3414 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3417 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3420 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3423 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3426 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3429 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3432 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3435 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3438 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3441 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3444template <typename Derived>
3445bool RecursiveASTVisitor<Derived>::TraverseOMPClause(
OMPClause *
C) {
3448 switch (
C->getClauseKind()) {
3449#define GEN_CLANG_CLAUSE_CLASS
3450#define CLAUSE_CLASS(Enum, Str, Class) \
3451 case llvm::omp::Clause::Enum: \
3452 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3454#define CLAUSE_NO_CLASS(Enum, Str) \
3455 case llvm::omp::Clause::Enum: \
3457#include "llvm/Frontend/OpenMP/OMP.inc"
3462template <
typename Derived>
3463bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3465 TRY_TO(TraverseStmt(Node->getPreInitStmt()));
3469template <
typename Derived>
3470bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3472 TRY_TO(VisitOMPClauseWithPreInit(Node));
3473 TRY_TO(TraverseStmt(Node->getPostUpdateExpr()));
3477template <
typename Derived>
3480 TRY_TO(TraverseStmt(
C->getAllocator()));
3484template <
typename Derived>
3486 TRY_TO(TraverseStmt(
C->getAllocator()));
3487 TRY_TO(VisitOMPClauseList(
C));
3491template <
typename Derived>
3493 TRY_TO(VisitOMPClauseWithPreInit(
C));
3494 TRY_TO(TraverseStmt(
C->getCondition()));
3498template <
typename Derived>
3500 TRY_TO(VisitOMPClauseWithPreInit(
C));
3501 TRY_TO(TraverseStmt(
C->getCondition()));
3505template <
typename Derived>
3508 TRY_TO(VisitOMPClauseWithPreInit(
C));
3509 TRY_TO(TraverseStmt(
C->getNumThreads()));
3513template <
typename Derived>
3515 TRY_TO(TraverseStmt(
C->getAlignment()));
3519template <
typename Derived>
3521 TRY_TO(TraverseStmt(
C->getSafelen()));
3525template <
typename Derived>
3527 TRY_TO(TraverseStmt(
C->getSimdlen()));
3531template <
typename Derived>
3533 for (
Expr *E :
C->getSizesRefs())
3538template <
typename Derived>
3540 for (
Expr *E :
C->getCountsRefs())
3545template <
typename Derived>
3548 for (
Expr *E :
C->getArgsRefs())
3553template <
typename Derived>
3558template <
typename Derived>
3561 TRY_TO(TraverseStmt(
C->getFirst()));
3562 TRY_TO(TraverseStmt(
C->getCount()));
3566template <
typename Derived>
3568 TRY_TO(TraverseStmt(
C->getFactor()));
3572template <
typename Derived>
3575 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3579template <
typename Derived>
3584template <
typename Derived>
3590template <
typename Derived>
3592 OMPTransparentClause *
C) {
3593 TRY_TO(TraverseStmt(
C->getImpexType()));
3597template <
typename Derived>
3602template <
typename Derived>
3604 OMPUnifiedAddressClause *) {
3608template <
typename Derived>
3610 OMPUnifiedSharedMemoryClause *) {
3614template <
typename Derived>
3616 OMPReverseOffloadClause *) {
3620template <
typename Derived>
3622 OMPDynamicAllocatorsClause *) {
3626template <
typename Derived>
3628 OMPAtomicDefaultMemOrderClause *) {
3632template <
typename Derived>
3637template <
typename Derived>
3642template <
typename Derived>
3647template <
typename Derived>
3649 TRY_TO(TraverseStmt(
C->getMessageString()));
3653template <
typename Derived>
3656 TRY_TO(VisitOMPClauseWithPreInit(
C));
3657 TRY_TO(TraverseStmt(
C->getChunkSize()));
3661template <
typename Derived>
3663 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3667template <
typename Derived>
3669 TRY_TO(TraverseStmt(
C->getCondition()));
3673template <
typename Derived>
3678template <
typename Derived>
3684template <
typename Derived>
3689template <
typename Derived>
3694template <
typename Derived>
3699template <
typename Derived>
3704template <
typename Derived>
3709template <
typename Derived>
3714template <
typename Derived>
3719template <
typename Derived>
3724template <
typename Derived>
3729template <
typename Derived>
3734template <
typename Derived>
3739template <
typename Derived>
3744template <
typename Derived>
3746 OMPNoOpenMPRoutinesClause *) {
3750template <
typename Derived>
3752 OMPNoOpenMPConstructsClause *) {
3756template <
typename Derived>
3758 OMPNoParallelismClause *) {
3762template <
typename Derived>
3767template <
typename Derived>
3772template <
typename Derived>
3777template <
typename Derived>
3782template <
typename Derived>
3787template <
typename Derived>
3792template <
typename Derived>
3797template <
typename Derived>
3799 TRY_TO(VisitOMPClauseList(
C));
3803template <
typename Derived>
3805 TRY_TO(TraverseStmt(
C->getInteropVar()));
3809template <
typename Derived>
3811 TRY_TO(TraverseStmt(
C->getInteropVar()));
3815template <
typename Derived>
3817 OMPNovariantsClause *
C) {
3818 TRY_TO(VisitOMPClauseWithPreInit(
C));
3819 TRY_TO(TraverseStmt(
C->getCondition()));
3823template <
typename Derived>
3825 OMPNocontextClause *
C) {
3826 TRY_TO(VisitOMPClauseWithPreInit(
C));
3827 TRY_TO(TraverseStmt(
C->getCondition()));
3831template <
typename Derived>
3832template <
typename T>
3833bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
3834 for (
auto *E : Node->varlist()) {
3840template <
typename Derived>
3842 OMPInclusiveClause *
C) {
3843 TRY_TO(VisitOMPClauseList(
C));
3847template <
typename Derived>
3849 OMPExclusiveClause *
C) {
3850 TRY_TO(VisitOMPClauseList(
C));
3854template <
typename Derived>
3856 TRY_TO(VisitOMPClauseList(
C));
3857 for (
auto *E :
C->private_copies()) {
3863template <
typename Derived>
3865 OMPFirstprivateClause *
C) {
3866 TRY_TO(VisitOMPClauseList(
C));
3867 TRY_TO(VisitOMPClauseWithPreInit(
C));
3868 for (
auto *E :
C->private_copies()) {
3871 for (
auto *E :
C->inits()) {
3877template <
typename Derived>
3879 OMPLastprivateClause *
C) {
3880 TRY_TO(VisitOMPClauseList(
C));
3881 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3882 for (
auto *E :
C->private_copies()) {
3885 for (
auto *E :
C->source_exprs()) {
3888 for (
auto *E :
C->destination_exprs()) {
3891 for (
auto *E :
C->assignment_ops()) {
3897template <
typename Derived>
3899 TRY_TO(VisitOMPClauseList(
C));
3903template <
typename Derived>
3905 TRY_TO(TraverseStmt(
C->getStep()));
3906 TRY_TO(TraverseStmt(
C->getCalcStep()));
3907 TRY_TO(VisitOMPClauseList(
C));
3908 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3909 for (
auto *E :
C->privates()) {
3912 for (
auto *E :
C->inits()) {
3915 for (
auto *E :
C->updates()) {
3918 for (
auto *E :
C->finals()) {
3924template <
typename Derived>
3926 TRY_TO(TraverseStmt(
C->getAlignment()));
3927 TRY_TO(VisitOMPClauseList(
C));
3931template <
typename Derived>
3933 TRY_TO(VisitOMPClauseList(
C));
3934 for (
auto *E :
C->source_exprs()) {
3937 for (
auto *E :
C->destination_exprs()) {
3940 for (
auto *E :
C->assignment_ops()) {
3946template <
typename Derived>
3948 OMPCopyprivateClause *
C) {
3949 TRY_TO(VisitOMPClauseList(
C));
3950 for (
auto *E :
C->source_exprs()) {
3953 for (
auto *E :
C->destination_exprs()) {
3956 for (
auto *E :
C->assignment_ops()) {
3962template <
typename Derived>
3966 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3967 TRY_TO(VisitOMPClauseList(
C));
3968 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3969 for (
auto *E :
C->privates()) {
3972 for (
auto *E :
C->lhs_exprs()) {
3975 for (
auto *E :
C->rhs_exprs()) {
3978 for (
auto *E :
C->reduction_ops()) {
3981 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3982 for (
auto *E :
C->copy_ops()) {
3985 for (
auto *E :
C->copy_array_temps()) {
3988 for (
auto *E :
C->copy_array_elems()) {
3995template <
typename Derived>
3997 OMPTaskReductionClause *
C) {
3999 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
4000 TRY_TO(VisitOMPClauseList(
C));
4001 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
4002 for (
auto *E :
C->privates()) {
4005 for (
auto *E :
C->lhs_exprs()) {
4008 for (
auto *E :
C->rhs_exprs()) {
4011 for (
auto *E :
C->reduction_ops()) {
4017template <
typename Derived>
4019 OMPInReductionClause *
C) {
4021 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
4022 TRY_TO(VisitOMPClauseList(
C));
4023 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
4024 for (
auto *E :
C->privates()) {
4027 for (
auto *E :
C->lhs_exprs()) {
4030 for (
auto *E :
C->rhs_exprs()) {
4033 for (
auto *E :
C->reduction_ops()) {
4036 for (
auto *E :
C->taskgroup_descriptors())
4041template <
typename Derived>
4043 TRY_TO(VisitOMPClauseList(
C));
4047template <
typename Derived>
4049 TRY_TO(TraverseStmt(
C->getDepobj()));
4053template <
typename Derived>
4055 TRY_TO(VisitOMPClauseList(
C));
4059template <
typename Derived>
4061 TRY_TO(VisitOMPClauseWithPreInit(
C));
4062 TRY_TO(TraverseStmt(
C->getDevice()));
4066template <
typename Derived>
4068 TRY_TO(VisitOMPClauseList(
C));
4072template <
typename Derived>
4074 OMPNumTeamsClause *
C) {
4075 TRY_TO(VisitOMPClauseList(
C));
4076 TRY_TO(VisitOMPClauseWithPreInit(
C));
4080template <
typename Derived>
4082 OMPThreadLimitClause *
C) {
4083 TRY_TO(VisitOMPClauseList(
C));
4084 TRY_TO(VisitOMPClauseWithPreInit(
C));
4088template <
typename Derived>
4090 OMPPriorityClause *
C) {
4091 TRY_TO(VisitOMPClauseWithPreInit(
C));
4092 TRY_TO(TraverseStmt(
C->getPriority()));
4096template <
typename Derived>
4098 OMPGrainsizeClause *
C) {
4099 TRY_TO(VisitOMPClauseWithPreInit(
C));
4100 TRY_TO(TraverseStmt(
C->getGrainsize()));
4104template <
typename Derived>
4106 OMPNumTasksClause *
C) {
4107 TRY_TO(VisitOMPClauseWithPreInit(
C));
4108 TRY_TO(TraverseStmt(
C->getNumTasks()));
4112template <
typename Derived>
4114 TRY_TO(TraverseStmt(
C->getHint()));
4118template <
typename Derived>
4120 OMPDistScheduleClause *
C) {
4121 TRY_TO(VisitOMPClauseWithPreInit(
C));
4122 TRY_TO(TraverseStmt(
C->getChunkSize()));
4126template <
typename Derived>
4132template <
typename Derived>
4134 TRY_TO(VisitOMPClauseList(
C));
4138template <
typename Derived>
4140 TRY_TO(VisitOMPClauseList(
C));
4144template <
typename Derived>
4146 OMPUseDevicePtrClause *
C) {
4147 TRY_TO(VisitOMPClauseList(
C));
4151template <
typename Derived>
4153 OMPUseDeviceAddrClause *
C) {
4154 TRY_TO(VisitOMPClauseList(
C));
4158template <
typename Derived>
4160 OMPIsDevicePtrClause *
C) {
4161 TRY_TO(VisitOMPClauseList(
C));
4165template <
typename Derived>
4167 OMPHasDeviceAddrClause *
C) {
4168 TRY_TO(VisitOMPClauseList(
C));
4172template <
typename Derived>
4174 OMPNontemporalClause *
C) {
4175 TRY_TO(VisitOMPClauseList(
C));
4176 for (
auto *E :
C->private_refs()) {
4182template <
typename Derived>
4187template <
typename Derived>
4189 TRY_TO(TraverseStmt(
C->getEventHandler()));
4193template <
typename Derived>
4195 OMPUsesAllocatorsClause *
C) {
4196 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
4197 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
4204template <
typename Derived>
4206 OMPAffinityClause *
C) {
4207 TRY_TO(TraverseStmt(
C->getModifier()));
4208 for (
Expr *E :
C->varlist())
4213template <
typename Derived>
4215 TRY_TO(VisitOMPClauseWithPreInit(
C));
4216 TRY_TO(TraverseStmt(
C->getThreadID()));
4220template <
typename Derived>
4225template <
typename Derived>
4227 OMPXDynCGroupMemClause *
C) {
4228 TRY_TO(VisitOMPClauseWithPreInit(
C));
4229 TRY_TO(TraverseStmt(
C->getSize()));
4233template <
typename Derived>
4235 OMPDynGroupprivateClause *
C) {
4236 TRY_TO(VisitOMPClauseWithPreInit(
C));
4237 TRY_TO(TraverseStmt(
C->getSize()));
4241template <
typename Derived>
4243 OMPDoacrossClause *
C) {
4244 TRY_TO(VisitOMPClauseList(
C));
4248template <
typename Derived>
4250 OMPXAttributeClause *
C) {
4254template <
typename Derived>
4259template <
typename Derived>
4260bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4262 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4266template <
typename Derived>
4267bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4269 TRY_TO(TraverseOpenACCConstructStmt(S));
4270 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4274template <
typename Derived>
4275bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *
C) {
4276 for (
const Stmt *Child :
C->children())
4277 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4281template <
typename Derived>
4282bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4285 for (
const auto *
C : Clauses)
4286 TRY_TO(VisitOpenACCClause(
C));
4291 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4293 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4295 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4297 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4299 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4301 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4303 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4305 if (S->hasDevNumExpr())
4306 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4307 for (
auto *E : S->getQueueIdExprs())
4309 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4312 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4314 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4316 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4318 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4320 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4322 for (
auto *E : S->getVarList())
This file provides AST data structures related to concepts.
#define STMT(DERIVED, BASE)
#define TYPE(DERIVED, BASE)
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc QualifierLoc)
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.
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 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 an access specifier followed by colon ':'.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
A binding in a decomposition declaration.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
This class is used for builtin types like 'int'.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents a base class of a C++ class.
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ base or member initializer.
Represents a C++ deduction guide declaration.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
Represents a C++26 reflect expression [expr.reflect].
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
A C++ static_cast expression (C++ [expr.static.cast]).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
This captures a statement into a function.
CaseStmt - Represent a case statement.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Declaration of a class template.
Represents a 'co_await' expression.
Complex values, per C99 6.2.5p11.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
A reference to a concept and its template args, as it appears in the code.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
Represents a 'co_yield' expression.
Represents a pointer type decayed from an array or function type.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
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.
A decomposition declaration.
DeferStmt - This represents a deferred statement.
Represents an extended address space qualifier where the input address space value is dependent.
Represents a 'co_await' expression while the type of the promise is dependent.
Provides information about a dependent function-template specialization declaration.
A qualified reference to a name whose declaration cannot yet be resolved.
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 matrix type where the type and the number of rows and columns is dependent on a template...
Represents a vector type where either the type or size is dependent.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
Represents a reference to emded data.
Represents an empty-declaration.
An instance of this object exists for each enum constant that is defined.
Represents an explicit instantiation of a template entity in source code.
Represents a standard C++ module export declaration.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
ExtVectorType - Extended vector type.
Declaration context for names declared as extern "C" in C++.
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Declaration of a friend template.
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
This class represents temporary values used to represent inout and out arguments in HLSL.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
Represents a field injected from an anonymous union/struct into the parent scope.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
An lvalue reference type, per C++11 [dcl.ref].
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
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...
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Represents a linkage specification.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSingleSubscriptExpr - Matrix single subscript expression for the MatrixType extension when you ...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
A pointer to member type per C++ 8.3.3 - Pointers to members.
This represents a decl that may have a name.
Represents a C++ namespace alias.
Represent a C++ namespace.
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*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'pragma omp allocate ...' directive.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Pseudo declaration for capturing expressions.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This is a basic class for representing single OpenMP clause.
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents the 'counts' clause in the 'pragma omp split' directive.
This represents 'pragma omp declare mapper ...' directive.
This represents 'pragma omp declare reduction ...' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'pragma omp groupprivate ...' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This class represents the 'looprange' clause in the 'pragma omp fuse' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'pragma omp requires...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents 'pragma omp threadprivate ...' directive.
This represents 'threadset' clause in the 'pragma omp task ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents a field declaration created by an @defs(...).
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCompatibleAliasDecl - Represents alias of a class.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Represents an ObjC class declaration.
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
Represents one property declaration in an Objective-C interface.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents an Objective-C protocol declaration.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Helper class for OffsetOfExpr.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
This is a base class for any OpenACC statement-level constructs that have an associated statement.
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
This is the base type for all OpenACC Clauses.
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Represents a partial function definition.
Represents a C++11 pack expansion that produces a sequence of expressions.
ParenExpr - This represents a parenthesized expression, e.g.
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
PointerType - C99 6.7.5.1 - Pointer Declarators.
Represents a #pragma detect_mismatch line.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Expr *const * semantics_iterator
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.
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
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 TraverseOffsetOfNode(const OffsetOfNode *Node)
Recursively visit a single component of an __builtin_offsetof designator (a field,...
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 VisitOffsetOfNode(const OffsetOfNode *Node)
Visit a single component of an __builtin_offsetof designator.
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.
Represents the body of a requires-expression.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Scope - A scope is a transient data structure that is used while parsing the program.
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Represents a C++11 static_assert declaration.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
StmtClass getStmtClass() const
llvm::iterator_range< child_iterator > child_range
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Abstract type representing delayed type pack expansions.
SwitchStmt - This represents a 'switch' stmt.
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.
A template parameter object.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl ** iterator
Iterates through the template parameters in this list.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
A declaration that models statements at global scope.
The top declaration context.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
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
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Wrapper of type source information for a type with no direct qualifiers.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a C++ using-enum-declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a call to the builtin function __builtin_va_arg.
Represents a variable declaration or definition.
Declaration of a variable template.
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
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.
bool isa(CodeGen::Address addr)
TRY_TO(TraverseNestedNameSpecifier(Qualifier))
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
@ Parameter
The parameter type of a method or function.
@ Template
We are parsing a template declaration.
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,...
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
DEF_TRAVERSE_TYPE(ComplexType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(PointerType
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
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