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"
657template <
typename Derived>
658LLVM_ATTRIBUTE_NOINLINE
bool
664 Queue->push_back({S,
false});
669 LocalQueue.push_back({S,
false});
671 while (!LocalQueue.empty()) {
672 auto &CurrSAndVisited = LocalQueue.back();
673 Stmt *CurrS = CurrSAndVisited.getPointer();
674 bool Visited = CurrSAndVisited.getInt();
676 LocalQueue.pop_back();
677 TRY_TO(dataTraverseStmtPost(CurrS));
678 if (getDerived().shouldTraversePostOrder()) {
679 TRY_TO(PostVisitStmt(CurrS));
684 if (getDerived().dataTraverseStmtPre(CurrS)) {
685 CurrSAndVisited.setInt(
true);
686 size_t N = LocalQueue.size();
687 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
689 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
691 LocalQueue.pop_back();
698template <
typename Derived>
704#define ABSTRACT_TYPE(CLASS, BASE)
705#define TYPE(CLASS, BASE) \
707 return getDerived().Traverse##CLASS##Type( \
708 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));
709#include "clang/AST/TypeNodes.inc"
715template <
typename Derived>
721#define ABSTRACT_TYPELOC(CLASS, BASE)
722#define TYPELOC(CLASS, BASE) \
723 case TypeLoc::CLASS: \
724 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
725#include "clang/AST/TypeLocNodes.def"
732#define VISITORCLASS RecursiveASTVisitor
733#include "clang/AST/AttrVisitor.inc"
736template <
typename Derived>
743 if (!getDerived().shouldVisitImplicitCode()) {
748 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(
D))
749 return TraverseTemplateTypeParamDeclConstraints(TTPD);
760 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
D))
761 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
762 FTD->getDeclName().getCXXDeductionGuideTemplate()))
767#define ABSTRACT_DECL(DECL)
768#define DECL(CLASS, BASE) \
770 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
773#include "clang/AST/DeclNodes.inc"
778template <
typename Derived>
803template <
typename Derived>
810 TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
829template <
typename Derived>
837 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
841 TRY_TO(TraverseTemplateName(
858template <
typename Derived>
861 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
864 if (QTN->getQualifier()) {
865 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
872template <
typename Derived>
884 return getDerived().TraverseType(Arg.
getAsType());
888 return getDerived().TraverseTemplateName(
892 return getDerived().TraverseStmt(Arg.
getAsExpr());
895 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
903template <
typename Derived>
919 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
921 return getDerived().TraverseType(Arg.
getAsType());
927 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
929 return getDerived().TraverseTemplateName(
936 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
942template <
typename Derived>
946 TRY_TO(TraverseTemplateArgument(Arg));
951template <
typename Derived>
955 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
957 if (
Init->isWritten() || getDerived().shouldVisitImplicitCode())
963template <
typename Derived>
968 if (LE->isInitCapture(
C))
969 TRY_TO(TraverseDecl(
C->getCapturedVar()));
978#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
979 template <typename Derived> \
980 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
981 if (!getDerived().shouldTraversePostOrder()) \
982 TRY_TO(WalkUpFrom##TYPE(T)); \
984 if (getDerived().shouldTraversePostOrder()) \
985 TRY_TO(WalkUpFrom##TYPE(T)); \
1005 TRY_TO(TraverseType(QualType(
T->getClass(), 0)));
1014 TRY_TO(TraverseType(
T->getElementType()));
1015 if (
T->getSizeExpr())
1016 TRY_TO(TraverseStmt(
const_cast<Expr*
>(
T->getSizeExpr())));
1020 TRY_TO(TraverseType(
T->getElementType()));
1021 if (
T->getSizeExpr())
1022 TRY_TO(TraverseStmt(
const_cast<Expr *
>(
T->getSizeExpr())));
1026 {
TRY_TO(TraverseType(
T->getElementType())); })
1029 TRY_TO(TraverseType(
T->getElementType()));
1034 TRY_TO(TraverseType(
T->getElementType()));
1035 if (
T->getSizeExpr())
1036 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1040 TRY_TO(TraverseStmt(
T->getAddrSpaceExpr()));
1045 if (
T->getSizeExpr())
1046 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1047 TRY_TO(TraverseType(
T->getElementType()));
1051 if (
T->getSizeExpr())
1052 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1061 {
TRY_TO(TraverseType(
T->getElementType())); })
1064 if (
T->getRowExpr())
1065 TRY_TO(TraverseStmt(
T->getRowExpr()));
1066 if (
T->getColumnExpr())
1067 TRY_TO(TraverseStmt(
T->getColumnExpr()));
1068 TRY_TO(TraverseType(
T->getElementType()));
1086 TRY_TO(TraverseStmt(NE));
1094 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1099 {
TRY_TO(TraverseStmt(
T->getUnderlyingExpr())); })
1102 TRY_TO(TraverseType(
T->getPattern()));
1107 TRY_TO(TraverseType(
T->getBaseType()));
1108 TRY_TO(TraverseType(
T->getUnderlyingType()));
1112 TRY_TO(TraverseType(
T->getDeducedType()));
1113 if (
T->isConstrained()) {
1114 TRY_TO(TraverseTemplateArguments(
T->getTypeConstraintArguments()));
1118 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1119 TRY_TO(TraverseType(
T->getDeducedType()));
1126 TRY_TO(TraverseType(
T->getReplacementType()));
1129 TRY_TO(TraverseTemplateArgument(
T->getArgumentPack()));
1133 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1134 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1140 {
TRY_TO(TraverseType(
T->getModifiedType())); })
1143 if (
T->getCountExpr())
1144 TRY_TO(TraverseStmt(
T->getCountExpr()));
1149 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1152 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1157 {
TRY_TO(TraverseType(
T->getUnderlyingType())); })
1160 if (
T->getQualifier()) {
1161 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1163 TRY_TO(TraverseType(
T->getNamedType()));
1167 {
TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier())); })
1170 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1171 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1183 if (
T->getBaseType().getTypePtr() !=
T)
1184 TRY_TO(TraverseType(
T->getBaseType()));
1185 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1186 TRY_TO(TraverseType(typeArg));
1199 {
TRY_TO(TraverseStmt(
T->getNumBitsExpr())); })
1211 template <
typename Derived> \
1212 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##
Loc(
TYPE##
Loc TL) { \
1213 if (!getDerived().shouldTraversePostOrder()) { \
1214 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1215 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1216 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1219 if (getDerived().shouldTraversePostOrder()) { \
1220 TRY_TO(WalkUpFrom##
TYPE##
Loc(TL)); \
1221 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1222 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1227template <
typename Derived>
1229RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1245 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1252 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1256 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1259 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1262 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1265 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1270 if (
auto *TSI = TL.getClassTInfo())
1271 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1278 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1281 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1283template <typename Derived>
1284bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1286 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1291 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1292 TRY_TO(TraverseArrayTypeLocHelper(TL));
1296 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
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(TraverseTypeLoc(TL.getElementLoc()));
1312 TRY_TO(TraverseArrayTypeLocHelper(TL));
1316 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1317 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1323 if (TL.getTypePtr()->getSizeExpr())
1324 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1325 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1330 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1334 if (TL.getTypePtr()->getSizeExpr())
1335 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1336 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1342 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1346 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1347 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1348 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1352 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1353 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1354 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1358 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1362 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1366 for (
unsigned I = 0,
E = TL.getNumParams(); I !=
E; ++I) {
1367 if (TL.getParam(I)) {
1368 TRY_TO(TraverseDecl(TL.getParam(I)));
1369 }
else if (I < T->getNumParams()) {
1379 TRY_TO(TraverseStmt(NE));
1387 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1390 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1395 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1399 TRY_TO(TraverseType(TL.getPattern()));
1400 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1404 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1408 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1409 if (TL.isConstrained()) {
1410 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1415 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1416 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1423 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1426 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1431 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1432 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1433 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1442 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1445 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1448 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1451 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1454 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1457 if (TL.getQualifierLoc()) {
1458 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1460 TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
1464 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1468 if (TL.getQualifierLoc()) {
1469 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1472 for (
unsigned I = 0,
E = TL.getNumArgs(); I !=
E; ++I) {
1473 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1478 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1481 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1483 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1492 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1493 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1494 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1495 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1496 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1498 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1503 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1511 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1523template <typename Derived>
1525 const Decl *Child) {
1528 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1531 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1532 return Cls->isLambda();
1536template <
typename Derived>
1541 for (
auto *Child : DC->
decls()) {
1542 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1543 TRY_TO(TraverseDecl(Child));
1550#define DEF_TRAVERSE_DECL(DECL, CODE) \
1551 template <typename Derived> \
1552 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1553 bool ShouldVisitChildren = true; \
1554 bool ReturnValue = true; \
1555 if (!getDerived().shouldTraversePostOrder()) \
1556 TRY_TO(WalkUpFrom##DECL(D)); \
1558 if (ReturnValue && ShouldVisitChildren) \
1559 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1560 if (ReturnValue) { \
1562 for (auto *I : D->attrs()) \
1563 TRY_TO(getDerived().TraverseAttr(I)); \
1565 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1566 TRY_TO(WalkUpFrom##DECL(D)); \
1567 return ReturnValue; \
1574 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1576 for (
const auto &I :
D->captures()) {
1577 if (I.hasCopyExpr()) {
1578 TRY_TO(TraverseStmt(I.getCopyExpr()));
1585 TRY_TO(TraverseStmt(
D->getBody()));
1594 TRY_TO(TraverseStmt(
D->getTemporaryExpr()));
1598 {
TRY_TO(TraverseStmt(
D->getAsmString())); })
1606 if (
D->getFriendType()) {
1607 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1610 if (
auto *ET =
D->getFriendType()->getType()->getAs<ElaboratedType>())
1611 TRY_TO(TraverseDecl(ET->getOwnedTagDecl()));
1613 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1618 if (
D->getFriendType())
1619 TRY_TO(TraverseTypeLoc(
D->getFriendType()->getTypeLoc()));
1621 TRY_TO(TraverseDecl(
D->getFriendDecl()));
1622 for (
unsigned I = 0,
E =
D->getNumTemplateParameters(); I <
E; ++I) {
1623 TemplateParameterList *TPL =
D->getTemplateParameterList(I);
1624 for (TemplateParameterList::iterator ITPL = TPL->begin(), ETPL = TPL->end();
1625 ITPL != ETPL; ++ITPL) {
1626 TRY_TO(TraverseDecl(*ITPL));
1639 TRY_TO(TraverseStmt(
D->getAssertExpr()));
1640 TRY_TO(TraverseStmt(
D->getMessage()));
1650 auto Scope =
D->getASTContext().getTraversalScope();
1651 bool HasLimitedScope =
1652 Scope.size() != 1 || !isa<TranslationUnitDecl>(Scope.front());
1653 if (HasLimitedScope) {
1655 for (
auto *Child : Scope) {
1656 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1657 TRY_TO(TraverseDecl(Child));
1669 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1690 if (ObjCTypeParamList *typeParamList =
D->getTypeParamList()) {
1691 for (
auto typeParam : *typeParamList) {
1692 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1695 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1696 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1697 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1708 if (ObjCTypeParamList *typeParamList =
D->getTypeParamListAsWritten()) {
1709 for (
auto typeParam : *typeParamList) {
1710 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1714 if (TypeSourceInfo *superTInfo =
D->getSuperClassTInfo()) {
1715 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1717 if (
D->isThisDeclarationADefinition()) {
1718 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1719 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1720 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1726 if (
D->isThisDeclarationADefinition()) {
1727 for (
auto It : llvm::zip(
D->protocols(),
D->protocol_locs())) {
1728 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1729 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1735 if (
D->getReturnTypeSourceInfo()) {
1736 TRY_TO(TraverseTypeLoc(
D->getReturnTypeSourceInfo()->getTypeLoc()));
1738 for (ParmVarDecl *Parameter :
D->parameters()) {
1739 TRY_TO(TraverseDecl(Parameter));
1741 if (
D->isThisDeclarationADefinition()) {
1742 TRY_TO(TraverseStmt(
D->getBody()));
1748 if (
D->hasExplicitBound()) {
1749 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1757 if (
D->getTypeSourceInfo())
1758 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1760 TRY_TO(TraverseType(
D->getType()));
1765 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1766 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
1770 {
TRY_TO(TraverseTypeLoc(
D->getEnumTypeLoc())); })
1775 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
1783 for (
auto *I :
D->varlist()) {
1789 for (
auto *C :
D->clauselists()) {
1790 TRY_TO(TraverseOMPClause(C));
1795 TRY_TO(TraverseStmt(
D->getCombiner()));
1796 if (
auto *Initializer =
D->getInitializer())
1797 TRY_TO(TraverseStmt(Initializer));
1798 TRY_TO(TraverseType(
D->getType()));
1803 for (
auto *C :
D->clauselists())
1804 TRY_TO(TraverseOMPClause(C));
1805 TRY_TO(TraverseType(
D->getType()));
1812 for (
auto *I :
D->varlist())
1814 for (
auto *C :
D->clauselists())
1815 TRY_TO(TraverseOMPClause(C));
1819template <typename Derived>
1820bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1821 TemplateParameterList *TPL) {
1823 for (NamedDecl *
D : *TPL) {
1826 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1827 TRY_TO(TraverseStmt(RequiresClause));
1833template <
typename Derived>
1834template <
typename T>
1835bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *
D) {
1836 for (
unsigned i = 0; i <
D->getNumTemplateParameterLists(); i++) {
1837 TemplateParameterList *TPL =
D->getTemplateParameterList(i);
1838 TraverseTemplateParameterListHelper(TPL);
1843template <
typename Derived>
1844bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1845 ClassTemplateDecl *
D) {
1846 for (
auto *SD :
D->specializations()) {
1847 for (
auto *RD : SD->redecls()) {
1848 assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName());
1850 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1854 TRY_TO(TraverseDecl(RD));
1871template <
typename Derived>
1872bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1873 VarTemplateDecl *
D) {
1874 for (
auto *SD :
D->specializations()) {
1875 for (
auto *RD : SD->redecls()) {
1877 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1880 TRY_TO(TraverseDecl(RD));
1896template <
typename Derived>
1897bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1898 FunctionTemplateDecl *
D) {
1899 for (
auto *FD :
D->specializations()) {
1900 for (
auto *RD : FD->redecls()) {
1901 switch (RD->getTemplateSpecializationKind()) {
1905 TRY_TO(TraverseDecl(RD));
1912 TRY_TO(TraverseDecl(RD));
1926#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
1927 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
1928 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
1929 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
1937 if (getDerived().shouldVisitTemplateInstantiations() && \
1938 D == D->getCanonicalDecl()) \
1939 TRY_TO(TraverseTemplateInstantiations(D)); \
1953 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
1954 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1955 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1956 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1960 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
1963template <typename Derived>
1964bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
1965 const TemplateTypeParmDecl *
D) {
1966 if (
const auto *TC =
D->getTypeConstraint())
1967 TRY_TO(TraverseTypeConstraint(TC));
1973 if (
D->getTypeForDecl())
1974 TRY_TO(TraverseType(QualType(
D->getTypeForDecl(), 0)));
1975 TRY_TO(TraverseTemplateTypeParamDeclConstraints(
D));
1976 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
1977 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
1981 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1988 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
1995 TRY_TO(TraverseDecl(
D->getTemplatedDecl()));
1996 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2000 TRY_TO(TraverseTemplateParameterListHelper(
D->getTemplateParameters()));
2001 TRY_TO(TraverseStmt(
D->getConstraintExpr()));
2007 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2016 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2018 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2019 if (
auto *TSI =
D->getIntegerTypeSourceInfo())
2020 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2026template <typename Derived>
2027bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *
D) {
2031 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2032 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2036template <
typename Derived>
2037bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
2038 const CXXBaseSpecifier &
Base) {
2039 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2043template <
typename Derived>
2044bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *
D) {
2045 if (!TraverseRecordHelper(
D))
2047 if (
D->isCompleteDefinition()) {
2048 for (
const auto &I :
D->bases()) {
2049 TRY_TO(TraverseCXXBaseSpecifier(I));
2061template <typename Derived>
2062bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2063 const TemplateArgumentLoc *TAL,
unsigned Count) {
2064 for (
unsigned I = 0; I < Count; ++I) {
2065 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2070#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2071 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2080 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2082 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2083 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2086 if (getDerived().shouldVisitTemplateInstantiations() || \
2087 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2089 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2091 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2104#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2105 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2107 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2109 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2110 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2111 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2116 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2129 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2130 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2135template <typename Derived>
2136bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *
D) {
2137 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2138 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2139 if (
D->getTypeSourceInfo())
2140 TRY_TO(TraverseTypeLoc(
D->getTypeSourceInfo()->getTypeLoc()));
2142 TRY_TO(TraverseType(
D->getType()));
2148 for (
auto *Binding :
D->bindings()) {
2149 TRY_TO(TraverseDecl(Binding));
2154 if (getDerived().shouldVisitImplicitCode()) {
2155 TRY_TO(TraverseStmt(
D->getBinding()));
2156 if (
const auto HoldingVar =
D->getHoldingVar())
2157 TRY_TO(TraverseDecl(HoldingVar));
2169 TRY_TO(TraverseDeclaratorHelper(
D));
2170 if (
D->isBitField())
2171 TRY_TO(TraverseStmt(
D->getBitWidth()));
2172 if (
D->hasInClassInitializer())
2173 TRY_TO(TraverseStmt(
D->getInClassInitializer()));
2177 TRY_TO(TraverseDeclaratorHelper(
D));
2178 if (
D->isBitField())
2179 TRY_TO(TraverseStmt(
D->getBitWidth()));
2184 TRY_TO(TraverseDeclaratorHelper(
D));
2185 if (
D->isBitField())
2186 TRY_TO(TraverseStmt(
D->getBitWidth()));
2190template <typename Derived>
2191bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *
D) {
2192 TRY_TO(TraverseDeclTemplateParameterLists(
D));
2193 TRY_TO(TraverseNestedNameSpecifierLoc(
D->getQualifierLoc()));
2194 TRY_TO(TraverseDeclarationNameInfo(
D->getNameInfo()));
2201 if (
const FunctionTemplateSpecializationInfo *FTSI =
2202 D->getTemplateSpecializationInfo()) {
2203 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2204 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2207 if (
const ASTTemplateArgumentListInfo *TALI =
2208 FTSI->TemplateArgumentsAsWritten) {
2209 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2210 TALI->NumTemplateArgs));
2213 }
else if (
const DependentFunctionTemplateSpecializationInfo *DFSI =
2214 D->getDependentSpecializationInfo()) {
2215 if (
const ASTTemplateArgumentListInfo *TALI =
2216 DFSI->TemplateArgumentsAsWritten) {
2217 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2218 TALI->NumTemplateArgs));
2226 if (TypeSourceInfo *TSI =
D->getTypeSourceInfo()) {
2227 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2228 }
else if (getDerived().shouldVisitImplicitCode()) {
2233 for (ParmVarDecl *Parameter :
D->parameters()) {
2234 TRY_TO(TraverseDecl(Parameter));
2239 if (Expr *TrailingRequiresClause =
D->getTrailingRequiresClause()) {
2240 TRY_TO(TraverseStmt(TrailingRequiresClause));
2243 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(
D)) {
2245 for (
auto *I : Ctor->inits()) {
2246 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2247 TRY_TO(TraverseConstructorInitializer(I));
2252 D->isThisDeclarationADefinition() &&
2255 (!
D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2257 if (
const auto *MD = dyn_cast<CXXMethodDecl>(
D)) {
2258 if (
const CXXRecordDecl *RD = MD->getParent()) {
2259 if (RD->isLambda() &&
2261 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2267 TRY_TO(TraverseStmt(
D->getBody()));
2270 for (
auto *Child :
D->decls()) {
2271 if (isa<UsingShadowDecl>(Child))
2272 TRY_TO(TraverseDecl(Child));
2322template <typename Derived>
2323bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *
D) {
2324 TRY_TO(TraverseDeclaratorHelper(
D));
2326 if (!isa<ParmVarDecl>(
D) &&
2327 (!
D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2328 TRY_TO(TraverseStmt(
D->getInit()));
2338 TRY_TO(TraverseDeclaratorHelper(
D));
2339 if (
D->hasDefaultArgument() && !
D->defaultArgumentWasInherited())
2340 TRY_TO(TraverseTemplateArgumentLoc(
D->getDefaultArgument()));
2346 if (
D->hasDefaultArg() &&
D->hasUninstantiatedDefaultArg() &&
2347 !
D->hasUnparsedDefaultArg())
2348 TRY_TO(TraverseStmt(
D->getUninstantiatedDefaultArg()));
2350 if (
D->hasDefaultArg() && !
D->hasUninstantiatedDefaultArg() &&
2351 !
D->hasUnparsedDefaultArg())
2352 TRY_TO(TraverseStmt(
D->getDefaultArg()));
2358 TRY_TO(TraverseTemplateArguments(
D->getTemplateArguments()));
2374 template <
typename Derived> \
2375 bool RecursiveASTVisitor<Derived>::Traverse##
STMT( \
2376 STMT *S, DataRecursionQueue *Queue) { \
2379 if (!getDerived().shouldTraversePostOrder()) \
2380 TRY_TO(WalkUpFrom##
STMT(S)); \
2382 if (ShouldVisitChildren) { \
2383 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2384 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2391 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2392 TRY_TO(WalkUpFrom##
STMT(S)); \
2399 for (
unsigned I = 0,
E = S->getNumInputs(); I <
E; ++I) {
2402 for (
unsigned I = 0,
E = S->getNumOutputs(); I <
E; ++I) {
2405 for (
unsigned I = 0,
E = S->getNumClobbers(); I <
E; ++I) {
2418 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2423 for (
auto *I : S->decls()) {
2459 if (!getDerived().shouldVisitImplicitCode()) {
2471 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2472 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2482 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2483 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2484 if (S->hasExplicitTemplateArgs()) {
2485 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2486 S->getNumTemplateArgs()));
2491 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2492 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2493 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2494 S->getNumTemplateArgs()));
2498 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2499 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2500 if (S->hasExplicitTemplateArgs()) {
2501 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2502 S->getNumTemplateArgs()));
2507 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2508 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2509 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2510 S->getNumTemplateArgs()));
2520 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2524 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2528 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2532 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2536 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2540 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2544 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2548 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2551template <typename Derived>
2552bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2553 InitListExpr *S, DataRecursionQueue *Queue) {
2557 if (!getDerived().shouldTraversePostOrder())
2558 TRY_TO(WalkUpFromInitListExpr(S));
2561 for (Stmt *SubStmt : S->children()) {
2565 if (!Queue && getDerived().shouldTraversePostOrder())
2566 TRY_TO(WalkUpFromInitListExpr(S));
2571template <
typename Derived>
2572bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
2573 ObjCProtocolLoc ProtocolLoc) {
2577template <
typename Derived>
2578bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2579 ConceptReference *CR) {
2580 if (!getDerived().shouldTraversePostOrder())
2581 TRY_TO(VisitConceptReference(CR));
2582 TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
2583 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2584 if (CR->hasExplicitTemplateArgs())
2585 TRY_TO(TraverseTemplateArgumentLocsHelper(
2586 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2587 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2588 if (getDerived().shouldTraversePostOrder())
2589 TRY_TO(VisitConceptReference(CR));
2601template <
typename Derived>
2602bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2603 InitListExpr *S, DataRecursionQueue *Queue) {
2604 if (S->isSemanticForm() && S->isSyntacticForm()) {
2606 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2609 TRY_TO(TraverseSynOrSemInitListExpr(
2610 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2611 if (getDerived().shouldVisitImplicitCode()) {
2614 TRY_TO(TraverseSynOrSemInitListExpr(
2615 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2624 if (S->isExprPredicate())
2625 TRY_TO(TraverseStmt(S->getControllingExpr()));
2627 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2629 for (
const GenericSelectionExpr::Association Assoc : S->associations()) {
2630 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2631 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2632 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2634 ShouldVisitChildren =
false;
2641 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2642 e = S->semantics_end();
2645 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2646 sub = OVE->getSourceExpr();
2655 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2660 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2668 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2674 if (S->isArgumentType())
2675 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2681 if (S->isTypeOperand())
2682 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2686 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2694 if (S->isTypeOperand())
2695 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2699 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2700 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2704 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2712 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2717 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2723 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2724 const LambdaCapture *
C = S->capture_begin() + I;
2725 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2726 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2730 if (getDerived().shouldVisitImplicitCode()) {
2732 TRY_TO(TraverseDecl(S->getLambdaClass()));
2735 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2736 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2738 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2739 if (S->hasExplicitParameters()) {
2741 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2742 TRY_TO(TraverseDecl(Proto.getParam(I)));
2745 auto *
T = Proto.getTypePtr();
2752 if (S->hasExplicitResultType())
2753 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2763 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2782 TRY_TO(TraverseDecl(S->getBlockDecl()));
2788 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2794 if (getDerived().shouldVisitImplicitCode())
2795 TRY_TO(TraverseStmt(S->getExpr()));
2799 if (getDerived().shouldVisitImplicitCode())
2800 TRY_TO(TraverseStmt(S->getExpr()));
2810 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2811 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2812 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2813 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2814 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2829 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2836 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2837 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2844 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2845 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2849 if (S->isClassReceiver()) {
2850 ObjCInterfaceDecl *IDecl = S->getClassReceiver();
2851 QualType
Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2852 ObjCInterfaceLocInfo
Data;
2853 Data.NameLoc = S->getReceiverLocation();
2864 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2871 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2880 for (IntegerLiteral *IL : S->underlying_data_elements()) {
2886 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2887 if (S->hasExplicitTemplateArgs()) {
2888 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2889 S->getNumTemplateArgs()));
2894 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2895 if (S->hasExplicitTemplateArgs()) {
2896 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2897 S->getNumTemplateArgs()));
2909 if (!getDerived().shouldVisitImplicitCode()) {
2910 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
2911 S->getDecomposedForm();
2912 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
2913 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
2941 if (S->getLifetimeExtendedTemporaryDecl()) {
2942 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
2943 S->getLifetimeExtendedTemporaryDecl()));
2951 if (!getDerived().shouldVisitImplicitCode()) {
2957 if (!getDerived().shouldVisitImplicitCode()) {
2963 if (!getDerived().shouldVisitImplicitCode()) {
2969 if (!getDerived().shouldVisitImplicitCode()) {
2975 if (!getDerived().shouldVisitImplicitCode()) {
2982 TRY_TO(TraverseConceptReference(S->getConceptReference()));
2986 TRY_TO(TraverseDecl(S->getBody()));
2987 for (ParmVarDecl *Parm : S->getLocalParameters())
2988 TRY_TO(TraverseDecl(Parm));
2989 for (concepts::Requirement *Req : S->getRequirements())
2990 TRY_TO(TraverseConceptRequirement(Req));
3009template <typename Derived>
3010bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3011 OMPExecutableDirective *S) {
3012 for (
auto *C : S->clauses()) {
3013 TRY_TO(TraverseOMPClause(C));
3019 if (!getDerived().shouldVisitImplicitCode()) {
3021 TRY_TO(TraverseStmt(S->getLoopStmt()));
3026template <typename Derived>
3028RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3029 return 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(TraverseOMPExecutableDirective(S)); })
3066 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3069 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3072 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3075 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3076 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)); })
3248 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3251 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3254 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3257 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3260template <typename Derived>
3261bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
3264 switch (
C->getClauseKind()) {
3265#define GEN_CLANG_CLAUSE_CLASS
3266#define CLAUSE_CLASS(Enum, Str, Class) \
3267 case llvm::omp::Clause::Enum: \
3268 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3270#define CLAUSE_NO_CLASS(Enum, Str) \
3271 case llvm::omp::Clause::Enum: \
3273#include "llvm/Frontend/OpenMP/OMP.inc"
3278template <
typename Derived>
3279bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3280 OMPClauseWithPreInit *
Node) {
3281 TRY_TO(TraverseStmt(
Node->getPreInitStmt()));
3285template <
typename Derived>
3286bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3287 OMPClauseWithPostUpdate *
Node) {
3289 TRY_TO(TraverseStmt(
Node->getPostUpdateExpr()));
3293template <
typename Derived>
3294bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
3295 OMPAllocatorClause *C) {
3296 TRY_TO(TraverseStmt(
C->getAllocator()));
3300template <
typename Derived>
3301bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
3302 TRY_TO(TraverseStmt(
C->getAllocator()));
3303 TRY_TO(VisitOMPClauseList(C));
3307template <
typename Derived>
3308bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
3309 TRY_TO(VisitOMPClauseWithPreInit(C));
3310 TRY_TO(TraverseStmt(
C->getCondition()));
3314template <
typename Derived>
3315bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
3316 TRY_TO(VisitOMPClauseWithPreInit(C));
3317 TRY_TO(TraverseStmt(
C->getCondition()));
3321template <
typename Derived>
3323RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3324 TRY_TO(VisitOMPClauseWithPreInit(C));
3325 TRY_TO(TraverseStmt(
C->getNumThreads()));
3329template <
typename Derived>
3330bool RecursiveASTVisitor<Derived>::VisitOMPAlignClause(OMPAlignClause *C) {
3331 TRY_TO(TraverseStmt(
C->getAlignment()));
3335template <
typename Derived>
3336bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3337 TRY_TO(TraverseStmt(
C->getSafelen()));
3341template <
typename Derived>
3342bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3343 TRY_TO(TraverseStmt(
C->getSimdlen()));
3347template <
typename Derived>
3348bool RecursiveASTVisitor<Derived>::VisitOMPSizesClause(OMPSizesClause *C) {
3349 for (Expr *
E :
C->getSizesRefs())
3354template <
typename Derived>
3355bool RecursiveASTVisitor<Derived>::VisitOMPPermutationClause(
3356 OMPPermutationClause *C) {
3357 for (Expr *
E :
C->getArgsRefs())
3362template <
typename Derived>
3363bool RecursiveASTVisitor<Derived>::VisitOMPFullClause(OMPFullClause *C) {
3367template <
typename Derived>
3368bool RecursiveASTVisitor<Derived>::VisitOMPPartialClause(OMPPartialClause *C) {
3369 TRY_TO(TraverseStmt(
C->getFactor()));
3373template <
typename Derived>
3375RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3376 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3380template <
typename Derived>
3381bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3385template <
typename Derived>
3386bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3390template <
typename Derived>
3391bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3392 OMPUnifiedAddressClause *) {
3396template <
typename Derived>
3397bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3398 OMPUnifiedSharedMemoryClause *) {
3402template <
typename Derived>
3403bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3404 OMPReverseOffloadClause *) {
3408template <
typename Derived>
3409bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3410 OMPDynamicAllocatorsClause *) {
3414template <
typename Derived>
3415bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3416 OMPAtomicDefaultMemOrderClause *) {
3420template <
typename Derived>
3421bool RecursiveASTVisitor<Derived>::VisitOMPAtClause(OMPAtClause *) {
3425template <
typename Derived>
3426bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
3430template <
typename Derived>
3431bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
3432 TRY_TO(TraverseStmt(
C->getMessageString()));
3436template <
typename Derived>
3438RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3439 TRY_TO(VisitOMPClauseWithPreInit(C));
3440 TRY_TO(TraverseStmt(
C->getChunkSize()));
3444template <
typename Derived>
3445bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3446 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3450template <
typename Derived>
3451bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3455template <
typename Derived>
3456bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3460template <
typename Derived>
3462RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3466template <
typename Derived>
3467bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3471template <
typename Derived>
3472bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3476template <
typename Derived>
3477bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3481template <
typename Derived>
3482bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3486template <
typename Derived>
3487bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
3491template <
typename Derived>
3492bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3496template <
typename Derived>
3497bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3501template <
typename Derived>
3502bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
3506template <
typename Derived>
3507bool RecursiveASTVisitor<Derived>::VisitOMPAbsentClause(OMPAbsentClause *) {
3511template <
typename Derived>
3512bool RecursiveASTVisitor<Derived>::VisitOMPHoldsClause(OMPHoldsClause *) {
3516template <
typename Derived>
3517bool RecursiveASTVisitor<Derived>::VisitOMPContainsClause(OMPContainsClause *) {
3521template <
typename Derived>
3522bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {
3526template <
typename Derived>
3527bool RecursiveASTVisitor<Derived>::VisitOMPNoOpenMPRoutinesClause(
3528 OMPNoOpenMPRoutinesClause *) {
3532template <
typename Derived>
3533bool RecursiveASTVisitor<Derived>::VisitOMPNoParallelismClause(
3534 OMPNoParallelismClause *) {
3538template <
typename Derived>
3539bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
3543template <
typename Derived>
3544bool RecursiveASTVisitor<Derived>::VisitOMPReleaseClause(OMPReleaseClause *) {
3548template <
typename Derived>
3549bool RecursiveASTVisitor<Derived>::VisitOMPRelaxedClause(OMPRelaxedClause *) {
3553template <
typename Derived>
3554bool RecursiveASTVisitor<Derived>::VisitOMPWeakClause(OMPWeakClause *) {
3558template <
typename Derived>
3559bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3563template <
typename Derived>
3564bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3568template <
typename Derived>
3569bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3573template <
typename Derived>
3574bool RecursiveASTVisitor<Derived>::VisitOMPInitClause(OMPInitClause *C) {
3575 TRY_TO(VisitOMPClauseList(C));
3579template <
typename Derived>
3580bool RecursiveASTVisitor<Derived>::VisitOMPUseClause(OMPUseClause *C) {
3581 TRY_TO(TraverseStmt(
C->getInteropVar()));
3585template <
typename Derived>
3586bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *C) {
3587 TRY_TO(TraverseStmt(
C->getInteropVar()));
3591template <
typename Derived>
3592bool RecursiveASTVisitor<Derived>::VisitOMPNovariantsClause(
3593 OMPNovariantsClause *C) {
3594 TRY_TO(VisitOMPClauseWithPreInit(C));
3595 TRY_TO(TraverseStmt(
C->getCondition()));
3599template <
typename Derived>
3600bool RecursiveASTVisitor<Derived>::VisitOMPNocontextClause(
3601 OMPNocontextClause *C) {
3602 TRY_TO(VisitOMPClauseWithPreInit(C));
3603 TRY_TO(TraverseStmt(
C->getCondition()));
3607template <
typename Derived>
3608template <
typename T>
3609bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *
Node) {
3610 for (
auto *
E :
Node->varlist()) {
3616template <
typename Derived>
3617bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
3618 OMPInclusiveClause *C) {
3619 TRY_TO(VisitOMPClauseList(C));
3623template <
typename Derived>
3624bool RecursiveASTVisitor<Derived>::VisitOMPExclusiveClause(
3625 OMPExclusiveClause *C) {
3626 TRY_TO(VisitOMPClauseList(C));
3630template <
typename Derived>
3631bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3632 TRY_TO(VisitOMPClauseList(C));
3633 for (
auto *
E :
C->private_copies()) {
3639template <
typename Derived>
3640bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3641 OMPFirstprivateClause *C) {
3642 TRY_TO(VisitOMPClauseList(C));
3643 TRY_TO(VisitOMPClauseWithPreInit(C));
3644 for (
auto *
E :
C->private_copies()) {
3647 for (
auto *
E :
C->inits()) {
3653template <
typename Derived>
3654bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3655 OMPLastprivateClause *C) {
3656 TRY_TO(VisitOMPClauseList(C));
3657 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3658 for (
auto *
E :
C->private_copies()) {
3661 for (
auto *
E :
C->source_exprs()) {
3664 for (
auto *
E :
C->destination_exprs()) {
3667 for (
auto *
E :
C->assignment_ops()) {
3673template <
typename Derived>
3674bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3675 TRY_TO(VisitOMPClauseList(C));
3679template <
typename Derived>
3680bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3681 TRY_TO(TraverseStmt(
C->getStep()));
3682 TRY_TO(TraverseStmt(
C->getCalcStep()));
3683 TRY_TO(VisitOMPClauseList(C));
3684 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3685 for (
auto *
E :
C->privates()) {
3688 for (
auto *
E :
C->inits()) {
3691 for (
auto *
E :
C->updates()) {
3694 for (
auto *
E :
C->finals()) {
3700template <
typename Derived>
3701bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3702 TRY_TO(TraverseStmt(
C->getAlignment()));
3703 TRY_TO(VisitOMPClauseList(C));
3707template <
typename Derived>
3708bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3709 TRY_TO(VisitOMPClauseList(C));
3710 for (
auto *
E :
C->source_exprs()) {
3713 for (
auto *
E :
C->destination_exprs()) {
3716 for (
auto *
E :
C->assignment_ops()) {
3722template <
typename Derived>
3723bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3724 OMPCopyprivateClause *C) {
3725 TRY_TO(VisitOMPClauseList(C));
3726 for (
auto *
E :
C->source_exprs()) {
3729 for (
auto *
E :
C->destination_exprs()) {
3732 for (
auto *
E :
C->assignment_ops()) {
3738template <
typename Derived>
3740RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3741 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3742 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3743 TRY_TO(VisitOMPClauseList(C));
3744 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3745 for (
auto *
E :
C->privates()) {
3748 for (
auto *
E :
C->lhs_exprs()) {
3751 for (
auto *
E :
C->rhs_exprs()) {
3754 for (
auto *
E :
C->reduction_ops()) {
3757 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3758 for (
auto *
E :
C->copy_ops()) {
3761 for (
auto *
E :
C->copy_array_temps()) {
3764 for (
auto *
E :
C->copy_array_elems()) {
3771template <
typename Derived>
3772bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3773 OMPTaskReductionClause *C) {
3774 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3775 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3776 TRY_TO(VisitOMPClauseList(C));
3777 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3778 for (
auto *
E :
C->privates()) {
3781 for (
auto *
E :
C->lhs_exprs()) {
3784 for (
auto *
E :
C->rhs_exprs()) {
3787 for (
auto *
E :
C->reduction_ops()) {
3793template <
typename Derived>
3794bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3795 OMPInReductionClause *C) {
3796 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3797 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3798 TRY_TO(VisitOMPClauseList(C));
3799 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3800 for (
auto *
E :
C->privates()) {
3803 for (
auto *
E :
C->lhs_exprs()) {
3806 for (
auto *
E :
C->rhs_exprs()) {
3809 for (
auto *
E :
C->reduction_ops()) {
3812 for (
auto *
E :
C->taskgroup_descriptors())
3817template <
typename Derived>
3818bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3819 TRY_TO(VisitOMPClauseList(C));
3823template <
typename Derived>
3824bool RecursiveASTVisitor<Derived>::VisitOMPDepobjClause(OMPDepobjClause *C) {
3825 TRY_TO(TraverseStmt(
C->getDepobj()));
3829template <
typename Derived>
3830bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3831 TRY_TO(VisitOMPClauseList(C));
3835template <
typename Derived>
3836bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3837 TRY_TO(VisitOMPClauseWithPreInit(C));
3838 TRY_TO(TraverseStmt(
C->getDevice()));
3842template <
typename Derived>
3843bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3844 TRY_TO(VisitOMPClauseList(C));
3848template <
typename Derived>
3849bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
3850 OMPNumTeamsClause *C) {
3851 TRY_TO(VisitOMPClauseList(C));
3852 TRY_TO(VisitOMPClauseWithPreInit(C));
3856template <
typename Derived>
3857bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
3858 OMPThreadLimitClause *C) {
3859 TRY_TO(VisitOMPClauseList(C));
3860 TRY_TO(VisitOMPClauseWithPreInit(C));
3864template <
typename Derived>
3865bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
3866 OMPPriorityClause *C) {
3867 TRY_TO(VisitOMPClauseWithPreInit(C));
3868 TRY_TO(TraverseStmt(
C->getPriority()));
3872template <
typename Derived>
3873bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
3874 OMPGrainsizeClause *C) {
3875 TRY_TO(VisitOMPClauseWithPreInit(C));
3876 TRY_TO(TraverseStmt(
C->getGrainsize()));
3880template <
typename Derived>
3881bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
3882 OMPNumTasksClause *C) {
3883 TRY_TO(VisitOMPClauseWithPreInit(C));
3884 TRY_TO(TraverseStmt(
C->getNumTasks()));
3888template <
typename Derived>
3889bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
3890 TRY_TO(TraverseStmt(
C->getHint()));
3894template <
typename Derived>
3895bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
3896 OMPDistScheduleClause *C) {
3897 TRY_TO(VisitOMPClauseWithPreInit(C));
3898 TRY_TO(TraverseStmt(
C->getChunkSize()));
3902template <
typename Derived>
3904RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
3908template <
typename Derived>
3909bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
3910 TRY_TO(VisitOMPClauseList(C));
3914template <
typename Derived>
3915bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
3916 TRY_TO(VisitOMPClauseList(C));
3920template <
typename Derived>
3921bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
3922 OMPUseDevicePtrClause *C) {
3923 TRY_TO(VisitOMPClauseList(C));
3927template <
typename Derived>
3928bool RecursiveASTVisitor<Derived>::VisitOMPUseDeviceAddrClause(
3929 OMPUseDeviceAddrClause *C) {
3930 TRY_TO(VisitOMPClauseList(C));
3934template <
typename Derived>
3935bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
3936 OMPIsDevicePtrClause *C) {
3937 TRY_TO(VisitOMPClauseList(C));
3941template <
typename Derived>
3942bool RecursiveASTVisitor<Derived>::VisitOMPHasDeviceAddrClause(
3943 OMPHasDeviceAddrClause *C) {
3944 TRY_TO(VisitOMPClauseList(C));
3948template <
typename Derived>
3949bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
3950 OMPNontemporalClause *C) {
3951 TRY_TO(VisitOMPClauseList(C));
3952 for (
auto *
E :
C->private_refs()) {
3958template <
typename Derived>
3959bool RecursiveASTVisitor<Derived>::VisitOMPOrderClause(OMPOrderClause *) {
3963template <
typename Derived>
3964bool RecursiveASTVisitor<Derived>::VisitOMPDetachClause(OMPDetachClause *C) {
3965 TRY_TO(TraverseStmt(
C->getEventHandler()));
3969template <
typename Derived>
3970bool RecursiveASTVisitor<Derived>::VisitOMPUsesAllocatorsClause(
3971 OMPUsesAllocatorsClause *C) {
3972 for (
unsigned I = 0,
E =
C->getNumberOfAllocators(); I <
E; ++I) {
3973 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
3980template <
typename Derived>
3981bool RecursiveASTVisitor<Derived>::VisitOMPAffinityClause(
3982 OMPAffinityClause *C) {
3983 TRY_TO(TraverseStmt(
C->getModifier()));
3984 for (Expr *
E :
C->varlist())
3989template <
typename Derived>
3990bool RecursiveASTVisitor<Derived>::VisitOMPFilterClause(OMPFilterClause *C) {
3991 TRY_TO(VisitOMPClauseWithPreInit(C));
3992 TRY_TO(TraverseStmt(
C->getThreadID()));
3996template <
typename Derived>
3997bool RecursiveASTVisitor<Derived>::VisitOMPBindClause(OMPBindClause *C) {
4001template <
typename Derived>
4002bool RecursiveASTVisitor<Derived>::VisitOMPXDynCGroupMemClause(
4003 OMPXDynCGroupMemClause *C) {
4004 TRY_TO(VisitOMPClauseWithPreInit(C));
4005 TRY_TO(TraverseStmt(
C->getSize()));
4009template <
typename Derived>
4010bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
4011 OMPDoacrossClause *C) {
4012 TRY_TO(VisitOMPClauseList(C));
4016template <
typename Derived>
4017bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
4018 OMPXAttributeClause *C) {
4022template <
typename Derived>
4023bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
4027template <
typename Derived>
4028bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4029 OpenACCConstructStmt *C) {
4030 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4034template <
typename Derived>
4035bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4036 OpenACCAssociatedStmtConstruct *S) {
4037 TRY_TO(TraverseOpenACCConstructStmt(S));
4038 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4042template <
typename Derived>
4043bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *C) {
4044 for (
const Stmt *Child :
C->children())
4045 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4049template <
typename Derived>
4050bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4051 ArrayRef<const OpenACCClause *> Clauses) {
4053 for (
const auto *C : Clauses)
4054 TRY_TO(VisitOpenACCClause(C));
4059 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4061 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4063 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4065 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4067 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4069 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4071 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4073 if (S->hasDevNumExpr())
4074 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4075 for (
auto *
E : S->getQueueIdExprs())
4077 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4080 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4082 {
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.
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.
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.
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...
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
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.
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.
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.
A declaration that models statements at global scope.
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.