13#ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14#define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
47#include "llvm/ADT/PointerIntPair.h"
48#include "llvm/ADT/SmallVector.h"
49#include "llvm/Support/Casting.h"
60#define TRY_TO(CALL_EXPR) \
62 if (!getDerived().CALL_EXPR) \
68template <
typename T,
typename U>
70template <
typename T,
typename U,
typename R,
typename...
P>
76template <
typename FirstMethodPtrTy,
typename SecondMethodPtrTy>
77LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG
auto
79 [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
82 SecondMethodPtrTy>::value)
83 return FirstMethodPtr == SecondMethodPtr;
165 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
330#define ATTR_VISITOR_DECLS_ONLY
331#include "clang/AST/AttrVisitor.inc"
332#undef ATTR_VISITOR_DECLS_ONLY
344#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
345 (::clang::detail::has_same_member_pointer_type< \
346 decltype(&RecursiveASTVisitor::Traverse##NAME), \
347 decltype(&Derived::Traverse##NAME)>::value \
348 ? static_cast<std::conditional_t< \
349 ::clang::detail::has_same_member_pointer_type< \
350 decltype(&RecursiveASTVisitor::Traverse##NAME), \
351 decltype(&Derived::Traverse##NAME)>::value, \
352 Derived &, RecursiveASTVisitor &>>(*this) \
353 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
354 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
359#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
361 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
367#define ABSTRACT_STMT(STMT)
368#define STMT(CLASS, PARENT) \
369 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
370#include "clang/AST/StmtNodes.inc"
376#define STMT(CLASS, PARENT) \
377 bool WalkUpFrom##CLASS(CLASS *S) { \
378 TRY_TO(WalkUpFrom##PARENT(S)); \
379 TRY_TO(Visit##CLASS(S)); \
382 bool Visit##CLASS(CLASS *S) { return true; }
383#include "clang/AST/StmtNodes.inc"
389#define ABSTRACT_TYPE(CLASS, BASE)
390#define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T);
391#include "clang/AST/TypeNodes.inc"
397#define TYPE(CLASS, BASE) \
398 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
399 TRY_TO(WalkUpFrom##BASE(T)); \
400 TRY_TO(Visit##CLASS##Type(T)); \
403 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
404#include "clang/AST/TypeNodes.inc"
410#define ABSTRACT_TYPELOC(CLASS, BASE)
411#define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
412#include "clang/AST/TypeLocNodes.def"
431#define TYPE(CLASS, BASE) \
432 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
433 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
434 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
437 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
438#include "clang/AST/TypeNodes.inc"
443#define ABSTRACT_DECL(DECL)
444#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
445#include "clang/AST/DeclNodes.inc"
451#define DECL(CLASS, BASE) \
452 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
453 TRY_TO(WalkUpFrom##BASE(D)); \
454 TRY_TO(Visit##CLASS##Decl(D)); \
457 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
458#include "clang/AST/DeclNodes.inc"
462#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
463 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
467#undef DEF_TRAVERSE_TMPL_INST
483 template <
typename T>
484 bool TraverseDeclTemplateParameterLists(
T *
D);
500#define GEN_CLANG_CLAUSE_CLASS
501#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
502#include "llvm/Frontend/OpenMP/OMP.inc"
504 template <
typename T>
bool VisitOMPClauseList(
T *
Node);
506 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *
Node);
507 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
509 bool PostVisitStmt(Stmt *S);
510 bool TraverseOpenACCConstructStmt(OpenACCConstructStmt *S);
512 TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S);
513 bool VisitOpenACCClauseList(ArrayRef<const OpenACCClause *>);
514 bool VisitOpenACCClause(
const OpenACCClause *);
517template <
typename Derived>
520 if (!getDerived().shouldVisitImplicitCode()) {
521 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
524 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
525 TRY_TO(TraverseStmt(IDC));
531 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
536template <
typename Derived>
541 return getDerived().TraverseConceptTypeRequirement(
542 cast<concepts::TypeRequirement>(R));
545 return getDerived().TraverseConceptExprRequirement(
546 cast<concepts::ExprRequirement>(R));
548 return getDerived().TraverseConceptNestedRequirement(
549 cast<concepts::NestedRequirement>(R));
551 llvm_unreachable(
"unexpected case");
554template <
typename Derived>
558 switch (S->getStmtClass()) {
561#define ABSTRACT_STMT(STMT)
562#define STMT(CLASS, PARENT) \
563 case Stmt::CLASS##Class: \
564 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
565#include "clang/AST/StmtNodes.inc"
573template <
typename Derived>
581template <
typename Derived>
587 if (RetReq.isTypeConstraint()) {
588 if (getDerived().shouldVisitImplicitCode()) {
589 TRY_TO(TraverseTemplateParameterListHelper(
590 RetReq.getTypeConstraintTemplateParameterList()));
593 TRY_TO(TraverseTypeConstraint(RetReq.getTypeConstraint()));
599template <
typename Derived>
607template <
typename Derived>
625 switch (S->getStmtClass()) {
628#define ABSTRACT_STMT(STMT)
629#define STMT(CLASS, PARENT) \
630 case Stmt::CLASS##Class: \
631 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
632 &Derived::Traverse##CLASS)) { \
633 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
636#define INITLISTEXPR(CLASS, PARENT) \
637 case Stmt::CLASS##Class: \
638 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
639 &Derived::Traverse##CLASS)) { \
640 auto ILE = static_cast<CLASS *>(S); \
641 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
642 TRY_TO(WalkUpFrom##CLASS(Syn)); \
643 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
644 TRY_TO(WalkUpFrom##CLASS(Sem)); \
647#include "clang/AST/StmtNodes.inc"
655template <
typename Derived>
662 Queue->push_back({S,
false});
667 LocalQueue.push_back({S,
false});
669 while (!LocalQueue.empty()) {
670 auto &CurrSAndVisited = LocalQueue.back();
671 Stmt *CurrS = CurrSAndVisited.getPointer();
672 bool Visited = CurrSAndVisited.getInt();
674 LocalQueue.pop_back();
675 TRY_TO(dataTraverseStmtPost(CurrS));
676 if (getDerived().shouldTraversePostOrder()) {
677 TRY_TO(PostVisitStmt(CurrS));
682 if (getDerived().dataTraverseStmtPre(CurrS)) {
683 CurrSAndVisited.setInt(
true);
684 size_t N = LocalQueue.size();
685 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
687 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
689 LocalQueue.pop_back();
696template <
typename Derived>
702#define ABSTRACT_TYPE(CLASS, BASE)
703#define TYPE(CLASS, BASE) \
705 return getDerived().Traverse##CLASS##Type( \
706 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));
707#include "clang/AST/TypeNodes.inc"
713template <
typename Derived>
719#define ABSTRACT_TYPELOC(CLASS, BASE)
720#define TYPELOC(CLASS, BASE) \
721 case TypeLoc::CLASS: \
722 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
723#include "clang/AST/TypeLocNodes.def"
730#define VISITORCLASS RecursiveASTVisitor
731#include "clang/AST/AttrVisitor.inc"
734template <
typename Derived>
741 if (!getDerived().shouldVisitImplicitCode()) {
746 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(
D))
747 return TraverseTemplateTypeParamDeclConstraints(TTPD);
758 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
D))
759 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
760 FTD->getDeclName().getCXXDeductionGuideTemplate()))
765#define ABSTRACT_DECL(DECL)
766#define DECL(CLASS, BASE) \
768 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
771#include "clang/AST/DeclNodes.inc"
776template <
typename Derived>
801template <
typename Derived>
808 TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
827template <
typename Derived>
835 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
839 TRY_TO(TraverseTemplateName(
856template <
typename Derived>
859 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
862 if (QTN->getQualifier()) {
863 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
870template <
typename Derived>
882 return getDerived().TraverseType(Arg.
getAsType());
886 return getDerived().TraverseTemplateName(
890 return getDerived().TraverseStmt(Arg.
getAsExpr());
893 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
901template <
typename Derived>
917 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
919 return getDerived().TraverseType(Arg.
getAsType());
925 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
927 return getDerived().TraverseTemplateName(
934 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
940template <
typename Derived>
944 TRY_TO(TraverseTemplateArgument(Arg));
949template <
typename Derived>
953 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
955 if (
Init->isWritten() || getDerived().shouldVisitImplicitCode())
961template <
typename Derived>
966 if (LE->isInitCapture(
C))
967 TRY_TO(TraverseDecl(
C->getCapturedVar()));
976#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
977 template <typename Derived> \
978 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
979 if (!getDerived().shouldTraversePostOrder()) \
980 TRY_TO(WalkUpFrom##TYPE(T)); \
982 if (getDerived().shouldTraversePostOrder()) \
983 TRY_TO(WalkUpFrom##TYPE(T)); \
1003 TRY_TO(TraverseType(QualType(
T->getClass(), 0)));
1012 TRY_TO(TraverseType(
T->getElementType()));
1013 if (
T->getSizeExpr())
1014 TRY_TO(TraverseStmt(
const_cast<Expr*
>(
T->getSizeExpr())));
1018 TRY_TO(TraverseType(
T->getElementType()));
1019 if (
T->getSizeExpr())
1020 TRY_TO(TraverseStmt(
const_cast<Expr *
>(
T->getSizeExpr())));
1024 {
TRY_TO(TraverseType(
T->getElementType())); })
1027 TRY_TO(TraverseType(
T->getElementType()));
1032 TRY_TO(TraverseType(
T->getElementType()));
1033 if (
T->getSizeExpr())
1034 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1038 TRY_TO(TraverseStmt(
T->getAddrSpaceExpr()));
1043 if (
T->getSizeExpr())
1044 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1045 TRY_TO(TraverseType(
T->getElementType()));
1049 if (
T->getSizeExpr())
1050 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1059 {
TRY_TO(TraverseType(
T->getElementType())); })
1062 if (
T->getRowExpr())
1063 TRY_TO(TraverseStmt(
T->getRowExpr()));
1064 if (
T->getColumnExpr())
1065 TRY_TO(TraverseStmt(
T->getColumnExpr()));
1066 TRY_TO(TraverseType(
T->getElementType()));
1084 TRY_TO(TraverseStmt(NE));
1092 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1097 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1100 TRY_TO(TraverseType(
T->getPattern()));
1105 TRY_TO(TraverseType(
T->getBaseType()));
1106 TRY_TO(TraverseType(
T->getUnderlyingType()));
1110 TRY_TO(TraverseType(
T->getDeducedType()));
1111 if (
T->isConstrained()) {
1112 TRY_TO(TraverseTemplateArguments(
T->getTypeConstraintArguments()));
1116 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1117 TRY_TO(TraverseType(
T->getDeducedType()));
1124 TRY_TO(TraverseType(
T->getReplacementType()));
1127 TRY_TO(TraverseTemplateArgument(
T->getArgumentPack()));
1131 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1132 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1138 {
TRY_TO(TraverseType(
T->getModifiedType())); })
1141 if (
T->getCountExpr())
1142 TRY_TO(TraverseStmt(
T->getCountExpr()));
1147 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1152 {
TRY_TO(TraverseType(
T->getUnderlyingType())); })
1155 if (
T->getQualifier()) {
1156 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1158 TRY_TO(TraverseType(
T->getNamedType()));
1162 {
TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier())); })
1165 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1166 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1178 if (
T->getBaseType().getTypePtr() !=
T)
1179 TRY_TO(TraverseType(
T->getBaseType()));
1180 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1181 TRY_TO(TraverseType(typeArg));
1194 {
TRY_TO(TraverseStmt(
T->getNumBitsExpr())); })
1206 template <
typename Derived> \
1207 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##
Loc(
TYPE##
Loc TL) { \
1208 if (!getDerived().shouldTraversePostOrder()) { \
1209 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1210 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1211 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1214 if (getDerived().shouldTraversePostOrder()) { \
1215 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1216 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1217 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1222template <
typename Derived>
1224RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1240 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1247 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1251 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1254 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1257 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1260 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1265 if (
auto *TSI = TL.getClassTInfo())
1266 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1273 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1276 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1278template <typename Derived>
1279bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1281 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1286 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1287 TRY_TO(TraverseArrayTypeLocHelper(TL));
1291 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1296 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1297 TRY_TO(TraverseArrayTypeLocHelper(TL));
1301 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1302 TRY_TO(TraverseArrayTypeLocHelper(TL));
1306 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1307 TRY_TO(TraverseArrayTypeLocHelper(TL));
1311 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1312 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1318 if (TL.getTypePtr()->getSizeExpr())
1319 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1320 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1325 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1329 if (TL.getTypePtr()->getSizeExpr())
1330 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1331 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1337 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1341 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1342 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1343 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1347 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1348 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1349 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1353 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1357 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1361 for (
unsigned I = 0,
E = TL.getNumParams(); I !=
E; ++I) {
1362 if (TL.getParam(I)) {
1363 TRY_TO(TraverseDecl(TL.getParam(I)));
1364 }
else if (I < T->getNumParams()) {
1374 TRY_TO(TraverseStmt(NE));
1382 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1385 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1390 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1394 TRY_TO(TraverseType(TL.getPattern()));
1395 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1399 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1403 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1404 if (TL.isConstrained()) {
1405 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1410 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1411 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1418 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1421 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1426 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1427 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1428 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1437 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1440 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1443 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1446 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1449 if (TL.getQualifierLoc()) {
1450 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1452 TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
1456 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1460 if (TL.getQualifierLoc()) {
1461 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1464 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1465 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1470 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1473 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1474 ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));
1475 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1484 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1485 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1486 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1487 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1488 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1489 ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));
1490 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1495 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1503 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1515template <typename Derived>
1517 const Decl *Child) {
1520 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1523 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1524 return Cls->isLambda();
1528template <
typename Derived>
1529bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {
1533 for (
auto *Child : DC->decls()) {
1534 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1535 TRY_TO(TraverseDecl(Child));
1542#define DEF_TRAVERSE_DECL(DECL, CODE) \
1543 template <typename Derived> \
1544 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1545 bool ShouldVisitChildren = true; \
1546 bool ReturnValue = true; \
1547 if (!getDerived().shouldTraversePostOrder()) \
1548 TRY_TO(WalkUpFrom##DECL(D)); \
1550 if (ReturnValue && ShouldVisitChildren) \
1551 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1552 if (ReturnValue) { \
1554 for (auto *I : D->attrs()) \
1555 TRY_TO(getDerived().TraverseAttr(I)); \
1557 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1558 TRY_TO(WalkUpFrom##DECL(D)); \
1559 return ReturnValue; \
1565 if (TypeSourceInfo *TInfo =
D->getSignatureAsWritten())
1566 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1568 for (
const auto &I :
D->captures()) {
1569 if (I.hasCopyExpr()) {
1570 TRY_TO(TraverseStmt(I.getCopyExpr()));
1573 ShouldVisitChildren =
false;
1577 TRY_TO(TraverseStmt(
D->getBody()));
1578 ShouldVisitChildren =
false;
1586 TRY_TO(TraverseStmt(
D->getTemporaryExpr()));
1590 {
TRY_TO(TraverseStmt(
D->getAsmString())); })
1598 if (
D->getFriendType()) {
1599 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1602 if (
auto *ET =
D->getFriendType()->getType()->getAs<ElaboratedType>())
1603 TRY_TO(TraverseDecl(ET->getOwnedTagDecl()));
1605 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1610 if (
D->getFriendType())
1611 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1613 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1614 for (
unsigned I = 0,
E =
D->getNumTemplateParameters(); I <
E; ++I) {
1615 TemplateParameterList *TPL =
D->getTemplateParameterList(I);
1616 for (TemplateParameterList::iterator ITPL = TPL->begin(), ETPL = TPL->end();
1617 ITPL != ETPL; ++ITPL) {
1618 TRY_TO(TraverseDecl(*ITPL));
1631 TRY_TO(TraverseStmt(
D->getAssertExpr()));
1632 TRY_TO(TraverseStmt(
D->getMessage()));
1642 auto Scope =
D->getASTContext().getTraversalScope();
1643 bool HasLimitedScope =
1644 Scope.size() != 1 || !isa<TranslationUnitDecl>(Scope.front());
1645 if (HasLimitedScope) {
1646 ShouldVisitChildren =
false;
1647 for (
auto *Child : Scope) {
1648 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1649 TRY_TO(TraverseDecl(Child));
1661 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1665 ShouldVisitChildren =
false;
1682 if (ObjCTypeParamList *typeParamList =
D->getTypeParamList()) {
1683 for (
auto typeParam : *typeParamList) {
1684 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1687 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1688 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1689 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1700 if (ObjCTypeParamList *typeParamList =
D->getTypeParamListAsWritten()) {
1701 for (
auto typeParam : *typeParamList) {
1702 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1706 if (TypeSourceInfo *superTInfo =
D->getSuperClassTInfo()) {
1707 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1709 if (
D->isThisDeclarationADefinition()) {
1710 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1711 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1712 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1718 if (
D->isThisDeclarationADefinition()) {
1719 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1720 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1721 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1727 if (
D->getReturnTypeSourceInfo()) {
1728 TRY_TO(TraverseTypeLoc(
D->getReturnTypeSourceInfo()->getTypeLoc()));
1730 for (ParmVarDecl *Parameter :
D->parameters()) {
1731 TRY_TO(TraverseDecl(Parameter));
1733 if (
D->isThisDeclarationADefinition()) {
1734 TRY_TO(TraverseStmt(
D->getBody()));
1736 ShouldVisitChildren =
false;
1740 if (
D->hasExplicitBound()) {
1741 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1749 if (
D->getTypeSourceInfo())
1750 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1752 TRY_TO(TraverseType(
D->getType()));
1753 ShouldVisitChildren =
false;
1757 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1758 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
1762 {
TRY_TO(TraverseTypeLoc(
D->getEnumTypeLoc())); })
1767 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1775 for (
auto *I :
D->varlist()) {
1781 for (
auto *C :
D->clauselists()) {
1782 TRY_TO(TraverseOMPClause(C));
1787 TRY_TO(TraverseStmt(
D->getCombiner()));
1788 if (
auto *Initializer =
D->getInitializer())
1789 TRY_TO(TraverseStmt(Initializer));
1790 TRY_TO(TraverseType(
D->getType()));
1795 for (
auto *C :
D->clauselists())
1796 TRY_TO(TraverseOMPClause(C));
1797 TRY_TO(TraverseType(
D->getType()));
1804 for (
auto *I :
D->varlist())
1806 for (
auto *C :
D->clauselists())
1807 TRY_TO(TraverseOMPClause(C));
1811template <typename Derived>
1812bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1813 TemplateParameterList *TPL) {
1815 for (NamedDecl *
D : *TPL) {
1818 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1819 TRY_TO(TraverseStmt(RequiresClause));
1825template <
typename Derived>
1826template <
typename T>
1827bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *
D) {
1828 for (
unsigned i = 0; i <
D->getNumTemplateParameterLists(); i++) {
1829 TemplateParameterList *TPL =
D->getTemplateParameterList(i);
1830 TraverseTemplateParameterListHelper(TPL);
1835template <
typename Derived>
1836bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1837 ClassTemplateDecl *
D) {
1838 for (
auto *SD :
D->specializations()) {
1839 for (
auto *RD : SD->redecls()) {
1840 assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName());
1842 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1846 TRY_TO(TraverseDecl(RD));
1863template <
typename Derived>
1864bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1865 VarTemplateDecl *
D) {
1866 for (
auto *SD :
D->specializations()) {
1867 for (
auto *RD : SD->redecls()) {
1869 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1872 TRY_TO(TraverseDecl(RD));
1888template <
typename Derived>
1889bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1890 FunctionTemplateDecl *
D) {
1891 for (
auto *FD :
D->specializations()) {
1892 for (
auto *RD : FD->redecls()) {
1893 switch (RD->getTemplateSpecializationKind()) {
1897 TRY_TO(TraverseDecl(RD));
1904 TRY_TO(TraverseDecl(RD));
1918#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
1919 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
1920 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
1921 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
1929 if (getDerived().shouldVisitTemplateInstantiations() && \
1930 D == D->getCanonicalDecl()) \
1931 TRY_TO(TraverseTemplateInstantiations(D)); \
1945 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
1946 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1947 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1948 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1952 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1955template <typename Derived>
1956bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
1957 const TemplateTypeParmDecl *
D) {
1958 if (
const auto *TC =
D->getTypeConstraint())
1959 TRY_TO(TraverseTypeConstraint(TC));
1965 if (
D->getTypeForDecl())
1966 TRY_TO(TraverseType(QualType(
D->getTypeForDecl(), 0)));
1967 TRY_TO(TraverseTemplateTypeParamDeclConstraints(
D));
1968 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1969 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1973 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1980 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1987 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
1988 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1992 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1993 TRY_TO(TraverseStmt(
D->getConstraintExpr()));
1999 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2008 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2010 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2011 if (
auto *TSI =
D->getIntegerTypeSourceInfo())
2012 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2018template <typename Derived>
2019bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *
D) {
2023 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2024 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2028template <
typename Derived>
2029bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
2030 const CXXBaseSpecifier &
Base) {
2031 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2035template <
typename Derived>
2036bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *
D) {
2037 if (!TraverseRecordHelper(
D))
2039 if (
D->isCompleteDefinition()) {
2040 for (
const auto &I :
D->bases()) {
2041 TRY_TO(TraverseCXXBaseSpecifier(I));
2053template <typename Derived>
2054bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2055 const TemplateArgumentLoc *TAL,
unsigned Count) {
2056 for (
unsigned I = 0; I < Count; ++I) {
2057 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2062#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2063 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2072 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2074 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2075 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2078 if (getDerived().shouldVisitTemplateInstantiations() || \
2079 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2081 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2083 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2096#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2097 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2099 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2101 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2102 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2103 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2108 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2121 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2122 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2127template <typename Derived>
2128bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *
D) {
2129 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2130 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2131 if (
D->getTypeSourceInfo())
2132 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2134 TRY_TO(TraverseType(
D->getType()));
2140 for (
auto *Binding :
D->bindings()) {
2141 TRY_TO(TraverseDecl(Binding));
2146 if (getDerived().shouldVisitImplicitCode())
2147 TRY_TO(TraverseStmt(
D->getBinding()));
2158 TRY_TO(TraverseDeclaratorHelper(
D));
2159 if (
D->isBitField())
2160 TRY_TO(TraverseStmt(
D->getBitWidth()));
2161 if (
D->hasInClassInitializer())
2162 TRY_TO(TraverseStmt(
D->getInClassInitializer()));
2166 TRY_TO(TraverseDeclaratorHelper(
D));
2167 if (
D->isBitField())
2168 TRY_TO(TraverseStmt(
D->getBitWidth()));
2173 TRY_TO(TraverseDeclaratorHelper(
D));
2174 if (
D->isBitField())
2175 TRY_TO(TraverseStmt(
D->getBitWidth()));
2179template <typename Derived>
2180bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *
D) {
2181 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2182 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2183 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2190 if (
const FunctionTemplateSpecializationInfo *FTSI =
2191 D->getTemplateSpecializationInfo()) {
2192 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2193 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2196 if (
const ASTTemplateArgumentListInfo *TALI =
2197 FTSI->TemplateArgumentsAsWritten) {
2198 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2199 TALI->NumTemplateArgs));
2202 }
else if (
const DependentFunctionTemplateSpecializationInfo *DFSI =
2203 D->getDependentSpecializationInfo()) {
2204 if (
const ASTTemplateArgumentListInfo *TALI =
2205 DFSI->TemplateArgumentsAsWritten) {
2206 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2207 TALI->NumTemplateArgs));
2215 if (TypeSourceInfo *TSI =
D->getTypeSourceInfo()) {
2216 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2217 }
else if (getDerived().shouldVisitImplicitCode()) {
2222 for (ParmVarDecl *Parameter :
D->parameters()) {
2223 TRY_TO(TraverseDecl(Parameter));
2228 if (Expr *TrailingRequiresClause =
D->getTrailingRequiresClause()) {
2229 TRY_TO(TraverseStmt(TrailingRequiresClause));
2232 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(
D)) {
2234 for (
auto *I : Ctor->inits()) {
2235 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2236 TRY_TO(TraverseConstructorInitializer(I));
2241 D->isThisDeclarationADefinition() &&
2244 (!
D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2246 if (
const auto *MD = dyn_cast<CXXMethodDecl>(
D)) {
2247 if (
const CXXRecordDecl *RD = MD->getParent()) {
2248 if (RD->isLambda() &&
2250 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2256 TRY_TO(TraverseStmt(
D->getBody()));
2259 for (
auto *Child :
D->decls()) {
2260 if (isa<UsingShadowDecl>(Child))
2261 TRY_TO(TraverseDecl(Child));
2270 ShouldVisitChildren =
false;
2277 ShouldVisitChildren =
false;
2284 ShouldVisitChildren =
false;
2291 ShouldVisitChildren =
false;
2300 ShouldVisitChildren =
false;
2307 ShouldVisitChildren =
false;
2311template <typename Derived>
2312bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *
D) {
2313 TRY_TO(TraverseDeclaratorHelper(
D));
2315 if (!isa<ParmVarDecl>(
D) &&
2316 (!
D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2317 TRY_TO(TraverseStmt(
D->getInit()));
2327 TRY_TO(TraverseDeclaratorHelper(
D));
2328 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2329 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2335 if (
D->hasDefaultArg() &&
D->hasUninstantiatedDefaultArg() &&
2336 !
D->hasUnparsedDefaultArg())
2337 TRY_TO(TraverseStmt(
D->getUninstantiatedDefaultArg()));
2339 if (
D->hasDefaultArg() && !
D->hasUninstantiatedDefaultArg() &&
2340 !
D->hasUnparsedDefaultArg())
2341 TRY_TO(TraverseStmt(
D->getDefaultArg()));
2347 TRY_TO(TraverseTemplateArguments(
D->getTemplateArguments()));
2363 template <
typename Derived> \
2364 bool RecursiveASTVisitor<Derived>::Traverse##
STMT( \
2365 STMT *S, DataRecursionQueue *Queue) { \
2366 bool ShouldVisitChildren =
true; \
2368 if (!getDerived().shouldTraversePostOrder()) \
2369 TRY_TO(WalkUpFrom##
STMT(S)); \
2371 if (ShouldVisitChildren) { \
2372 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2373 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2380 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2381 TRY_TO(WalkUpFrom##
STMT(S)); \
2388 for (
unsigned I = 0,
E = S->getNumInputs(); I <
E; ++I) {
2391 for (
unsigned I = 0,
E = S->getNumOutputs(); I <
E; ++I) {
2394 for (
unsigned I = 0,
E = S->getNumClobbers(); I <
E; ++I) {
2407 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2412 for (
auto *I : S->decls()) {
2420 ShouldVisitChildren =
false;
2448 if (!getDerived().shouldVisitImplicitCode()) {
2455 ShouldVisitChildren =
false;
2460 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2461 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2471 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2472 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2473 if (S->hasExplicitTemplateArgs()) {
2474 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2475 S->getNumTemplateArgs()));
2480 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2481 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2482 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2483 S->getNumTemplateArgs()));
2487 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2488 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2489 if (S->hasExplicitTemplateArgs()) {
2490 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2491 S->getNumTemplateArgs()));
2496 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2497 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2498 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2499 S->getNumTemplateArgs()));
2509 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2513 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2517 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2521 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2525 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2529 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2533 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2537 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2540template <typename Derived>
2541bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2542 InitListExpr *S, DataRecursionQueue *Queue) {
2546 if (!getDerived().shouldTraversePostOrder())
2547 TRY_TO(WalkUpFromInitListExpr(S));
2550 for (Stmt *SubStmt : S->children()) {
2554 if (!Queue && getDerived().shouldTraversePostOrder())
2555 TRY_TO(WalkUpFromInitListExpr(S));
2560template <
typename Derived>
2561bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
2562 ObjCProtocolLoc ProtocolLoc) {
2566template <
typename Derived>
2567bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2568 ConceptReference *CR) {
2569 if (!getDerived().shouldTraversePostOrder())
2570 TRY_TO(VisitConceptReference(CR));
2571 TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
2572 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2573 if (CR->hasExplicitTemplateArgs())
2574 TRY_TO(TraverseTemplateArgumentLocsHelper(
2575 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2576 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2577 if (getDerived().shouldTraversePostOrder())
2578 TRY_TO(VisitConceptReference(CR));
2590template <
typename Derived>
2591bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2592 InitListExpr *S, DataRecursionQueue *Queue) {
2593 if (S->isSemanticForm() && S->isSyntacticForm()) {
2595 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2598 TRY_TO(TraverseSynOrSemInitListExpr(
2599 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2600 if (getDerived().shouldVisitImplicitCode()) {
2603 TRY_TO(TraverseSynOrSemInitListExpr(
2604 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2613 if (S->isExprPredicate())
2614 TRY_TO(TraverseStmt(S->getControllingExpr()));
2616 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2618 for (
const GenericSelectionExpr::Association Assoc : S->associations()) {
2619 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2620 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2621 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2623 ShouldVisitChildren =
false;
2630 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2631 e = S->semantics_end();
2634 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2635 sub = OVE->getSourceExpr();
2638 ShouldVisitChildren =
false;
2644 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2649 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2657 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2663 if (S->isArgumentType())
2664 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2670 if (S->isTypeOperand())
2671 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2675 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2683 if (S->isTypeOperand())
2684 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2688 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2689 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2693 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2701 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2706 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2712 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2713 const LambdaCapture *
C = S->capture_begin() + I;
2714 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2715 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2719 if (getDerived().shouldVisitImplicitCode()) {
2721 TRY_TO(TraverseDecl(S->getLambdaClass()));
2724 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2725 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2727 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2728 if (S->hasExplicitParameters()) {
2730 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2731 TRY_TO(TraverseDecl(Proto.getParam(I)));
2734 auto *
T = Proto.getTypePtr();
2741 if (S->hasExplicitResultType())
2742 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2747 ShouldVisitChildren =
false;
2752 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2771 TRY_TO(TraverseDecl(S->getBlockDecl()));
2777 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2783 if (getDerived().shouldVisitImplicitCode())
2784 TRY_TO(TraverseStmt(S->getExpr()));
2788 if (getDerived().shouldVisitImplicitCode())
2789 TRY_TO(TraverseStmt(S->getExpr()));
2799 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2800 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2801 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2802 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2803 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2818 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2825 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2826 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2833 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2834 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2838 if (S->isClassReceiver()) {
2839 ObjCInterfaceDecl *IDecl = S->getClassReceiver();
2840 QualType
Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2841 ObjCInterfaceLocInfo
Data;
2842 Data.NameLoc = S->getReceiverLocation();
2853 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2860 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2868 for (IntegerLiteral *IL : S->underlying_data_elements()) {
2874 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2875 if (S->hasExplicitTemplateArgs()) {
2876 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2877 S->getNumTemplateArgs()));
2882 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2883 if (S->hasExplicitTemplateArgs()) {
2884 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2885 S->getNumTemplateArgs()));
2897 if (!getDerived().shouldVisitImplicitCode()) {
2898 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
2899 S->getDecomposedForm();
2900 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
2901 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
2902 ShouldVisitChildren =
false;
2929 if (S->getLifetimeExtendedTemporaryDecl()) {
2930 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
2931 S->getLifetimeExtendedTemporaryDecl()));
2932 ShouldVisitChildren =
false;
2939 if (!getDerived().shouldVisitImplicitCode()) {
2941 ShouldVisitChildren =
false;
2945 if (!getDerived().shouldVisitImplicitCode()) {
2947 ShouldVisitChildren =
false;
2951 if (!getDerived().shouldVisitImplicitCode()) {
2953 ShouldVisitChildren =
false;
2957 if (!getDerived().shouldVisitImplicitCode()) {
2959 ShouldVisitChildren =
false;
2963 if (!getDerived().shouldVisitImplicitCode()) {
2965 ShouldVisitChildren =
false;
2970 TRY_TO(TraverseConceptReference(S->getConceptReference()));
2974 TRY_TO(TraverseDecl(S->getBody()));
2975 for (ParmVarDecl *Parm : S->getLocalParameters())
2976 TRY_TO(TraverseDecl(Parm));
2977 for (concepts::Requirement *Req : S->getRequirements())
2978 TRY_TO(TraverseConceptRequirement(Req));
2997template <typename Derived>
2998bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
2999 OMPExecutableDirective *S) {
3000 for (
auto *C : S->clauses()) {
3001 TRY_TO(TraverseOMPClause(C));
3007 if (!getDerived().shouldVisitImplicitCode()) {
3009 TRY_TO(TraverseStmt(S->getLoopStmt()));
3010 ShouldVisitChildren =
false;
3014template <typename Derived>
3016RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3017 return TraverseOMPExecutableDirective(S);
3021 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3024 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3027 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3030 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3033 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3036 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3039 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3042 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3045 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3048 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3051 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3054 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3057 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3060 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3063 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3064 TRY_TO(TraverseOMPExecutableDirective(S));
3068 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3071 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3074 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3077 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3080 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3083 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3086 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3089 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3092 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3095 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3098 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3101 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3104 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3107 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3110 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3113 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3116 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3119 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3122 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3125 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3128 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3131 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3134 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3137 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3140 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3143 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3146 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3149 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3152 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3155 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3158 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3161 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3164 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3167 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3170 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3173 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3176 {
TRY_TO(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(TraverseOMPExecutableDirective(S)); })
3230 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3233 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3236 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3239 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3242 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3245 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3248template <typename Derived>
3249bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
3252 switch (
C->getClauseKind()) {
3253#define GEN_CLANG_CLAUSE_CLASS
3254#define CLAUSE_CLASS(Enum, Str, Class) \
3255 case llvm::omp::Clause::Enum: \
3256 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3258#define CLAUSE_NO_CLASS(Enum, Str) \
3259 case llvm::omp::Clause::Enum: \
3261#include "llvm/Frontend/OpenMP/OMP.inc"
3266template <
typename Derived>
3267bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3268 OMPClauseWithPreInit *
Node) {
3269 TRY_TO(TraverseStmt(
Node->getPreInitStmt()));
3273template <
typename Derived>
3274bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3275 OMPClauseWithPostUpdate *
Node) {
3277 TRY_TO(TraverseStmt(
Node->getPostUpdateExpr()));
3281template <
typename Derived>
3282bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
3283 OMPAllocatorClause *C) {
3284 TRY_TO(TraverseStmt(
C->getAllocator()));
3288template <
typename Derived>
3289bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
3290 TRY_TO(TraverseStmt(
C->getAllocator()));
3291 TRY_TO(VisitOMPClauseList(C));
3295template <
typename Derived>
3296bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
3297 TRY_TO(VisitOMPClauseWithPreInit(C));
3298 TRY_TO(TraverseStmt(
C->getCondition()));
3302template <
typename Derived>
3303bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
3304 TRY_TO(VisitOMPClauseWithPreInit(C));
3305 TRY_TO(TraverseStmt(
C->getCondition()));
3309template <
typename Derived>
3311RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3312 TRY_TO(VisitOMPClauseWithPreInit(C));
3313 TRY_TO(TraverseStmt(
C->getNumThreads()));
3317template <
typename Derived>
3318bool RecursiveASTVisitor<Derived>::VisitOMPAlignClause(OMPAlignClause *C) {
3319 TRY_TO(TraverseStmt(
C->getAlignment()));
3323template <
typename Derived>
3324bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3325 TRY_TO(TraverseStmt(
C->getSafelen()));
3329template <
typename Derived>
3330bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3331 TRY_TO(TraverseStmt(
C->getSimdlen()));
3335template <
typename Derived>
3336bool RecursiveASTVisitor<Derived>::VisitOMPSizesClause(OMPSizesClause *C) {
3337 for (Expr *
E :
C->getSizesRefs())
3342template <
typename Derived>
3343bool RecursiveASTVisitor<Derived>::VisitOMPFullClause(OMPFullClause *C) {
3347template <
typename Derived>
3348bool RecursiveASTVisitor<Derived>::VisitOMPPartialClause(OMPPartialClause *C) {
3349 TRY_TO(TraverseStmt(
C->getFactor()));
3353template <
typename Derived>
3355RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3356 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3360template <
typename Derived>
3361bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3365template <
typename Derived>
3366bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3370template <
typename Derived>
3371bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3372 OMPUnifiedAddressClause *) {
3376template <
typename Derived>
3377bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3378 OMPUnifiedSharedMemoryClause *) {
3382template <
typename Derived>
3383bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3384 OMPReverseOffloadClause *) {
3388template <
typename Derived>
3389bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3390 OMPDynamicAllocatorsClause *) {
3394template <
typename Derived>
3395bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3396 OMPAtomicDefaultMemOrderClause *) {
3400template <
typename Derived>
3401bool RecursiveASTVisitor<Derived>::VisitOMPAtClause(OMPAtClause *) {
3405template <
typename Derived>
3406bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
3410template <
typename Derived>
3411bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
3412 TRY_TO(TraverseStmt(
C->getMessageString()));
3416template <
typename Derived>
3418RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3419 TRY_TO(VisitOMPClauseWithPreInit(C));
3420 TRY_TO(TraverseStmt(
C->getChunkSize()));
3424template <
typename Derived>
3425bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3426 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3430template <
typename Derived>
3431bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3435template <
typename Derived>
3436bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3440template <
typename Derived>
3442RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3446template <
typename Derived>
3447bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3451template <
typename Derived>
3452bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3456template <
typename Derived>
3457bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3461template <
typename Derived>
3462bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3466template <
typename Derived>
3467bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
3471template <
typename Derived>
3472bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3476template <
typename Derived>
3477bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3481template <
typename Derived>
3482bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
3486template <
typename Derived>
3487bool RecursiveASTVisitor<Derived>::VisitOMPAbsentClause(OMPAbsentClause *) {
3491template <
typename Derived>
3492bool RecursiveASTVisitor<Derived>::VisitOMPHoldsClause(OMPHoldsClause *) {
3496template <
typename Derived>
3497bool RecursiveASTVisitor<Derived>::VisitOMPContainsClause(OMPContainsClause *) {
3501template <
typename Derived>
3502bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
3506template <
typename Derived>
3507bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPRoutinesClause(
3508 OMPNoOpenMPRoutinesClause *) {
3512template <
typename Derived>
3513bool RecursiveASTVisitor<Derived>::VisitOMPNoParallelismClause(
3514 OMPNoParallelismClause *) {
3518template <
typename Derived>
3519bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
3523template <
typename Derived>
3524bool RecursiveASTVisitor<Derived>::VisitOMPReleaseClause(OMPReleaseClause *) {
3528template <
typename Derived>
3529bool RecursiveASTVisitor<Derived>::VisitOMPRelaxedClause(OMPRelaxedClause *) {
3533template <
typename Derived>
3534bool RecursiveASTVisitor<Derived>::VisitOMPWeakClause(OMPWeakClause *) {
3538template <
typename Derived>
3539bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3543template <
typename Derived>
3544bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3548template <
typename Derived>
3549bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3553template <
typename Derived>
3554bool RecursiveASTVisitor<Derived>::VisitOMPInitClause(OMPInitClause *C) {
3555 TRY_TO(VisitOMPClauseList(C));
3559template <
typename Derived>
3560bool RecursiveASTVisitor<Derived>::VisitOMPUseClause(OMPUseClause *C) {
3561 TRY_TO(TraverseStmt(
C->getInteropVar()));
3565template <
typename Derived>
3566bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *C) {
3567 TRY_TO(TraverseStmt(
C->getInteropVar()));
3571template <
typename Derived>
3572bool RecursiveASTVisitor<Derived>::VisitOMPNovariantsClause(
3573 OMPNovariantsClause *C) {
3574 TRY_TO(VisitOMPClauseWithPreInit(C));
3575 TRY_TO(TraverseStmt(
C->getCondition()));
3579template <
typename Derived>
3580bool RecursiveASTVisitor<Derived>::VisitOMPNocontextClause(
3581 OMPNocontextClause *C) {
3582 TRY_TO(VisitOMPClauseWithPreInit(C));
3583 TRY_TO(TraverseStmt(
C->getCondition()));
3587template <
typename Derived>
3588template <
typename T>
3589bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *
Node) {
3590 for (
auto *
E :
Node->varlist()) {
3596template <
typename Derived>
3597bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
3598 OMPInclusiveClause *C) {
3599 TRY_TO(VisitOMPClauseList(C));
3603template <
typename Derived>
3604bool RecursiveASTVisitor<Derived>::VisitOMPExclusiveClause(
3605 OMPExclusiveClause *C) {
3606 TRY_TO(VisitOMPClauseList(C));
3610template <
typename Derived>
3611bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3612 TRY_TO(VisitOMPClauseList(C));
3613 for (
auto *
E :
C->private_copies()) {
3619template <
typename Derived>
3620bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3621 OMPFirstprivateClause *C) {
3622 TRY_TO(VisitOMPClauseList(C));
3623 TRY_TO(VisitOMPClauseWithPreInit(C));
3624 for (
auto *
E :
C->private_copies()) {
3627 for (
auto *
E :
C->inits()) {
3633template <
typename Derived>
3634bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3635 OMPLastprivateClause *C) {
3636 TRY_TO(VisitOMPClauseList(C));
3637 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3638 for (
auto *
E :
C->private_copies()) {
3641 for (
auto *
E :
C->source_exprs()) {
3644 for (
auto *
E :
C->destination_exprs()) {
3647 for (
auto *
E :
C->assignment_ops()) {
3653template <
typename Derived>
3654bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3655 TRY_TO(VisitOMPClauseList(C));
3659template <
typename Derived>
3660bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3661 TRY_TO(TraverseStmt(
C->getStep()));
3662 TRY_TO(TraverseStmt(
C->getCalcStep()));
3663 TRY_TO(VisitOMPClauseList(C));
3664 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3665 for (
auto *
E :
C->privates()) {
3668 for (
auto *
E :
C->inits()) {
3671 for (
auto *
E :
C->updates()) {
3674 for (
auto *
E :
C->finals()) {
3680template <
typename Derived>
3681bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3682 TRY_TO(TraverseStmt(
C->getAlignment()));
3683 TRY_TO(VisitOMPClauseList(C));
3687template <
typename Derived>
3688bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3689 TRY_TO(VisitOMPClauseList(C));
3690 for (
auto *
E :
C->source_exprs()) {
3693 for (
auto *
E :
C->destination_exprs()) {
3696 for (
auto *
E :
C->assignment_ops()) {
3702template <
typename Derived>
3703bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3704 OMPCopyprivateClause *C) {
3705 TRY_TO(VisitOMPClauseList(C));
3706 for (
auto *
E :
C->source_exprs()) {
3709 for (
auto *
E :
C->destination_exprs()) {
3712 for (
auto *
E :
C->assignment_ops()) {
3718template <
typename Derived>
3720RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3721 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3722 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3723 TRY_TO(VisitOMPClauseList(C));
3724 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3725 for (
auto *
E :
C->privates()) {
3728 for (
auto *
E :
C->lhs_exprs()) {
3731 for (
auto *
E :
C->rhs_exprs()) {
3734 for (
auto *
E :
C->reduction_ops()) {
3737 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3738 for (
auto *
E :
C->copy_ops()) {
3741 for (
auto *
E :
C->copy_array_temps()) {
3744 for (
auto *
E :
C->copy_array_elems()) {
3751template <
typename Derived>
3752bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3753 OMPTaskReductionClause *C) {
3754 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3755 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3756 TRY_TO(VisitOMPClauseList(C));
3757 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3758 for (
auto *
E :
C->privates()) {
3761 for (
auto *
E :
C->lhs_exprs()) {
3764 for (
auto *
E :
C->rhs_exprs()) {
3767 for (
auto *
E :
C->reduction_ops()) {
3773template <
typename Derived>
3774bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3775 OMPInReductionClause *C) {
3776 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3777 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3778 TRY_TO(VisitOMPClauseList(C));
3779 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3780 for (
auto *
E :
C->privates()) {
3783 for (
auto *
E :
C->lhs_exprs()) {
3786 for (
auto *
E :
C->rhs_exprs()) {
3789 for (
auto *
E :
C->reduction_ops()) {
3792 for (
auto *
E :
C->taskgroup_descriptors())
3797template <
typename Derived>
3798bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3799 TRY_TO(VisitOMPClauseList(C));
3803template <
typename Derived>
3804bool RecursiveASTVisitor<Derived>::VisitOMPDepobjClause(OMPDepobjClause *C) {
3805 TRY_TO(TraverseStmt(
C->getDepobj()));
3809template <
typename Derived>
3810bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3811 TRY_TO(VisitOMPClauseList(C));
3815template <
typename Derived>
3816bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3817 TRY_TO(VisitOMPClauseWithPreInit(C));
3818 TRY_TO(TraverseStmt(
C->getDevice()));
3822template <
typename Derived>
3823bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3824 TRY_TO(VisitOMPClauseList(C));
3828template <
typename Derived>
3829bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
3830 OMPNumTeamsClause *C) {
3831 TRY_TO(VisitOMPClauseList(C));
3832 TRY_TO(VisitOMPClauseWithPreInit(C));
3836template <
typename Derived>
3837bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
3838 OMPThreadLimitClause *C) {
3839 TRY_TO(VisitOMPClauseList(C));
3840 TRY_TO(VisitOMPClauseWithPreInit(C));
3844template <
typename Derived>
3845bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
3846 OMPPriorityClause *C) {
3847 TRY_TO(VisitOMPClauseWithPreInit(C));
3848 TRY_TO(TraverseStmt(
C->getPriority()));
3852template <
typename Derived>
3853bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
3854 OMPGrainsizeClause *C) {
3855 TRY_TO(VisitOMPClauseWithPreInit(C));
3856 TRY_TO(TraverseStmt(
C->getGrainsize()));
3860template <
typename Derived>
3861bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
3862 OMPNumTasksClause *C) {
3863 TRY_TO(VisitOMPClauseWithPreInit(C));
3864 TRY_TO(TraverseStmt(
C->getNumTasks()));
3868template <
typename Derived>
3869bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
3870 TRY_TO(TraverseStmt(
C->getHint()));
3874template <
typename Derived>
3875bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
3876 OMPDistScheduleClause *C) {
3877 TRY_TO(VisitOMPClauseWithPreInit(C));
3878 TRY_TO(TraverseStmt(
C->getChunkSize()));
3882template <
typename Derived>
3884RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
3888template <
typename Derived>
3889bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
3890 TRY_TO(VisitOMPClauseList(C));
3894template <
typename Derived>
3895bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
3896 TRY_TO(VisitOMPClauseList(C));
3900template <
typename Derived>
3901bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
3902 OMPUseDevicePtrClause *C) {
3903 TRY_TO(VisitOMPClauseList(C));
3907template <
typename Derived>
3908bool RecursiveASTVisitor<Derived>::VisitOMPUseDeviceAddrClause(
3909 OMPUseDeviceAddrClause *C) {
3910 TRY_TO(VisitOMPClauseList(C));
3914template <
typename Derived>
3915bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
3916 OMPIsDevicePtrClause *C) {
3917 TRY_TO(VisitOMPClauseList(C));
3921template <
typename Derived>
3922bool RecursiveASTVisitor<Derived>::VisitOMPHasDeviceAddrClause(
3923 OMPHasDeviceAddrClause *C) {
3924 TRY_TO(VisitOMPClauseList(C));
3928template <
typename Derived>
3929bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
3930 OMPNontemporalClause *C) {
3931 TRY_TO(VisitOMPClauseList(C));
3932 for (
auto *
E :
C->private_refs()) {
3938template <
typename Derived>
3939bool RecursiveASTVisitor<Derived>::VisitOMPOrderClause(OMPOrderClause *) {
3943template <
typename Derived>
3944bool RecursiveASTVisitor<Derived>::VisitOMPDetachClause(OMPDetachClause *C) {
3945 TRY_TO(TraverseStmt(
C->getEventHandler()));
3949template <
typename Derived>
3950bool RecursiveASTVisitor<Derived>::VisitOMPUsesAllocatorsClause(
3951 OMPUsesAllocatorsClause *C) {
3952 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
3953 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
3960template <
typename Derived>
3961bool RecursiveASTVisitor<Derived>::VisitOMPAffinityClause(
3962 OMPAffinityClause *C) {
3963 TRY_TO(TraverseStmt(
C->getModifier()));
3964 for (Expr *
E :
C->varlist())
3969template <
typename Derived>
3970bool RecursiveASTVisitor<Derived>::VisitOMPFilterClause(OMPFilterClause *C) {
3971 TRY_TO(VisitOMPClauseWithPreInit(C));
3972 TRY_TO(TraverseStmt(
C->getThreadID()));
3976template <
typename Derived>
3977bool RecursiveASTVisitor<Derived>::VisitOMPBindClause(OMPBindClause *C) {
3981template <
typename Derived>
3982bool RecursiveASTVisitor<Derived>::VisitOMPXDynCGroupMemClause(
3983 OMPXDynCGroupMemClause *C) {
3984 TRY_TO(VisitOMPClauseWithPreInit(C));
3985 TRY_TO(TraverseStmt(
C->getSize()));
3989template <
typename Derived>
3990bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
3991 OMPDoacrossClause *C) {
3992 TRY_TO(VisitOMPClauseList(C));
3996template <
typename Derived>
3997bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
3998 OMPXAttributeClause *C) {
4002template <
typename Derived>
4003bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
4007template <
typename Derived>
4008bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4009 OpenACCConstructStmt *C) {
4010 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4014template <
typename Derived>
4015bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4016 OpenACCAssociatedStmtConstruct *S) {
4017 TRY_TO(TraverseOpenACCConstructStmt(S));
4018 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4022template <
typename Derived>
4023bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *C) {
4024 for (
const Stmt *Child :
C->children())
4025 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4029template <
typename Derived>
4030bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4031 ArrayRef<const OpenACCClause *> Clauses) {
4033 for (
const auto *C : Clauses)
4034 TRY_TO(VisitOpenACCClause(C));
4048 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4050 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
This file provides AST data structures related to concepts.
#define TYPE(DERIVED, BASE)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::DenseSet< const void * > Visited
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND)
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
#define STMT(CLASS, PARENT)
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define DEF_TRAVERSE_DECL(DECL, CODE)
#define DEF_TRAVERSE_STMT(STMT, CODE)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
#define TRY_TO(CALL_EXPR)
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Wrapper for source info for arrays.
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Represents a C++ struct/union/class.
Complex values, per C99 6.2.5p11.
A reference to a concept and its template args, as it appears in the code.
Represents the canonical version of C arrays with a specified constant size.
Represents a concrete matrix type with constant number of rows and columns.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
Represents a qualified type name for which the type name is dependent.
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 dependent template name that cannot be resolved prior to template instantiation.
Represents a vector type where either the type or size is dependent.
This represents one expression.
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
QualType getParamType(unsigned i) const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > exceptions() const
ArrayRef< QualType > param_types() const
QualType getReturnType() const
Represents a C array with an unspecified size.
Describes an C or C++ initializer list.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
A C++ nested-name-specifier augmented with source location information.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Represents a pointer to an Objective C object.
Represents a pack expansion of types.
Sugar for parentheses used when specifying types.
A (possibly-)qualified type.
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool 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 TraverseType(QualType T)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
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 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 TraverseNestedNameSpecifier(NestedNameSpecifier *NNS)
Recursively visit a C++ nested-name-specifier.
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 TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
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 TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
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 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.
Stmt - This represents one statement.
llvm::iterator_range< child_iterator > child_range
Represents the result of substituting a set of types for a template type parameter pack.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
TypeSourceInfo * getTypeSourceInfo() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() 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.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Declaration of a template type parameter.
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.
TypeLocClass getTypeLocClass() const
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.
The base class of the type hierarchy.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
TypeClass getTypeClass() const
Wrapper of type source information for a type with no direct qualifiers.
Represents a variable declaration or definition.
Represents a GCC generic vector type.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
TypeSourceInfo * getType() const
LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr) -> bool
Returns true if and only if FirstMethodPtr and SecondMethodPtr are pointers to the same non-static me...
bool ReturnValue(const InterpState &S, const T &V, APValue &R)
Convert a value to an APValue.
The JSON file list parser is used to communicate input to InstallAPI.
for(const auto &A :T->param_types())
const FunctionProtoType * T
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
@ Class
The "class" keyword introduces the elaborated-type-specifier.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.