14 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H 15 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H 44 #include "llvm/ADT/PointerIntPair.h" 45 #include "llvm/ADT/SmallVector.h" 46 #include "llvm/Support/Casting.h" 49 #include <type_traits> 55 #define UNARYOP_LIST() \ 56 OPERATOR(PostInc) OPERATOR(PostDec) OPERATOR(PreInc) OPERATOR(PreDec) \ 57 OPERATOR(AddrOf) OPERATOR(Deref) OPERATOR(Plus) OPERATOR(Minus) \ 58 OPERATOR(Not) OPERATOR(LNot) OPERATOR(Real) OPERATOR(Imag) \ 59 OPERATOR(Extension) OPERATOR(Coawait) 62 #define BINOP_LIST() \ 63 OPERATOR(PtrMemD) OPERATOR(PtrMemI) OPERATOR(Mul) OPERATOR(Div) \ 64 OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) OPERATOR(Shl) OPERATOR(Shr) \ 65 OPERATOR(LT) OPERATOR(GT) OPERATOR(LE) OPERATOR(GE) OPERATOR(EQ) \ 66 OPERATOR(NE) OPERATOR(Cmp) OPERATOR(And) OPERATOR(Xor) OPERATOR(Or) \ 67 OPERATOR(LAnd) OPERATOR(LOr) OPERATOR(Assign) OPERATOR(Comma) 71 OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) \ 72 OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or) OPERATOR(Xor) 80 #define TRY_TO(CALL_EXPR) \ 82 if (!getDerived().CALL_EXPR) \ 162 Derived &
getDerived() {
return *
static_cast<Derived *
>(
this); }
312 #define ATTR_VISITOR_DECLS_ONLY 313 #include "clang/AST/AttrVisitor.inc" 314 #undef ATTR_VISITOR_DECLS_ONLY 321 template<
typename T,
typename U>
322 struct has_same_member_pointer_type : std::false_type {};
323 template<
typename T,
typename U,
typename R,
typename...
P>
324 struct has_same_member_pointer_type<R (T::*)(P...), R (U::*)(P...)>
332 #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \ 333 (has_same_member_pointer_type<decltype( \ 334 &RecursiveASTVisitor::Traverse##NAME), \ 335 decltype(&Derived::Traverse##NAME)>::value \ 336 ? static_cast<typename std::conditional< \ 337 has_same_member_pointer_type< \ 338 decltype(&RecursiveASTVisitor::Traverse##NAME), \ 339 decltype(&Derived::Traverse##NAME)>::value, \ 340 Derived &, RecursiveASTVisitor &>::type>(*this) \ 341 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \ 342 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR))) 347 #define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \ 349 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \ 355 #define ABSTRACT_STMT(STMT) 356 #define STMT(CLASS, PARENT) \ 357 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr); 358 #include "clang/AST/StmtNodes.inc" 364 #define STMT(CLASS, PARENT) \ 365 bool WalkUpFrom##CLASS(CLASS *S) { \ 366 TRY_TO(WalkUpFrom##PARENT(S)); \ 367 TRY_TO(Visit##CLASS(S)); \ 370 bool Visit##CLASS(CLASS *S) { return true; } 371 #include "clang/AST/StmtNodes.inc" 376 #define OPERATOR(NAME) \ 377 bool TraverseUnary##NAME(UnaryOperator *S, \ 378 DataRecursionQueue *Queue = nullptr) { \ 379 if (!getDerived().shouldTraversePostOrder()) \ 380 TRY_TO(WalkUpFromUnary##NAME(S)); \ 381 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getSubExpr()); \ 384 bool WalkUpFromUnary##NAME(UnaryOperator *S) { \ 385 TRY_TO(WalkUpFromUnaryOperator(S)); \ 386 TRY_TO(VisitUnary##NAME(S)); \ 389 bool VisitUnary##NAME(UnaryOperator *S) { return true; } 397 #define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE) \ 398 bool TraverseBin##NAME(BINOP_TYPE *S, DataRecursionQueue *Queue = nullptr) { \ 399 if (!getDerived().shouldTraversePostOrder()) \ 400 TRY_TO(WalkUpFromBin##NAME(S)); \ 401 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLHS()); \ 402 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getRHS()); \ 405 bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \ 406 TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \ 407 TRY_TO(VisitBin##NAME(S)); \ 410 bool VisitBin##NAME(BINOP_TYPE *S) { return true; } 412 #define OPERATOR(NAME) GENERAL_BINOP_FALLBACK(NAME, BinaryOperator) 420 #define OPERATOR(NAME) \ 421 GENERAL_BINOP_FALLBACK(NAME##Assign, CompoundAssignOperator) 425 #undef GENERAL_BINOP_FALLBACK 431 #define ABSTRACT_TYPE(CLASS, BASE) 432 #define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T); 433 #include "clang/AST/TypeNodes.def" 439 #define TYPE(CLASS, BASE) \ 440 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \ 441 TRY_TO(WalkUpFrom##BASE(T)); \ 442 TRY_TO(Visit##CLASS##Type(T)); \ 445 bool Visit##CLASS##Type(CLASS##Type *T) { return true; } 446 #include "clang/AST/TypeNodes.def" 452 #define ABSTRACT_TYPELOC(CLASS, BASE) 453 #define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL); 454 #include "clang/AST/TypeLocNodes.def" 473 #define TYPE(CLASS, BASE) \ 474 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \ 475 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \ 476 TRY_TO(Visit##CLASS##TypeLoc(TL)); \ 479 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; } 480 #include "clang/AST/TypeNodes.def" 485 #define ABSTRACT_DECL(DECL) 486 #define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D); 487 #include "clang/AST/DeclNodes.inc" 493 #define DECL(CLASS, BASE) \ 494 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \ 495 TRY_TO(WalkUpFrom##BASE(D)); \ 496 TRY_TO(Visit##CLASS##Decl(D)); \ 499 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; } 500 #include "clang/AST/DeclNodes.inc" 506 bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
509 template <
typename T>
510 bool TraverseDeclTemplateParameterLists(T *D);
512 #define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \ 513 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D); 517 #undef DEF_TRAVERSE_TMPL_INST 518 bool TraverseTemplateArgumentLocsHelper(
const TemplateArgumentLoc *TAL,
520 bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
521 bool TraverseRecordHelper(RecordDecl *D);
522 bool TraverseCXXRecordHelper(CXXRecordDecl *D);
523 bool TraverseDeclaratorHelper(DeclaratorDecl *D);
524 bool TraverseDeclContextHelper(DeclContext *DC);
525 bool TraverseFunctionHelper(FunctionDecl *D);
526 bool TraverseVarHelper(VarDecl *D);
527 bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
528 bool TraverseOMPLoopDirective(OMPLoopDirective *S);
530 #define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C); 531 #include "clang/Basic/OpenMPKinds.def" 533 template <
typename T>
bool VisitOMPClauseList(T *
Node);
536 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
539 bool PostVisitStmt(Stmt *S);
542 template <
typename Derived>
543 bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
545 #define DISPATCH_STMT(NAME, CLASS, VAR) \ 546 return TRAVERSE_STMT_BASE(NAME, CLASS, VAR, Queue); 551 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
552 switch (BinOp->getOpcode()) {
553 #define OPERATOR(NAME) \ 555 DISPATCH_STMT(Bin##NAME, BinaryOperator, S); 561 #define OPERATOR(NAME) \ 562 case BO_##NAME##Assign: \ 563 DISPATCH_STMT(Bin##NAME##Assign, CompoundAssignOperator, S); 569 }
else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
570 switch (UnOp->getOpcode()) {
571 #define OPERATOR(NAME) \ 573 DISPATCH_STMT(Unary##NAME, UnaryOperator, S); 582 switch (S->getStmtClass()) {
585 #define ABSTRACT_STMT(STMT) 586 #define STMT(CLASS, PARENT) \ 587 case Stmt::CLASS##Class: \ 588 DISPATCH_STMT(CLASS, CLASS, S); 589 #include "clang/AST/StmtNodes.inc" 597 template <
typename Derived>
598 bool RecursiveASTVisitor<Derived>::PostVisitStmt(Stmt *S) {
599 switch (S->getStmtClass()) {
602 #define ABSTRACT_STMT(STMT) 603 #define STMT(CLASS, PARENT) \ 604 case Stmt::CLASS##Class: \ 605 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); break; 606 #define INITLISTEXPR(CLASS, PARENT) \ 607 case Stmt::CLASS##Class: \ 609 auto ILE = static_cast<CLASS *>(S); \ 610 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \ 611 TRY_TO(WalkUpFrom##CLASS(Syn)); \ 612 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \ 613 TRY_TO(WalkUpFrom##CLASS(Sem)); \ 616 #include "clang/AST/StmtNodes.inc" 624 template <
typename Derived>
631 Queue->push_back({S,
false});
636 LocalQueue.push_back({S,
false});
638 while (!LocalQueue.empty()) {
639 auto &CurrSAndVisited = LocalQueue.back();
640 Stmt *CurrS = CurrSAndVisited.getPointer();
641 bool Visited = CurrSAndVisited.getInt();
643 LocalQueue.pop_back();
646 TRY_TO(PostVisitStmt(CurrS));
652 CurrSAndVisited.setInt(
true);
653 size_t N = LocalQueue.size();
654 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
656 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
658 LocalQueue.pop_back();
665 #define DISPATCH(NAME, CLASS, VAR) \ 666 return getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)) 668 template <
typename Derived>
674 #define ABSTRACT_TYPE(CLASS, BASE) 675 #define TYPE(CLASS, BASE) \ 677 DISPATCH(CLASS##Type, CLASS##Type, const_cast<Type *>(T.getTypePtr())); 678 #include "clang/AST/TypeNodes.def" 684 template <
typename Derived>
690 #define ABSTRACT_TYPELOC(CLASS, BASE) 691 #define TYPELOC(CLASS, BASE) \ 692 case TypeLoc::CLASS: \ 693 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>()); 694 #include "clang/AST/TypeLocNodes.def" 701 #define VISITORCLASS RecursiveASTVisitor 702 #include "clang/AST/AttrVisitor.inc" 705 template <
typename Derived>
716 #define ABSTRACT_DECL(DECL) 717 #define DECL(CLASS, BASE) \ 719 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \ 722 #include "clang/AST/DeclNodes.inc" 726 for (
auto *I : D->
attrs()) {
735 template <
typename Derived>
760 template <
typename Derived>
786 template <
typename Derived>
815 template <
typename Derived>
825 template <
typename Derived>
856 template <
typename Derived>
871 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
895 template <
typename Derived>
898 for (
unsigned I = 0; I != NumArgs; ++I) {
905 template <
typename Derived>
917 template <
typename Derived>
929 template <
typename Derived>
939 #define DEF_TRAVERSE_TYPE(TYPE, CODE) \ 940 template <typename Derived> \ 941 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \ 942 if (!getDerived().shouldTraversePostOrder()) \ 943 TRY_TO(WalkUpFrom##TYPE(T)); \ 945 if (getDerived().shouldTraversePostOrder()) \ 946 TRY_TO(WalkUpFrom##TYPE(T)); \ 987 if (T->getSizeExpr())
997 if (T->getSizeExpr())
1003 if (T->getSizeExpr())
1018 for (
const auto &A : T->param_types()) {
1022 for (
const auto &E : T->exceptions()) {
1026 if (Expr *NE = T->getNoexceptExpr())
1075 if (T->getQualifier()) {
1098 if (T->getBaseType().getTypePtr() != T)
1100 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1122 template <typename Derived> \
1123 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##Loc(
TYPE##Loc TL) { \
1125 TRY_TO(WalkUpFrom##
TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
1126 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1131 template <
typename Derived>
1133 RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1185 template <typename Derived>
1186 bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1194 return TraverseArrayTypeLocHelper(TL);
1199 return TraverseArrayTypeLocHelper(TL);
1204 return TraverseArrayTypeLocHelper(TL);
1209 return TraverseArrayTypeLocHelper(TL);
1220 if (TL.getTypePtr()->getSizeExpr())
1231 if (TL.getTypePtr()->getSizeExpr())
1249 const FunctionProtoType *T = TL.getTypePtr();
1251 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1252 if (TL.getParam(I)) {
1254 }
else if (I < T->getNumParams()) {
1259 for (
const auto &E : T->exceptions()) {
1263 if (Expr *NE = T->getNoexceptExpr())
1308 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1321 if (TL.getQualifierLoc()) {
1332 if (TL.getQualifierLoc()) {
1336 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1351 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1353 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1373 template <typename Derived>
1375 const Decl *Child) {
1378 return isa<BlockDecl>(Child) || isa<CapturedDecl>(Child);
1381 template <
typename Derived>
1386 for (
auto *Child : DC->
decls()) {
1395 #define DEF_TRAVERSE_DECL(DECL, CODE) \ 1396 template <typename Derived> \ 1397 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \ 1398 bool ShouldVisitChildren = true; \ 1399 bool ReturnValue = true; \ 1400 if (!getDerived().shouldTraversePostOrder()) \ 1401 TRY_TO(WalkUpFrom##DECL(D)); \ 1403 if (ReturnValue && ShouldVisitChildren) \ 1404 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \ 1405 if (ReturnValue && getDerived().shouldTraversePostOrder()) \ 1406 TRY_TO(WalkUpFrom##DECL(D)); \ 1407 return ReturnValue; \ 1413 if (TypeSourceInfo *TInfo = D->getSignatureAsWritten())
1416 for (
const auto &I : D->captures()) {
1417 if (I.hasCopyExpr()) {
1438 if (D->getFriendType())
1445 if (D->getFriendType())
1449 for (
unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1452 ITPL != ETPL; ++ITPL) {
1461 if (D->hasExplicitTemplateArgs()) {
1516 for (
auto typeParam : *typeParamList) {
1517 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1530 for (
auto typeParam : *typeParamList) {
1531 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1544 if (D->getReturnTypeSourceInfo()) {
1550 if (D->isThisDeclarationADefinition()) {
1557 if (D->hasExplicitBound()) {
1566 if (D->getTypeSourceInfo())
1589 for (
auto *I : D->varlists()) {
1596 if (
auto *Initializer = D->getInitializer())
1605 template <typename Derived>
1617 template <
typename Derived>
1618 template <
typename T>
1620 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1622 TraverseTemplateParameterListHelper(TPL);
1627 template <
typename Derived>
1631 for (
auto *RD : SD->redecls()) {
1633 if (cast<CXXRecordDecl>(RD)->isInjectedClassName())
1637 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1658 template <
typename Derived>
1662 for (
auto *RD : SD->redecls()) {
1664 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1683 template <
typename Derived>
1687 for (
auto *RD : FD->redecls()) {
1688 switch (RD->getTemplateSpecializationKind()) {
1713 #define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \ 1714 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \ 1715 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \ 1716 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \ 1724 if (getDerived().shouldVisitTemplateInstantiations() && \ 1725 D == D->getCanonicalDecl()) \ 1726 TRY_TO(TraverseTemplateInstantiations(D)); \ 1741 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
1753 if (D->getTypeForDecl())
1755 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1788 TRY_TO(TraverseDeclTemplateParameterLists(D));
1790 if (D->getTypeForDecl())
1799 template <typename Derived>
1804 TRY_TO(TraverseDeclTemplateParameterLists(D));
1809 template <
typename Derived>
1816 template <
typename Derived>
1818 if (!TraverseRecordHelper(D))
1821 for (
const auto &I : D->
bases()) {
1835 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
1860 template <
typename Derived>
1863 for (
unsigned I = 0; I < Count; ++I) {
1869 #define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \ 1870 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \ 1872 if (TemplateParameterList *TPL = D->getTemplateParameters()) { \ 1873 for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \ 1875 TRY_TO(TraverseDecl(*I)); \ 1879 TRY_TO(TraverseTemplateArgumentLocsHelper( \ 1880 D->getTemplateArgsAsWritten()->getTemplateArgs(), \ 1881 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \ 1886 TRY_TO(Traverse##DECLKIND##Helper(D)); \ 1905 template <typename Derived>
1907 TRY_TO(TraverseDeclTemplateParameterLists(D));
1917 TRY_TO(TraverseVarHelper(D));
1918 for (
auto *Binding : D->bindings()) {
1931 TRY_TO(TraverseDeclaratorHelper(D));
1932 if (D->isBitField())
1934 else if (D->hasInClassInitializer())
1939 TRY_TO(TraverseDeclaratorHelper(D));
1940 if (D->isBitField())
1946 TRY_TO(TraverseDeclaratorHelper(D));
1947 if (D->isBitField())
1952 template <typename Derived>
1954 TRY_TO(TraverseDeclTemplateParameterLists(D));
1970 FTSI->TemplateArgumentsAsWritten) {
1971 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
1972 TALI->NumTemplateArgs));
1995 for (
auto *I : Ctor->inits()) {
2010 ReturnValue = TraverseFunctionHelper(D);
2017 ReturnValue = TraverseFunctionHelper(D);
2024 ReturnValue = TraverseFunctionHelper(D);
2031 ReturnValue = TraverseFunctionHelper(D);
2040 ReturnValue = TraverseFunctionHelper(D);
2047 ReturnValue = TraverseFunctionHelper(D);
2050 template <typename Derived>
2052 TRY_TO(TraverseDeclaratorHelper(D));
2054 if (!isa<ParmVarDecl>(D) &&
2066 TRY_TO(TraverseDeclaratorHelper(D));
2067 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2072 TRY_TO(TraverseVarHelper(D));
2074 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2075 !D->hasUnparsedDefaultArg())
2078 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2079 !D->hasUnparsedDefaultArg())
2096 template <typename Derived> \
2100 bool ReturnValue =
true; \
2102 TRY_TO(WalkUpFrom##
STMT(S)); \
2104 if (ShouldVisitChildren) { \
2106 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2110 TRY_TO(WalkUpFrom##
STMT(S)); \
2111 return ReturnValue; \
2116 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2119 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2122 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2140 for (
auto *I : S->decls()) {
2197 if (S->hasExplicitTemplateArgs()) {
2198 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2199 S->getNumTemplateArgs()));
2206 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2207 S->getNumTemplateArgs()));
2213 if (S->hasExplicitTemplateArgs()) {
2214 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2215 S->getNumTemplateArgs()));
2222 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2223 S->getNumTemplateArgs()));
2256 template <typename Derived>
2263 TRY_TO(WalkUpFromInitListExpr(S));
2279 template <
typename Derived>
2294 for (
unsigned i = 0; i != S->getNumAssocs(); ++i) {
2307 e = S->semantics_end();
2311 sub = OVE->getSourceExpr();
2339 if (S->isArgumentType())
2346 if (S->isTypeOperand())
2359 if (S->isTypeOperand())
2364 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2387 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2394 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2397 if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
2401 if (S->hasExplicitParameters()) {
2403 for (
unsigned I = 0, N = Proto.
getNumParams(); I != N; ++I) {
2406 }
else if (S->hasExplicitResultType()) {
2411 for (
const auto &E : T->exceptions()) {
2415 if (
Expr *NE = T->getNoexceptExpr())
2468 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2522 if (S->hasExplicitTemplateArgs()) {
2523 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2524 S->getNumTemplateArgs()));
2530 if (S->hasExplicitTemplateArgs()) {
2531 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2532 S->getNumTemplateArgs()));
2574 if (!
getDerived().shouldVisitImplicitCode()) {
2580 if (!
getDerived().shouldVisitImplicitCode()) {
2586 if (!
getDerived().shouldVisitImplicitCode()) {
2592 if (!
getDerived().shouldVisitImplicitCode()) {
2614 template <typename Derived>
2617 for (
auto *C : S->
clauses()) {
2618 TRY_TO(TraverseOMPClause(C));
2623 template <
typename Derived>
2626 return TraverseOMPExecutableDirective(S);
2630 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2633 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2636 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2639 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2642 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2645 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2648 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2651 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2655 TRY_TO(TraverseOMPExecutableDirective(S));
2659 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2662 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2665 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2668 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2671 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2674 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2677 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2680 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2683 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2686 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2689 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2692 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2695 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2698 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2701 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2704 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2707 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2710 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2713 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2716 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2719 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2722 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2725 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2728 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2731 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2734 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2737 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2740 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2743 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2746 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2749 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2752 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2755 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2758 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2761 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2764 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2767 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2770 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2773 template <typename Derived>
2778 #define OPENMP_CLAUSE(Name, Class) \ 2780 TRY_TO(Visit##Class(static_cast<Class *>(C))); \ 2782 #include "clang/Basic/OpenMPKinds.def" 2791 template <
typename Derived>
2798 template <
typename Derived>
2801 TRY_TO(VisitOMPClauseWithPreInit(Node));
2806 template <
typename Derived>
2808 TRY_TO(VisitOMPClauseWithPreInit(C));
2813 template <
typename Derived>
2819 template <
typename Derived>
2822 TRY_TO(VisitOMPClauseWithPreInit(C));
2827 template <
typename Derived>
2833 template <
typename Derived>
2839 template <
typename Derived>
2846 template <
typename Derived>
2851 template <
typename Derived>
2856 template <
typename Derived>
2859 TRY_TO(VisitOMPClauseWithPreInit(C));
2864 template <
typename Derived>
2870 template <
typename Derived>
2875 template <
typename Derived>
2880 template <
typename Derived>
2886 template <
typename Derived>
2891 template <
typename Derived>
2896 template <
typename Derived>
2901 template <
typename Derived>
2906 template <
typename Derived>
2911 template <
typename Derived>
2916 template <
typename Derived>
2921 template <
typename Derived>
2926 template <
typename Derived>
2927 template <
typename T>
2929 for (
auto *E : Node->varlists()) {
2935 template <
typename Derived>
2937 TRY_TO(VisitOMPClauseList(C));
2944 template <
typename Derived>
2947 TRY_TO(VisitOMPClauseList(C));
2948 TRY_TO(VisitOMPClauseWithPreInit(C));
2952 for (
auto *E : C->
inits()) {
2958 template <
typename Derived>
2961 TRY_TO(VisitOMPClauseList(C));
2962 TRY_TO(VisitOMPClauseWithPostUpdate(C));
2978 template <
typename Derived>
2980 TRY_TO(VisitOMPClauseList(C));
2984 template <
typename Derived>
2988 TRY_TO(VisitOMPClauseList(C));
2989 TRY_TO(VisitOMPClauseWithPostUpdate(C));
2990 for (
auto *E : C->privates()) {
2993 for (
auto *E : C->inits()) {
2996 for (
auto *E : C->updates()) {
2999 for (
auto *E : C->finals()) {
3005 template <
typename Derived>
3008 TRY_TO(VisitOMPClauseList(C));
3012 template <
typename Derived>
3014 TRY_TO(VisitOMPClauseList(C));
3027 template <
typename Derived>
3030 TRY_TO(VisitOMPClauseList(C));
3043 template <
typename Derived>
3048 TRY_TO(VisitOMPClauseList(C));
3049 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3065 template <
typename Derived>
3070 TRY_TO(VisitOMPClauseList(C));
3071 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3087 template <
typename Derived>
3092 TRY_TO(VisitOMPClauseList(C));
3093 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3111 template <
typename Derived>
3113 TRY_TO(VisitOMPClauseList(C));
3117 template <
typename Derived>
3119 TRY_TO(VisitOMPClauseList(C));
3123 template <
typename Derived>
3125 TRY_TO(VisitOMPClauseWithPreInit(C));
3130 template <
typename Derived>
3132 TRY_TO(VisitOMPClauseList(C));
3136 template <
typename Derived>
3139 TRY_TO(VisitOMPClauseWithPreInit(C));
3144 template <
typename Derived>
3147 TRY_TO(VisitOMPClauseWithPreInit(C));
3152 template <
typename Derived>
3159 template <
typename Derived>
3166 template <
typename Derived>
3173 template <
typename Derived>
3179 template <
typename Derived>
3182 TRY_TO(VisitOMPClauseWithPreInit(C));
3187 template <
typename Derived>
3193 template <
typename Derived>
3195 TRY_TO(VisitOMPClauseList(C));
3199 template <
typename Derived>
3201 TRY_TO(VisitOMPClauseList(C));
3205 template <
typename Derived>
3208 TRY_TO(VisitOMPClauseList(C));
3212 template <
typename Derived>
3215 TRY_TO(VisitOMPClauseList(C));
3236 #undef DEF_TRAVERSE_STMT 3237 #undef TRAVERSE_STMT 3238 #undef TRAVERSE_STMT_BASE 3244 #endif // LLVM_CLANG_AST_RECURSIVEASTVISITOR_H ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
A call to an overloaded operator written using operator syntax.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
This represents '#pragma omp distribute simd' composite directive.
This represents '#pragma omp master' directive.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
The null pointer literal (C++11 [lex.nullptr])
This represents '#pragma omp task' directive.
This represents a GCC inline-assembly statement extension.
Represents a function declaration or definition.
Represents a 'co_await' expression while the type of the promise is dependent.
helper_expr_const_range reduction_ops() const
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
Expr * getInit() const
Get the initializer.
bool TraverseLambdaBody(LambdaExpr *LE, DataRecursionQueue *Queue=nullptr)
Recursively visit the body of a lambda expression.
bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
helper_expr_const_range lhs_exprs() const
This represents clause 'copyin' in the '#pragma omp ...' directives.
const TypeClass * getTypePtr() const
A (possibly-)qualified type.
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND)
ArrayRef< OMPClause * > clauses()
bool shouldWalkTypesOfTypeLocs() const
Return whether this visitor should recurse into the types of TypeLocs.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
DEF_TRAVERSE_TYPE(ComplexType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(PointerType
NestedNameSpecifierLoc getTemplateQualifierLoc() const
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
helper_expr_const_range rhs_exprs() const
private_copies_range private_copies()
Expr *const * semantics_iterator
Represents a 'co_return' statement in the C++ Coroutines TS.
Stmt - This represents one statement.
This represents clause 'in_reduction' in the '#pragma omp task' directives.
IfStmt - This represents an if/then/else.
Class that handles pre-initialization statement for some clauses, like 'shedule', 'firstprivate' etc...
An instance of this object exists for each enum constant that is defined.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Represents a qualified type name for which the type name is dependent.
This represents '#pragma omp for simd' directive.
spec_range specializations() const
The template argument is an expression, and we've not resolved it to one of the other forms yet...
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
helper_expr_const_range rhs_exprs() const
Decl - This represents one declaration (or definition), e.g.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
This represents '#pragma omp teams distribute parallel for' composite directive.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
This represents 'if' clause in the '#pragma omp ...' directive.
Defines the C++ template declaration subclasses.
bool isWritten() const
Determine whether this initializer is explicitly written in the source code.
Represents an attribute applied to a statement.
ParenExpr - This represents a parethesized expression, e.g.
helper_expr_const_range assignment_ops() const
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
This represents 'priority' clause in the '#pragma omp ...' directive.
bool VisitTypeLoc(TypeLoc TL)
The base class of the type hierarchy.
Represents an empty-declaration.
helper_expr_const_range lhs_exprs() const
This represents '#pragma omp target teams distribute' combined directive.
Represents Objective-C's @throw statement.
bool isSemanticForm() const
llvm::iterator_range< child_iterator > child_range
Declaration of a variable template.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
Represents a call to a C++ constructor.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Expr * getCondition() const
Returns condition.
A container of type source information.
This represents 'update' clause in the '#pragma omp atomic' directive.
Expr * getCondition() const
Returns condition.
This represents '#pragma omp parallel for' directive.
MS property subscript expression.
DEF_TRAVERSE_DECL(BlockDecl, { if(TypeSourceInfo *TInfo=D->getSignatureAsWritten()) TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));TRY_TO(TraverseStmt(D->getBody()));for(const auto &I :D->captures()) { if(I.hasCopyExpr()) { TRY_TO(TraverseStmt(I.getCopyExpr()));} } ShouldVisitChildren=false;}) DEF_TRAVERSE_DECL(CapturedDecl
This represents '#pragma omp target teams distribute parallel for' combined directive.
bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Expr * getAlignment()
Returns alignment.
Expr * getNumForLoops() const
Return the number of associated for-loops.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
An identifier, stored as an IdentifierInfo*.
This represents '#pragma omp target exit data' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
helper_expr_const_range assignment_ops() const
TRY_TO(TraverseType(T->getPointeeType()))
Represents a variable declaration or definition.
This represents clause 'private' in the '#pragma omp ...' directives.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
CompoundLiteralExpr - [C99 6.5.2.5].
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
Derived & getDerived()
Return a reference to the derived class.
Represents an empty template argument, e.g., one that has not been deduced.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Declaration context for names declared as extern "C" in C++.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
ObjCMethodDecl - Represents an instance or class method declaration.
bool dataTraverseStmtPre(Stmt *S)
Invoked before visiting a statement or expression via data recursion.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
A namespace, stored as a NamespaceDecl*.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Stores a list of template parameters for a TemplateDecl and its derived classes.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
Defines the Objective-C statement AST node classes.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
A C++ throw-expression (C++ [except.throw]).
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
Expr * getGrainsize() const
Return safe iteration space distance.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
This represents 'safelen' clause in the '#pragma omp ...' directive.
A C++ static_cast expression (C++ [expr.static.cast]).
Base wrapper for a particular "section" of type source info.
LabelStmt - Represents a label, which has a substatement.
Represents a struct/union/class.
Represents a C99 designated initializer expression.
This represents '#pragma omp parallel' directive.
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents a class type in Objective C.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
This represents 'simd' clause in the '#pragma omp ...' directive.
TypeSourceInfo * getTypeSourceInfo() const
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
#define TYPE(CLASS, BASE)
Represents a member of a struct/union/class.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Represents a place-holder for an object not to be initialized by anything.
CompoundStmt * getBody() const
Retrieve the body of the lambda.
Expr * getChunkSize()
Get chunk size.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
This represents clause 'map' in the '#pragma omp ...' directives.
This represents clause 'to' in the '#pragma omp ...' directives.
ParmVarDecl * getParam(unsigned i) const
This represents '#pragma omp target simd' directive.
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Defines some OpenMP-specific enums and functions.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Expr * getSafelen() const
Return safe iteration space distance.
bool TraverseSynOrSemInitListExpr(InitListExpr *S, DataRecursionQueue *Queue=nullptr)
Recursively visit the syntactic or semantic form of an initialization list.
This represents '#pragma omp barrier' directive.
Wrapper of type source information for a type with no direct qualifiers.
Declaration of a function specialization at template class scope.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
Expr * getNumTeams()
Return NumTeams number.
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
This represents '#pragma omp critical' directive.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
ArrayRef< ParmVarDecl * > parameters() const
Represents Objective-C's @catch statement.
#define TRY_TO(CALL_EXPR)
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Stmt::child_range getStmtChildren(Stmt *S)
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Represents a C++ using-declaration.
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
A convenient class for passing around template argument information.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
A builtin binary operation expression such as "x + y" or "x <= y".
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc...
const TemplateArgumentLoc * getArgumentArray() const
This represents '#pragma omp cancellation point' directive.
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
This represents 'default' clause in the '#pragma omp ...' directive.
ObjCStringLiteral, used for Objective-C string literals i.e.
spec_range specializations() const
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
This represents 'final' clause in the '#pragma omp ...' directive.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents '#pragma omp teams' directive.
bool WalkUpFromType(Type *T)
This represents clause 'reduction' in the '#pragma omp ...' directives.
This represents '#pragma omp teams distribute simd' combined directive.
Represents an Objective-C protocol declaration.
Represents binding an expression to a temporary.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
helper_expr_const_range source_exprs() const
bool WalkUpFromStmt(Stmt *S)
Represents a C++ member access expression where the actual member referenced could not be resolved be...
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
Represents an ObjC class declaration.
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
Represents a linkage specification.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
A binding in a decomposition declaration.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
helper_expr_const_range source_exprs() const
A default argument (C++ [dcl.fct.default]).
helper_expr_const_range privates() const
This represents clause 'from' in the '#pragma omp ...' directives.
Represents the this expression in C++.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
helper_expr_const_range reduction_ops() const
This represents '#pragma omp target parallel for simd' directive.
OpenMP 4.0 [2.4, Array Sections].
ConditionalOperator - The ?: ternary operator.
bool WalkUpFromTypeLoc(TypeLoc TL)
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents the declaration of a typedef-name via a C++11 alias-declaration.
CompoundStmt - This represents a group of statements like { stmt stmt }.
This represents 'threads' clause in the '#pragma omp ...' directive.
helper_expr_const_range destination_exprs() const
This represents '#pragma omp taskgroup' directive.
Expr * getSimdlen() const
Return safe iteration space distance.
helper_expr_const_range source_exprs() const
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Represents a ValueDecl that came out of a declarator.
This represents clause 'aligned' in the '#pragma omp ...' directives.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
helper_expr_const_range private_copies() const
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
Represents a call to the builtin function __builtin_va_arg.
helper_expr_const_range destination_exprs() const
spec_range specializations() const
This represents '#pragma omp distribute' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
DEF_TRAVERSE_TYPELOC(ComplexType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(PointerType
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Expr - This represents one expression.
bool TraverseConstructorInitializer(CXXCtorInitializer *Init)
Recursively visit a constructor initializer.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
Declaration of a template type parameter.
Expr * getNumTasks() const
Return safe iteration space distance.
bool WalkUpFromDecl(Decl *D)
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
Represents a C++ functional cast expression that builds a temporary object.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
A C++ const_cast expression (C++ [expr.const.cast]).
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL)
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Represents Objective-C's @synchronized statement.
ObjCSelectorExpr used for @selector in Objective-C.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
Represents an expression that computes the length of a parameter pack.
CXXTryStmt - A C++ try block, including all handlers.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL)
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
This represents '#pragma omp target teams distribute simd' combined directive.
helper_expr_const_range rhs_exprs() const
Defines the clang::TypeLoc interface and its subclasses.
A namespace alias, stored as a NamespaceAliasDecl*.
This represents 'ordered' clause in the '#pragma omp ...' directive.
This represents '#pragma omp for' directive.
Declaration of an alias template.
Represents a folding of a pack over an operator.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
This represents '#pragma omp target teams' directive.
An expression that sends a message to the given Objective-C object or class.
This represents a Microsoft inline-assembly statement extension.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
A member reference to an MSPropertyDecl.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Expr * getDevice()
Return device number.
This represents '#pragma omp cancel' directive.
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
Represents a C++ deduction guide declaration.
Represents a C++ conversion function within a class.
This template specialization was implicitly instantiated from a template.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc getReturnLoc() const
This file defines OpenMP AST classes for clauses.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
This represents '#pragma omp flush' directive.
This represents '#pragma omp parallel for simd' directive.
DoStmt - This represents a 'do/while' stmt.
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
helper_expr_const_range assignment_ops() const
This represents 'untied' clause in the '#pragma omp ...' directive.
This represents '#pragma omp target enter data' directive.
Represents a C++ Modules TS module export declaration.
bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL)
This represents 'num_teams' clause in the '#pragma omp ...' directive.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
This captures a statement into a function.
Represents a call to an inherited base class constructor from an inheriting constructor.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
bool shouldVisitTemplateInstantiations() const
Return whether this visitor should recurse into template instantiations.
helper_expr_const_range taskgroup_descriptors() const
This represents '#pragma omp single' directive.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Sugar for parentheses used when specifying types.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents '#pragma omp declare reduction ...' directive.
Pseudo declaration for capturing expressions.
Interfaces are the core concept in Objective-C for object oriented design.
bool TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
This is a basic class for representing single OpenMP executable directive.
private_copies_range private_copies()
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
DeclarationName getName() const
getName - Returns the embedded declaration name.
This represents 'schedule' clause in the '#pragma omp ...' directive.
Represents a call to a member function that may be written either with member call syntax (e...
#define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Represents the declaration of a label.
This represents clause 'shared' in the '#pragma omp ...' directives.
Represents a dependent using declaration which was not marked with typename.
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
Represents a static or instance method of a struct/union/class.
Expr * getPriority()
Return Priority number.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents '#pragma omp taskwait' directive.
This file defines OpenMP nodes for declarative directives.
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
This is a basic class for representing single OpenMP clause.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
ObjCProtocolExpr used for protocol expression in Objective-C.
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
Represents one property declaration in an Objective-C interface.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
This represents '#pragma omp target' directive.
Expr * getNumForLoops() const
Return the number of associated for-loops.
TypeClass getTypeClass() const
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool isExplicit() const
Determine whether this was an explicit capture (written between the square brackets introducing the l...
An expression trait intrinsic.
DeclarationNameInfo getNameInfo() const
Represents a C++11 static_assert declaration.
This represents '#pragma omp ordered' directive.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
This represents '#pragma omp target update' directive.
ObjCBoxedExpr - used for generalized expression boxing.
bool TraverseType(QualType T)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
helper_expr_const_range lhs_exprs() const
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)
Recursively visit a lambda capture.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
The injected class name of a C++ class template or class template partial specialization.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a pack expansion of types.
CompoundAssignOperator - For compound assignments (e.g.
Defines various enumerations that describe declaration and type specifiers.
Represents a C11 generic selection.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
bool shouldVisitImplicitCode() const
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destru...
AddrLabelExpr - The GNU address of label extension, representing &&label.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
ast_type_traits::DynTypedNode Node
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Represents a template argument.
Represents a template name that was expressed as a qualified name.
NullStmt - This is the null statement ";": C99 6.8.3p3.
Dataflow Directional Tag Classes.
This represents 'device' clause in the '#pragma omp ...' directive.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
const TemplateArgument & getArgument() const
[C99 6.4.2.2] - A predefined identifier such as func.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
helper_expr_const_range privates() const
The template argument is a pack expansion of a template name that was provided for a template templat...
This represents '#pragma omp section' directive.
This represents '#pragma omp teams distribute' directive.
#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND)
Represents a field injected from an anonymous union/struct into the parent scope. ...
Expr * getSourceExpression() const
const Expr * getInit() const
A runtime availability query.
A decomposition declaration.
This template specialization was instantiated from a template due to an explicit instantiation declar...
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
This represents '#pragma omp simd' directive.
Represents a 'co_yield' expression.
Represents a dependent using declaration which was marked with typename.
Represents the declaration of an Objective-C type parameter.
Represents a C++11 pack expansion that produces a sequence of expressions.
This represents clause 'linear' in the '#pragma omp ...' directives.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
This represents '#pragma omp atomic' directive.
A type that was preceded by the 'template' keyword, stored as a Type*.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Represents a __leave statement.
unsigned getNumParams() const
Represents a pointer to an Objective C object.
helper_expr_const_range privates() const
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SwitchStmt - This represents a 'switch' stmt.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents the body of a coroutine.
Location wrapper for a TemplateArgument.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
This file defines OpenMP AST classes for executable directives and clauses.
Represents Objective-C's collection statement.
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type...
Represents a C++ base or member initializer.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
ObjCEncodeExpr, used for @encode in Objective-C.
helper_expr_const_range destination_exprs() const
Represents a call to a CUDA kernel function.
Represents a 'co_await' expression.
TypeSourceInfo * getTypeSourceInfo() const
TypeLocClass getTypeLocClass() const
Represents Objective-C's @finally statement.
The template argument is a type.
bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS)
Recursively visit a C++ nested-name-specifier.
The template argument is actually a parameter pack.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Represents a base class of a C++ class.
This represents 'write' clause in the '#pragma omp atomic' directive.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
UnqualTypeLoc getUnqualifiedLoc() const
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
GotoStmt - This represents a direct goto.
A use of a default initializer in a constructor or in aggregate initialization.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ArgKind getKind() const
Return the kind of stored template argument.
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Represents a type parameter type in Objective C.
Represents a field declaration created by an @defs(...).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
This represents '#pragma omp target parallel' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
ContinueStmt - This represents a continue.
Represents a loop initializing the elements of an array.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
The template argument is a template name that was provided for a template template parameter...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
bool dataTraverseStmtPost(Stmt *S)
Invoked after visiting a statement or expression via data recursion.
The parameter type of a method or function.
ObjCIvarDecl - Represents an ObjC instance variable.
WhileStmt - This represents a 'while' stmt.
helper_expr_const_range reduction_ops() const
Declaration of a class template.
Expr * getThreadLimit()
Return ThreadLimit number.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Represents Objective-C's @try ... @catch ... @finally statement.
This represents '#pragma omp taskloop simd' directive.
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
bool TraverseTemplateArguments(const TemplateArgument *Args, unsigned NumArgs)
Recursively visit a set of template arguments.
#define DEF_TRAVERSE_STMT(STMT, CODE)
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp sections' directive.
Expr * getHint() const
Returns number of threads.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
The top declaration context.
This represents '#pragma omp target data' directive.
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
BreakStmt - This represents a break.
Expr * getChunkSize()
Get chunk size.
Expr * getNumThreads() const
Returns number of threads.
An instance of this class represents the declaration of a property member.
bool TraverseAttr(Attr *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...
This represents '#pragma omp taskyield' directive.
This represents a decl that may have a name.
This represents '#pragma omp distribute parallel for simd' composite directive.
A boolean literal, per ([C++ lex.bool] Boolean literals).
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
This represents '#pragma omp parallel sections' directive.
Represents a C++ namespace alias.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
bool VisitUnqualTypeLoc(UnqualTypeLoc TL)
Declaration of a friend template.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
const Expr * getPostUpdateExpr() const
Get post-update expression for the clause.
The global specifier '::'. There is no stored value.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Represents Objective-C's @autoreleasepool Statement.
This represents '#pragma omp threadprivate ...' directive.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
InitListExpr * getSyntacticForm() const
Declaration of a template function.
Represents an implicitly-generated value initialization of an object of a given type.
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
This represents '#pragma omp target parallel for' directive.
Attr - This represents one attribute.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
InitListExpr * getSemanticForm() const
Defines the LambdaCapture class.
ObjCCompatibleAliasDecl - Represents alias of a class.
#define STMT(CLASS, PARENT)
This represents '#pragma omp taskloop' directive.