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);
495 bool TraverseSubstPackTypeHelper(SubstPackType *T);
502 bool TraverseVarHelper(
VarDecl *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);
515 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node);
517 bool PostVisitStmt(Stmt *S);
522 bool VisitOpenACCClause(
const OpenACCClause *);
525template <
typename Derived>
532 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
544template <
typename Derived>
549 return getDerived().TraverseConceptTypeRequirement(
553 return getDerived().TraverseConceptExprRequirement(
556 return getDerived().TraverseConceptNestedRequirement(
559 llvm_unreachable(
"unexpected case");
562template <
typename Derived>
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()) {
597 TRY_TO(TraverseTemplateParameterListHelper(
598 RetReq.getTypeConstraintTemplateParameterList()));
607template <
typename Derived>
615template <
typename Derived>
616bool RecursiveASTVisitor<Derived>::PostVisitStmt(
Stmt *S) {
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();
687 TRY_TO(PostVisitStmt(CurrS));
693 CurrSAndVisited.setInt(
true);
694 size_t N = LocalQueue.size();
697 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
699 LocalQueue.pop_back();
706template <
typename Derived>
708 bool TraverseQualifier) {
712 switch (T->getTypeClass()) {
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>
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>
834template <
typename Derived>
863template <
typename Derived>
868 Template.getAsQualifiedTemplateName()) {
869 if (QTN->getQualifier()) {
877template <
typename Derived>
908template <
typename Derived>
924 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
947template <
typename Derived>
956template <
typename Derived>
968template <
typename Derived>
973 if (LE->isInitCapture(
C))
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)); \
1004 {
TRY_TO(TraverseType(T->getPointeeType())); })
1007 {
TRY_TO(TraverseType(T->getPointeeType())); })
1010 {
TRY_TO(TraverseType(T->getPointeeType())); })
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()));
1053 TRY_TO(TraverseType(T->getPointeeType()));
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()));
1084 {
TRY_TO(TraverseType(T->getReturnType())); })
1087 TRY_TO(TraverseType(T->getReturnType()));
1089 for (
const auto &A : T->param_types()) {
1093 for (
const auto &E : T->exceptions()) {
1097 if (
Expr *NE = T->getNoexceptExpr())
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()));
1129 TRY_TO(TraverseType(T->getUnderlyingType()));
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->getUnderlyingType())); })
1164 {
TRY_TO(TraverseType(T->getWrappedType())); })
1167 for (
auto &Operand : T->getOperands()) {
1168 if (Operand.isConstant() || Operand.isType()) {
1169 TRY_TO(TraverseType(Operand.getResultType()));
1177 {
TRY_TO(TraverseType(T->getUnderlyingType())); })
1179template <typename Derived>
1180bool RecursiveASTVisitor<Derived>::TraverseTagType(TagType *T,
1181 bool TraverseQualifier) {
1182 if (TraverseQualifier)
1183 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1189 {
TRY_TO(TraverseTagType(T, TraverseQualifier)); })
1191 {
TRY_TO(TraverseTagType(T, TraverseQualifier)); })
1194 if (TraverseQualifier)
1195 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1199 if (TraverseQualifier) {
1200 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1204 T->getTemplateName().getAsTemplateDecl(
true))));
1206 TRY_TO(TraverseTemplateArguments(T->template_arguments()));
1210 if (TraverseQualifier) {
1211 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1215 T->getTemplateName().getAsTemplateDecl(
true))));
1217 TRY_TO(TraverseType(T->getDeducedType()));
1229 if (T->getBaseType().getTypePtr() != T)
1230 TRY_TO(TraverseType(T->getBaseType()));
1231 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1232 TRY_TO(TraverseType(typeArg));
1237 {
TRY_TO(TraverseType(T->getPointeeType())); })
1245 {
TRY_TO(TraverseStmt(T->getNumBitsExpr())); })
1259 template <
typename Derived> \
1261 TYPE##Loc TL,
bool TraverseQualifier) { \
1262 if (!getDerived().shouldTraversePostOrder()) { \
1263 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1264 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1265 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1270 if (getDerived().shouldTraversePostOrder()) { \
1271 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1272 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1273 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1278template <
typename Derived>
1281 assert(TraverseQualifier &&
1282 "Qualifiers should never occur within NestedNameSpecifiers");
1298 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1305 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1309 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1312 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1315 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1318 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1326 TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
1327 TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
1331 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1334 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1336template <typename Derived>
1337bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(
ArrayTypeLoc TL) {
1339 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1344 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1345 TRY_TO(TraverseArrayTypeLocHelper(TL));
1349 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1350 TRY_TO(TraverseArrayTypeLocHelper(TL));
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(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1370 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1376 if (TL.getTypePtr()->getSizeExpr())
1377 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1378 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1383 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1387 if (TL.getTypePtr()->getSizeExpr())
1388 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1389 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1395 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1399 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1400 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1401 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1405 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1406 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1407 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1411 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1415 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1419 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1420 if (TL.getParam(I)) {
1421 TRY_TO(TraverseDecl(TL.getParam(I)));
1422 }
else if (I < T->getNumParams()) {
1423 TRY_TO(TraverseType(T->getParamType(I)));
1427 for (
const auto &E : T->exceptions()) {
1431 if (
Expr *NE = T->getNoexceptExpr())
1432 TRY_TO(TraverseStmt(NE));
1437 TraverseQualifier && QualifierLoc)
1442 TraverseQualifier && QualifierLoc)
1447 TraverseQualifier && QualifierLoc)
1452 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1455 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1460 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1464 TRY_TO(TraverseType(TL.getPattern()));
1465 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1469 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1473 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1474 if (TL.isConstrained()) {
1475 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1481 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1484template <typename Derived>
1485bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeLocHelper(
1487 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1491template <
typename Derived>
1492bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeHelper(
1494 TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
1499 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1502 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1507 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1510 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1513 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1516 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1519 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1522 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1525 {
TRY_TO(TraverseType(TL.getType())); })
1527template <typename Derived>
1528bool RecursiveASTVisitor<Derived>::TraverseTagTypeLoc(
TagTypeLoc TL,
1529 bool TraverseQualifier) {
1531 TraverseQualifier && QualifierLoc)
1537 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1539 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1541 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1544 if (TraverseQualifier)
1549 if (TraverseQualifier)
1553 TRY_TO(TraverseTemplateName(
1554 TemplateName(TL.getTypePtr()->getTemplateName().getAsTemplateDecl(
1557 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1558 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1563 if (TraverseQualifier)
1566 const auto *T = TL.getTypePtr();
1569 TraverseTemplateName(
TemplateName(T->getTemplateName().getAsTemplateDecl(
1572 TRY_TO(TraverseType(T->getDeducedType()));
1576 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1579 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1581 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1590 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1591 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1592 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1593 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1594 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1596 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1601 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1609 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1623template <typename Derived>
1625 const Decl *Child) {
1631 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1632 return Cls->isLambda();
1636template <
typename Derived>
1637bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(
DeclContext *DC) {
1641 for (
auto *Child : DC->decls()) {
1642 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1643 TRY_TO(TraverseDecl(Child));
1650#define DEF_TRAVERSE_DECL(DECL, CODE) \
1651 template <typename Derived> \
1652 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1653 bool ShouldVisitChildren = true; \
1654 bool ReturnValue = true; \
1655 if (!getDerived().shouldTraversePostOrder()) \
1656 TRY_TO(WalkUpFrom##DECL(D)); \
1658 if (ReturnValue && ShouldVisitChildren) \
1659 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1660 if (ReturnValue) { \
1662 for (auto *I : D->attrs()) \
1663 TRY_TO(getDerived().TraverseAttr(I)); \
1665 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1666 TRY_TO(WalkUpFrom##DECL(D)); \
1667 return ReturnValue; \
1674 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1675 TRY_TO(TraverseStmt(D->getBody()));
1676 for (
const auto &I : D->captures()) {
1677 if (I.hasCopyExpr()) {
1678 TRY_TO(TraverseStmt(I.getCopyExpr()));
1681 ShouldVisitChildren =
false;
1685 TRY_TO(TraverseStmt(D->getBody()));
1686 ShouldVisitChildren =
false;
1690 TRY_TO(TraverseStmt(D->getBody()));
1691 ShouldVisitChildren =
false;
1701 TRY_TO(TraverseStmt(D->getTemporaryExpr()));
1705 {
TRY_TO(TraverseStmt(D->getAsmStringExpr())); })
1713 if (D->getFriendType()) {
1714 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1717 if (
auto *TT = D->getFriendType()->getType()->getAs<TagType>();
1718 TT && TT->isTagOwned())
1719 TRY_TO(TraverseDecl(TT->getDecl()));
1721 TRY_TO(TraverseDecl(D->getFriendDecl()));
1726 if (D->getFriendType())
1727 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1729 TRY_TO(TraverseDecl(D->getFriendDecl()));
1730 for (
unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1733 ITPL != ETPL; ++ITPL) {
1734 TRY_TO(TraverseDecl(*ITPL));
1747 TRY_TO(TraverseStmt(D->getAssertExpr()));
1748 TRY_TO(TraverseStmt(D->getMessage()));
1758 auto Scope = D->getASTContext().getTraversalScope();
1759 bool HasLimitedScope =
1761 if (HasLimitedScope) {
1762 ShouldVisitChildren =
false;
1763 for (
auto *Child :
Scope) {
1764 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1765 TRY_TO(TraverseDecl(Child));
1781 ShouldVisitChildren =
false;
1799 for (
auto typeParam : *typeParamList) {
1800 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1803 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1805 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1817 for (
auto typeParam : *typeParamList) {
1818 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1823 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1825 if (D->isThisDeclarationADefinition()) {
1826 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1828 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1834 if (D->isThisDeclarationADefinition()) {
1835 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1837 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1843 if (D->getReturnTypeSourceInfo()) {
1844 TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
1849 if (D->isThisDeclarationADefinition()) {
1850 TRY_TO(TraverseStmt(D->getBody()));
1852 ShouldVisitChildren =
false;
1856 if (D->hasExplicitBound()) {
1857 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1865 if (D->getTypeSourceInfo())
1866 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1868 TRY_TO(TraverseType(D->getType()));
1869 ShouldVisitChildren =
false;
1874 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1878 {
TRY_TO(TraverseTypeLoc(D->getEnumTypeLoc())); })
1891 for (
auto *I : D->varlist()) {
1897 for (
auto *I : D->varlist()) {
1903 for (
auto *
C : D->clauselists()) {
1909 TRY_TO(TraverseStmt(D->getCombiner()));
1912 TRY_TO(TraverseType(D->getType()));
1917 for (
auto *
C : D->clauselists())
1919 TRY_TO(TraverseType(D->getType()));
1926 for (
auto *I : D->varlist())
1928 for (
auto *
C : D->clauselists())
1933 {
TRY_TO(VisitOpenACCClauseList(D->clauses())); })
1936 TRY_TO(TraverseStmt(D->getFunctionReference()));
1937 TRY_TO(VisitOpenACCClauseList(D->clauses()));
1941template <typename Derived>
1942bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1948 if (
Expr *RequiresClause = TPL->getRequiresClause()) {
1949 TRY_TO(TraverseStmt(RequiresClause));
1955template <
typename Derived>
1956template <
typename T>
1957bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *D) {
1958 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1960 TraverseTemplateParameterListHelper(TPL);
1965template <
typename Derived>
1968 for (
auto *SD : D->specializations()) {
1969 for (
auto *RD : SD->redecls()) {
1976 TRY_TO(TraverseDecl(RD));
1993template <
typename Derived>
1996 for (
auto *SD : D->specializations()) {
1997 for (
auto *RD : SD->redecls()) {
2002 TRY_TO(TraverseDecl(RD));
2018template <
typename Derived>
2021 for (
auto *FD : D->specializations()) {
2022 for (
auto *RD : FD->redecls()) {
2023 switch (RD->getTemplateSpecializationKind()) {
2027 TRY_TO(TraverseDecl(RD));
2034 TRY_TO(TraverseDecl(RD));
2048#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
2049 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
2050 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2051 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
2059 if (getDerived().shouldVisitTemplateInstantiations() && \
2060 D == D->getCanonicalDecl()) \
2061 TRY_TO(TraverseTemplateInstantiations(D)); \
2075 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2076 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2077 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2078 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2082 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2085template <typename Derived>
2086bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
2088 if (
const auto *TC = D->getTypeConstraint())
2089 TRY_TO(TraverseTypeConstraint(TC));
2095 if (D->getTypeForDecl())
2097 TRY_TO(TraverseTemplateTypeParamDeclConstraints(D));
2098 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2099 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2103 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2110 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2117 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2118 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2122 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2123 TRY_TO(TraverseStmt(D->getConstraintExpr()));
2138 TRY_TO(TraverseDeclTemplateParameterLists(D));
2141 if (
auto *TSI = D->getIntegerTypeSourceInfo())
2142 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2148template <typename Derived>
2149bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(
RecordDecl *D) {
2153 TRY_TO(TraverseDeclTemplateParameterLists(D));
2158template <
typename Derived>
2161 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2165template <
typename Derived>
2166bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(
CXXRecordDecl *D) {
2167 if (!TraverseRecordHelper(D))
2169 if (D->isCompleteDefinition()) {
2170 for (
const auto &I : D->bases()) {
2171 TRY_TO(TraverseCXXBaseSpecifier(I));
2183template <typename Derived>
2184bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2186 for (
unsigned I = 0; I < Count; ++I) {
2187 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2192#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2193 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2202 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2203 assert(D->getTemplateSpecializationKind() != TSK_ImplicitInstantiation); \
2205 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2206 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2209 if (getDerived().shouldVisitTemplateInstantiations() || \
2210 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2212 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2214 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2227#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2228 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2230 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2232 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2233 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2234 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2239 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2253 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2258template <typename Derived>
2259bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(
DeclaratorDecl *D) {
2260 TRY_TO(TraverseDeclTemplateParameterLists(D));
2262 if (D->getTypeSourceInfo())
2263 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2265 TRY_TO(TraverseType(D->getType()));
2270 TRY_TO(TraverseVarHelper(D));
2271 for (
auto *Binding : D->bindings()) {
2272 TRY_TO(TraverseDecl(Binding));
2277 if (getDerived().shouldVisitImplicitCode()) {
2278 TRY_TO(TraverseStmt(D->getBinding()));
2279 if (
const auto HoldingVar = D->getHoldingVar())
2280 TRY_TO(TraverseDecl(HoldingVar));
2292 TRY_TO(TraverseDeclaratorHelper(D));
2293 if (D->isBitField())
2294 TRY_TO(TraverseStmt(D->getBitWidth()));
2295 if (D->hasInClassInitializer())
2296 TRY_TO(TraverseStmt(D->getInClassInitializer()));
2300 TRY_TO(TraverseDeclaratorHelper(D));
2301 if (D->isBitField())
2302 TRY_TO(TraverseStmt(D->getBitWidth()));
2307 TRY_TO(TraverseDeclaratorHelper(D));
2308 if (D->isBitField())
2309 TRY_TO(TraverseStmt(D->getBitWidth()));
2313template <typename Derived>
2314bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(
FunctionDecl *D) {
2315 TRY_TO(TraverseDeclTemplateParameterLists(D));
2317 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2325 D->getTemplateSpecializationInfo()) {
2331 FTSI->TemplateArgumentsAsWritten) {
2332 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2333 TALI->NumTemplateArgs));
2337 D->getDependentSpecializationInfo()) {
2339 DFSI->TemplateArgumentsAsWritten) {
2340 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2341 TALI->NumTemplateArgs));
2350 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2351 }
else if (getDerived().shouldVisitImplicitCode()) {
2363 D->getTrailingRequiresClause()) {
2365 const_cast<Expr *
>(TrailingRequiresClause.ConstraintExpr)));
2370 for (
auto *I : Ctor->inits()) {
2371 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2372 TRY_TO(TraverseConstructorInitializer(I));
2377 D->isThisDeclarationADefinition() &&
2380 (!D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2382 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
2384 if (RD->isLambda() &&
2386 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2392 TRY_TO(TraverseStmt(D->getBody()));
2395 for (
auto *Child : D->decls()) {
2397 TRY_TO(TraverseDecl(Child));
2406 ShouldVisitChildren =
false;
2413 ShouldVisitChildren =
false;
2420 ShouldVisitChildren =
false;
2427 ShouldVisitChildren =
false;
2436 ShouldVisitChildren =
false;
2443 ShouldVisitChildren =
false;
2447template <typename Derived>
2448bool RecursiveASTVisitor<Derived>::TraverseVarHelper(
VarDecl *D) {
2449 TRY_TO(TraverseDeclaratorHelper(D));
2452 (!D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2453 TRY_TO(TraverseStmt(D->getInit()));
2463 TRY_TO(TraverseDeclaratorHelper(D));
2464 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2465 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2469 TRY_TO(TraverseVarHelper(D));
2471 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2472 !D->hasUnparsedDefaultArg())
2473 TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
2475 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2476 !D->hasUnparsedDefaultArg())
2477 TRY_TO(TraverseStmt(D->getDefaultArg()));
2483 TRY_TO(TraverseTemplateArguments(D->getTemplateArguments()));
2499 template <
typename Derived> \
2501 STMT *S, DataRecursionQueue *Queue) { \
2502 bool ShouldVisitChildren =
true; \
2504 if (!getDerived().shouldTraversePostOrder()) \
2505 TRY_TO(WalkUpFrom##
STMT(S)); \
2507 if (ShouldVisitChildren) { \
2508 for (
Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2509 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2516 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2517 TRY_TO(WalkUpFrom##
STMT(S)); \
2524 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2527 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2530 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2543 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2548 for (
auto *I : S->decls()) {
2556 ShouldVisitChildren =
false;
2585 if (!getDerived().shouldVisitImplicitCode()) {
2592 ShouldVisitChildren =
false;
2598 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2609 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2610 if (S->hasExplicitTemplateArgs()) {
2611 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2612 S->getNumTemplateArgs()));
2618 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2619 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2620 S->getNumTemplateArgs()));
2625 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2626 if (S->hasExplicitTemplateArgs()) {
2627 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2628 S->getNumTemplateArgs()));
2634 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2635 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2636 S->getNumTemplateArgs()));
2646 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2650 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2654 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2658 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2662 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2666 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2670 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2674 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2677template <typename Derived>
2683 if (!getDerived().shouldTraversePostOrder())
2684 TRY_TO(WalkUpFromInitListExpr(S));
2691 if (!Queue && getDerived().shouldTraversePostOrder())
2692 TRY_TO(WalkUpFromInitListExpr(S));
2697template <
typename Derived>
2703template <
typename Derived>
2706 if (!getDerived().shouldTraversePostOrder())
2707 TRY_TO(VisitConceptReference(CR));
2709 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2710 if (CR->hasExplicitTemplateArgs())
2711 TRY_TO(TraverseTemplateArgumentLocsHelper(
2712 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2713 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2714 if (getDerived().shouldTraversePostOrder())
2715 TRY_TO(VisitConceptReference(CR));
2727template <
typename Derived>
2730 if (S->isSemanticForm() && S->isSyntacticForm()) {
2732 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2735 TRY_TO(TraverseSynOrSemInitListExpr(
2736 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2737 if (getDerived().shouldVisitImplicitCode()) {
2740 TRY_TO(TraverseSynOrSemInitListExpr(
2741 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2750 if (S->isExprPredicate())
2751 TRY_TO(TraverseStmt(S->getControllingExpr()));
2753 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2757 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2760 ShouldVisitChildren =
false;
2768 e = S->semantics_end();
2772 sub = OVE->getSourceExpr();
2775 ShouldVisitChildren =
false;
2781 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2786 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2794 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2800 if (S->isArgumentType())
2801 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2807 if (S->isTypeOperand())
2808 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2820 if (S->isTypeOperand())
2821 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2825 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2826 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2830 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2838 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2843 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2849 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2851 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2852 TRY_TO(TraverseLambdaCapture(S,
C, S->capture_init_begin()[I]));
2856 if (getDerived().shouldVisitImplicitCode()) {
2858 TRY_TO(TraverseDecl(S->getLambdaClass()));
2861 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2864 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2865 if (S->hasExplicitParameters()) {
2867 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2868 TRY_TO(TraverseDecl(Proto.getParam(I)));
2871 auto *T = Proto.getTypePtr();
2872 for (
const auto &E : T->exceptions())
2875 if (
Expr *NE = T->getNoexceptExpr())
2878 if (S->hasExplicitResultType())
2879 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2881 const_cast<Expr *
>(S->getTrailingRequiresClause().ConstraintExpr));
2885 ShouldVisitChildren =
false;
2890 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2912 TRY_TO(TraverseDecl(S->getBlockDecl()));
2918 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2924 if (getDerived().shouldVisitImplicitCode())
2925 TRY_TO(TraverseStmt(S->getExpr()));
2929 if (getDerived().shouldVisitImplicitCode())
2930 TRY_TO(TraverseStmt(S->getExpr()));
2942 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2943 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2944 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2968 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2976 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2980 if (S->isClassReceiver()) {
2982 QualType Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2984 Data.NameLoc = S->getReceiverLocation();
2995 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
3002 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
3005 if (getDerived().shouldVisitImplicitCode()) {
3006 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3007 TRY_TO(TraverseStmt(S->getKernelLaunchIdExpr()));
3008 ShouldVisitChildren =
false;
3025 if (S->hasExplicitTemplateArgs()) {
3026 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3027 S->getNumTemplateArgs()));
3033 if (S->hasExplicitTemplateArgs()) {
3034 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3035 S->getNumTemplateArgs()));
3046 if (getDerived().shouldVisitImplicitCode()) {
3047 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3048 TRY_TO(TraverseStmt(S->getKernelLaunchStmt()));
3049 TRY_TO(TraverseDecl(S->getOutlinedFunctionDecl()));
3050 ShouldVisitChildren =
false;
3056 if (!getDerived().shouldVisitImplicitCode()) {
3058 S->getDecomposedForm();
3059 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
3060 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
3061 ShouldVisitChildren =
false;
3087 if (S->getLifetimeExtendedTemporaryDecl()) {
3088 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
3089 S->getLifetimeExtendedTemporaryDecl()));
3090 ShouldVisitChildren =
false;
3097 if (!getDerived().shouldVisitImplicitCode()) {
3099 ShouldVisitChildren =
false;
3103 if (!getDerived().shouldVisitImplicitCode()) {
3105 ShouldVisitChildren =
false;
3109 if (!getDerived().shouldVisitImplicitCode()) {
3111 ShouldVisitChildren =
false;
3115 if (!getDerived().shouldVisitImplicitCode()) {
3117 ShouldVisitChildren =
false;
3121 if (!getDerived().shouldVisitImplicitCode()) {
3123 ShouldVisitChildren =
false;
3128 TRY_TO(TraverseConceptReference(S->getConceptReference()));
3132 TRY_TO(TraverseDecl(S->getBody()));
3134 TRY_TO(TraverseDecl(Parm));
3136 TRY_TO(TraverseConceptRequirement(Req));
3155template <typename Derived>
3156bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3157 OMPExecutableDirective *S) {
3158 for (
auto *
C : S->clauses()) {
3165 if (!getDerived().shouldVisitImplicitCode()) {
3167 TRY_TO(TraverseStmt(S->getLoopStmt()));
3168 ShouldVisitChildren =
false;
3172template <typename Derived>
3174RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3175 return TraverseOMPExecutableDirective(S);
3179 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3182 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3185 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3188 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3191 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3194 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3197 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3200 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3203 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3206 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3209 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3212 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3215 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3218 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3221 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3224 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3227 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3228 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(TraverseOMPExecutableDirective(S)); })
3262 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3265 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3268 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3271 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3274 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3277 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3280 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3283 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3286 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3289 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3292 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3295 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3298 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3301 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3304 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3307 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3310 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3313 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3316 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3319 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3322 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3325 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3328 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3331 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3334 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3337 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3340 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3343 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3346 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3349 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3352 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3355 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3358 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3361 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3364 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3367 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3370 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3373 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3376 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3379 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3382 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3385 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3388 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3391 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3394 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3397 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3400 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3403 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3406 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3409 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3412template <typename Derived>
3413bool RecursiveASTVisitor<Derived>::TraverseOMPClause(
OMPClause *
C) {
3416 switch (
C->getClauseKind()) {
3417#define GEN_CLANG_CLAUSE_CLASS
3418#define CLAUSE_CLASS(Enum, Str, Class) \
3419 case llvm::omp::Clause::Enum: \
3420 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3422#define CLAUSE_NO_CLASS(Enum, Str) \
3423 case llvm::omp::Clause::Enum: \
3425#include "llvm/Frontend/OpenMP/OMP.inc"
3430template <
typename Derived>
3431bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3433 TRY_TO(TraverseStmt(Node->getPreInitStmt()));
3437template <
typename Derived>
3438bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3440 TRY_TO(VisitOMPClauseWithPreInit(Node));
3441 TRY_TO(TraverseStmt(Node->getPostUpdateExpr()));
3445template <
typename Derived>
3448 TRY_TO(TraverseStmt(
C->getAllocator()));
3452template <
typename Derived>
3454 TRY_TO(TraverseStmt(
C->getAllocator()));
3455 TRY_TO(VisitOMPClauseList(
C));
3459template <
typename Derived>
3461 TRY_TO(VisitOMPClauseWithPreInit(
C));
3462 TRY_TO(TraverseStmt(
C->getCondition()));
3466template <
typename Derived>
3468 TRY_TO(VisitOMPClauseWithPreInit(
C));
3469 TRY_TO(TraverseStmt(
C->getCondition()));
3473template <
typename Derived>
3476 TRY_TO(VisitOMPClauseWithPreInit(
C));
3477 TRY_TO(TraverseStmt(
C->getNumThreads()));
3481template <
typename Derived>
3483 TRY_TO(TraverseStmt(
C->getAlignment()));
3487template <
typename Derived>
3489 TRY_TO(TraverseStmt(
C->getSafelen()));
3493template <
typename Derived>
3495 TRY_TO(TraverseStmt(
C->getSimdlen()));
3499template <
typename Derived>
3501 for (
Expr *E :
C->getSizesRefs())
3506template <
typename Derived>
3509 for (
Expr *E :
C->getArgsRefs())
3514template <
typename Derived>
3519template <
typename Derived>
3522 TRY_TO(TraverseStmt(
C->getFirst()));
3523 TRY_TO(TraverseStmt(
C->getCount()));
3527template <
typename Derived>
3529 TRY_TO(TraverseStmt(
C->getFactor()));
3533template <
typename Derived>
3536 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3540template <
typename Derived>
3545template <
typename Derived>
3551template <
typename Derived>
3553 OMPTransparentClause *
C) {
3554 TRY_TO(TraverseStmt(
C->getImpexType()));
3558template <
typename Derived>
3563template <
typename Derived>
3565 OMPUnifiedAddressClause *) {
3569template <
typename Derived>
3571 OMPUnifiedSharedMemoryClause *) {
3575template <
typename Derived>
3577 OMPReverseOffloadClause *) {
3581template <
typename Derived>
3583 OMPDynamicAllocatorsClause *) {
3587template <
typename Derived>
3589 OMPAtomicDefaultMemOrderClause *) {
3593template <
typename Derived>
3598template <
typename Derived>
3603template <
typename Derived>
3608template <
typename Derived>
3610 TRY_TO(TraverseStmt(
C->getMessageString()));
3614template <
typename Derived>
3617 TRY_TO(VisitOMPClauseWithPreInit(
C));
3618 TRY_TO(TraverseStmt(
C->getChunkSize()));
3622template <
typename Derived>
3624 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3628template <
typename Derived>
3630 TRY_TO(TraverseStmt(
C->getCondition()));
3634template <
typename Derived>
3639template <
typename Derived>
3645template <
typename Derived>
3650template <
typename Derived>
3655template <
typename Derived>
3660template <
typename Derived>
3665template <
typename Derived>
3670template <
typename Derived>
3675template <
typename Derived>
3680template <
typename Derived>
3685template <
typename Derived>
3690template <
typename Derived>
3695template <
typename Derived>
3700template <
typename Derived>
3705template <
typename Derived>
3707 OMPNoOpenMPRoutinesClause *) {
3711template <
typename Derived>
3713 OMPNoOpenMPConstructsClause *) {
3717template <
typename Derived>
3719 OMPNoParallelismClause *) {
3723template <
typename Derived>
3728template <
typename Derived>
3733template <
typename Derived>
3738template <
typename Derived>
3743template <
typename Derived>
3748template <
typename Derived>
3753template <
typename Derived>
3758template <
typename Derived>
3760 TRY_TO(VisitOMPClauseList(
C));
3764template <
typename Derived>
3766 TRY_TO(TraverseStmt(
C->getInteropVar()));
3770template <
typename Derived>
3772 TRY_TO(TraverseStmt(
C->getInteropVar()));
3776template <
typename Derived>
3778 OMPNovariantsClause *
C) {
3779 TRY_TO(VisitOMPClauseWithPreInit(
C));
3780 TRY_TO(TraverseStmt(
C->getCondition()));
3784template <
typename Derived>
3786 OMPNocontextClause *
C) {
3787 TRY_TO(VisitOMPClauseWithPreInit(
C));
3788 TRY_TO(TraverseStmt(
C->getCondition()));
3792template <
typename Derived>
3793template <
typename T>
3794bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
3795 for (
auto *E : Node->varlist()) {
3801template <
typename Derived>
3803 OMPInclusiveClause *
C) {
3804 TRY_TO(VisitOMPClauseList(
C));
3808template <
typename Derived>
3810 OMPExclusiveClause *
C) {
3811 TRY_TO(VisitOMPClauseList(
C));
3815template <
typename Derived>
3817 TRY_TO(VisitOMPClauseList(
C));
3818 for (
auto *E :
C->private_copies()) {
3824template <
typename Derived>
3826 OMPFirstprivateClause *
C) {
3827 TRY_TO(VisitOMPClauseList(
C));
3828 TRY_TO(VisitOMPClauseWithPreInit(
C));
3829 for (
auto *E :
C->private_copies()) {
3832 for (
auto *E :
C->inits()) {
3838template <
typename Derived>
3840 OMPLastprivateClause *
C) {
3841 TRY_TO(VisitOMPClauseList(
C));
3842 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3843 for (
auto *E :
C->private_copies()) {
3846 for (
auto *E :
C->source_exprs()) {
3849 for (
auto *E :
C->destination_exprs()) {
3852 for (
auto *E :
C->assignment_ops()) {
3858template <
typename Derived>
3860 TRY_TO(VisitOMPClauseList(
C));
3864template <
typename Derived>
3866 TRY_TO(TraverseStmt(
C->getStep()));
3867 TRY_TO(TraverseStmt(
C->getCalcStep()));
3868 TRY_TO(VisitOMPClauseList(
C));
3869 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3870 for (
auto *E :
C->privates()) {
3873 for (
auto *E :
C->inits()) {
3876 for (
auto *E :
C->updates()) {
3879 for (
auto *E :
C->finals()) {
3885template <
typename Derived>
3887 TRY_TO(TraverseStmt(
C->getAlignment()));
3888 TRY_TO(VisitOMPClauseList(
C));
3892template <
typename Derived>
3894 TRY_TO(VisitOMPClauseList(
C));
3895 for (
auto *E :
C->source_exprs()) {
3898 for (
auto *E :
C->destination_exprs()) {
3901 for (
auto *E :
C->assignment_ops()) {
3907template <
typename Derived>
3909 OMPCopyprivateClause *
C) {
3910 TRY_TO(VisitOMPClauseList(
C));
3911 for (
auto *E :
C->source_exprs()) {
3914 for (
auto *E :
C->destination_exprs()) {
3917 for (
auto *E :
C->assignment_ops()) {
3923template <
typename Derived>
3927 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3928 TRY_TO(VisitOMPClauseList(
C));
3929 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3930 for (
auto *E :
C->privates()) {
3933 for (
auto *E :
C->lhs_exprs()) {
3936 for (
auto *E :
C->rhs_exprs()) {
3939 for (
auto *E :
C->reduction_ops()) {
3942 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3943 for (
auto *E :
C->copy_ops()) {
3946 for (
auto *E :
C->copy_array_temps()) {
3949 for (
auto *E :
C->copy_array_elems()) {
3956template <
typename Derived>
3958 OMPTaskReductionClause *
C) {
3960 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3961 TRY_TO(VisitOMPClauseList(
C));
3962 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3963 for (
auto *E :
C->privates()) {
3966 for (
auto *E :
C->lhs_exprs()) {
3969 for (
auto *E :
C->rhs_exprs()) {
3972 for (
auto *E :
C->reduction_ops()) {
3978template <
typename Derived>
3980 OMPInReductionClause *
C) {
3982 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3983 TRY_TO(VisitOMPClauseList(
C));
3984 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3985 for (
auto *E :
C->privates()) {
3988 for (
auto *E :
C->lhs_exprs()) {
3991 for (
auto *E :
C->rhs_exprs()) {
3994 for (
auto *E :
C->reduction_ops()) {
3997 for (
auto *E :
C->taskgroup_descriptors())
4002template <
typename Derived>
4004 TRY_TO(VisitOMPClauseList(
C));
4008template <
typename Derived>
4010 TRY_TO(TraverseStmt(
C->getDepobj()));
4014template <
typename Derived>
4016 TRY_TO(VisitOMPClauseList(
C));
4020template <
typename Derived>
4022 TRY_TO(VisitOMPClauseWithPreInit(
C));
4023 TRY_TO(TraverseStmt(
C->getDevice()));
4027template <
typename Derived>
4029 TRY_TO(VisitOMPClauseList(
C));
4033template <
typename Derived>
4035 OMPNumTeamsClause *
C) {
4036 TRY_TO(VisitOMPClauseList(
C));
4037 TRY_TO(VisitOMPClauseWithPreInit(
C));
4041template <
typename Derived>
4043 OMPThreadLimitClause *
C) {
4044 TRY_TO(VisitOMPClauseList(
C));
4045 TRY_TO(VisitOMPClauseWithPreInit(
C));
4049template <
typename Derived>
4051 OMPPriorityClause *
C) {
4052 TRY_TO(VisitOMPClauseWithPreInit(
C));
4053 TRY_TO(TraverseStmt(
C->getPriority()));
4057template <
typename Derived>
4059 OMPGrainsizeClause *
C) {
4060 TRY_TO(VisitOMPClauseWithPreInit(
C));
4061 TRY_TO(TraverseStmt(
C->getGrainsize()));
4065template <
typename Derived>
4067 OMPNumTasksClause *
C) {
4068 TRY_TO(VisitOMPClauseWithPreInit(
C));
4069 TRY_TO(TraverseStmt(
C->getNumTasks()));
4073template <
typename Derived>
4075 TRY_TO(TraverseStmt(
C->getHint()));
4079template <
typename Derived>
4081 OMPDistScheduleClause *
C) {
4082 TRY_TO(VisitOMPClauseWithPreInit(
C));
4083 TRY_TO(TraverseStmt(
C->getChunkSize()));
4087template <
typename Derived>
4093template <
typename Derived>
4095 TRY_TO(VisitOMPClauseList(
C));
4099template <
typename Derived>
4101 TRY_TO(VisitOMPClauseList(
C));
4105template <
typename Derived>
4107 OMPUseDevicePtrClause *
C) {
4108 TRY_TO(VisitOMPClauseList(
C));
4112template <
typename Derived>
4114 OMPUseDeviceAddrClause *
C) {
4115 TRY_TO(VisitOMPClauseList(
C));
4119template <
typename Derived>
4121 OMPIsDevicePtrClause *
C) {
4122 TRY_TO(VisitOMPClauseList(
C));
4126template <
typename Derived>
4128 OMPHasDeviceAddrClause *
C) {
4129 TRY_TO(VisitOMPClauseList(
C));
4133template <
typename Derived>
4135 OMPNontemporalClause *
C) {
4136 TRY_TO(VisitOMPClauseList(
C));
4137 for (
auto *E :
C->private_refs()) {
4143template <
typename Derived>
4148template <
typename Derived>
4150 TRY_TO(TraverseStmt(
C->getEventHandler()));
4154template <
typename Derived>
4156 OMPUsesAllocatorsClause *
C) {
4157 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
4158 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
4165template <
typename Derived>
4167 OMPAffinityClause *
C) {
4168 TRY_TO(TraverseStmt(
C->getModifier()));
4169 for (
Expr *E :
C->varlist())
4174template <
typename Derived>
4176 TRY_TO(VisitOMPClauseWithPreInit(
C));
4177 TRY_TO(TraverseStmt(
C->getThreadID()));
4181template <
typename Derived>
4186template <
typename Derived>
4188 OMPXDynCGroupMemClause *
C) {
4189 TRY_TO(VisitOMPClauseWithPreInit(
C));
4190 TRY_TO(TraverseStmt(
C->getSize()));
4194template <
typename Derived>
4196 OMPDynGroupprivateClause *
C) {
4197 TRY_TO(VisitOMPClauseWithPreInit(
C));
4198 TRY_TO(TraverseStmt(
C->getSize()));
4202template <
typename Derived>
4204 OMPDoacrossClause *
C) {
4205 TRY_TO(VisitOMPClauseList(
C));
4209template <
typename Derived>
4211 OMPXAttributeClause *
C) {
4215template <
typename Derived>
4220template <
typename Derived>
4221bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4223 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4227template <
typename Derived>
4228bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4230 TRY_TO(TraverseOpenACCConstructStmt(S));
4231 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4235template <
typename Derived>
4236bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *
C) {
4237 for (
const Stmt *Child :
C->children())
4238 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4242template <
typename Derived>
4243bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4246 for (
const auto *
C : Clauses)
4247 TRY_TO(VisitOpenACCClause(
C));
4252 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4254 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4256 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4258 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4260 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4262 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4264 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4266 if (S->hasDevNumExpr())
4267 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4268 for (
auto *E : S->getQueueIdExprs())
4270 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4273 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4275 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4277 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4279 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4281 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4283 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 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 '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,...
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 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.
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.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
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...
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.
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