13#ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14#define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
46#include "llvm/ADT/PointerIntPair.h"
47#include "llvm/ADT/SmallVector.h"
48#include "llvm/Support/Casting.h"
59#define TRY_TO(CALL_EXPR) \
61 if (!getDerived().CALL_EXPR) \
67template <
typename T,
typename U>
69template <
typename T,
typename U,
typename R,
typename...
P>
75template <
typename FirstMethodPtrTy,
typename SecondMethodPtrTy>
76LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG
auto
78 [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
81 SecondMethodPtrTy>::value)
82 return FirstMethodPtr == SecondMethodPtr;
164 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
329#define ATTR_VISITOR_DECLS_ONLY
330#include "clang/AST/AttrVisitor.inc"
331#undef ATTR_VISITOR_DECLS_ONLY
343#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
344 (::clang::detail::has_same_member_pointer_type< \
345 decltype(&RecursiveASTVisitor::Traverse##NAME), \
346 decltype(&Derived::Traverse##NAME)>::value \
347 ? static_cast<std::conditional_t< \
348 ::clang::detail::has_same_member_pointer_type< \
349 decltype(&RecursiveASTVisitor::Traverse##NAME), \
350 decltype(&Derived::Traverse##NAME)>::value, \
351 Derived &, RecursiveASTVisitor &>>(*this) \
352 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
353 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
358#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
360 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
366#define ABSTRACT_STMT(STMT)
367#define STMT(CLASS, PARENT) \
368 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
369#include "clang/AST/StmtNodes.inc"
375#define STMT(CLASS, PARENT) \
376 bool WalkUpFrom##CLASS(CLASS *S) { \
377 TRY_TO(WalkUpFrom##PARENT(S)); \
378 TRY_TO(Visit##CLASS(S)); \
381 bool Visit##CLASS(CLASS *S) { return true; }
382#include "clang/AST/StmtNodes.inc"
388#define ABSTRACT_TYPE(CLASS, BASE)
389#define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T);
390#include "clang/AST/TypeNodes.inc"
396#define TYPE(CLASS, BASE) \
397 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
398 TRY_TO(WalkUpFrom##BASE(T)); \
399 TRY_TO(Visit##CLASS##Type(T)); \
402 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
403#include "clang/AST/TypeNodes.inc"
409#define ABSTRACT_TYPELOC(CLASS, BASE)
410#define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
411#include "clang/AST/TypeLocNodes.def"
430#define TYPE(CLASS, BASE) \
431 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
432 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
433 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
436 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
437#include "clang/AST/TypeNodes.inc"
442#define ABSTRACT_DECL(DECL)
443#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
444#include "clang/AST/DeclNodes.inc"
450#define DECL(CLASS, BASE) \
451 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
452 TRY_TO(WalkUpFrom##BASE(D)); \
453 TRY_TO(Visit##CLASS##Decl(D)); \
456 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
457#include "clang/AST/DeclNodes.inc"
461#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
462 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
466#undef DEF_TRAVERSE_TMPL_INST
482 template <
typename T>
483 bool TraverseDeclTemplateParameterLists(T *D);
495 bool TraverseVarHelper(
VarDecl *D);
499#define GEN_CLANG_CLAUSE_CLASS
500#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
501#include "llvm/Frontend/OpenMP/OMP.inc"
503 template <
typename T>
bool VisitOMPClauseList(T *
Node);
505 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *
Node);
506 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
508 bool PostVisitStmt(Stmt *S);
509 bool TraverseOpenACCConstructStmt(OpenACCConstructStmt *S);
511 TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S);
514template <
typename Derived>
517 if (!getDerived().shouldVisitImplicitCode()) {
518 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
521 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
522 TRY_TO(TraverseStmt(IDC));
528 TRY_TO(TraverseConceptReference(
C->getConceptReference()));
533template <
typename Derived>
538 return getDerived().TraverseConceptTypeRequirement(
539 cast<concepts::TypeRequirement>(R));
542 return getDerived().TraverseConceptExprRequirement(
543 cast<concepts::ExprRequirement>(R));
545 return getDerived().TraverseConceptNestedRequirement(
546 cast<concepts::NestedRequirement>(R));
548 llvm_unreachable(
"unexpected case");
551template <
typename Derived>
555 switch (S->getStmtClass()) {
558#define ABSTRACT_STMT(STMT)
559#define STMT(CLASS, PARENT) \
560 case Stmt::CLASS##Class: \
561 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
562#include "clang/AST/StmtNodes.inc"
570template <
typename Derived>
578template <
typename Derived>
584 if (RetReq.isTypeConstraint()) {
585 if (getDerived().shouldVisitImplicitCode()) {
586 TRY_TO(TraverseTemplateParameterListHelper(
587 RetReq.getTypeConstraintTemplateParameterList()));
590 TRY_TO(TraverseTypeConstraint(RetReq.getTypeConstraint()));
596template <
typename Derived>
604template <
typename Derived>
622 switch (S->getStmtClass()) {
625#define ABSTRACT_STMT(STMT)
626#define STMT(CLASS, PARENT) \
627 case Stmt::CLASS##Class: \
628 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
629 &Derived::Traverse##CLASS)) { \
630 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
633#define INITLISTEXPR(CLASS, PARENT) \
634 case Stmt::CLASS##Class: \
635 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
636 &Derived::Traverse##CLASS)) { \
637 auto ILE = static_cast<CLASS *>(S); \
638 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
639 TRY_TO(WalkUpFrom##CLASS(Syn)); \
640 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
641 TRY_TO(WalkUpFrom##CLASS(Sem)); \
644#include "clang/AST/StmtNodes.inc"
652template <
typename Derived>
659 Queue->push_back({S,
false});
664 LocalQueue.push_back({S,
false});
666 while (!LocalQueue.empty()) {
667 auto &CurrSAndVisited = LocalQueue.back();
668 Stmt *CurrS = CurrSAndVisited.getPointer();
669 bool Visited = CurrSAndVisited.getInt();
671 LocalQueue.pop_back();
672 TRY_TO(dataTraverseStmtPost(CurrS));
673 if (getDerived().shouldTraversePostOrder()) {
674 TRY_TO(PostVisitStmt(CurrS));
679 if (getDerived().dataTraverseStmtPre(CurrS)) {
680 CurrSAndVisited.setInt(
true);
681 size_t N = LocalQueue.size();
682 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
684 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
686 LocalQueue.pop_back();
693template <
typename Derived>
699#define ABSTRACT_TYPE(CLASS, BASE)
700#define TYPE(CLASS, BASE) \
702 return getDerived().Traverse##CLASS##Type( \
703 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));
704#include "clang/AST/TypeNodes.inc"
710template <
typename Derived>
716#define ABSTRACT_TYPELOC(CLASS, BASE)
717#define TYPELOC(CLASS, BASE) \
718 case TypeLoc::CLASS: \
719 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
720#include "clang/AST/TypeLocNodes.def"
727#define VISITORCLASS RecursiveASTVisitor
728#include "clang/AST/AttrVisitor.inc"
731template <
typename Derived>
738 if (!getDerived().shouldVisitImplicitCode() && D->
isImplicit()) {
742 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(D))
743 return TraverseTemplateTypeParamDeclConstraints(TTPD);
748#define ABSTRACT_DECL(DECL)
749#define DECL(CLASS, BASE) \
751 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
754#include "clang/AST/DeclNodes.inc"
759template <
typename Derived>
784template <
typename Derived>
791 TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
810template <
typename Derived>
818 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
822 TRY_TO(TraverseTemplateName(
839template <
typename Derived>
842 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
844 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
849template <
typename Derived>
861 return getDerived().TraverseType(Arg.
getAsType());
865 return getDerived().TraverseTemplateName(
869 return getDerived().TraverseStmt(Arg.
getAsExpr());
872 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
880template <
typename Derived>
896 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
898 return getDerived().TraverseType(Arg.
getAsType());
904 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
906 return getDerived().TraverseTemplateName(
913 return getDerived().TraverseTemplateArguments(Arg.
pack_elements());
919template <
typename Derived>
923 TRY_TO(TraverseTemplateArgument(Arg));
928template <
typename Derived>
932 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
934 if (
Init->isWritten() || getDerived().shouldVisitImplicitCode())
940template <
typename Derived>
945 if (LE->isInitCapture(
C))
946 TRY_TO(TraverseDecl(
C->getCapturedVar()));
955#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
956 template <typename Derived> \
957 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
958 if (!getDerived().shouldTraversePostOrder()) \
959 TRY_TO(WalkUpFrom##TYPE(T)); \
961 if (getDerived().shouldTraversePostOrder()) \
962 TRY_TO(WalkUpFrom##TYPE(T)); \
973 {
TRY_TO(TraverseType(T->getPointeeType())); })
976 {
TRY_TO(TraverseType(T->getPointeeType())); })
979 {
TRY_TO(TraverseType(T->getPointeeType())); })
982 TRY_TO(TraverseType(QualType(T->getClass(), 0)));
983 TRY_TO(TraverseType(T->getPointeeType()));
991 TRY_TO(TraverseType(T->getElementType()));
992 if (T->getSizeExpr())
993 TRY_TO(TraverseStmt(
const_cast<Expr*
>(T->getSizeExpr())));
997 {
TRY_TO(TraverseType(T->getElementType())); })
1000 TRY_TO(TraverseType(T->getElementType()));
1001 TRY_TO(TraverseStmt(T->getSizeExpr()));
1005 TRY_TO(TraverseType(T->getElementType()));
1006 if (T->getSizeExpr())
1007 TRY_TO(TraverseStmt(T->getSizeExpr()));
1011 TRY_TO(TraverseStmt(T->getAddrSpaceExpr()));
1012 TRY_TO(TraverseType(T->getPointeeType()));
1016 if (T->getSizeExpr())
1017 TRY_TO(TraverseStmt(T->getSizeExpr()));
1022 if (T->getSizeExpr())
1023 TRY_TO(TraverseStmt(T->getSizeExpr()));
1024 TRY_TO(TraverseType(T->getElementType()));
1032 {
TRY_TO(TraverseType(T->getElementType())); })
1035 if (T->getRowExpr())
1036 TRY_TO(TraverseStmt(T->getRowExpr()));
1037 if (T->getColumnExpr())
1038 TRY_TO(TraverseStmt(T->getColumnExpr()));
1039 TRY_TO(TraverseType(T->getElementType()));
1043 {
TRY_TO(TraverseType(T->getReturnType())); })
1046 TRY_TO(TraverseType(T->getReturnType()));
1048 for (
const auto &A : T->param_types()) {
1052 for (
const auto &E : T->exceptions()) {
1056 if (
Expr *NE = T->getNoexceptExpr())
1057 TRY_TO(TraverseStmt(NE));
1065 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1070 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1073 TRY_TO(TraverseType(T->getPattern()));
1074 TRY_TO(TraverseStmt(T->getIndexExpr()));
1078 TRY_TO(TraverseType(T->getBaseType()));
1079 TRY_TO(TraverseType(T->getUnderlyingType()));
1083 TRY_TO(TraverseType(T->getDeducedType()));
1084 if (T->isConstrained()) {
1085 TRY_TO(TraverseTemplateArguments(T->getTypeConstraintArguments()));
1089 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1097 TRY_TO(TraverseType(T->getReplacementType()));
1100 TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
1104 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1105 TRY_TO(TraverseTemplateArguments(T->template_arguments()));
1111 {
TRY_TO(TraverseType(T->getModifiedType())); })
1114 {
TRY_TO(TraverseType(T->getWrappedType())); })
1119 {
TRY_TO(TraverseType(T->getUnderlyingType())); })
1122 if (T->getQualifier()) {
1123 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1125 TRY_TO(TraverseType(T->getNamedType()));
1129 {
TRY_TO(TraverseNestedNameSpecifier(T->getQualifier())); })
1132 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1133 TRY_TO(TraverseTemplateArguments(T->template_arguments()));
1145 if (T->getBaseType().getTypePtr() != T)
1146 TRY_TO(TraverseType(T->getBaseType()));
1147 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1148 TRY_TO(TraverseType(typeArg));
1153 {
TRY_TO(TraverseType(T->getPointeeType())); })
1161 {
TRY_TO(TraverseStmt(T->getNumBitsExpr())); })
1173 template <
typename Derived> \
1174 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##Loc(
TYPE##Loc TL) { \
1175 if (!getDerived().shouldTraversePostOrder()) { \
1176 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1177 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1178 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1181 if (getDerived().shouldTraversePostOrder()) { \
1182 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1183 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1184 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1189template <
typename Derived>
1191RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1207 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1214 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1218 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1221 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1224 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1227 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1232 if (
auto *TSI = TL.getClassTInfo())
1233 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1240 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1243 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1245template <typename Derived>
1246bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1248 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1253 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1254 TRY_TO(TraverseArrayTypeLocHelper(TL));
1258 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1263 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1264 TRY_TO(TraverseArrayTypeLocHelper(TL));
1268 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1269 TRY_TO(TraverseArrayTypeLocHelper(TL));
1273 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1274 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1280 if (TL.getTypePtr()->getSizeExpr())
1281 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1282 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1287 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1291 if (TL.getTypePtr()->getSizeExpr())
1292 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1293 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1299 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1303 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1304 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1305 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1309 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1310 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1311 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1315 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1319 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1323 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1324 if (TL.getParam(I)) {
1325 TRY_TO(TraverseDecl(TL.getParam(I)));
1326 }
else if (I < T->getNumParams()) {
1336 TRY_TO(TraverseStmt(NE));
1344 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1347 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1352 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1356 TRY_TO(TraverseType(TL.getPattern()));
1357 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1361 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1365 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1366 if (TL.isConstrained()) {
1367 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1372 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1373 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1380 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1383 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1388 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1389 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1390 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1399 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1402 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1405 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1408 if (TL.getQualifierLoc()) {
1409 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1411 TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
1415 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1419 if (TL.getQualifierLoc()) {
1420 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1423 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1424 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1429 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1432 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1433 ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));
1434 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1443 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1444 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1445 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1446 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1447 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1448 ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));
1449 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1454 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1462 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1474template <typename Derived>
1476 const Decl *Child) {
1479 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1482 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1483 return Cls->isLambda();
1487template <
typename Derived>
1488bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {
1492 for (
auto *Child : DC->decls()) {
1493 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1494 TRY_TO(TraverseDecl(Child));
1501#define DEF_TRAVERSE_DECL(DECL, CODE) \
1502 template <typename Derived> \
1503 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1504 bool ShouldVisitChildren = true; \
1505 bool ReturnValue = true; \
1506 if (!getDerived().shouldTraversePostOrder()) \
1507 TRY_TO(WalkUpFrom##DECL(D)); \
1509 if (ReturnValue && ShouldVisitChildren) \
1510 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1511 if (ReturnValue) { \
1513 for (auto *I : D->attrs()) \
1514 TRY_TO(getDerived().TraverseAttr(I)); \
1516 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1517 TRY_TO(WalkUpFrom##DECL(D)); \
1518 return ReturnValue; \
1524 if (TypeSourceInfo *TInfo = D->getSignatureAsWritten())
1525 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1526 TRY_TO(TraverseStmt(D->getBody()));
1527 for (
const auto &I : D->captures()) {
1528 if (I.hasCopyExpr()) {
1529 TRY_TO(TraverseStmt(I.getCopyExpr()));
1532 ShouldVisitChildren =
false;
1536 TRY_TO(TraverseStmt(D->getBody()));
1537 ShouldVisitChildren =
false;
1545 TRY_TO(TraverseStmt(D->getTemporaryExpr()));
1549 {
TRY_TO(TraverseStmt(D->getAsmString())); })
1557 if (D->getFriendType()) {
1558 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1561 if (
auto *ET = D->getFriendType()->getType()->getAs<ElaboratedType>())
1562 TRY_TO(TraverseDecl(ET->getOwnedTagDecl()));
1564 TRY_TO(TraverseDecl(D->getFriendDecl()));
1569 if (D->getFriendType())
1570 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1572 TRY_TO(TraverseDecl(D->getFriendDecl()));
1573 for (
unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1574 TemplateParameterList *TPL = D->getTemplateParameterList(I);
1575 for (TemplateParameterList::iterator ITPL = TPL->begin(), ETPL = TPL->end();
1576 ITPL != ETPL; ++ITPL) {
1577 TRY_TO(TraverseDecl(*ITPL));
1590 TRY_TO(TraverseStmt(D->getAssertExpr()));
1591 TRY_TO(TraverseStmt(D->getMessage()));
1601 auto Scope = D->getASTContext().getTraversalScope();
1602 bool HasLimitedScope =
1603 Scope.size() != 1 || !isa<TranslationUnitDecl>(Scope.front());
1604 if (HasLimitedScope) {
1605 ShouldVisitChildren =
false;
1606 for (
auto *Child : Scope) {
1607 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1608 TRY_TO(TraverseDecl(Child));
1620 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1624 ShouldVisitChildren =
false;
1641 if (ObjCTypeParamList *typeParamList = D->getTypeParamList()) {
1642 for (
auto typeParam : *typeParamList) {
1643 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1646 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1647 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1648 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1659 if (ObjCTypeParamList *typeParamList = D->getTypeParamListAsWritten()) {
1660 for (
auto typeParam : *typeParamList) {
1661 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1665 if (TypeSourceInfo *superTInfo = D->getSuperClassTInfo()) {
1666 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1668 if (D->isThisDeclarationADefinition()) {
1669 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1670 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1671 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1677 if (D->isThisDeclarationADefinition()) {
1678 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1679 ObjCProtocolLoc ProtocolLoc(std::get<0>(It), std::get<1>(It));
1680 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1686 if (D->getReturnTypeSourceInfo()) {
1687 TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
1689 for (ParmVarDecl *Parameter : D->parameters()) {
1690 TRY_TO(TraverseDecl(Parameter));
1692 if (D->isThisDeclarationADefinition()) {
1693 TRY_TO(TraverseStmt(D->getBody()));
1695 ShouldVisitChildren =
false;
1699 if (D->hasExplicitBound()) {
1700 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1708 if (D->getTypeSourceInfo())
1709 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1711 TRY_TO(TraverseType(D->getType()));
1712 ShouldVisitChildren =
false;
1716 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1717 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1721 {
TRY_TO(TraverseTypeLoc(D->getEnumTypeLoc())); })
1726 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1734 for (
auto *I : D->varlists()) {
1740 for (
auto *C : D->clauselists()) {
1741 TRY_TO(TraverseOMPClause(C));
1746 TRY_TO(TraverseStmt(D->getCombiner()));
1747 if (
auto *Initializer = D->getInitializer())
1748 TRY_TO(TraverseStmt(Initializer));
1749 TRY_TO(TraverseType(D->getType()));
1754 for (
auto *C : D->clauselists())
1755 TRY_TO(TraverseOMPClause(C));
1756 TRY_TO(TraverseType(D->getType()));
1763 for (
auto *I : D->varlists())
1765 for (
auto *C : D->clauselists())
1766 TRY_TO(TraverseOMPClause(C));
1770template <typename Derived>
1771bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1772 TemplateParameterList *TPL) {
1774 for (NamedDecl *D : *TPL) {
1777 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1778 TRY_TO(TraverseStmt(RequiresClause));
1784template <
typename Derived>
1785template <
typename T>
1786bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *D) {
1787 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1788 TemplateParameterList *TPL = D->getTemplateParameterList(i);
1789 TraverseTemplateParameterListHelper(TPL);
1794template <
typename Derived>
1795bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1796 ClassTemplateDecl *D) {
1797 for (
auto *SD : D->specializations()) {
1798 for (
auto *RD : SD->redecls()) {
1799 assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName());
1801 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1805 TRY_TO(TraverseDecl(RD));
1822template <
typename Derived>
1823bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1824 VarTemplateDecl *D) {
1825 for (
auto *SD : D->specializations()) {
1826 for (
auto *RD : SD->redecls()) {
1828 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1831 TRY_TO(TraverseDecl(RD));
1847template <
typename Derived>
1848bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1849 FunctionTemplateDecl *D) {
1850 for (
auto *FD : D->specializations()) {
1851 for (
auto *RD : FD->redecls()) {
1852 switch (RD->getTemplateSpecializationKind()) {
1856 TRY_TO(TraverseDecl(RD));
1863 TRY_TO(TraverseDecl(RD));
1877#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
1878 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
1879 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
1880 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
1888 if (getDerived().shouldVisitTemplateInstantiations() && \
1889 D == D->getCanonicalDecl()) \
1890 TRY_TO(TraverseTemplateInstantiations(D)); \
1904 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
1905 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1906 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
1907 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1911 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1914template <typename Derived>
1915bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
1916 const TemplateTypeParmDecl *D) {
1917 if (
const auto *TC = D->getTypeConstraint())
1918 TRY_TO(TraverseTypeConstraint(TC));
1924 if (D->getTypeForDecl())
1925 TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
1926 TRY_TO(TraverseTemplateTypeParamDeclConstraints(D));
1927 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1928 TRY_TO(TraverseTypeLoc(D->getDefaultArgumentInfo()->getTypeLoc()));
1932 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1939 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1946 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
1947 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1951 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1952 TRY_TO(TraverseStmt(D->getConstraintExpr()));
1958 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1967 TRY_TO(TraverseDeclTemplateParameterLists(D));
1969 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1970 if (
auto *TSI = D->getIntegerTypeSourceInfo())
1971 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1977template <typename Derived>
1978bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *D) {
1982 TRY_TO(TraverseDeclTemplateParameterLists(D));
1983 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1987template <
typename Derived>
1988bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
1989 const CXXBaseSpecifier &
Base) {
1990 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
1994template <
typename Derived>
1995bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *D) {
1996 if (!TraverseRecordHelper(D))
1998 if (D->isCompleteDefinition()) {
1999 for (
const auto &I : D->bases()) {
2000 TRY_TO(TraverseCXXBaseSpecifier(I));
2013 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2022 if (TypeSourceInfo *TSI = D->getTypeAsWritten()) \
2023 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc())); \
2025 if (getDerived().shouldVisitTemplateInstantiations() || \
2026 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2028 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2030 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2043template <
typename Derived>
2044bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2045 const TemplateArgumentLoc *TAL,
unsigned Count) {
2046 for (
unsigned I = 0; I < Count; ++I) {
2047 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2052#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2053 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2055 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2057 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2058 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2059 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2064 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2077 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
2078 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2083template <typename Derived>
2084bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *D) {
2085 TRY_TO(TraverseDeclTemplateParameterLists(D));
2086 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
2087 if (D->getTypeSourceInfo())
2088 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2090 TRY_TO(TraverseType(D->getType()));
2095 TRY_TO(TraverseVarHelper(D));
2096 for (
auto *Binding : D->bindings()) {
2097 TRY_TO(TraverseDecl(Binding));
2102 if (getDerived().shouldVisitImplicitCode())
2103 TRY_TO(TraverseStmt(D->getBinding()));
2114 TRY_TO(TraverseDeclaratorHelper(D));
2115 if (D->isBitField())
2116 TRY_TO(TraverseStmt(D->getBitWidth()));
2117 if (D->hasInClassInitializer())
2118 TRY_TO(TraverseStmt(D->getInClassInitializer()));
2122 TRY_TO(TraverseDeclaratorHelper(D));
2123 if (D->isBitField())
2124 TRY_TO(TraverseStmt(D->getBitWidth()));
2129 TRY_TO(TraverseDeclaratorHelper(D));
2130 if (D->isBitField())
2131 TRY_TO(TraverseStmt(D->getBitWidth()));
2135template <typename Derived>
2136bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *D) {
2137 TRY_TO(TraverseDeclTemplateParameterLists(D));
2138 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
2139 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2146 if (
const FunctionTemplateSpecializationInfo *FTSI =
2147 D->getTemplateSpecializationInfo()) {
2148 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2149 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2152 if (
const ASTTemplateArgumentListInfo *TALI =
2153 FTSI->TemplateArgumentsAsWritten) {
2154 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2155 TALI->NumTemplateArgs));
2158 }
else if (
const DependentFunctionTemplateSpecializationInfo *DFSI =
2159 D->getDependentSpecializationInfo()) {
2160 if (
const ASTTemplateArgumentListInfo *TALI =
2161 DFSI->TemplateArgumentsAsWritten) {
2162 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2163 TALI->NumTemplateArgs));
2171 if (TypeSourceInfo *TSI = D->getTypeSourceInfo()) {
2172 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2173 }
else if (getDerived().shouldVisitImplicitCode()) {
2178 for (ParmVarDecl *Parameter : D->parameters()) {
2179 TRY_TO(TraverseDecl(Parameter));
2184 if (Expr *TrailingRequiresClause = D->getTrailingRequiresClause()) {
2185 TRY_TO(TraverseStmt(TrailingRequiresClause));
2188 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
2190 for (
auto *I : Ctor->inits()) {
2191 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2192 TRY_TO(TraverseConstructorInitializer(I));
2197 D->isThisDeclarationADefinition() &&
2200 (!D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2202 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
2203 if (
const CXXRecordDecl *RD = MD->getParent()) {
2204 if (RD->isLambda() &&
2206 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2212 TRY_TO(TraverseStmt(D->getBody()));
2215 for (
auto *Child : D->decls()) {
2216 if (isa<UsingShadowDecl>(Child))
2217 TRY_TO(TraverseDecl(Child));
2226 ShouldVisitChildren =
false;
2233 ShouldVisitChildren =
false;
2240 ShouldVisitChildren =
false;
2247 ShouldVisitChildren =
false;
2256 ShouldVisitChildren =
false;
2263 ShouldVisitChildren =
false;
2267template <typename Derived>
2268bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *D) {
2269 TRY_TO(TraverseDeclaratorHelper(D));
2271 if (!isa<ParmVarDecl>(D) &&
2272 (!D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2273 TRY_TO(TraverseStmt(D->getInit()));
2283 TRY_TO(TraverseDeclaratorHelper(D));
2284 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2285 TRY_TO(TraverseStmt(D->getDefaultArgument()));
2289 TRY_TO(TraverseVarHelper(D));
2291 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2292 !D->hasUnparsedDefaultArg())
2293 TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
2295 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2296 !D->hasUnparsedDefaultArg())
2297 TRY_TO(TraverseStmt(D->getDefaultArg()));
2303 TRY_TO(TraverseTemplateArguments(D->getTemplateArguments()));
2319 template <
typename Derived> \
2320 bool RecursiveASTVisitor<Derived>::Traverse##
STMT( \
2321 STMT *S, DataRecursionQueue *Queue) { \
2322 bool ShouldVisitChildren =
true; \
2324 if (!getDerived().shouldTraversePostOrder()) \
2325 TRY_TO(WalkUpFrom##
STMT(S)); \
2327 if (ShouldVisitChildren) { \
2328 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2329 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2336 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2337 TRY_TO(WalkUpFrom##
STMT(S)); \
2344 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2347 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2350 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2363 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2368 for (
auto *I : S->decls()) {
2376 ShouldVisitChildren =
false;
2404 if (!getDerived().shouldVisitImplicitCode()) {
2411 ShouldVisitChildren =
false;
2416 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2417 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2427 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2428 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2429 if (S->hasExplicitTemplateArgs()) {
2430 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2431 S->getNumTemplateArgs()));
2436 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2437 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2438 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2439 S->getNumTemplateArgs()));
2443 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2444 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2445 if (S->hasExplicitTemplateArgs()) {
2446 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2447 S->getNumTemplateArgs()));
2452 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2453 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2454 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2455 S->getNumTemplateArgs()));
2465 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2469 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2473 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2477 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2481 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2485 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2489 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2493 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2496template <typename Derived>
2497bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2498 InitListExpr *S, DataRecursionQueue *Queue) {
2502 if (!getDerived().shouldTraversePostOrder())
2503 TRY_TO(WalkUpFromInitListExpr(S));
2506 for (Stmt *SubStmt : S->children()) {
2510 if (!Queue && getDerived().shouldTraversePostOrder())
2511 TRY_TO(WalkUpFromInitListExpr(S));
2516template <
typename Derived>
2517bool RecursiveASTVisitor<Derived>::TraverseObjCProtocolLoc(
2518 ObjCProtocolLoc ProtocolLoc) {
2522template <
typename Derived>
2523bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2524 ConceptReference *CR) {
2525 if (!getDerived().shouldTraversePostOrder())
2526 TRY_TO(VisitConceptReference(CR));
2527 TRY_TO(TraverseNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc()));
2528 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2529 if (CR->hasExplicitTemplateArgs())
2530 TRY_TO(TraverseTemplateArgumentLocsHelper(
2531 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2532 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2533 if (getDerived().shouldTraversePostOrder())
2534 TRY_TO(VisitConceptReference(CR));
2546template <
typename Derived>
2547bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2548 InitListExpr *S, DataRecursionQueue *Queue) {
2549 if (S->isSemanticForm() && S->isSyntacticForm()) {
2551 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2554 TRY_TO(TraverseSynOrSemInitListExpr(
2555 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2556 if (getDerived().shouldVisitImplicitCode()) {
2559 TRY_TO(TraverseSynOrSemInitListExpr(
2560 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2569 if (S->isExprPredicate())
2570 TRY_TO(TraverseStmt(S->getControllingExpr()));
2572 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2574 for (
const GenericSelectionExpr::Association Assoc : S->associations()) {
2575 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2576 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2577 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2579 ShouldVisitChildren =
false;
2586 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2587 e = S->semantics_end();
2590 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2591 sub = OVE->getSourceExpr();
2594 ShouldVisitChildren =
false;
2600 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2605 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2613 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2619 if (S->isArgumentType())
2620 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2626 if (S->isTypeOperand())
2627 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2631 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2639 if (S->isTypeOperand())
2640 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2644 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2645 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2649 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2657 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2662 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2668 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2669 const LambdaCapture *
C = S->capture_begin() + I;
2670 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2671 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2675 if (getDerived().shouldVisitImplicitCode()) {
2677 TRY_TO(TraverseDecl(S->getLambdaClass()));
2680 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2681 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2683 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2684 if (S->hasExplicitParameters()) {
2686 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2687 TRY_TO(TraverseDecl(Proto.getParam(I)));
2690 auto *T = Proto.getTypePtr();
2691 for (
const auto &E : T->exceptions())
2694 if (Expr *NE = T->getNoexceptExpr())
2697 if (S->hasExplicitResultType())
2698 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2703 ShouldVisitChildren =
false;
2708 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2727 TRY_TO(TraverseDecl(S->getBlockDecl()));
2733 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2739 if (getDerived().shouldVisitImplicitCode())
2740 TRY_TO(TraverseStmt(S->getExpr()));
2744 if (getDerived().shouldVisitImplicitCode())
2745 TRY_TO(TraverseStmt(S->getExpr()));
2755 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2756 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2757 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2758 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2759 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2774 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2781 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2782 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2789 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2790 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2794 if (S->isClassReceiver()) {
2795 ObjCInterfaceDecl *IDecl = S->getClassReceiver();
2796 QualType
Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2797 ObjCInterfaceLocInfo
Data;
2798 Data.NameLoc = S->getReceiverLocation();
2809 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2816 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2825 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2826 if (S->hasExplicitTemplateArgs()) {
2827 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2828 S->getNumTemplateArgs()));
2833 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2834 if (S->hasExplicitTemplateArgs()) {
2835 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2836 S->getNumTemplateArgs()));
2848 if (!getDerived().shouldVisitImplicitCode()) {
2849 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
2850 S->getDecomposedForm();
2851 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
2852 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
2853 ShouldVisitChildren =
false;
2880 if (S->getLifetimeExtendedTemporaryDecl()) {
2881 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
2882 S->getLifetimeExtendedTemporaryDecl()));
2883 ShouldVisitChildren =
false;
2890 if (!getDerived().shouldVisitImplicitCode()) {
2892 ShouldVisitChildren =
false;
2896 if (!getDerived().shouldVisitImplicitCode()) {
2898 ShouldVisitChildren =
false;
2902 if (!getDerived().shouldVisitImplicitCode()) {
2904 ShouldVisitChildren =
false;
2908 if (!getDerived().shouldVisitImplicitCode()) {
2910 ShouldVisitChildren =
false;
2914 if (!getDerived().shouldVisitImplicitCode()) {
2916 ShouldVisitChildren =
false;
2921 TRY_TO(TraverseConceptReference(S->getConceptReference()));
2925 TRY_TO(TraverseDecl(S->getBody()));
2926 for (ParmVarDecl *Parm : S->getLocalParameters())
2927 TRY_TO(TraverseDecl(Parm));
2928 for (concepts::Requirement *Req : S->getRequirements())
2929 TRY_TO(TraverseConceptRequirement(Req));
2948template <typename Derived>
2949bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
2950 OMPExecutableDirective *S) {
2951 for (
auto *C : S->clauses()) {
2952 TRY_TO(TraverseOMPClause(C));
2958 if (!getDerived().shouldVisitImplicitCode()) {
2960 TRY_TO(TraverseStmt(S->getLoopStmt()));
2961 ShouldVisitChildren =
false;
2965template <typename Derived>
2967RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
2968 return TraverseOMPExecutableDirective(S);
2972 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2975 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2978 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2981 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2984 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2987 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2990 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2993 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2996 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2999 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3002 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3005 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3008 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3009 TRY_TO(TraverseOMPExecutableDirective(S));
3013 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3016 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3019 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3022 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3025 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3028 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3031 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3034 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3037 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3040 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3043 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3046 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3049 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3052 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3055 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3058 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3061 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3064 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3067 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3070 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3073 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3076 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3079 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3082 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3085 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3088 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3091 {
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)); })
3190template <typename Derived>
3191bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
3194 switch (
C->getClauseKind()) {
3195#define GEN_CLANG_CLAUSE_CLASS
3196#define CLAUSE_CLASS(Enum, Str, Class) \
3197 case llvm::omp::Clause::Enum: \
3198 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3200#define CLAUSE_NO_CLASS(Enum, Str) \
3201 case llvm::omp::Clause::Enum: \
3203#include "llvm/Frontend/OpenMP/OMP.inc"
3208template <
typename Derived>
3209bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3210 OMPClauseWithPreInit *
Node) {
3211 TRY_TO(TraverseStmt(
Node->getPreInitStmt()));
3215template <
typename Derived>
3216bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3217 OMPClauseWithPostUpdate *
Node) {
3219 TRY_TO(TraverseStmt(
Node->getPostUpdateExpr()));
3223template <
typename Derived>
3224bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
3225 OMPAllocatorClause *C) {
3226 TRY_TO(TraverseStmt(
C->getAllocator()));
3230template <
typename Derived>
3231bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
3232 TRY_TO(TraverseStmt(
C->getAllocator()));
3233 TRY_TO(VisitOMPClauseList(C));
3237template <
typename Derived>
3238bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
3239 TRY_TO(VisitOMPClauseWithPreInit(C));
3240 TRY_TO(TraverseStmt(
C->getCondition()));
3244template <
typename Derived>
3245bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
3246 TRY_TO(VisitOMPClauseWithPreInit(C));
3247 TRY_TO(TraverseStmt(
C->getCondition()));
3251template <
typename Derived>
3253RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3254 TRY_TO(VisitOMPClauseWithPreInit(C));
3255 TRY_TO(TraverseStmt(
C->getNumThreads()));
3259template <
typename Derived>
3260bool RecursiveASTVisitor<Derived>::VisitOMPAlignClause(OMPAlignClause *C) {
3261 TRY_TO(TraverseStmt(
C->getAlignment()));
3265template <
typename Derived>
3266bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3267 TRY_TO(TraverseStmt(
C->getSafelen()));
3271template <
typename Derived>
3272bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3273 TRY_TO(TraverseStmt(
C->getSimdlen()));
3277template <
typename Derived>
3278bool RecursiveASTVisitor<Derived>::VisitOMPSizesClause(OMPSizesClause *C) {
3279 for (Expr *E :
C->getSizesRefs())
3284template <
typename Derived>
3285bool RecursiveASTVisitor<Derived>::VisitOMPFullClause(OMPFullClause *C) {
3289template <
typename Derived>
3290bool RecursiveASTVisitor<Derived>::VisitOMPPartialClause(OMPPartialClause *C) {
3291 TRY_TO(TraverseStmt(
C->getFactor()));
3295template <
typename Derived>
3297RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3298 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3302template <
typename Derived>
3303bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3307template <
typename Derived>
3308bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3312template <
typename Derived>
3313bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3314 OMPUnifiedAddressClause *) {
3318template <
typename Derived>
3319bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3320 OMPUnifiedSharedMemoryClause *) {
3324template <
typename Derived>
3325bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3326 OMPReverseOffloadClause *) {
3330template <
typename Derived>
3331bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3332 OMPDynamicAllocatorsClause *) {
3336template <
typename Derived>
3337bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3338 OMPAtomicDefaultMemOrderClause *) {
3342template <
typename Derived>
3343bool RecursiveASTVisitor<Derived>::VisitOMPAtClause(OMPAtClause *) {
3347template <
typename Derived>
3348bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
3352template <
typename Derived>
3353bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
3354 TRY_TO(TraverseStmt(
C->getMessageString()));
3358template <
typename Derived>
3360RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3361 TRY_TO(VisitOMPClauseWithPreInit(C));
3362 TRY_TO(TraverseStmt(
C->getChunkSize()));
3366template <
typename Derived>
3367bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3368 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3372template <
typename Derived>
3373bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3377template <
typename Derived>
3378bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3382template <
typename Derived>
3384RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3388template <
typename Derived>
3389bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3393template <
typename Derived>
3394bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3398template <
typename Derived>
3399bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3403template <
typename Derived>
3404bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3408template <
typename Derived>
3409bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
3413template <
typename Derived>
3414bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3418template <
typename Derived>
3419bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3423template <
typename Derived>
3424bool RecursiveASTVisitor<Derived>::VisitOMPAcqRelClause(OMPAcqRelClause *) {
3428template <
typename Derived>
3429bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
3433template <
typename Derived>
3434bool RecursiveASTVisitor<Derived>::VisitOMPReleaseClause(OMPReleaseClause *) {
3438template <
typename Derived>
3439bool RecursiveASTVisitor<Derived>::VisitOMPRelaxedClause(OMPRelaxedClause *) {
3443template <
typename Derived>
3444bool RecursiveASTVisitor<Derived>::VisitOMPWeakClause(OMPWeakClause *) {
3448template <
typename Derived>
3449bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3453template <
typename Derived>
3454bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3458template <
typename Derived>
3459bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3463template <
typename Derived>
3464bool RecursiveASTVisitor<Derived>::VisitOMPInitClause(OMPInitClause *C) {
3465 TRY_TO(VisitOMPClauseList(C));
3469template <
typename Derived>
3470bool RecursiveASTVisitor<Derived>::VisitOMPUseClause(OMPUseClause *C) {
3471 TRY_TO(TraverseStmt(
C->getInteropVar()));
3475template <
typename Derived>
3476bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *C) {
3477 TRY_TO(TraverseStmt(
C->getInteropVar()));
3481template <
typename Derived>
3482bool RecursiveASTVisitor<Derived>::VisitOMPNovariantsClause(
3483 OMPNovariantsClause *C) {
3484 TRY_TO(VisitOMPClauseWithPreInit(C));
3485 TRY_TO(TraverseStmt(
C->getCondition()));
3489template <
typename Derived>
3490bool RecursiveASTVisitor<Derived>::VisitOMPNocontextClause(
3491 OMPNocontextClause *C) {
3492 TRY_TO(VisitOMPClauseWithPreInit(C));
3493 TRY_TO(TraverseStmt(
C->getCondition()));
3497template <
typename Derived>
3498template <
typename T>
3499bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *
Node) {
3500 for (
auto *E :
Node->varlists()) {
3506template <
typename Derived>
3507bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
3508 OMPInclusiveClause *C) {
3509 TRY_TO(VisitOMPClauseList(C));
3513template <
typename Derived>
3514bool RecursiveASTVisitor<Derived>::VisitOMPExclusiveClause(
3515 OMPExclusiveClause *C) {
3516 TRY_TO(VisitOMPClauseList(C));
3520template <
typename Derived>
3521bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3522 TRY_TO(VisitOMPClauseList(C));
3523 for (
auto *E :
C->private_copies()) {
3529template <
typename Derived>
3530bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3531 OMPFirstprivateClause *C) {
3532 TRY_TO(VisitOMPClauseList(C));
3533 TRY_TO(VisitOMPClauseWithPreInit(C));
3534 for (
auto *E :
C->private_copies()) {
3537 for (
auto *E :
C->inits()) {
3543template <
typename Derived>
3544bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3545 OMPLastprivateClause *C) {
3546 TRY_TO(VisitOMPClauseList(C));
3547 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3548 for (
auto *E :
C->private_copies()) {
3551 for (
auto *E :
C->source_exprs()) {
3554 for (
auto *E :
C->destination_exprs()) {
3557 for (
auto *E :
C->assignment_ops()) {
3563template <
typename Derived>
3564bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3565 TRY_TO(VisitOMPClauseList(C));
3569template <
typename Derived>
3570bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3571 TRY_TO(TraverseStmt(
C->getStep()));
3572 TRY_TO(TraverseStmt(
C->getCalcStep()));
3573 TRY_TO(VisitOMPClauseList(C));
3574 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3575 for (
auto *E :
C->privates()) {
3578 for (
auto *E :
C->inits()) {
3581 for (
auto *E :
C->updates()) {
3584 for (
auto *E :
C->finals()) {
3590template <
typename Derived>
3591bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3592 TRY_TO(TraverseStmt(
C->getAlignment()));
3593 TRY_TO(VisitOMPClauseList(C));
3597template <
typename Derived>
3598bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3599 TRY_TO(VisitOMPClauseList(C));
3600 for (
auto *E :
C->source_exprs()) {
3603 for (
auto *E :
C->destination_exprs()) {
3606 for (
auto *E :
C->assignment_ops()) {
3612template <
typename Derived>
3613bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3614 OMPCopyprivateClause *C) {
3615 TRY_TO(VisitOMPClauseList(C));
3616 for (
auto *E :
C->source_exprs()) {
3619 for (
auto *E :
C->destination_exprs()) {
3622 for (
auto *E :
C->assignment_ops()) {
3628template <
typename Derived>
3630RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3631 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3632 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3633 TRY_TO(VisitOMPClauseList(C));
3634 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3635 for (
auto *E :
C->privates()) {
3638 for (
auto *E :
C->lhs_exprs()) {
3641 for (
auto *E :
C->rhs_exprs()) {
3644 for (
auto *E :
C->reduction_ops()) {
3647 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3648 for (
auto *E :
C->copy_ops()) {
3651 for (
auto *E :
C->copy_array_temps()) {
3654 for (
auto *E :
C->copy_array_elems()) {
3661template <
typename Derived>
3662bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3663 OMPTaskReductionClause *C) {
3664 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3665 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3666 TRY_TO(VisitOMPClauseList(C));
3667 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3668 for (
auto *E :
C->privates()) {
3671 for (
auto *E :
C->lhs_exprs()) {
3674 for (
auto *E :
C->rhs_exprs()) {
3677 for (
auto *E :
C->reduction_ops()) {
3683template <
typename Derived>
3684bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3685 OMPInReductionClause *C) {
3686 TRY_TO(TraverseNestedNameSpecifierLoc(
C->getQualifierLoc()));
3687 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3688 TRY_TO(VisitOMPClauseList(C));
3689 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3690 for (
auto *E :
C->privates()) {
3693 for (
auto *E :
C->lhs_exprs()) {
3696 for (
auto *E :
C->rhs_exprs()) {
3699 for (
auto *E :
C->reduction_ops()) {
3702 for (
auto *E :
C->taskgroup_descriptors())
3707template <
typename Derived>
3708bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3709 TRY_TO(VisitOMPClauseList(C));
3713template <
typename Derived>
3714bool RecursiveASTVisitor<Derived>::VisitOMPDepobjClause(OMPDepobjClause *C) {
3715 TRY_TO(TraverseStmt(
C->getDepobj()));
3719template <
typename Derived>
3720bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3721 TRY_TO(VisitOMPClauseList(C));
3725template <
typename Derived>
3726bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3727 TRY_TO(VisitOMPClauseWithPreInit(C));
3728 TRY_TO(TraverseStmt(
C->getDevice()));
3732template <
typename Derived>
3733bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3734 TRY_TO(VisitOMPClauseList(C));
3738template <
typename Derived>
3739bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
3740 OMPNumTeamsClause *C) {
3741 TRY_TO(VisitOMPClauseWithPreInit(C));
3742 TRY_TO(TraverseStmt(
C->getNumTeams()));
3746template <
typename Derived>
3747bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
3748 OMPThreadLimitClause *C) {
3749 TRY_TO(VisitOMPClauseWithPreInit(C));
3750 TRY_TO(TraverseStmt(
C->getThreadLimit()));
3754template <
typename Derived>
3755bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
3756 OMPPriorityClause *C) {
3757 TRY_TO(VisitOMPClauseWithPreInit(C));
3758 TRY_TO(TraverseStmt(
C->getPriority()));
3762template <
typename Derived>
3763bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
3764 OMPGrainsizeClause *C) {
3765 TRY_TO(VisitOMPClauseWithPreInit(C));
3766 TRY_TO(TraverseStmt(
C->getGrainsize()));
3770template <
typename Derived>
3771bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
3772 OMPNumTasksClause *C) {
3773 TRY_TO(VisitOMPClauseWithPreInit(C));
3774 TRY_TO(TraverseStmt(
C->getNumTasks()));
3778template <
typename Derived>
3779bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
3780 TRY_TO(TraverseStmt(
C->getHint()));
3784template <
typename Derived>
3785bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
3786 OMPDistScheduleClause *C) {
3787 TRY_TO(VisitOMPClauseWithPreInit(C));
3788 TRY_TO(TraverseStmt(
C->getChunkSize()));
3792template <
typename Derived>
3794RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
3798template <
typename Derived>
3799bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
3800 TRY_TO(VisitOMPClauseList(C));
3804template <
typename Derived>
3805bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
3806 TRY_TO(VisitOMPClauseList(C));
3810template <
typename Derived>
3811bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
3812 OMPUseDevicePtrClause *C) {
3813 TRY_TO(VisitOMPClauseList(C));
3817template <
typename Derived>
3818bool RecursiveASTVisitor<Derived>::VisitOMPUseDeviceAddrClause(
3819 OMPUseDeviceAddrClause *C) {
3820 TRY_TO(VisitOMPClauseList(C));
3824template <
typename Derived>
3825bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
3826 OMPIsDevicePtrClause *C) {
3827 TRY_TO(VisitOMPClauseList(C));
3831template <
typename Derived>
3832bool RecursiveASTVisitor<Derived>::VisitOMPHasDeviceAddrClause(
3833 OMPHasDeviceAddrClause *C) {
3834 TRY_TO(VisitOMPClauseList(C));
3838template <
typename Derived>
3839bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
3840 OMPNontemporalClause *C) {
3841 TRY_TO(VisitOMPClauseList(C));
3842 for (
auto *E :
C->private_refs()) {
3848template <
typename Derived>
3849bool RecursiveASTVisitor<Derived>::VisitOMPOrderClause(OMPOrderClause *) {
3853template <
typename Derived>
3854bool RecursiveASTVisitor<Derived>::VisitOMPDetachClause(OMPDetachClause *C) {
3855 TRY_TO(TraverseStmt(
C->getEventHandler()));
3859template <
typename Derived>
3860bool RecursiveASTVisitor<Derived>::VisitOMPUsesAllocatorsClause(
3861 OMPUsesAllocatorsClause *C) {
3862 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
3863 const OMPUsesAllocatorsClause::Data
Data =
C->getAllocatorData(I);
3870template <
typename Derived>
3871bool RecursiveASTVisitor<Derived>::VisitOMPAffinityClause(
3872 OMPAffinityClause *C) {
3873 TRY_TO(TraverseStmt(
C->getModifier()));
3874 for (Expr *E :
C->varlists())
3879template <
typename Derived>
3880bool RecursiveASTVisitor<Derived>::VisitOMPFilterClause(OMPFilterClause *C) {
3881 TRY_TO(VisitOMPClauseWithPreInit(C));
3882 TRY_TO(TraverseStmt(
C->getThreadID()));
3886template <
typename Derived>
3887bool RecursiveASTVisitor<Derived>::VisitOMPBindClause(OMPBindClause *C) {
3891template <
typename Derived>
3892bool RecursiveASTVisitor<Derived>::VisitOMPXDynCGroupMemClause(
3893 OMPXDynCGroupMemClause *C) {
3894 TRY_TO(VisitOMPClauseWithPreInit(C));
3895 TRY_TO(TraverseStmt(
C->getSize()));
3899template <
typename Derived>
3900bool RecursiveASTVisitor<Derived>::VisitOMPDoacrossClause(
3901 OMPDoacrossClause *C) {
3902 TRY_TO(VisitOMPClauseList(C));
3906template <
typename Derived>
3907bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
3908 OMPXAttributeClause *C) {
3912template <
typename Derived>
3913bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
3917template <
typename Derived>
3918bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
3919 OpenACCConstructStmt *) {
3924template <
typename Derived>
3925bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
3926 OpenACCAssociatedStmtConstruct *S) {
3927 TRY_TO(TraverseOpenACCConstructStmt(S));
3928 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
3933 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
This file provides AST data structures related to concepts.
#define TYPE(DERIVED, BASE)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::DenseSet< const void * > Visited
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND)
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
#define STMT(CLASS, PARENT)
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define DEF_TRAVERSE_DECL(DECL, CODE)
#define DEF_TRAVERSE_STMT(STMT, CODE)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
#define TRY_TO(CALL_EXPR)
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Wrapper for source info for arrays.
Attr - This represents one attribute.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
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.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
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 an extended address space qualifier where the input address space value is dependent.
Represents a qualified type name for which the type name is dependent.
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Represents a dependent template name that cannot be resolved prior to template instantiation.
This represents one expression.
ExtVectorType - Extended vector type.
Represents a function declaration or definition.
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
Describes an C or C++ initializer list.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
A C++ nested-name-specifier augmented with source location information.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP executable directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Represents a pointer to an Objective C object.
Represents a pack expansion of types.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Represents a template name that was expressed as a qualified name.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type.
bool WalkUpFromDecl(Decl *D)
bool TraverseConceptRequirement(concepts::Requirement *R)
bool TraverseType(QualType T)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
bool dataTraverseStmtPre(Stmt *S)
Invoked before visiting a statement or expression via data recursion.
bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc)
Recursively visit an Objective-C protocol reference with location information.
bool VisitUnqualTypeLoc(UnqualTypeLoc TL)
bool TraverseConceptExprRequirement(concepts::ExprRequirement *R)
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the TranslationUnitDecl.
bool shouldVisitTemplateInstantiations() const
Return whether this visitor should recurse into template instantiations.
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool WalkUpFromType(Type *T)
bool dataTraverseStmtPost(Stmt *S)
Invoked after visiting a statement or expression via data recursion.
bool WalkUpFromTypeLoc(TypeLoc TL)
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
Stmt::child_range getStmtChildren(Stmt *S)
bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS)
Recursively visit a C++ nested-name-specifier.
bool shouldVisitImplicitCode() const
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destru...
bool TraverseConceptReference(ConceptReference *CR)
Recursively visit concept reference with location information.
bool TraverseTemplateArguments(ArrayRef< TemplateArgument > Args)
Recursively visit a set of template arguments.
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL)
bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
bool WalkUpFromStmt(Stmt *S)
bool TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
bool TraverseTypeConstraint(const TypeConstraint *C)
bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL)
bool VisitTypeLoc(TypeLoc TL)
bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)
Recursively visit a lambda capture.
bool VisitConceptReference(ConceptReference *CR)
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
bool shouldVisitLambdaBody() const
Return whether this visitor should recurse into lambda body.
bool TraverseSynOrSemInitListExpr(InitListExpr *S, DataRecursionQueue *Queue=nullptr)
Recursively visit the syntactic or semantic form of an initialization list.
bool TraverseAttr(Attr *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...
bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R)
bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL)
bool shouldWalkTypesOfTypeLocs() const
Return whether this visitor should recurse into the types of TypeLocs.
bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
Derived & getDerived()
Return a reference to the derived class.
bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R)
bool TraverseConstructorInitializer(CXXCtorInitializer *Init)
Recursively visit a constructor initializer.
Stmt - This represents one statement.
llvm::iterator_range< child_iterator > child_range
Represents the result of substituting a type for a template type parameter.
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.
Represents a type template specialization; the template must be a class template, a type alias templa...
Declaration of a template type parameter.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
TypeLocClass getTypeLocClass() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
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.
TypeClass getTypeClass() const
Wrapper of type source information for a type with no direct qualifiers.
Represents a variable declaration or definition.
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
TypeSourceInfo * getType() const
LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr) -> bool
Returns true if and only if FirstMethodPtr and SecondMethodPtr are pointers to the same non-static me...
bool ReturnValue(const T &V, APValue &R)
Convert a value to an APValue.
The JSON file list parser is used to communicate input to InstallAPI.
for(auto typeArg :T->getTypeArgsAsWritten())
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.