13#ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14#define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
49#include "llvm/ADT/PointerIntPair.h"
50#include "llvm/ADT/SmallVector.h"
51#include "llvm/Support/Casting.h"
62#define TRY_TO(CALL_EXPR) \
64 if (!getDerived().CALL_EXPR) \
70template <
typename T,
typename U>
72template <
typename T,
typename U,
typename R,
typename... P>
78template <
typename FirstMethodPtrTy,
typename SecondMethodPtrTy>
79LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG
auto
81 [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
84 SecondMethodPtrTy>::value)
85 return FirstMethodPtr == SecondMethodPtr;
167 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
332#define ATTR_VISITOR_DECLS_ONLY
333#include "clang/AST/AttrVisitor.inc"
334#undef ATTR_VISITOR_DECLS_ONLY
346#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
347 (::clang::detail::has_same_member_pointer_type< \
348 decltype(&RecursiveASTVisitor::Traverse##NAME), \
349 decltype(&Derived::Traverse##NAME)>::value \
350 ? static_cast<std::conditional_t< \
351 ::clang::detail::has_same_member_pointer_type< \
352 decltype(&RecursiveASTVisitor::Traverse##NAME), \
353 decltype(&Derived::Traverse##NAME)>::value, \
354 Derived &, RecursiveASTVisitor &>>(*this) \
355 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
356 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
361#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
363 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
369#define ABSTRACT_STMT(STMT)
370#define STMT(CLASS, PARENT) \
371 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
372#include "clang/AST/StmtNodes.inc"
378#define STMT(CLASS, PARENT) \
379 bool WalkUpFrom##CLASS(CLASS *S) { \
380 TRY_TO(WalkUpFrom##PARENT(S)); \
381 TRY_TO(Visit##CLASS(S)); \
384 bool Visit##CLASS(CLASS *S) { return true; }
385#include "clang/AST/StmtNodes.inc"
391#define ABSTRACT_TYPE(CLASS, BASE)
392#define TYPE(CLASS, BASE) \
393 bool Traverse##CLASS##Type(CLASS##Type *T, bool TraverseQualifier);
394#include "clang/AST/TypeNodes.inc"
400#define TYPE(CLASS, BASE) \
401 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
402 TRY_TO(WalkUpFrom##BASE(T)); \
403 TRY_TO(Visit##CLASS##Type(T)); \
406 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
407#include "clang/AST/TypeNodes.inc"
413#define ABSTRACT_TYPELOC(CLASS, BASE)
414#define TYPELOC(CLASS, BASE) \
415 bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL, bool TraverseQualifier);
416#include "clang/AST/TypeLocNodes.def"
435#define TYPE(CLASS, BASE) \
436 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
437 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
438 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
441 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
442#include "clang/AST/TypeNodes.inc"
447#define ABSTRACT_DECL(DECL)
448#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
449#include "clang/AST/DeclNodes.inc"
455#define DECL(CLASS, BASE) \
456 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
457 TRY_TO(WalkUpFrom##BASE(D)); \
458 TRY_TO(Visit##CLASS##Decl(D)); \
461 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
462#include "clang/AST/DeclNodes.inc"
466#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
467 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
471#undef DEF_TRAVERSE_TMPL_INST
487 template <
typename T>
488 bool TraverseDeclTemplateParameterLists(
T *D);
495 bool TraverseSubstPackTypeHelper(SubstPackType *
T);
502 bool TraverseVarHelper(
VarDecl *D);
506 bool TraverseTagType(TagType *
T,
bool TraverseQualifier);
507 bool TraverseTagTypeLoc(
TagTypeLoc TL,
bool TraverseQualifier);
508#define GEN_CLANG_CLAUSE_CLASS
509#define CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C);
510#include "llvm/Frontend/OpenMP/OMP.inc"
512 template <
typename T>
bool VisitOMPClauseList(T *Node);
514 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *Node);
515 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node);
517 bool PostVisitStmt(Stmt *S);
522 bool VisitOpenACCClause(
const OpenACCClause *);
525template <
typename Derived>
532 if (
Expr *IDC =
C->getImmediatelyDeclaredConstraint()) {
544template <
typename Derived>
549 return getDerived().TraverseConceptTypeRequirement(
553 return getDerived().TraverseConceptExprRequirement(
556 return getDerived().TraverseConceptNestedRequirement(
559 llvm_unreachable(
"unexpected case");
562template <
typename Derived>
569#define ABSTRACT_STMT(STMT)
570#define STMT(CLASS, PARENT) \
571 case Stmt::CLASS##Class: \
572 return TRAVERSE_STMT_BASE(CLASS, CLASS, S, Queue);
573#include "clang/AST/StmtNodes.inc"
581template <
typename Derived>
589template <
typename Derived>
595 if (RetReq.isTypeConstraint()) {
597 TRY_TO(TraverseTemplateParameterListHelper(
598 RetReq.getTypeConstraintTemplateParameterList()));
607template <
typename Derived>
615template <
typename Derived>
616bool RecursiveASTVisitor<Derived>::PostVisitStmt(
Stmt *S) {
636#define ABSTRACT_STMT(STMT)
637#define STMT(CLASS, PARENT) \
638 case Stmt::CLASS##Class: \
639 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
640 &Derived::Traverse##CLASS)) { \
641 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); \
644#define INITLISTEXPR(CLASS, PARENT) \
645 case Stmt::CLASS##Class: \
646 if (::clang::detail::isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
647 &Derived::Traverse##CLASS)) { \
648 auto ILE = static_cast<CLASS *>(S); \
649 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
650 TRY_TO(WalkUpFrom##CLASS(Syn)); \
651 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
652 TRY_TO(WalkUpFrom##CLASS(Sem)); \
655#include "clang/AST/StmtNodes.inc"
665template <
typename Derived>
666LLVM_ATTRIBUTE_NOINLINE
bool
672 Queue->push_back({S,
false});
677 LocalQueue.push_back({S,
false});
679 while (!LocalQueue.empty()) {
680 auto &CurrSAndVisited = LocalQueue.back();
681 Stmt *CurrS = CurrSAndVisited.getPointer();
682 bool Visited = CurrSAndVisited.getInt();
684 LocalQueue.pop_back();
687 TRY_TO(PostVisitStmt(CurrS));
693 CurrSAndVisited.setInt(
true);
694 size_t N = LocalQueue.size();
697 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
699 LocalQueue.pop_back();
706template <
typename Derived>
708 bool TraverseQualifier) {
712 switch (
T->getTypeClass()) {
713#define ABSTRACT_TYPE(CLASS, BASE)
714#define TYPE(CLASS, BASE) \
716 return getDerived().Traverse##CLASS##Type( \
717 static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())), \
719#include "clang/AST/TypeNodes.inc"
725template <
typename Derived>
727 bool TraverseQualifier) {
732#define ABSTRACT_TYPELOC(CLASS, BASE)
733#define TYPELOC(CLASS, BASE) \
734 case TypeLoc::CLASS: \
735 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>(), \
737#include "clang/AST/TypeLocNodes.def"
744#define VISITORCLASS RecursiveASTVisitor
745#include "clang/AST/AttrVisitor.inc"
748template <
typename Derived>
760 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(D))
761 return TraverseTemplateTypeParamDeclConstraints(TTPD);
772 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
773 if (llvm::isa_and_present<TypeAliasTemplateDecl>(
774 FTD->getDeclName().getCXXDeductionGuideTemplate()))
779#define ABSTRACT_DECL(DECL)
780#define DECL(CLASS, BASE) \
782 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
785#include "clang/AST/DeclNodes.inc"
790template <
typename Derived>
808 llvm_unreachable(
"unhandled kind");
811template <
typename Derived>
834template <
typename Derived>
863template <
typename Derived>
868 Template.getAsQualifiedTemplateName()) {
869 if (QTN->getQualifier()) {
877template <
typename Derived>
908template <
typename Derived>
924 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
947template <
typename Derived>
956template <
typename Derived>
968template <
typename Derived>
973 if (LE->isInitCapture(
C))
983#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
984 template <typename Derived> \
985 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T, \
986 bool TraverseQualifier) { \
987 if (!getDerived().shouldTraversePostOrder()) \
988 TRY_TO(WalkUpFrom##TYPE(T)); \
992 if (getDerived().shouldTraversePostOrder()) \
993 TRY_TO(WalkUpFrom##TYPE(T)); \
1004 {
TRY_TO(TraverseType(
T->getPointeeType())); })
1007 {
TRY_TO(TraverseType(T->getPointeeType())); })
1010 {
TRY_TO(TraverseType(
T->getPointeeType())); })
1013 NestedNameSpecifier Qualifier =
1016 : T->getQualifier();
1017 TRY_TO(TraverseNestedNameSpecifier(Qualifier));
1026 TRY_TO(TraverseType(
T->getElementType()));
1027 if (
T->getSizeExpr())
1028 TRY_TO(TraverseStmt(
const_cast<Expr*
>(
T->getSizeExpr())));
1032 TRY_TO(TraverseType(T->getElementType()));
1033 if (
T->getSizeExpr())
1034 TRY_TO(TraverseStmt(
const_cast<Expr *
>(
T->getSizeExpr())));
1038 {
TRY_TO(TraverseType(
T->getElementType())); })
1041 TRY_TO(TraverseType(T->getElementType()));
1046 TRY_TO(TraverseType(
T->getElementType()));
1047 if (
T->getSizeExpr())
1048 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1052 TRY_TO(TraverseStmt(T->getAddrSpaceExpr()));
1053 TRY_TO(TraverseType(T->getPointeeType()));
1057 if (
T->getSizeExpr())
1058 TRY_TO(TraverseStmt(
T->getSizeExpr()));
1059 TRY_TO(TraverseType(
T->getElementType()));
1063 if (T->getSizeExpr())
1064 TRY_TO(TraverseStmt(T->getSizeExpr()));
1073 {
TRY_TO(TraverseType(
T->getElementType())); })
1076 if (T->getRowExpr())
1077 TRY_TO(TraverseStmt(T->getRowExpr()));
1078 if (T->getColumnExpr())
1079 TRY_TO(TraverseStmt(T->getColumnExpr()));
1080 TRY_TO(TraverseType(T->getElementType()));
1084 {
TRY_TO(TraverseType(
T->getReturnType())); })
1087 TRY_TO(TraverseType(T->getReturnType()));
1089 for (
const auto &A :
T->param_types()) {
1093 for (
const auto &E :
T->exceptions()) {
1098 TRY_TO(TraverseStmt(NE));
1102 if (TraverseQualifier)
1103 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1106 if (TraverseQualifier)
1107 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1110 if (TraverseQualifier)
1111 TRY_TO(TraverseNestedNameSpecifier(
T->getQualifier()));
1115 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1120 {
TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1123 TRY_TO(TraverseType(
T->getPattern()));
1124 TRY_TO(TraverseStmt(
T->getIndexExpr()));
1128 TRY_TO(TraverseType(T->getBaseType()));
1133 TRY_TO(TraverseType(
T->getDeducedType()));
1134 if (
T->isConstrained()) {
1135 TRY_TO(TraverseTemplateArguments(
T->getTypeConstraintArguments()));
1141 TRY_TO(TraverseType(
T->getReplacementType()));
1144 {
TRY_TO(TraverseSubstPackTypeHelper(
T)); })
1146 {
TRY_TO(TraverseSubstPackTypeHelper(T)); })
1149 {
TRY_TO(TraverseType(
T->getModifiedType())); })
1152 if (T->getCountExpr())
1153 TRY_TO(TraverseStmt(T->getCountExpr()));
1158 {
TRY_TO(TraverseType(
T->getWrappedType())); })
1161 {
TRY_TO(TraverseType(T->getWrappedType())); })
1164 for (
auto &Operand :
T->getOperands()) {
1165 if (Operand.isConstant() || Operand.isType()) {
1166 TRY_TO(TraverseType(Operand.getResultType()));
1174 {
TRY_TO(TraverseType(
T->getUnderlyingType())); })
1176template <typename Derived>
1177bool RecursiveASTVisitor<Derived>::TraverseTagType(TagType *T,
1178 bool TraverseQualifier) {
1179 if (TraverseQualifier)
1180 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1186 {
TRY_TO(TraverseTagType(T, TraverseQualifier)); })
1188 {
TRY_TO(TraverseTagType(
T, TraverseQualifier)); })
1191 if (TraverseQualifier)
1192 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1196 if (TraverseQualifier) {
1197 TRY_TO(TraverseTemplateName(
T->getTemplateName()));
1201 T->getTemplateName().getAsTemplateDecl(
true))));
1203 TRY_TO(TraverseTemplateArguments(
T->template_arguments()));
1207 if (TraverseQualifier) {
1208 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1212 T->getTemplateName().getAsTemplateDecl(
true))));
1214 TRY_TO(TraverseType(
T->getDeducedType()));
1226 if (
T->getBaseType().getTypePtr() !=
T)
1227 TRY_TO(TraverseType(
T->getBaseType()));
1228 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1229 TRY_TO(TraverseType(typeArg));
1234 {
TRY_TO(TraverseType(
T->getPointeeType())); })
1242 {
TRY_TO(TraverseStmt(
T->getNumBitsExpr())); })
1256 template <
typename Derived> \
1257 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##Loc( \
1258 TYPE##Loc TL,
bool TraverseQualifier) { \
1259 if (!getDerived().shouldTraversePostOrder()) { \
1260 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1261 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1262 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1267 if (getDerived().shouldTraversePostOrder()) { \
1268 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1269 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1270 TRY_TO(WalkUpFrom##
TYPE(
const_cast<TYPE *
>(TL.getTypePtr()))); \
1275template <
typename Derived>
1278 assert(TraverseQualifier &&
1279 "Qualifiers should never occur within NestedNameSpecifiers");
1295 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1302 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1306 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1309 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1312 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1315 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1320 if (NestedNameSpecifierLoc QL = TL.getQualifierLoc())
1323 TRY_TO(TraverseNestedNameSpecifier(TL.getTypePtr()->getQualifier()));
1328 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1331 {
TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1333template <typename Derived>
1334bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(
ArrayTypeLoc TL) {
1336 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1341 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1342 TRY_TO(TraverseArrayTypeLocHelper(TL));
1346 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1351 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1352 TRY_TO(TraverseArrayTypeLocHelper(TL));
1356 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1357 TRY_TO(TraverseArrayTypeLocHelper(TL));
1361 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1362 TRY_TO(TraverseArrayTypeLocHelper(TL));
1366 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1367 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1373 if (TL.getTypePtr()->getSizeExpr())
1374 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1375 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1380 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1384 if (TL.getTypePtr()->getSizeExpr())
1385 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1386 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1392 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1396 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1397 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1398 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1402 TRY_TO(TraverseStmt(TL.getAttrRowOperand()));
1403 TRY_TO(TraverseStmt(TL.getAttrColumnOperand()));
1404 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1408 {
TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1412 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1416 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1417 if (TL.getParam(I)) {
1418 TRY_TO(TraverseDecl(TL.getParam(I)));
1419 }
else if (I < T->getNumParams()) {
1420 TRY_TO(TraverseType(
T->getParamType(I)));
1424 for (
const auto &E : T->exceptions()) {
1428 if (
Expr *NE =
T->getNoexceptExpr())
1429 TRY_TO(TraverseStmt(NE));
1434 TraverseQualifier && QualifierLoc)
1438 if (NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
1439 TraverseQualifier && QualifierLoc)
1444 TraverseQualifier && QualifierLoc)
1449 {
TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1452 TRY_TO(TraverseTypeLoc(TL.getUnmodifiedTInfo()->getTypeLoc()));
1457 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1461 TRY_TO(TraverseType(TL.getPattern()));
1462 TRY_TO(TraverseStmt(TL.getTypePtr()->getIndexExpr()));
1466 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1470 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1471 if (TL.isConstrained()) {
1472 TRY_TO(TraverseConceptReference(TL.getConceptReference()));
1478 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1481template <typename Derived>
1482bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeLocHelper(
1484 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1488template <
typename Derived>
1489bool RecursiveASTVisitor<Derived>::TraverseSubstPackTypeHelper(
1491 TRY_TO(TraverseTemplateArgument(
T->getArgumentPack()));
1496 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1499 {
TRY_TO(TraverseSubstPackTypeLocHelper(TL)); })
1504 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1507 {
TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1510 {
TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1513 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1516 {
TRY_TO(TraverseTypeLoc(TL.getWrappedLoc())); })
1519 {
TRY_TO(TraverseType(TL.getType())); })
1521template <typename Derived>
1522bool RecursiveASTVisitor<Derived>::TraverseTagTypeLoc(TagTypeLoc TL,
1523 bool TraverseQualifier) {
1524 if (NestedNameSpecifierLoc QualifierLoc = TL.getQualifierLoc();
1525 TraverseQualifier && QualifierLoc)
1531 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1533 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1535 {
TRY_TO(TraverseTagTypeLoc(TL, TraverseQualifier)); })
1538 if (TraverseQualifier)
1543 if (TraverseQualifier)
1547 TRY_TO(TraverseTemplateName(
1548 TemplateName(TL.getTypePtr()->getTemplateName().getAsTemplateDecl(
1551 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1552 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1557 if (TraverseQualifier)
1560 const auto *T = TL.getTypePtr();
1563 TraverseTemplateName(
TemplateName(
T->getTemplateName().getAsTemplateDecl(
1570 {
TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1573 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1574 ObjCProtocolLoc ProtocolLoc(TL.getProtocol(I), TL.getProtocolLoc(I));
1575 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1584 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1585 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1586 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1587 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1588 for (
unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) {
1590 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1595 {
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1603 TRY_TO(TraverseStmt(TL.getTypePtr()->getNumBitsExpr()));
1617template <typename Derived>
1619 const Decl *Child) {
1625 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1626 return Cls->isLambda();
1630template <
typename Derived>
1631bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(
DeclContext *DC) {
1635 for (
auto *Child : DC->decls()) {
1636 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1637 TRY_TO(TraverseDecl(Child));
1644#define DEF_TRAVERSE_DECL(DECL, CODE) \
1645 template <typename Derived> \
1646 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1647 bool ShouldVisitChildren = true; \
1648 bool ReturnValue = true; \
1649 if (!getDerived().shouldTraversePostOrder()) \
1650 TRY_TO(WalkUpFrom##DECL(D)); \
1652 if (ReturnValue && ShouldVisitChildren) \
1653 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1654 if (ReturnValue) { \
1656 for (auto *I : D->attrs()) \
1657 TRY_TO(getDerived().TraverseAttr(I)); \
1659 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1660 TRY_TO(WalkUpFrom##DECL(D)); \
1661 return ReturnValue; \
1668 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1669 TRY_TO(TraverseStmt(D->getBody()));
1670 for (
const auto &I : D->captures()) {
1671 if (I.hasCopyExpr()) {
1672 TRY_TO(TraverseStmt(I.getCopyExpr()));
1675 ShouldVisitChildren =
false;
1679 TRY_TO(TraverseStmt(D->getBody()));
1680 ShouldVisitChildren =
false;
1684 TRY_TO(TraverseStmt(D->getBody()));
1685 ShouldVisitChildren =
false;
1695 TRY_TO(TraverseStmt(D->getTemporaryExpr()));
1699 {
TRY_TO(TraverseStmt(D->getAsmStringExpr())); })
1707 if (D->getFriendType()) {
1708 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1711 if (
auto *TT = D->getFriendType()->getType()->getAs<TagType>();
1712 TT && TT->isTagOwned())
1713 TRY_TO(TraverseDecl(TT->getOriginalDecl()));
1715 TRY_TO(TraverseDecl(D->getFriendDecl()));
1720 if (D->getFriendType())
1721 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1723 TRY_TO(TraverseDecl(D->getFriendDecl()));
1724 for (
unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1727 ITPL != ETPL; ++ITPL) {
1728 TRY_TO(TraverseDecl(*ITPL));
1741 TRY_TO(TraverseStmt(D->getAssertExpr()));
1742 TRY_TO(TraverseStmt(D->getMessage()));
1752 auto Scope = D->getASTContext().getTraversalScope();
1753 bool HasLimitedScope =
1755 if (HasLimitedScope) {
1756 ShouldVisitChildren =
false;
1757 for (
auto *Child :
Scope) {
1758 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1759 TRY_TO(TraverseDecl(Child));
1775 ShouldVisitChildren =
false;
1793 for (
auto typeParam : *typeParamList) {
1794 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1797 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1799 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1811 for (
auto typeParam : *typeParamList) {
1812 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1817 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1819 if (D->isThisDeclarationADefinition()) {
1820 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1822 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1828 if (D->isThisDeclarationADefinition()) {
1829 for (
auto It : llvm::zip(D->protocols(), D->protocol_locs())) {
1831 TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
1837 if (D->getReturnTypeSourceInfo()) {
1838 TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
1843 if (D->isThisDeclarationADefinition()) {
1844 TRY_TO(TraverseStmt(D->getBody()));
1846 ShouldVisitChildren =
false;
1850 if (D->hasExplicitBound()) {
1851 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1859 if (D->getTypeSourceInfo())
1860 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1862 TRY_TO(TraverseType(D->getType()));
1863 ShouldVisitChildren =
false;
1868 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1872 {
TRY_TO(TraverseTypeLoc(D->getEnumTypeLoc())); })
1885 for (
auto *I : D->varlist()) {
1891 for (
auto *
C : D->clauselists()) {
1897 TRY_TO(TraverseStmt(D->getCombiner()));
1900 TRY_TO(TraverseType(D->getType()));
1905 for (
auto *
C : D->clauselists())
1907 TRY_TO(TraverseType(D->getType()));
1914 for (
auto *I : D->varlist())
1916 for (
auto *
C : D->clauselists())
1921 {
TRY_TO(VisitOpenACCClauseList(D->clauses())); })
1924 TRY_TO(TraverseStmt(D->getFunctionReference()));
1925 TRY_TO(VisitOpenACCClauseList(D->clauses()));
1929template <typename Derived>
1930bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1936 if (
Expr *RequiresClause = TPL->getRequiresClause()) {
1937 TRY_TO(TraverseStmt(RequiresClause));
1943template <
typename Derived>
1944template <
typename T>
1945bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(
T *D) {
1946 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1948 TraverseTemplateParameterListHelper(TPL);
1953template <
typename Derived>
1956 for (
auto *SD : D->specializations()) {
1957 for (
auto *RD : SD->redecls()) {
1964 TRY_TO(TraverseDecl(RD));
1981template <
typename Derived>
1984 for (
auto *SD : D->specializations()) {
1985 for (
auto *RD : SD->redecls()) {
1990 TRY_TO(TraverseDecl(RD));
2006template <
typename Derived>
2009 for (
auto *FD : D->specializations()) {
2010 for (
auto *RD : FD->redecls()) {
2011 switch (RD->getTemplateSpecializationKind()) {
2015 TRY_TO(TraverseDecl(RD));
2022 TRY_TO(TraverseDecl(RD));
2036#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
2037 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
2038 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2039 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
2047 if (getDerived().shouldVisitTemplateInstantiations() && \
2048 D == D->getCanonicalDecl()) \
2049 TRY_TO(TraverseTemplateInstantiations(D)); \
2063 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2064 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2065 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2066 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2070 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2073template <typename Derived>
2074bool RecursiveASTVisitor<Derived>::TraverseTemplateTypeParamDeclConstraints(
2076 if (
const auto *TC = D->getTypeConstraint())
2077 TRY_TO(TraverseTypeConstraint(TC));
2083 if (D->getTypeForDecl())
2085 TRY_TO(TraverseTemplateTypeParamDeclConstraints(D));
2086 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2087 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2091 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2098 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2105 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
2106 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2110 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
2111 TRY_TO(TraverseStmt(D->getConstraintExpr()));
2126 TRY_TO(TraverseDeclTemplateParameterLists(D));
2129 if (
auto *TSI = D->getIntegerTypeSourceInfo())
2130 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2136template <typename Derived>
2137bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(
RecordDecl *D) {
2141 TRY_TO(TraverseDeclTemplateParameterLists(D));
2146template <
typename Derived>
2149 TRY_TO(TraverseTypeLoc(
Base.getTypeSourceInfo()->getTypeLoc()));
2153template <
typename Derived>
2154bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(
CXXRecordDecl *D) {
2155 if (!TraverseRecordHelper(D))
2157 if (D->isCompleteDefinition()) {
2158 for (
const auto &I : D->bases()) {
2159 TRY_TO(TraverseCXXBaseSpecifier(I));
2171template <typename Derived>
2172bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
2174 for (
unsigned I = 0; I < Count; ++I) {
2175 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
2180#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2181 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
2190 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten()) { \
2192 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2193 ArgsWritten->getTemplateArgs(), ArgsWritten->NumTemplateArgs)); \
2196 if (getDerived().shouldVisitTemplateInstantiations() || \
2197 D->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { \
2199 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2201 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
2214#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
2215 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
2217 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
2219 TRY_TO(TraverseTemplateArgumentLocsHelper( \
2220 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
2221 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
2226 TRY_TO(Traverse##DECLKIND##Helper(D)); \
2240 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2245template <typename Derived>
2246bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(
DeclaratorDecl *D) {
2247 TRY_TO(TraverseDeclTemplateParameterLists(D));
2249 if (D->getTypeSourceInfo())
2250 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
2252 TRY_TO(TraverseType(D->getType()));
2257 TRY_TO(TraverseVarHelper(D));
2258 for (
auto *Binding : D->bindings()) {
2259 TRY_TO(TraverseDecl(Binding));
2264 if (getDerived().shouldVisitImplicitCode()) {
2265 TRY_TO(TraverseStmt(D->getBinding()));
2266 if (
const auto HoldingVar = D->getHoldingVar())
2267 TRY_TO(TraverseDecl(HoldingVar));
2279 TRY_TO(TraverseDeclaratorHelper(D));
2280 if (D->isBitField())
2281 TRY_TO(TraverseStmt(D->getBitWidth()));
2282 if (D->hasInClassInitializer())
2283 TRY_TO(TraverseStmt(D->getInClassInitializer()));
2287 TRY_TO(TraverseDeclaratorHelper(D));
2288 if (D->isBitField())
2289 TRY_TO(TraverseStmt(D->getBitWidth()));
2294 TRY_TO(TraverseDeclaratorHelper(D));
2295 if (D->isBitField())
2296 TRY_TO(TraverseStmt(D->getBitWidth()));
2300template <typename Derived>
2301bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(
FunctionDecl *D) {
2302 TRY_TO(TraverseDeclTemplateParameterLists(D));
2304 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2312 D->getTemplateSpecializationInfo()) {
2318 FTSI->TemplateArgumentsAsWritten) {
2319 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2320 TALI->NumTemplateArgs));
2324 D->getDependentSpecializationInfo()) {
2326 DFSI->TemplateArgumentsAsWritten) {
2327 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2328 TALI->NumTemplateArgs));
2337 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2338 }
else if (getDerived().shouldVisitImplicitCode()) {
2350 D->getTrailingRequiresClause()) {
2352 const_cast<Expr *
>(TrailingRequiresClause.ConstraintExpr)));
2357 for (
auto *I : Ctor->inits()) {
2358 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2359 TRY_TO(TraverseConstructorInitializer(I));
2364 D->isThisDeclarationADefinition() &&
2367 (!D->isDefaulted() || getDerived().shouldVisitImplicitCode());
2369 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
2371 if (RD->isLambda() &&
2373 VisitBody = VisitBody && getDerived().shouldVisitLambdaBody();
2379 TRY_TO(TraverseStmt(D->getBody()));
2382 for (
auto *Child : D->decls()) {
2384 TRY_TO(TraverseDecl(Child));
2393 ShouldVisitChildren =
false;
2400 ShouldVisitChildren =
false;
2407 ShouldVisitChildren =
false;
2414 ShouldVisitChildren =
false;
2423 ShouldVisitChildren =
false;
2430 ShouldVisitChildren =
false;
2434template <typename Derived>
2435bool RecursiveASTVisitor<Derived>::TraverseVarHelper(
VarDecl *D) {
2436 TRY_TO(TraverseDeclaratorHelper(D));
2439 (!D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2440 TRY_TO(TraverseStmt(D->getInit()));
2450 TRY_TO(TraverseDeclaratorHelper(D));
2451 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2452 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
2456 TRY_TO(TraverseVarHelper(D));
2458 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2459 !D->hasUnparsedDefaultArg())
2460 TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
2462 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2463 !D->hasUnparsedDefaultArg())
2464 TRY_TO(TraverseStmt(D->getDefaultArg()));
2470 TRY_TO(TraverseTemplateArguments(D->getTemplateArguments()));
2486 template <
typename Derived> \
2488 STMT *S, DataRecursionQueue *Queue) { \
2489 bool ShouldVisitChildren =
true; \
2491 if (!getDerived().shouldTraversePostOrder()) \
2492 TRY_TO(WalkUpFrom##
STMT(S)); \
2494 if (ShouldVisitChildren) { \
2495 for (
Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2496 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2503 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) { \
2504 TRY_TO(WalkUpFrom##
STMT(S)); \
2511 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2514 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2517 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2530 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2535 for (
auto *I : S->decls()) {
2543 ShouldVisitChildren =
false;
2571 if (!getDerived().shouldVisitImplicitCode()) {
2578 ShouldVisitChildren =
false;
2584 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2595 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2596 if (S->hasExplicitTemplateArgs()) {
2597 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2598 S->getNumTemplateArgs()));
2604 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2605 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2606 S->getNumTemplateArgs()));
2611 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2612 if (S->hasExplicitTemplateArgs()) {
2613 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2614 S->getNumTemplateArgs()));
2620 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2621 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2622 S->getNumTemplateArgs()));
2632 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2636 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2640 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2644 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2648 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2652 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2656 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2660 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2663template <typename Derived>
2669 if (!getDerived().shouldTraversePostOrder())
2670 TRY_TO(WalkUpFromInitListExpr(S));
2677 if (!Queue && getDerived().shouldTraversePostOrder())
2678 TRY_TO(WalkUpFromInitListExpr(S));
2683template <
typename Derived>
2689template <
typename Derived>
2692 if (!getDerived().shouldTraversePostOrder())
2693 TRY_TO(VisitConceptReference(CR));
2695 TRY_TO(TraverseDeclarationNameInfo(CR->getConceptNameInfo()));
2696 if (CR->hasExplicitTemplateArgs())
2697 TRY_TO(TraverseTemplateArgumentLocsHelper(
2698 CR->getTemplateArgsAsWritten()->getTemplateArgs(),
2699 CR->getTemplateArgsAsWritten()->NumTemplateArgs));
2700 if (getDerived().shouldTraversePostOrder())
2701 TRY_TO(VisitConceptReference(CR));
2713template <
typename Derived>
2716 if (S->isSemanticForm() && S->isSyntacticForm()) {
2718 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2721 TRY_TO(TraverseSynOrSemInitListExpr(
2722 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2723 if (getDerived().shouldVisitImplicitCode()) {
2726 TRY_TO(TraverseSynOrSemInitListExpr(
2727 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2736 if (S->isExprPredicate())
2737 TRY_TO(TraverseStmt(S->getControllingExpr()));
2739 TRY_TO(TraverseTypeLoc(S->getControllingType()->getTypeLoc()));
2743 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2746 ShouldVisitChildren =
false;
2754 e = S->semantics_end();
2758 sub = OVE->getSourceExpr();
2761 ShouldVisitChildren =
false;
2767 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2772 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2780 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2786 if (S->isArgumentType())
2787 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2793 if (S->isTypeOperand())
2794 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2806 if (S->isTypeOperand())
2807 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2811 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2812 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2816 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2824 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2829 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2835 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2837 if (
C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2838 TRY_TO(TraverseLambdaCapture(S,
C, S->capture_init_begin()[I]));
2842 if (getDerived().shouldVisitImplicitCode()) {
2844 TRY_TO(TraverseDecl(S->getLambdaClass()));
2847 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2850 TRY_TO(TraverseTemplateParameterListHelper(S->getTemplateParameterList()));
2851 if (S->hasExplicitParameters()) {
2853 for (
unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2854 TRY_TO(TraverseDecl(Proto.getParam(I)));
2857 auto *
T = Proto.getTypePtr();
2858 for (
const auto &E :
T->exceptions())
2861 if (
Expr *NE =
T->getNoexceptExpr())
2864 if (S->hasExplicitResultType())
2865 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2867 const_cast<Expr *
>(S->getTrailingRequiresClause().ConstraintExpr));
2871 ShouldVisitChildren =
false;
2876 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2895 TRY_TO(TraverseDecl(S->getBlockDecl()));
2901 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2907 if (getDerived().shouldVisitImplicitCode())
2908 TRY_TO(TraverseStmt(S->getExpr()));
2912 if (getDerived().shouldVisitImplicitCode())
2913 TRY_TO(TraverseStmt(S->getExpr()));
2925 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2926 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2927 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2950 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2958 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2962 if (S->isClassReceiver()) {
2964 QualType Type = IDecl->getASTContext().getObjCInterfaceType(IDecl);
2966 Data.NameLoc = S->getReceiverLocation();
2977 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2984 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
3000 if (S->hasExplicitTemplateArgs()) {
3001 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3002 S->getNumTemplateArgs()));
3008 if (S->hasExplicitTemplateArgs()) {
3009 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
3010 S->getNumTemplateArgs()));
3021 if (getDerived().shouldVisitImplicitCode()) {
3022 TRY_TO(TraverseStmt(S->getOriginalStmt()));
3023 TRY_TO(TraverseDecl(S->getOutlinedFunctionDecl()));
3024 ShouldVisitChildren =
false;
3030 if (!getDerived().shouldVisitImplicitCode()) {
3032 S->getDecomposedForm();
3033 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.LHS)));
3034 TRY_TO(TraverseStmt(
const_cast<Expr*
>(Decomposed.RHS)));
3035 ShouldVisitChildren =
false;
3061 if (S->getLifetimeExtendedTemporaryDecl()) {
3062 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
3063 S->getLifetimeExtendedTemporaryDecl()));
3064 ShouldVisitChildren =
false;
3071 if (!getDerived().shouldVisitImplicitCode()) {
3073 ShouldVisitChildren =
false;
3077 if (!getDerived().shouldVisitImplicitCode()) {
3079 ShouldVisitChildren =
false;
3083 if (!getDerived().shouldVisitImplicitCode()) {
3085 ShouldVisitChildren =
false;
3089 if (!getDerived().shouldVisitImplicitCode()) {
3091 ShouldVisitChildren =
false;
3095 if (!getDerived().shouldVisitImplicitCode()) {
3097 ShouldVisitChildren =
false;
3102 TRY_TO(TraverseConceptReference(S->getConceptReference()));
3106 TRY_TO(TraverseDecl(S->getBody()));
3108 TRY_TO(TraverseDecl(Parm));
3110 TRY_TO(TraverseConceptRequirement(Req));
3129template <typename Derived>
3130bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
3131 OMPExecutableDirective *S) {
3132 for (
auto *
C : S->clauses()) {
3139 if (!getDerived().shouldVisitImplicitCode()) {
3141 TRY_TO(TraverseStmt(S->getLoopStmt()));
3142 ShouldVisitChildren =
false;
3146template <typename Derived>
3148RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
3149 return TraverseOMPExecutableDirective(S);
3153 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3156 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3159 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3162 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3165 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3168 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3171 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3174 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3177 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3180 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3183 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3186 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3189 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3192 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3195 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3198 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
3199 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)); })
3260 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3263 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3266 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3269 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3272 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3275 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3278 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3281 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3284 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3287 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3290 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3293 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3296 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3299 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3302 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3305 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3308 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3311 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3314 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3317 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3320 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3323 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3326 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3329 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3332 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3335 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3338 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3341 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3344 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3347 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3350 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3353 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3356 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3359 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3362 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3365 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3368 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3371 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3374 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3377 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3380 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
3383template <typename Derived>
3384bool RecursiveASTVisitor<Derived>::TraverseOMPClause(
OMPClause *
C) {
3387 switch (
C->getClauseKind()) {
3388#define GEN_CLANG_CLAUSE_CLASS
3389#define CLAUSE_CLASS(Enum, Str, Class) \
3390 case llvm::omp::Clause::Enum: \
3391 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
3393#define CLAUSE_NO_CLASS(Enum, Str) \
3394 case llvm::omp::Clause::Enum: \
3396#include "llvm/Frontend/OpenMP/OMP.inc"
3401template <
typename Derived>
3402bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
3404 TRY_TO(TraverseStmt(Node->getPreInitStmt()));
3408template <
typename Derived>
3409bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
3411 TRY_TO(VisitOMPClauseWithPreInit(Node));
3412 TRY_TO(TraverseStmt(Node->getPostUpdateExpr()));
3416template <
typename Derived>
3419 TRY_TO(TraverseStmt(
C->getAllocator()));
3423template <
typename Derived>
3425 TRY_TO(TraverseStmt(
C->getAllocator()));
3426 TRY_TO(VisitOMPClauseList(
C));
3430template <
typename Derived>
3432 TRY_TO(VisitOMPClauseWithPreInit(
C));
3433 TRY_TO(TraverseStmt(
C->getCondition()));
3437template <
typename Derived>
3439 TRY_TO(VisitOMPClauseWithPreInit(
C));
3440 TRY_TO(TraverseStmt(
C->getCondition()));
3444template <
typename Derived>
3447 TRY_TO(VisitOMPClauseWithPreInit(
C));
3448 TRY_TO(TraverseStmt(
C->getNumThreads()));
3452template <
typename Derived>
3454 TRY_TO(TraverseStmt(
C->getAlignment()));
3458template <
typename Derived>
3460 TRY_TO(TraverseStmt(
C->getSafelen()));
3464template <
typename Derived>
3466 TRY_TO(TraverseStmt(
C->getSimdlen()));
3470template <
typename Derived>
3472 for (
Expr *E :
C->getSizesRefs())
3477template <
typename Derived>
3480 for (
Expr *E :
C->getArgsRefs())
3485template <
typename Derived>
3490template <
typename Derived>
3492 TRY_TO(TraverseStmt(
C->getFactor()));
3496template <
typename Derived>
3499 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3503template <
typename Derived>
3508template <
typename Derived>
3513template <
typename Derived>
3519template <
typename Derived>
3525template <
typename Derived>
3531template <
typename Derived>
3537template <
typename Derived>
3543template <
typename Derived>
3548template <
typename Derived>
3553template <
typename Derived>
3558template <
typename Derived>
3560 TRY_TO(TraverseStmt(
C->getMessageString()));
3564template <
typename Derived>
3567 TRY_TO(VisitOMPClauseWithPreInit(
C));
3568 TRY_TO(TraverseStmt(
C->getChunkSize()));
3572template <
typename Derived>
3574 TRY_TO(TraverseStmt(
C->getNumForLoops()));
3578template <
typename Derived>
3583template <
typename Derived>
3588template <
typename Derived>
3594template <
typename Derived>
3599template <
typename Derived>
3604template <
typename Derived>
3609template <
typename Derived>
3614template <
typename Derived>
3619template <
typename Derived>
3624template <
typename Derived>
3629template <
typename Derived>
3634template <
typename Derived>
3639template <
typename Derived>
3644template <
typename Derived>
3649template <
typename Derived>
3654template <
typename Derived>
3660template <
typename Derived>
3666template <
typename Derived>
3672template <
typename Derived>
3677template <
typename Derived>
3682template <
typename Derived>
3687template <
typename Derived>
3692template <
typename Derived>
3697template <
typename Derived>
3702template <
typename Derived>
3707template <
typename Derived>
3709 TRY_TO(VisitOMPClauseList(
C));
3713template <
typename Derived>
3715 TRY_TO(TraverseStmt(
C->getInteropVar()));
3719template <
typename Derived>
3721 TRY_TO(TraverseStmt(
C->getInteropVar()));
3725template <
typename Derived>
3728 TRY_TO(VisitOMPClauseWithPreInit(
C));
3729 TRY_TO(TraverseStmt(
C->getCondition()));
3733template <
typename Derived>
3736 TRY_TO(VisitOMPClauseWithPreInit(
C));
3737 TRY_TO(TraverseStmt(
C->getCondition()));
3741template <
typename Derived>
3742template <
typename T>
3743bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(
T *Node) {
3744 for (
auto *E : Node->varlist()) {
3750template <
typename Derived>
3753 TRY_TO(VisitOMPClauseList(
C));
3757template <
typename Derived>
3760 TRY_TO(VisitOMPClauseList(
C));
3764template <
typename Derived>
3766 TRY_TO(VisitOMPClauseList(
C));
3767 for (
auto *E :
C->private_copies()) {
3773template <
typename Derived>
3776 TRY_TO(VisitOMPClauseList(
C));
3777 TRY_TO(VisitOMPClauseWithPreInit(
C));
3778 for (
auto *E :
C->private_copies()) {
3781 for (
auto *E :
C->inits()) {
3787template <
typename Derived>
3790 TRY_TO(VisitOMPClauseList(
C));
3791 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3792 for (
auto *E :
C->private_copies()) {
3795 for (
auto *E :
C->source_exprs()) {
3798 for (
auto *E :
C->destination_exprs()) {
3801 for (
auto *E :
C->assignment_ops()) {
3807template <
typename Derived>
3809 TRY_TO(VisitOMPClauseList(
C));
3813template <
typename Derived>
3815 TRY_TO(TraverseStmt(
C->getStep()));
3816 TRY_TO(TraverseStmt(
C->getCalcStep()));
3817 TRY_TO(VisitOMPClauseList(
C));
3818 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3819 for (
auto *E :
C->privates()) {
3822 for (
auto *E :
C->inits()) {
3825 for (
auto *E :
C->updates()) {
3828 for (
auto *E :
C->finals()) {
3834template <
typename Derived>
3836 TRY_TO(TraverseStmt(
C->getAlignment()));
3837 TRY_TO(VisitOMPClauseList(
C));
3841template <
typename Derived>
3843 TRY_TO(VisitOMPClauseList(
C));
3844 for (
auto *E :
C->source_exprs()) {
3847 for (
auto *E :
C->destination_exprs()) {
3850 for (
auto *E :
C->assignment_ops()) {
3856template <
typename Derived>
3859 TRY_TO(VisitOMPClauseList(
C));
3860 for (
auto *E :
C->source_exprs()) {
3863 for (
auto *E :
C->destination_exprs()) {
3866 for (
auto *E :
C->assignment_ops()) {
3872template <
typename Derived>
3876 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3877 TRY_TO(VisitOMPClauseList(
C));
3878 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3879 for (
auto *E :
C->privates()) {
3882 for (
auto *E :
C->lhs_exprs()) {
3885 for (
auto *E :
C->rhs_exprs()) {
3888 for (
auto *E :
C->reduction_ops()) {
3891 if (
C->getModifier() == OMPC_REDUCTION_inscan) {
3892 for (
auto *E :
C->copy_ops()) {
3895 for (
auto *E :
C->copy_array_temps()) {
3898 for (
auto *E :
C->copy_array_elems()) {
3905template <
typename Derived>
3909 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3910 TRY_TO(VisitOMPClauseList(
C));
3911 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3912 for (
auto *E :
C->privates()) {
3915 for (
auto *E :
C->lhs_exprs()) {
3918 for (
auto *E :
C->rhs_exprs()) {
3921 for (
auto *E :
C->reduction_ops()) {
3927template <
typename Derived>
3931 TRY_TO(TraverseDeclarationNameInfo(
C->getNameInfo()));
3932 TRY_TO(VisitOMPClauseList(
C));
3933 TRY_TO(VisitOMPClauseWithPostUpdate(
C));
3934 for (
auto *E :
C->privates()) {
3937 for (
auto *E :
C->lhs_exprs()) {
3940 for (
auto *E :
C->rhs_exprs()) {
3943 for (
auto *E :
C->reduction_ops()) {
3946 for (
auto *E :
C->taskgroup_descriptors())
3951template <
typename Derived>
3953 TRY_TO(VisitOMPClauseList(
C));
3957template <
typename Derived>
3959 TRY_TO(TraverseStmt(
C->getDepobj()));
3963template <
typename Derived>
3965 TRY_TO(VisitOMPClauseList(
C));
3969template <
typename Derived>
3971 TRY_TO(VisitOMPClauseWithPreInit(
C));
3972 TRY_TO(TraverseStmt(
C->getDevice()));
3976template <
typename Derived>
3978 TRY_TO(VisitOMPClauseList(
C));
3982template <
typename Derived>
3985 TRY_TO(VisitOMPClauseList(
C));
3986 TRY_TO(VisitOMPClauseWithPreInit(
C));
3990template <
typename Derived>
3993 TRY_TO(VisitOMPClauseList(
C));
3994 TRY_TO(VisitOMPClauseWithPreInit(
C));
3998template <
typename Derived>
4001 TRY_TO(VisitOMPClauseWithPreInit(
C));
4002 TRY_TO(TraverseStmt(
C->getPriority()));
4006template <
typename Derived>
4009 TRY_TO(VisitOMPClauseWithPreInit(
C));
4010 TRY_TO(TraverseStmt(
C->getGrainsize()));
4014template <
typename Derived>
4017 TRY_TO(VisitOMPClauseWithPreInit(
C));
4018 TRY_TO(TraverseStmt(
C->getNumTasks()));
4022template <
typename Derived>
4024 TRY_TO(TraverseStmt(
C->getHint()));
4028template <
typename Derived>
4031 TRY_TO(VisitOMPClauseWithPreInit(
C));
4032 TRY_TO(TraverseStmt(
C->getChunkSize()));
4036template <
typename Derived>
4042template <
typename Derived>
4044 TRY_TO(VisitOMPClauseList(
C));
4048template <
typename Derived>
4050 TRY_TO(VisitOMPClauseList(
C));
4054template <
typename Derived>
4057 TRY_TO(VisitOMPClauseList(
C));
4061template <
typename Derived>
4064 TRY_TO(VisitOMPClauseList(
C));
4068template <
typename Derived>
4071 TRY_TO(VisitOMPClauseList(
C));
4075template <
typename Derived>
4078 TRY_TO(VisitOMPClauseList(
C));
4082template <
typename Derived>
4085 TRY_TO(VisitOMPClauseList(
C));
4086 for (
auto *E :
C->private_refs()) {
4092template <
typename Derived>
4097template <
typename Derived>
4099 TRY_TO(TraverseStmt(
C->getEventHandler()));
4103template <
typename Derived>
4106 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
4114template <
typename Derived>
4117 TRY_TO(TraverseStmt(
C->getModifier()));
4118 for (
Expr *E :
C->varlist())
4123template <
typename Derived>
4125 TRY_TO(VisitOMPClauseWithPreInit(
C));
4126 TRY_TO(TraverseStmt(
C->getThreadID()));
4130template <
typename Derived>
4135template <
typename Derived>
4138 TRY_TO(VisitOMPClauseWithPreInit(
C));
4139 TRY_TO(TraverseStmt(
C->getSize()));
4143template <
typename Derived>
4146 TRY_TO(VisitOMPClauseList(
C));
4150template <
typename Derived>
4156template <
typename Derived>
4161template <
typename Derived>
4162bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
4164 TRY_TO(VisitOpenACCClauseList(
C->clauses()));
4168template <
typename Derived>
4169bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
4171 TRY_TO(TraverseOpenACCConstructStmt(S));
4172 TRY_TO(TraverseStmt(S->getAssociatedStmt()));
4176template <
typename Derived>
4177bool RecursiveASTVisitor<Derived>::VisitOpenACCClause(
const OpenACCClause *
C) {
4178 for (
const Stmt *Child :
C->children())
4179 TRY_TO(TraverseStmt(
const_cast<Stmt *
>(Child)));
4183template <
typename Derived>
4184bool RecursiveASTVisitor<Derived>::VisitOpenACCClauseList(
4187 for (
const auto *
C : Clauses)
4188 TRY_TO(VisitOpenACCClause(
C));
4193 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4195 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4197 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4199 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4201 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4203 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4205 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4207 if (S->hasDevNumExpr())
4208 TRY_TO(TraverseStmt(S->getDevNumExpr()));
4209 for (
auto *E : S->getQueueIdExprs())
4211 TRY_TO(VisitOpenACCClauseList(S->clauses()));
4214 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4216 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4218 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4220 {
TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4222 {
TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
4224 for (
auto *E : S->getVarList())
This file provides AST data structures related to concepts.
#define STMT(DERIVED, BASE)
#define TYPE(DERIVED, BASE)
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc QualifierLoc)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenACC nodes for declarative directives.
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
#define DEF_TRAVERSE_TMPL_INST(kind)
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
#define DEF_TRAVERSE_TYPELOC(TYPE, CODE)
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND, DECLKIND)
#define DEF_TRAVERSE_DECL(DECL, CODE)
#define DEF_TRAVERSE_STMT(STMT, CODE)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
#define TRY_TO(CALL_EXPR)
Defines various enumerations that describe declaration and type specifiers.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents an access specifier followed by colon ':'.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Wrapper for source info for arrays.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
A binding in a decomposition declaration.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
This class is used for builtin types like 'int'.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents a base class of a C++ class.
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ base or member initializer.
Represents a C++ deduction guide declaration.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
A C++ static_cast expression (C++ [expr.static.cast]).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
This captures a statement into a function.
CaseStmt - Represent a case statement.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Declaration of a class template.
Represents a 'co_await' expression.
Complex values, per C99 6.2.5p11.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Declaration of a C++20 concept.
A reference to a concept and its template args, as it appears in the code.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
ConditionalOperator - The ?
Represents the canonical version of C arrays with a specified constant size.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a concrete matrix type with constant number of rows and columns.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a 'co_yield' expression.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
A decomposition declaration.
Represents a 'co_await' expression while the type of the promise is dependent.
Provides information about a dependent function-template specialization declaration.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a vector type where either the type or size is dependent.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
Represents a reference to emded data.
Represents an empty-declaration.
An instance of this object exists for each enum constant that is defined.
Represents a standard C++ module export declaration.
Represents an expression â generally a full-expression â that introduces cleanups to be run at the en...
This represents one expression.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Declaration context for names declared as extern "C" in C++.
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Declaration of a friend template.
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack, init-capture pack, or binding pack that has been...
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
This class represents temporary values used to represent inout and out arguments in HLSL.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
Represents a field injected from an anonymous union/struct into the parent scope.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Represents a linkage specification.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
An instance of this class represents the declaration of a property member.
A member reference to an MSPropertyDecl.
MS property subscript expression.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
This represents a decl that may have a name.
Represents a C++ namespace alias.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
NamespaceAndPrefixLoc castAsNamespaceAndPrefix() const
For a nested-name-specifier that refers to a namespace, retrieve the namespace and its prefix.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAndPrefix getAsNamespaceAndPrefix() const
const Type * getAsType() const
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
This represents the 'absent' clause in the 'pragma omp assume' directive.
This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.
This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.
This represents clause 'affinity' in the 'pragma omp task'-based directives.
This represents the 'align' clause in the 'pragma omp allocate' directive.
This represents clause 'aligned' in the 'pragma omp ...' directives.
This represents clause 'allocate' in the 'pragma omp ...' directives.
This represents 'pragma omp allocate ...' directive.
This represents 'allocator' clause in the 'pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents 'at' clause in the 'pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.
This represents 'bind' clause in the 'pragma omp ...' directives.
This represents 'capture' clause in the 'pragma omp atomic' directive.
Pseudo declaration for capturing expressions.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This is a basic class for representing single OpenMP clause.
This represents 'collapse' clause in the 'pragma omp ...' directive.
This represents 'compare' clause in the 'pragma omp atomic' directive.
This represents the 'contains' clause in the 'pragma omp assume' directive.
This represents clause 'copyin' in the 'pragma omp ...' directives.
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
This represents 'pragma omp declare mapper ...' directive.
This represents 'pragma omp declare reduction ...' directive.
This represents 'default' clause in the 'pragma omp ...' directive.
This represents 'defaultmap' clause in the 'pragma omp ...' directive.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.
This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...
This represents 'detach' clause in the 'pragma omp task' directive.
This represents 'device' clause in the 'pragma omp ...' directive.
This represents 'dist_schedule' clause in the 'pragma omp ...' directive.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.
This represents clause 'exclusive' in the 'pragma omp scan' directive.
This represents 'fail' clause in the 'pragma omp atomic' directive.
This represents 'filter' clause in the 'pragma omp ...' directive.
This represents 'final' clause in the 'pragma omp ...' directive.
This represents clause 'firstprivate' in the 'pragma omp ...' directives.
This represents implicit clause 'flush' for the 'pragma omp flush' directive.
This represents clause 'from' in the 'pragma omp ...' directives.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
This represents 'grainsize' clause in the 'pragma omp ...' directive.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
This represents 'hint' clause in the 'pragma omp ...' directive.
This represents the 'holds' clause in the 'pragma omp assume' directive.
This represents 'if' clause in the 'pragma omp ...' directive.
This represents clause 'in_reduction' in the 'pragma omp task' directives.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
This represents the 'init' clause in 'pragma omp ...' directives.
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents clause 'lastprivate' in the 'pragma omp ...' directives.
This represents clause 'linear' in the 'pragma omp ...' directives.
This represents clause 'map' in the 'pragma omp ...' directives.
This represents 'mergeable' clause in the 'pragma omp ...' directive.
This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...
This represents the 'no_openmp' clause in the 'pragma omp assume' directive.
This represents the 'no_openmp_constructs' clause in the.
This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.
This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.
This represents 'nocontext' clause in the 'pragma omp ...' directive.
This represents 'nogroup' clause in the 'pragma omp ...' directive.
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
This represents 'novariants' clause in the 'pragma omp ...' directive.
This represents 'nowait' clause in the 'pragma omp ...' directive.
This represents 'num_tasks' clause in the 'pragma omp ...' directive.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
This represents 'num_threads' clause in the 'pragma omp ...' directive.
This represents 'order' clause in the 'pragma omp ...' directive.
This represents 'ordered' clause in the 'pragma omp ...' directive.
Representation of the 'partial' clause of the 'pragma omp unroll' directive.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
This represents 'priority' clause in the 'pragma omp ...' directive.
This represents clause 'private' in the 'pragma omp ...' directives.
This represents 'proc_bind' clause in the 'pragma omp ...' directive.
This represents 'read' clause in the 'pragma omp atomic' directive.
This represents clause 'reduction' in the 'pragma omp ...' directives.
This represents 'relaxed' clause in the 'pragma omp atomic' directives.
This represents 'release' clause in the 'pragma omp atomic|flush' directives.
This represents 'pragma omp requires...' directive.
This represents 'reverse_offload' clause in the 'pragma omp requires' directive.
This represents 'simd' clause in the 'pragma omp ...' directive.
This represents 'safelen' clause in the 'pragma omp ...' directive.
This represents 'schedule' clause in the 'pragma omp ...' directive.
This represents 'self_maps' clause in the 'pragma omp requires' directive.
This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.
This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...
This represents clause 'shared' in the 'pragma omp ...' directives.
This represents 'simdlen' clause in the 'pragma omp ...' directive.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
This represents 'pragma omp threadprivate ...' directive.
This represents 'threads' clause in the 'pragma omp ...' directive.
This represents clause 'to' in the 'pragma omp ...' directives.
This represents 'unified_address' clause in the 'pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the 'pragma omp requires' directive.
This represents 'untied' clause in the 'pragma omp ...' directive.
This represents 'update' clause in the 'pragma omp atomic' directive.
This represents the 'use' clause in 'pragma omp ...' directives.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.
This represents 'weak' clause in the 'pragma omp atomic' directives.
This represents 'write' clause in the 'pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents a field declaration created by an @defs(...).
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCompatibleAliasDecl - Represents alias of a class.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Represents an ObjC class declaration.
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
Represents one property declaration in an Objective-C interface.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents an Objective-C protocol declaration.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Represents the declaration of an Objective-C type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
This is a base class for any OpenACC statement-level constructs that have an associated statement.
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
This is the base type for all OpenACC Clauses.
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
Represents a partial function definition.
Represents a C++11 pack expansion that produces a sequence of expressions.
ParenExpr - This represents a parenthesized expression, e.g.
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
Represents a #pragma detect_mismatch line.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Expr *const * semantics_iterator
A (possibly-)qualified type.
Represents a template name as written in source code.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type.
bool WalkUpFromDecl(Decl *D)
bool TraverseConceptRequirement(concepts::Requirement *R)
bool dataTraverseStmtPre(Stmt *S)
Invoked before visiting a statement or expression via data recursion.
bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc)
Recursively visit an Objective-C protocol reference with location information.
bool VisitUnqualTypeLoc(UnqualTypeLoc TL)
bool TraverseConceptExprRequirement(concepts::ExprRequirement *R)
bool TraverseNestedNameSpecifier(NestedNameSpecifier NNS)
Recursively visit a C++ nested-name-specifier.
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the TranslationUnitDecl.
bool shouldVisitTemplateInstantiations() const
Return whether this visitor should recurse into template instantiations.
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool WalkUpFromType(Type *T)
bool dataTraverseStmtPost(Stmt *S)
Invoked after visiting a statement or expression via data recursion.
bool WalkUpFromTypeLoc(TypeLoc TL)
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
Stmt::child_range getStmtChildren(Stmt *S)
bool shouldVisitImplicitCode() const
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destru...
bool TraverseConceptReference(ConceptReference *CR)
Recursively visit concept reference with location information.
bool TraverseTemplateArguments(ArrayRef< TemplateArgument > Args)
Recursively visit a set of template arguments.
bool TraverseTypeLoc(TypeLoc TL, bool TraverseQualifier=true)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL)
bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue)
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
bool WalkUpFromStmt(Stmt *S)
bool TraverseTypeConstraint(const TypeConstraint *C)
bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL)
bool VisitTypeLoc(TypeLoc TL)
bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)
Recursively visit a lambda capture.
bool VisitConceptReference(ConceptReference *CR)
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
bool shouldVisitLambdaBody() const
Return whether this visitor should recurse into lambda body.
bool TraverseSynOrSemInitListExpr(InitListExpr *S, DataRecursionQueue *Queue=nullptr)
Recursively visit the syntactic or semantic form of an initialization list.
bool TraverseAttr(Attr *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...
bool TraverseType(QualType T, bool TraverseQualifier=true)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R)
bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL)
bool shouldWalkTypesOfTypeLocs() const
Return whether this visitor should recurse into the types of TypeLocs.
bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
Derived & getDerived()
Return a reference to the derived class.
bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R)
bool TraverseConstructorInitializer(CXXCtorInitializer *Init)
Recursively visit a constructor initializer.
Represents the body of a requires-expression.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Represents a __leave statement.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Scope - A scope is a transient data structure that is used while parsing the program.
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Represents a C++11 static_assert declaration.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
StmtClass getStmtClass() const
llvm::iterator_range< child_iterator > child_range
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Abstract type representing delayed type pack expansions.
SwitchStmt - This represents a 'switch' stmt.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
TypeSourceInfo * getTypeSourceInfo() const
Expr * getSourceExpression() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Represents a C++ template name within the type system.
A template parameter object.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl ** iterator
Iterates through the template parameters in this list.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
A declaration that models statements at global scope.
The top declaration context.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
NestedNameSpecifierLoc getPrefix() const
If this type represents a qualified-id, this returns it's nested name specifier.
TypeLocClass getTypeLocClass() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
The base class of the type hierarchy.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Wrapper of type source information for a type with no direct qualifiers.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a C++ using-enum-declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a call to the builtin function __builtin_va_arg.
Represents a variable declaration or definition.
Declaration of a variable template.
Represents a GCC generic vector type.
WhileStmt - This represents a 'while' stmt.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
bool isExprSubstitutionFailure() const
const ReturnTypeRequirement & getReturnTypeRequirement() const
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
bool hasInvalidConstraint() const
Expr * getConstraintExpr() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
A requires-expression requirement which queries the existence of a type name or type template special...
bool isSubstitutionFailure() const
TypeSourceInfo * getType() const
LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr) -> bool
Returns true if and only if FirstMethodPtr and SecondMethodPtr are pointers to the same non-static me...
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
TRY_TO(TraverseNestedNameSpecifier(Qualifier))
DEF_TRAVERSE_TYPELOC(ComplexType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(PointerType
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
@ Parameter
The parameter type of a method or function.
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
DEF_TRAVERSE_TYPE(ComplexType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(PointerType
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
NestedNameSpecifierLoc Prefix
NestedNameSpecifier Prefix
Data for list of allocators.