13#ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14#define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
48#include "llvm/ADT/PointerIntPair.h"
49#include "llvm/ADT/SmallVector.h"
50#include "llvm/Support/Casting.h"
61#define TRY_TO(CALL_EXPR) \
63 if (!getDerived().CALL_EXPR) \
69template <
typename T,
typename U>
71template <
typename T,
typename U,
typename R,
typename...
P>
77template <
typename FirstMethodPtrTy,
typename SecondMethodPtrTy>
78LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG
auto
80 [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
83 SecondMethodPtrTy>::value)
84 return FirstMethodPtr == SecondMethodPtr;
166 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
331#define ATTR_VISITOR_DECLS_ONLY
332#include "clang/AST/AttrVisitor.inc"
333#undef ATTR_VISITOR_DECLS_ONLY
345#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
346 (::clang::detail::has_same_member_pointer_type< \
347 decltype(&RecursiveASTVisitor::Traverse##NAME), \
348 decltype(&Derived::Traverse##NAME)>::value \
349 ? static_cast<std::conditional_t< \
350 ::clang::detail::has_same_member_pointer_type< \
351 decltype(&RecursiveASTVisitor::Traverse##NAME), \
352 decltype(&Derived::Traverse##NAME)>::value, \
353 Derived &, RecursiveASTVisitor &>>(*this) \
354 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
355 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
360#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
362 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
368#define ABSTRACT_STMT(STMT)
369#define STMT(CLASS, PARENT) \
370 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
371#include "clang/AST/StmtNodes.inc"
377#define STMT(CLASS, PARENT) \
378 bool WalkUpFrom##CLASS(CLASS *S) { \
379 TRY_TO(WalkUpFrom##PARENT(S)); \
380 TRY_TO(Visit##CLASS(S)); \
383 bool Visit##CLASS(CLASS *S) { return true; }
384#include "clang/AST/StmtNodes.inc"
390#define ABSTRACT_TYPE(CLASS, BASE)
391#define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T);
392#include "clang/AST/TypeNodes.inc"
398#define TYPE(CLASS, BASE) \
399 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
400 TRY_TO(WalkUpFrom##BASE(T)); \
401 TRY_TO(Visit##CLASS##Type(T)); \
404 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
405#include "clang/AST/TypeNodes.inc"
411#define ABSTRACT_TYPELOC(CLASS, BASE)
412#define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
413#include "clang/AST/TypeLocNodes.def"
432#define TYPE(CLASS, BASE) \
433 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
434 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
435 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
438 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
439#include "clang/AST/TypeNodes.inc"
444#define ABSTRACT_DECL(DECL)
445#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
446#include "clang/AST/DeclNodes.inc"
452#define DECL(CLASS, BASE) \
453 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
454 TRY_TO(WalkUpFrom##BASE(D)); \
455 TRY_TO(Visit##CLASS##Decl(D)); \
458 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
459#include "clang/AST/DeclNodes.inc"
463#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
464 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
468#undef DEF_TRAVERSE_TMPL_INST
484 template <
typename T>
485 bool TraverseDeclTemplateParameterLists(
T *
D);
501#define GEN_CLANG_CLAUSE_CLASS
502#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
503#include "llvm/Frontend/OpenMP/OMP.inc"
505 template <
typename T>
bool VisitOMPClauseList(
T *
Node);
507 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *
Node);
508 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
510 bool PostVisitStmt(Stmt *S);
511 bool TraverseOpenACCConstructStmt(OpenACCConstructStmt *S);
513 TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S);
514 bool VisitOpenACCClauseList(ArrayRef<const OpenACCClause *>);
515 bool VisitOpenACCClause(
const OpenACCClause *);
518template <
typename Derived>
521 if (!getDerived().shouldVisitImplicitCode()) {
522 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
525 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
526 TRY_TO(TraverseStmt(IDC));
532 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
537template <
typename Derived>
542 return getDerived().TraverseConceptTypeRequirement(
543 cast<concepts::TypeRequirement>(R));
546 return getDerived().TraverseConceptExprRequirement(
547 cast<concepts::ExprRequirement>(R));
549 return getDerived().TraverseConceptNestedRequirement(
550 cast<concepts::NestedRequirement>(R));
552 llvm_unreachable(
"unexpected case");
555template <
typename Derived>
559 switch (S->getStmtClass()) {
562#define ABSTRACT_STMT(STMT)
563#define STMT(CLASS, PARENT) \
564 case Stmt::CLASS##Class: \
565 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
566#include "clang/AST/StmtNodes.inc"
574template <
typename Derived>
582template <
typename Derived>
588 if (RetReq.isTypeConstraint()) {
589 if (getDerived().shouldVisitImplicitCode()) {
590 TRY_TO(TraverseTemplateParameterListHelper(
591 RetReq.getTypeConstraintTemplateParameterList()));
594 TRY_TO(TraverseTypeConstraint(RetReq.getTypeConstraint()));
600template <
typename Derived>
608template <
typename Derived>
626 switch (S->getStmtClass()) {
629#define ABSTRACT_STMT(STMT)
630#define STMT(CLASS, PARENT) \
631 case Stmt::CLASS##Class: \
632 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
633 &Derived::Traverse##CLASS)) { \
634 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
637#define INITLISTEXPR(CLASS, PARENT) \
638 case Stmt::CLASS##Class: \
639 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
640 &Derived::Traverse##CLASS)) { \
641 auto ILE = static_cast<CLASS *>(S); \
642 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
643 TRY_TO(WalkUpFrom##CLASS(Syn)); \
644 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
645 TRY_TO(WalkUpFrom##CLASS(Sem)); \
648#include "clang/AST/StmtNodes.inc"
658template <
typename Derived>
659LLVM_ATTRIBUTE_NOINLINE
bool
665 Queue->push_back({S,
false});
670 LocalQueue.push_back({S,
false});
672 while (!LocalQueue.empty()) {
673 auto &CurrSAndVisited = LocalQueue.back();
674 Stmt *CurrS = CurrSAndVisited.getPointer();
675 bool Visited = CurrSAndVisited.getInt();
677 LocalQueue.pop_back();
678 TRY_TO(dataTraverseStmtPost(CurrS));
679 if (getDerived().shouldTraversePostOrder()) {
680 TRY_TO(PostVisitStmt(CurrS));
685 if (getDerived().dataTraverseStmtPre(CurrS)) {
686 CurrSAndVisited.setInt(
true);
687 size_t N = LocalQueue.size();
688 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
690 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
692 LocalQueue.pop_back();
699template <
typename Derived>
705#define ABSTRACT_TYPE(CLASS, BASE)
706#define TYPE(CLASS, BASE) \
708 return getDerived().Traverse##CLASS##Type( \
709 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));
710#include "clang/AST/TypeNodes.inc"
716template <
typename Derived>
722#define ABSTRACT_TYPELOC(CLASS, BASE)
723#define TYPELOC(CLASS, BASE) \
724 case TypeLoc::CLASS: \
725 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
726#include "clang/AST/TypeLocNodes.def"
733#define VISITORCLASS RecursiveASTVisitor
734#include "clang/AST/AttrVisitor.inc"
737template <
typename Derived>
744 if (!getDerived().shouldVisitImplicitCode()) {
749 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(
D))
750 return TraverseTemplateTypeParamDeclConstraints(TTPD);
761 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
D))
762 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
763 FTD->getDeclName().getCXXDeductionGuideTemplate()))
768#define ABSTRACT_DECL(DECL)
769#define DECL(CLASS, BASE) \
771 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
774#include "clang/AST/DeclNodes.inc"
779template <
typename Derived>
804template <
typename Derived>
811 TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
830template <
typename Derived>
838 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
842 TRY_TO(TraverseTemplateName(
859template <
typename Derived>
862 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
865 if (QTN->getQualifier()) {
866 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
873template <
typename Derived>
885 return getDerived().TraverseType(Arg.
getAsType());
889 return getDerived().TraverseTemplateName(
893 return getDerived().TraverseStmt(Arg.
getAsExpr());
896 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
904template <
typename Derived>
920 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
922 return getDerived().TraverseType(Arg.
getAsType());
928 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
930 return getDerived().TraverseTemplateName(
937 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
943template <
typename Derived>
947 TRY_TO(TraverseTemplateArgument(Arg));
952template <
typename Derived>
956 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
958 if (
Init->isWritten() || getDerived().shouldVisitImplicitCode())
964template <
typename Derived>
969 if (LE->isInitCapture(
C))
970 TRY_TO(TraverseDecl(
C->getCapturedVar()));
979#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
980 template <typename Derived> \
981 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
982 if (!getDerived().shouldTraversePostOrder()) \
983 TRY_TO(WalkUpFrom##TYPE(T)); \
985 if (getDerived().shouldTraversePostOrder()) \
986 TRY_TO(WalkUpFrom##TYPE(T)); \
1006 TRY_TO(TraverseType(QualType(
T->getClass(), 0)));
1015 TRY_TO(TraverseType(
T->getElementType()));
1016 if (
T->getSizeExpr())
1017 TRY_TO(TraverseStmt(
const_cast<Expr*
>(
T->getSizeExpr())));
1021 TRY_TO(TraverseType(
T->getElementType()));
1022 if (
T->getSizeExpr())
1023 TRY_TO(TraverseStmt(
const_cast<Expr *
>(
T->getSizeExpr())));
1027 {
TRY_TO(TraverseType(
T->getElementType())); })
1030 TRY_TO(TraverseType(
T->getElementType()));
1035 TRY_TO(TraverseType(
T->getElementType()));
1036 if (
T->getSizeExpr())
1037 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1041 TRY_TO(TraverseStmt(
T->getAddrSpaceExpr()));
1046 if (
T->getSizeExpr())
1047 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1048 TRY_TO(TraverseType(
T->getElementType()));
1052 if (
T->getSizeExpr())
1053 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1062 {
TRY_TO(TraverseType(
T->getElementType())); })
1065 if (
T->getRowExpr())
1066 TRY_TO(TraverseStmt(
T->getRowExpr()));
1067 if (
T->getColumnExpr())
1068 TRY_TO(TraverseStmt(
T->getColumnExpr()));
1069 TRY_TO(TraverseType(
T->getElementType()));
1087 TRY_TO(TraverseStmt(NE));
1095 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1100 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1103 TRY_TO(TraverseType(
T->getPattern()));
1108 TRY_TO(TraverseType(
T->getBaseType()));
1109 TRY_TO(TraverseType(
T->getUnderlyingType()));
1113 TRY_TO(TraverseType(
T->getDeducedType()));
1114 if (
T->isConstrained()) {
1115 TRY_TO(TraverseTemplateArguments(
T->getTypeConstraintArguments()));
1119 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1120 TRY_TO(TraverseType(
T->getDeducedType()));
1127 TRY_TO(TraverseType(
T->getReplacementType()));
1130 TRY_TO(TraverseTemplateArgument(
T->getArgumentPack()));
1134 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1135 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1141 {
TRY_TO(TraverseType(
T->getModifiedType())); })
1144 if (
T->getCountExpr())
1145 TRY_TO(TraverseStmt(
T->getCountExpr()));
1150 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1153 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1158 {
TRY_TO(TraverseType(
T->getUnderlyingType())); })
1161 if (
T->getQualifier()) {
1162 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1164 TRY_TO(TraverseType(
T->getNamedType()));
1168 {
TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier())); })
1171 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1172 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1184 if (
T->getBaseType().getTypePtr() !=
T)
1185 TRY_TO(TraverseType(
T->getBaseType()));
1186 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1187 TRY_TO(TraverseType(typeArg));
1200 {
TRY_TO(TraverseStmt(
T->getNumBitsExpr())); })
1212 template <
typename Derived> \
1213 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##
Loc(
TYPE##
Loc TL) { \
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()))); \
1220 if (getDerived().shouldTraversePostOrder()) { \
1221 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1222 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1223 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1228template <
typename Derived>
1230RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1246 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1253 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1257 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1260 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1263 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1266 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1271 if (
auto *TSI = TL.getClassTInfo())
1272 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1279 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1282 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1284template <typename Derived>
1285bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1287 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1292 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1293 TRY_TO(TraverseArrayTypeLocHelper(TL));
1297 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1302 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1303 TRY_TO(TraverseArrayTypeLocHelper(TL));
1307 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1308 TRY_TO(TraverseArrayTypeLocHelper(TL));
1312 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1313 TRY_TO(TraverseArrayTypeLocHelper(TL));
1317 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1318 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1324 if (TL.getTypePtr()->getSizeExpr())
1325 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1326 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1331 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1335 if (TL.getTypePtr()->getSizeExpr())
1336 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1337 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
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(TraverseStmt(TL.getAttrRowOperand()));
1354 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1355 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1359 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1363 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1367 for (
unsigned I = 0,
E = TL.getNumParams(); I !=
E; ++I) {
1368 if (TL.getParam(I)) {
1369 TRY_TO(TraverseDecl(TL.getParam(I)));
1370 }
else if (I < T->getNumParams()) {
1380 TRY_TO(TraverseStmt(NE));
1388 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1391 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1396 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1400 TRY_TO(TraverseType(TL.getPattern()));
1401 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1405 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1409 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1410 if (TL.isConstrained()) {
1411 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1416 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1417 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1424 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1427 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1432 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1433 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1434 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1443 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1446 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1449 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1452 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1455 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1458 if (TL.getQualifierLoc()) {
1459 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1461 TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
1465 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1469 if (TL.getQualifierLoc()) {
1470 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1473 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1474 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1479 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1482 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1484 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1493 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1494 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1495 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1496 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1497 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1499 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1504 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1512 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1524template <typename Derived>
1526 const Decl *Child) {
1529 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1532 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1533 return Cls->isLambda();
1537template <
typename Derived>
1542 for (
auto *Child : DC->
decls()) {
1543 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1544 TRY_TO(TraverseDecl(Child));
1551#define DEF_TRAVERSE_DECL(DECL, CODE) \
1552 template <typename Derived> \
1553 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1554 bool ShouldVisitChildren = true; \
1555 bool ReturnValue = true; \
1556 if (!getDerived().shouldTraversePostOrder()) \
1557 TRY_TO(WalkUpFrom##DECL(D)); \
1559 if (ReturnValue && ShouldVisitChildren) \
1560 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1561 if (ReturnValue) { \
1563 for (auto *I : D->attrs()) \
1564 TRY_TO(getDerived().TraverseAttr(I)); \
1566 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1567 TRY_TO(WalkUpFrom##DECL(D)); \
1568 return ReturnValue; \
1575 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1577 for (
const auto &I :
D->captures()) {
1578 if (I.hasCopyExpr()) {
1579 TRY_TO(TraverseStmt(I.getCopyExpr()));
1586 TRY_TO(TraverseStmt(
D->getBody()));
1591 TRY_TO(TraverseStmt(
D->getBody()));
1600 TRY_TO(TraverseStmt(
D->getTemporaryExpr()));
1604 {
TRY_TO(TraverseStmt(
D->getAsmString())); })
1612 if (
D->getFriendType()) {
1613 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1616 if (
auto *ET =
D->getFriendType()->getType()->getAs<
ElaboratedType>())
1617 TRY_TO(TraverseDecl(ET->getOwnedTagDecl()));
1619 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1624 if (
D->getFriendType())
1625 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1628 for (
unsigned I = 0,
E =
D->getNumTemplateParameters(); I <
E; ++I) {
1631 ITPL != ETPL; ++ITPL) {
1632 TRY_TO(TraverseDecl(*ITPL));
1645 TRY_TO(TraverseStmt(
D->getAssertExpr()));
1656 auto Scope =
D->getASTContext().getTraversalScope();
1657 bool HasLimitedScope =
1658 Scope.size() != 1 || !isa<TranslationUnitDecl>(
Scope.front());
1659 if (HasLimitedScope) {
1661 for (
auto *Child :
Scope) {
1662 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1663 TRY_TO(TraverseDecl(Child));
1675 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1696 if (ObjCTypeParamList *typeParamList =
D->getTypeParamList()) {
1697 for (
auto typeParam : *typeParamList) {
1698 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1701 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1702 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1703 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1714 if (ObjCTypeParamList *typeParamList =
D->getTypeParamListAsWritten()) {
1715 for (
auto typeParam : *typeParamList) {
1716 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1720 if (TypeSourceInfo *superTInfo =
D->getSuperClassTInfo()) {
1721 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1723 if (
D->isThisDeclarationADefinition()) {
1724 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1725 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1726 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1732 if (
D->isThisDeclarationADefinition()) {
1733 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1734 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1735 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1741 if (
D->getReturnTypeSourceInfo()) {
1742 TRY_TO(TraverseTypeLoc(
D->getReturnTypeSourceInfo()->getTypeLoc()));
1744 for (ParmVarDecl *Parameter :
D->parameters()) {
1745 TRY_TO(TraverseDecl(Parameter));
1747 if (
D->isThisDeclarationADefinition()) {
1748 TRY_TO(TraverseStmt(
D->getBody()));
1754 if (
D->hasExplicitBound()) {
1755 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1763 if (
D->getTypeSourceInfo())
1764 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1766 TRY_TO(TraverseType(
D->getType()));
1771 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1772 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
1776 {
TRY_TO(TraverseTypeLoc(
D->getEnumTypeLoc())); })
1781 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1789 for (
auto *I :
D->varlist()) {
1795 for (
auto *C :
D->clauselists()) {
1796 TRY_TO(TraverseOMPClause(C));
1801 TRY_TO(TraverseStmt(
D->getCombiner()));
1802 if (
auto *Initializer =
D->getInitializer())
1803 TRY_TO(TraverseStmt(Initializer));
1804 TRY_TO(TraverseType(
D->getType()));
1809 for (
auto *C :
D->clauselists())
1810 TRY_TO(TraverseOMPClause(C));
1811 TRY_TO(TraverseType(
D->getType()));
1818 for (
auto *I :
D->varlist())
1820 for (
auto *C :
D->clauselists())
1821 TRY_TO(TraverseOMPClause(C));
1825template <typename Derived>
1826bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1827 TemplateParameterList *TPL) {
1829 for (NamedDecl *
D : *TPL) {
1832 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1833 TRY_TO(TraverseStmt(RequiresClause));
1839template <
typename Derived>
1840template <
typename T>
1841bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *
D) {
1842 for (
unsigned i = 0; i <
D->getNumTemplateParameterLists(); i++) {
1843 TemplateParameterList *TPL =
D->getTemplateParameterList(i);
1844 TraverseTemplateParameterListHelper(TPL);
1849template <
typename Derived>
1850bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1851 ClassTemplateDecl *
D) {
1852 for (
auto *SD :
D->specializations()) {
1853 for (
auto *RD : SD->redecls()) {
1854 assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName());
1856 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1860 TRY_TO(TraverseDecl(RD));
1877template <
typename Derived>
1878bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1879 VarTemplateDecl *
D) {
1880 for (
auto *SD :
D->specializations()) {
1881 for (
auto *RD : SD->redecls()) {
1883 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1886 TRY_TO(TraverseDecl(RD));
1902template <
typename Derived>
1903bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1904 FunctionTemplateDecl *
D) {
1905 for (
auto *FD :
D->specializations()) {
1906 for (
auto *RD : FD->redecls()) {
1907 switch (RD->getTemplateSpecializationKind()) {
1911 TRY_TO(TraverseDecl(RD));
1918 TRY_TO(TraverseDecl(RD));
1932#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
1933 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
1934 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
1935 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
1943 if (getDerived().shouldVisitTemplateInstantiations() && \
1944 D == D->getCanonicalDecl()) \
1945 TRY_TO(TraverseTemplateInstantiations(D)); \
1959 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
1960 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1961 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1962 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1966 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1969template <typename Derived>
1970bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
1971 const TemplateTypeParmDecl *
D) {
1972 if (
const auto *TC =
D->getTypeConstraint())
1973 TRY_TO(TraverseTypeConstraint(TC));
1979 if (
D->getTypeForDecl())
1980 TRY_TO(TraverseType(QualType(
D->getTypeForDecl(), 0)));
1981 TRY_TO(TraverseTemplateTypeParamDeclConstraints(
D));
1982 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1983 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1987 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1994 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2001 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
2002 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2006 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2007 TRY_TO(TraverseStmt(
D->getConstraintExpr()));
2013 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2022 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2024 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2025 if (
auto *TSI =
D->getIntegerTypeSourceInfo())
2026 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2032template <typename Derived>
2033bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *
D) {
2037 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2038 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2042template <
typename Derived>
2043bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
2044 const CXXBaseSpecifier &
Base) {
2045 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2049template <
typename Derived>
2050bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *
D) {
2051 if (!TraverseRecordHelper(
D))
2053 if (
D->isCompleteDefinition()) {
2054 for (
const auto &I :
D->bases()) {
2055 TRY_TO(TraverseCXXBaseSpecifier(I));
2067template <typename Derived>
2068bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2069 const TemplateArgumentLoc *TAL,
unsigned Count) {
2070 for (
unsigned I = 0; I < Count; ++I) {
2071 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2076#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2077 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2086 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2088 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2089 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2092 if (getDerived().shouldVisitTemplateInstantiations() || \
2093 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2095 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2097 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2110#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2111 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2113 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2115 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2116 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2117 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2122 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2135 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2136 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2141template <typename Derived>
2142bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *
D) {
2143 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2144 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2145 if (
D->getTypeSourceInfo())
2146 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2148 TRY_TO(TraverseType(
D->getType()));
2154 for (
auto *Binding :
D->bindings()) {
2155 TRY_TO(TraverseDecl(Binding));
2160 if (getDerived().shouldVisitImplicitCode()) {
2161 TRY_TO(TraverseStmt(
D->getBinding()));
2162 if (
const auto HoldingVar =
D->getHoldingVar())
2163 TRY_TO(TraverseDecl(HoldingVar));
2175 TRY_TO(TraverseDeclaratorHelper(
D));
2176 if (
D->isBitField())
2177 TRY_TO(TraverseStmt(
D->getBitWidth()));
2178 if (
D->hasInClassInitializer())
2179 TRY_TO(TraverseStmt(
D->getInClassInitializer()));
2183 TRY_TO(TraverseDeclaratorHelper(
D));
2184 if (
D->isBitField())
2185 TRY_TO(TraverseStmt(
D->getBitWidth()));
2190 TRY_TO(TraverseDeclaratorHelper(
D));
2191 if (
D->isBitField())
2192 TRY_TO(TraverseStmt(
D->getBitWidth()));
2196template <typename Derived>
2197bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *
D) {
2198 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2199 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2200 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2207 if (
const FunctionTemplateSpecializationInfo *FTSI =
2208 D->getTemplateSpecializationInfo()) {
2209 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2210 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2213 if (
const ASTTemplateArgumentListInfo *TALI =
2214 FTSI->TemplateArgumentsAsWritten) {
2215 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2216 TALI->NumTemplateArgs));
2219 }
else if (
const DependentFunctionTemplateSpecializationInfo *DFSI =
2220 D->getDependentSpecializationInfo()) {
2221 if (
const ASTTemplateArgumentListInfo *TALI =
2222 DFSI->TemplateArgumentsAsWritten) {
2223 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2224 TALI->NumTemplateArgs));
2232 if (TypeSourceInfo *TSI =
D->getTypeSourceInfo()) {
2233 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2234 }
else if (getDerived().shouldVisitImplicitCode()) {
2239 for (ParmVarDecl *Parameter :
D->parameters()) {
2240 TRY_TO(TraverseDecl(Parameter));
2245 if (Expr *TrailingRequiresClause =
D->getTrailingRequiresClause()) {
2246 TRY_TO(TraverseStmt(TrailingRequiresClause));
2249 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(
D)) {
2251 for (
auto *I : Ctor->inits()) {
2252 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2253 TRY_TO(TraverseConstructorInitializer(I));
2258 D->isThisDeclarationADefinition() &&
2261 (!
D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2263 if (
const auto *MD = dyn_cast<CXXMethodDecl>(
D)) {
2264 if (
const CXXRecordDecl *RD = MD->getParent()) {
2265 if (RD->isLambda() &&
2267 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2273 TRY_TO(TraverseStmt(
D->getBody()));
2276 for (
auto *Child :
D->decls()) {
2277 if (isa<UsingShadowDecl>(Child))
2278 TRY_TO(TraverseDecl(Child));
2328template <typename Derived>
2329bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *
D) {
2330 TRY_TO(TraverseDeclaratorHelper(
D));
2332 if (!isa<ParmVarDecl>(
D) &&
2333 (!
D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2334 TRY_TO(TraverseStmt(
D->getInit()));
2344 TRY_TO(TraverseDeclaratorHelper(
D));
2345 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2346 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2352 if (
D->hasDefaultArg() &&
D->hasUninstantiatedDefaultArg() &&
2353 !
D->hasUnparsedDefaultArg())
2354 TRY_TO(TraverseStmt(
D->getUninstantiatedDefaultArg()));
2356 if (
D->hasDefaultArg() && !
D->hasUninstantiatedDefaultArg() &&
2357 !
D->hasUnparsedDefaultArg())
2358 TRY_TO(TraverseStmt(
D->getDefaultArg()));
2364 TRY_TO(TraverseTemplateArguments(
D->getTemplateArguments()));
2380 template <
typename Derived> \
2381 bool RecursiveASTVisitor<Derived>::Traverse##
STMT( \
2382 STMT *S, DataRecursionQueue *Queue) { \
2385 if (!getDerived().shouldTraversePostOrder()) \
2386 TRY_TO(WalkUpFrom##
STMT(S)); \
2388 if (ShouldVisitChildren) { \
2389 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2390 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2397 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2398 TRY_TO(WalkUpFrom##
STMT(S)); \
2405 for (
unsigned I = 0,
E = S->getNumInputs(); I <
E; ++I) {
2408 for (
unsigned I = 0,
E = S->getNumOutputs(); I <
E; ++I) {
2411 for (
unsigned I = 0,
E = S->getNumClobbers(); I <
E; ++I) {
2424 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2429 for (
auto *I : S->decls()) {
2465 if (!getDerived().shouldVisitImplicitCode()) {
2477 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2478 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2488 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2489 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2490 if (S->hasExplicitTemplateArgs()) {
2491 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2492 S->getNumTemplateArgs()));
2497 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2498 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2499 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2500 S->getNumTemplateArgs()));
2504 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2505 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2506 if (S->hasExplicitTemplateArgs()) {
2507 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2508 S->getNumTemplateArgs()));
2513 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2514 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2515 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2516 S->getNumTemplateArgs()));
2526 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2530 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2534 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2538 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2542 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2546 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2550 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2554 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2557template <typename Derived>
2558bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2559 InitListExpr *S, DataRecursionQueue *Queue) {
2563 if (!getDerived().shouldTraversePostOrder())
2564 TRY_TO(WalkUpFromInitListExpr(S));
2567 for (Stmt *SubStmt : S->children()) {
2571 if (!Queue && getDerived().shouldTraversePostOrder())
2572 TRY_TO(WalkUpFromInitListExpr(S));
2577template <
typename Derived>
2578bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
2579 ObjCProtocolLoc ProtocolLoc) {
2583template <
typename Derived>
2584bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2585 ConceptReference *CR) {
2586 if (!getDerived().shouldTraversePostOrder())
2587 TRY_TO(VisitConceptReference(CR));
2588 TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
2589 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2590 if (CR->hasExplicitTemplateArgs())
2591 TRY_TO(TraverseTemplateArgumentLocsHelper(
2592 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2593 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2594 if (getDerived().shouldTraversePostOrder())
2595 TRY_TO(VisitConceptReference(CR));
2607template <
typename Derived>
2608bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2609 InitListExpr *S, DataRecursionQueue *Queue) {
2610 if (S->isSemanticForm() && S->isSyntacticForm()) {
2612 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2615 TRY_TO(TraverseSynOrSemInitListExpr(
2616 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2617 if (getDerived().shouldVisitImplicitCode()) {
2620 TRY_TO(TraverseSynOrSemInitListExpr(
2621 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2630 if (S->isExprPredicate())
2631 TRY_TO(TraverseStmt(S->getControllingExpr()));
2633 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2635 for (
const GenericSelectionExpr::Association Assoc : S->associations()) {
2636 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2637 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2638 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2640 ShouldVisitChildren =
false;
2647 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2648 e = S->semantics_end();
2651 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2652 sub = OVE->getSourceExpr();
2661 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2666 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2674 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2680 if (S->isArgumentType())
2681 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2687 if (S->isTypeOperand())
2688 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2692 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2700 if (S->isTypeOperand())
2701 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2705 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2706 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2710 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2718 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2723 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2729 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2730 const LambdaCapture *
C = S->capture_begin() + I;
2731 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2732 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2736 if (getDerived().shouldVisitImplicitCode()) {
2738 TRY_TO(TraverseDecl(S->getLambdaClass()));
2741 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2742 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2744 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2745 if (S->hasExplicitParameters()) {
2747 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2748 TRY_TO(TraverseDecl(Proto.getParam(I)));
2751 auto *
T = Proto.getTypePtr();
2758 if (S->hasExplicitResultType())
2759 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2769 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2788 TRY_TO(TraverseDecl(S->getBlockDecl()));
2794 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2800 if (getDerived().shouldVisitImplicitCode())
2801 TRY_TO(TraverseStmt(S->getExpr()));
2805 if (getDerived().shouldVisitImplicitCode())
2806 TRY_TO(TraverseStmt(S->getExpr()));
2816 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2817 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2818 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2819 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2820 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2835 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2842 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2843 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2850 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2851 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2855 if (S->isClassReceiver()) {
2856 ObjCInterfaceDecl *IDecl = S->getClassReceiver();
2857 QualType
Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2858 ObjCInterfaceLocInfo
Data;
2859 Data.NameLoc = S->getReceiverLocation();
2870 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2877 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2886 for (IntegerLiteral *IL : S->underlying_data_elements()) {
2892 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2893 if (S->hasExplicitTemplateArgs()) {
2894 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2895 S->getNumTemplateArgs()));
2900 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2901 if (S->hasExplicitTemplateArgs()) {
2902 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2903 S->getNumTemplateArgs()));
2914 if (getDerived().shouldVisitImplicitCode()) {
2915 TRY_TO(TraverseStmt(S->getOriginalStmt()));
2916 TRY_TO(TraverseDecl(S->getOutlinedFunctionDecl()));
2923 if (!getDerived().shouldVisitImplicitCode()) {
2924 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
2925 S->getDecomposedForm();
2926 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
2927 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
2955 if (S->getLifetimeExtendedTemporaryDecl()) {
2956 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
2957 S->getLifetimeExtendedTemporaryDecl()));
2965 if (!getDerived().shouldVisitImplicitCode()) {
2971 if (!getDerived().shouldVisitImplicitCode()) {
2977 if (!getDerived().shouldVisitImplicitCode()) {
2983 if (!getDerived().shouldVisitImplicitCode()) {
2989 if (!getDerived().shouldVisitImplicitCode()) {
2996 TRY_TO(TraverseConceptReference(S->getConceptReference()));
3000 TRY_TO(TraverseDecl(S->getBody()));
3001 for (ParmVarDecl *Parm : S->getLocalParameters())
3002 TRY_TO(TraverseDecl(Parm));
3003 for (concepts::Requirement *Req : S->getRequirements())
3004 TRY_TO(TraverseConceptRequirement(Req));
3023template <typename Derived>
3024bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3025 OMPExecutableDirective *S) {
3026 for (
auto *C : S->clauses()) {
3027 TRY_TO(TraverseOMPClause(C));
3033 if (!getDerived().shouldVisitImplicitCode()) {
3035 TRY_TO(TraverseStmt(S->getLoopStmt()));
3040template <typename Derived>
3042RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3043 return TraverseOMPExecutableDirective(S);
3047 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3050 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3053 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3056 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3059 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3062 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3065 {
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(TraverseDeclarationNameInfo(S->getDirectiveName()));
3090 TRY_TO(TraverseOMPExecutableDirective(S));
3094 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3097 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3100 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3103 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3106 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3109 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3112 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3115 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3118 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3121 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3124 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3127 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3130 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3133 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3136 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3139 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3142 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3145 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3148 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3151 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3154 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3157 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3160 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3163 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3166 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3169 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3172 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3175 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3178 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3181 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3184 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3187 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3190 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3193 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3196 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3199 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3202 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3205 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3208 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3211 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3214 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3217 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3220 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3223 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3226 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3229 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3232 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3235 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3238 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3241 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3244 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3247 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3250 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3253 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3256 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3259 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3262 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3265 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3268 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3271 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3274template <typename Derived>
3275bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
3278 switch (
C->getClauseKind()) {
3279#define GEN_CLANG_CLAUSE_CLASS
3280#define CLAUSE_CLASS(Enum, Str, Class) \
3281 case llvm::omp::Clause::Enum: \
3282 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3284#define CLAUSE_NO_CLASS(Enum, Str) \
3285 case llvm::omp::Clause::Enum: \
3287#include "llvm/Frontend/OpenMP/OMP.inc"
3292template <
typename Derived>
3293bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3294 OMPClauseWithPreInit *
Node) {
3295 TRY_TO(TraverseStmt(
Node->getPreInitStmt()));
3299template <
typename Derived>
3300bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3301 OMPClauseWithPostUpdate *
Node) {
3303 TRY_TO(TraverseStmt(
Node->getPostUpdateExpr()));
3307template <
typename Derived>
3308bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
3309 OMPAllocatorClause *C) {
3310 TRY_TO(TraverseStmt(
C->getAllocator()));
3314template <
typename Derived>
3315bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
3316 TRY_TO(TraverseStmt(
C->getAllocator()));
3317 TRY_TO(VisitOMPClauseList(C));
3321template <
typename Derived>
3322bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
3323 TRY_TO(VisitOMPClauseWithPreInit(C));
3324 TRY_TO(TraverseStmt(
C->getCondition()));
3328template <
typename Derived>
3329bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
3330 TRY_TO(VisitOMPClauseWithPreInit(C));
3331 TRY_TO(TraverseStmt(
C->getCondition()));
3335template <
typename Derived>
3337RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3338 TRY_TO(VisitOMPClauseWithPreInit(C));
3339 TRY_TO(TraverseStmt(
C->getNumThreads()));
3343template <
typename Derived>
3344bool RecursiveASTVisitor<Derived>::VisitOMPAlignClause(OMPAlignClause *C) {
3345 TRY_TO(TraverseStmt(
C->getAlignment()));
3349template <
typename Derived>
3350bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3351 TRY_TO(TraverseStmt(
C->getSafelen()));
3355template <
typename Derived>
3356bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3357 TRY_TO(TraverseStmt(
C->getSimdlen()));
3361template <
typename Derived>
3362bool RecursiveASTVisitor<Derived>::VisitOMPSizesClause(OMPSizesClause *C) {
3363 for (Expr *
E :
C->getSizesRefs())
3368template <
typename Derived>
3369bool RecursiveASTVisitor<Derived>::VisitOMPPermutationClause(
3370 OMPPermutationClause *C) {
3371 for (Expr *
E :
C->getArgsRefs())
3376template <
typename Derived>
3377bool RecursiveASTVisitor<Derived>::VisitOMPFullClause(OMPFullClause *C) {
3381template <
typename Derived>
3382bool RecursiveASTVisitor<Derived>::VisitOMPPartialClause(OMPPartialClause *C) {
3383 TRY_TO(TraverseStmt(
C->getFactor()));
3387template <
typename Derived>
3389RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3390 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3394template <
typename Derived>
3395bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3399template <
typename Derived>
3400bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3404template <
typename Derived>
3405bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3406 OMPUnifiedAddressClause *) {
3410template <
typename Derived>
3411bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3412 OMPUnifiedSharedMemoryClause *) {
3416template <
typename Derived>
3417bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3418 OMPReverseOffloadClause *) {
3422template <
typename Derived>
3423bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3424 OMPDynamicAllocatorsClause *) {
3428template <
typename Derived>
3429bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3430 OMPAtomicDefaultMemOrderClause *) {
3434template <
typename Derived>
3435bool RecursiveASTVisitor<Derived>::VisitOMPAtClause(OMPAtClause *) {
3439template <
typename Derived>
3440bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
3444template <
typename Derived>
3445bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
3446 TRY_TO(TraverseStmt(
C->getMessageString()));
3450template <
typename Derived>
3452RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3453 TRY_TO(VisitOMPClauseWithPreInit(C));
3454 TRY_TO(TraverseStmt(
C->getChunkSize()));
3458template <
typename Derived>
3459bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3460 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3464template <
typename Derived>
3465bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3469template <
typename Derived>
3470bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3474template <
typename Derived>
3476RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3480template <
typename Derived>
3481bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3485template <
typename Derived>
3486bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3490template <
typename Derived>
3491bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3495template <
typename Derived>
3496bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3500template <
typename Derived>
3501bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
3505template <
typename Derived>
3506bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3510template <
typename Derived>
3511bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3515template <
typename Derived>
3516bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
3520template <
typename Derived>
3521bool RecursiveASTVisitor<Derived>::VisitOMPAbsentClause(OMPAbsentClause *) {
3525template <
typename Derived>
3526bool RecursiveASTVisitor<Derived>::VisitOMPHoldsClause(OMPHoldsClause *) {
3530template <
typename Derived>
3531bool RecursiveASTVisitor<Derived>::VisitOMPContainsClause(OMPContainsClause *) {
3535template <
typename Derived>
3536bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
3540template <
typename Derived>
3541bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPRoutinesClause(
3542 OMPNoOpenMPRoutinesClause *) {
3546template <
typename Derived>
3547bool RecursiveASTVisitor<Derived>::VisitOMPNoParallelismClause(
3548 OMPNoParallelismClause *) {
3552template <
typename Derived>
3553bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
3557template <
typename Derived>
3558bool RecursiveASTVisitor<Derived>::VisitOMPReleaseClause(OMPReleaseClause *) {
3562template <
typename Derived>
3563bool RecursiveASTVisitor<Derived>::VisitOMPRelaxedClause(OMPRelaxedClause *) {
3567template <
typename Derived>
3568bool RecursiveASTVisitor<Derived>::VisitOMPWeakClause(OMPWeakClause *) {
3572template <
typename Derived>
3573bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3577template <
typename Derived>
3578bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3582template <
typename Derived>
3583bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3587template <
typename Derived>
3588bool RecursiveASTVisitor<Derived>::VisitOMPInitClause(OMPInitClause *C) {
3589 TRY_TO(VisitOMPClauseList(C));
3593template <
typename Derived>
3594bool RecursiveASTVisitor<Derived>::VisitOMPUseClause(OMPUseClause *C) {
3595 TRY_TO(TraverseStmt(
C->getInteropVar()));
3599template <
typename Derived>
3600bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *C) {
3601 TRY_TO(TraverseStmt(
C->getInteropVar()));
3605template <
typename Derived>
3606bool RecursiveASTVisitor<Derived>::VisitOMPNovariantsClause(
3607 OMPNovariantsClause *C) {
3608 TRY_TO(VisitOMPClauseWithPreInit(C));
3609 TRY_TO(TraverseStmt(
C->getCondition()));
3613template <
typename Derived>
3614bool RecursiveASTVisitor<Derived>::VisitOMPNocontextClause(
3615 OMPNocontextClause *C) {
3616 TRY_TO(VisitOMPClauseWithPreInit(C));
3617 TRY_TO(TraverseStmt(
C->getCondition()));
3621template <
typename Derived>
3622template <
typename T>
3623bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *
Node) {
3624 for (
auto *
E :
Node->varlist()) {
3630template <
typename Derived>
3631bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
3632 OMPInclusiveClause *C) {
3633 TRY_TO(VisitOMPClauseList(C));
3637template <
typename Derived>
3638bool RecursiveASTVisitor<Derived>::VisitOMPExclusiveClause(
3639 OMPExclusiveClause *C) {
3640 TRY_TO(VisitOMPClauseList(C));
3644template <
typename Derived>
3645bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3646 TRY_TO(VisitOMPClauseList(C));
3647 for (
auto *
E :
C->private_copies()) {
3653template <
typename Derived>
3654bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3655 OMPFirstprivateClause *C) {
3656 TRY_TO(VisitOMPClauseList(C));
3657 TRY_TO(VisitOMPClauseWithPreInit(C));
3658 for (
auto *
E :
C->private_copies()) {
3661 for (
auto *
E :
C->inits()) {
3667template <
typename Derived>
3668bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3669 OMPLastprivateClause *C) {
3670 TRY_TO(VisitOMPClauseList(C));
3671 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3672 for (
auto *
E :
C->private_copies()) {
3675 for (
auto *
E :
C->source_exprs()) {
3678 for (
auto *
E :
C->destination_exprs()) {
3681 for (
auto *
E :
C->assignment_ops()) {
3687template <
typename Derived>
3688bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3689 TRY_TO(VisitOMPClauseList(C));
3693template <
typename Derived>
3694bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3695 TRY_TO(TraverseStmt(
C->getStep()));
3696 TRY_TO(TraverseStmt(
C->getCalcStep()));
3697 TRY_TO(VisitOMPClauseList(C));
3698 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3699 for (
auto *
E :
C->privates()) {
3702 for (
auto *
E :
C->inits()) {
3705 for (
auto *
E :
C->updates()) {
3708 for (
auto *
E :
C->finals()) {
3714template <
typename Derived>
3715bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3716 TRY_TO(TraverseStmt(
C->getAlignment()));
3717 TRY_TO(VisitOMPClauseList(C));
3721template <
typename Derived>
3722bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3723 TRY_TO(VisitOMPClauseList(C));
3724 for (
auto *
E :
C->source_exprs()) {
3727 for (
auto *
E :
C->destination_exprs()) {
3730 for (
auto *
E :
C->assignment_ops()) {
3736template <
typename Derived>
3737bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3738 OMPCopyprivateClause *C) {
3739 TRY_TO(VisitOMPClauseList(C));
3740 for (
auto *
E :
C->source_exprs()) {
3743 for (
auto *
E :
C->destination_exprs()) {
3746 for (
auto *
E :
C->assignment_ops()) {
3752template <
typename Derived>
3754RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3755 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3756 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3757 TRY_TO(VisitOMPClauseList(C));
3758 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3759 for (
auto *
E :
C->privates()) {
3762 for (
auto *
E :
C->lhs_exprs()) {
3765 for (
auto *
E :
C->rhs_exprs()) {
3768 for (
auto *
E :
C->reduction_ops()) {
3771 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3772 for (
auto *
E :
C->copy_ops()) {
3775 for (
auto *
E :
C->copy_array_temps()) {
3778 for (
auto *
E :
C->copy_array_elems()) {
3785template <
typename Derived>
3786bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3787 OMPTaskReductionClause *C) {
3788 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3789 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3790 TRY_TO(VisitOMPClauseList(C));
3791 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3792 for (
auto *
E :
C->privates()) {
3795 for (
auto *
E :
C->lhs_exprs()) {
3798 for (
auto *
E :
C->rhs_exprs()) {
3801 for (
auto *
E :
C->reduction_ops()) {
3807template <
typename Derived>
3808bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3809 OMPInReductionClause *C) {
3810 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3811 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3812 TRY_TO(VisitOMPClauseList(C));
3813 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3814 for (
auto *
E :
C->privates()) {
3817 for (
auto *
E :
C->lhs_exprs()) {
3820 for (
auto *
E :
C->rhs_exprs()) {
3823 for (
auto *
E :
C->reduction_ops()) {
3826 for (
auto *
E :
C->taskgroup_descriptors())
3831template <
typename Derived>
3832bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3833 TRY_TO(VisitOMPClauseList(C));
3837template <
typename Derived>
3838bool RecursiveASTVisitor<Derived>::VisitOMPDepobjClause(OMPDepobjClause *C) {
3839 TRY_TO(TraverseStmt(
C->getDepobj()));
3843template <
typename Derived>
3844bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3845 TRY_TO(VisitOMPClauseList(C));
3849template <
typename Derived>
3850bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3851 TRY_TO(VisitOMPClauseWithPreInit(C));
3852 TRY_TO(TraverseStmt(
C->getDevice()));
3856template <
typename Derived>
3857bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3858 TRY_TO(VisitOMPClauseList(C));
3862template <
typename Derived>
3863bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
3864 OMPNumTeamsClause *C) {
3865 TRY_TO(VisitOMPClauseList(C));
3866 TRY_TO(VisitOMPClauseWithPreInit(C));
3870template <
typename Derived>
3871bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
3872 OMPThreadLimitClause *C) {
3873 TRY_TO(VisitOMPClauseList(C));
3874 TRY_TO(VisitOMPClauseWithPreInit(C));
3878template <
typename Derived>
3879bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
3880 OMPPriorityClause *C) {
3881 TRY_TO(VisitOMPClauseWithPreInit(C));
3882 TRY_TO(TraverseStmt(
C->getPriority()));
3886template <
typename Derived>
3887bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
3888 OMPGrainsizeClause *C) {
3889 TRY_TO(VisitOMPClauseWithPreInit(C));
3890 TRY_TO(TraverseStmt(
C->getGrainsize()));
3894template <
typename Derived>
3895bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
3896 OMPNumTasksClause *C) {
3897 TRY_TO(VisitOMPClauseWithPreInit(C));
3898 TRY_TO(TraverseStmt(
C->getNumTasks()));
3902template <
typename Derived>
3903bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
3904 TRY_TO(TraverseStmt(
C->getHint()));
3908template <
typename Derived>
3909bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
3910 OMPDistScheduleClause *C) {
3911 TRY_TO(VisitOMPClauseWithPreInit(C));
3912 TRY_TO(TraverseStmt(
C->getChunkSize()));
3916template <
typename Derived>
3918RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
3922template <
typename Derived>
3923bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
3924 TRY_TO(VisitOMPClauseList(C));
3928template <
typename Derived>
3929bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
3930 TRY_TO(VisitOMPClauseList(C));
3934template <
typename Derived>
3935bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
3936 OMPUseDevicePtrClause *C) {
3937 TRY_TO(VisitOMPClauseList(C));
3941template <
typename Derived>
3942bool RecursiveASTVisitor<Derived>::VisitOMPUseDeviceAddrClause(
3943 OMPUseDeviceAddrClause *C) {
3944 TRY_TO(VisitOMPClauseList(C));
3948template <
typename Derived>
3949bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
3950 OMPIsDevicePtrClause *C) {
3951 TRY_TO(VisitOMPClauseList(C));
3955template <
typename Derived>
3956bool RecursiveASTVisitor<Derived>::VisitOMPHasDeviceAddrClause(
3957 OMPHasDeviceAddrClause *C) {
3958 TRY_TO(VisitOMPClauseList(C));
3962template <
typename Derived>
3963bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
3964 OMPNontemporalClause *C) {
3965 TRY_TO(VisitOMPClauseList(C));
3966 for (
auto *
E :
C->private_refs()) {
3972template <
typename Derived>
3973bool RecursiveASTVisitor<Derived>::VisitOMPOrderClause(OMPOrderClause *) {
3977template <
typename Derived>
3978bool RecursiveASTVisitor<Derived>::VisitOMPDetachClause(OMPDetachClause *C) {
3979 TRY_TO(TraverseStmt(
C->getEventHandler()));
3983template <
typename Derived>
3984bool RecursiveASTVisitor<Derived>::VisitOMPUsesAllocatorsClause(
3985 OMPUsesAllocatorsClause *C) {
3986 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
3987 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
3994template <
typename Derived>
3995bool RecursiveASTVisitor<Derived>::VisitOMPAffinityClause(
3996 OMPAffinityClause *C) {
3997 TRY_TO(TraverseStmt(
C->getModifier()));
3998 for (Expr *
E :
C->varlist())
4003template <
typename Derived>
4004bool RecursiveASTVisitor<Derived>::VisitOMPFilterClause(OMPFilterClause *C) {
4005 TRY_TO(VisitOMPClauseWithPreInit(C));
4006 TRY_TO(TraverseStmt(
C->getThreadID()));
4010template <
typename Derived>
4011bool RecursiveASTVisitor<Derived>::VisitOMPBindClause(OMPBindClause *C) {
4015template <
typename Derived>
4016bool RecursiveASTVisitor<Derived>::VisitOMPXDynCGroupMemClause(
4017 OMPXDynCGroupMemClause *C) {
4018 TRY_TO(VisitOMPClauseWithPreInit(C));
4019 TRY_TO(TraverseStmt(
C->getSize()));
4023template <
typename Derived>
4024bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
4025 OMPDoacrossClause *C) {
4026 TRY_TO(VisitOMPClauseList(C));
4030template <
typename Derived>
4031bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
4032 OMPXAttributeClause *C) {
4036template <
typename Derived>
4037bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
4041template <
typename Derived>
4042bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4043 OpenACCConstructStmt *C) {
4044 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4048template <
typename Derived>
4049bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4050 OpenACCAssociatedStmtConstruct *S) {
4051 TRY_TO(TraverseOpenACCConstructStmt(S));
4052 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4056template <
typename Derived>
4057bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *C) {
4058 for (
const Stmt *Child :
C->children())
4059 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4063template <
typename Derived>
4064bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4065 ArrayRef<const OpenACCClause *> Clauses) {
4067 for (
const auto *C : Clauses)
4068 TRY_TO(VisitOpenACCClause(C));
4073 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4075 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4077 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4079 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4081 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4083 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4085 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4087 if (S->hasDevNumExpr())
4088 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4089 for (
auto *
E : S->getQueueIdExprs())
4091 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4094 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4096 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4098 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4100 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
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.
#define DEF_TRAVERSE_TMPL_INST(kind)
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::DenseSet< const void * > Visited
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
#define STMT(CLASS, PARENT)
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define DEF_TRAVERSE_DECL(DECL, CODE)
#define DEF_TRAVERSE_STMT(STMT, CODE)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
#define TRY_TO(CALL_EXPR)
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Wrapper for source info for arrays.
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Represents a C++ struct/union/class.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Complex values, per C99 6.2.5p11.
A reference to a concept and its template args, as it appears in the code.
Represents the canonical version of C arrays with a specified constant size.
Represents a concrete matrix type with constant number of rows and columns.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a dependent template name that cannot be resolved prior to template instantiation.
Represents a template specialization type whose template cannot be resolved, e.g.
Represents a vector type where either the type or size is dependent.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
This represents one expression.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
QualType getParamType(unsigned i) const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > exceptions() const
ArrayRef< QualType > param_types() const
QualType getReturnType() const
Represents a C array with an unspecified size.
Describes an C or C++ initializer list.
Represents the declaration of a label.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
This represents a decl that may have a name.
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 class type in Objective C.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents a type parameter type in Objective C.
Sugar for parentheses used when specifying types.
A (possibly-)qualified type.
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type.
bool WalkUpFromDecl(Decl *D)
bool TraverseConceptRequirement(concepts::Requirement *R)
bool 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 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.
Scope - A scope is a transient data structure that is used while parsing the program.
Stmt - This represents one statement.
llvm::iterator_range< child_iterator > child_range
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.
The top declaration context.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
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...
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.