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); }
314 #define ATTR_VISITOR_DECLS_ONLY 315 #include "clang/AST/AttrVisitor.inc" 316 #undef ATTR_VISITOR_DECLS_ONLY 323 template<
typename T,
typename U>
324 struct has_same_member_pointer_type : std::false_type {};
325 template<
typename T,
typename U,
typename R,
typename...
P>
326 struct has_same_member_pointer_type<R (T::*)(P...), R (U::*)(P...)>
334 #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \ 335 (has_same_member_pointer_type<decltype( \ 336 &RecursiveASTVisitor::Traverse##NAME), \ 337 decltype(&Derived::Traverse##NAME)>::value \ 338 ? static_cast<typename std::conditional< \ 339 has_same_member_pointer_type< \ 340 decltype(&RecursiveASTVisitor::Traverse##NAME), \ 341 decltype(&Derived::Traverse##NAME)>::value, \ 342 Derived &, RecursiveASTVisitor &>::type>(*this) \ 343 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \ 344 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR))) 349 #define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \ 351 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \ 357 #define ABSTRACT_STMT(STMT) 358 #define STMT(CLASS, PARENT) \ 359 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr); 360 #include "clang/AST/StmtNodes.inc" 366 #define STMT(CLASS, PARENT) \ 367 bool WalkUpFrom##CLASS(CLASS *S) { \ 368 TRY_TO(WalkUpFrom##PARENT(S)); \ 369 TRY_TO(Visit##CLASS(S)); \ 372 bool Visit##CLASS(CLASS *S) { return true; } 373 #include "clang/AST/StmtNodes.inc" 378 #define OPERATOR(NAME) \ 379 bool TraverseUnary##NAME(UnaryOperator *S, \ 380 DataRecursionQueue *Queue = nullptr) { \ 381 if (!getDerived().shouldTraversePostOrder()) \ 382 TRY_TO(WalkUpFromUnary##NAME(S)); \ 383 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getSubExpr()); \ 386 bool WalkUpFromUnary##NAME(UnaryOperator *S) { \ 387 TRY_TO(WalkUpFromUnaryOperator(S)); \ 388 TRY_TO(VisitUnary##NAME(S)); \ 391 bool VisitUnary##NAME(UnaryOperator *S) { return true; } 399 #define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE) \ 400 bool TraverseBin##NAME(BINOP_TYPE *S, DataRecursionQueue *Queue = nullptr) { \ 401 if (!getDerived().shouldTraversePostOrder()) \ 402 TRY_TO(WalkUpFromBin##NAME(S)); \ 403 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLHS()); \ 404 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getRHS()); \ 407 bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \ 408 TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \ 409 TRY_TO(VisitBin##NAME(S)); \ 412 bool VisitBin##NAME(BINOP_TYPE *S) { return true; } 414 #define OPERATOR(NAME) GENERAL_BINOP_FALLBACK(NAME, BinaryOperator) 422 #define OPERATOR(NAME) \ 423 GENERAL_BINOP_FALLBACK(NAME##Assign, CompoundAssignOperator) 427 #undef GENERAL_BINOP_FALLBACK 433 #define ABSTRACT_TYPE(CLASS, BASE) 434 #define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T); 435 #include "clang/AST/TypeNodes.def" 441 #define TYPE(CLASS, BASE) \ 442 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \ 443 TRY_TO(WalkUpFrom##BASE(T)); \ 444 TRY_TO(Visit##CLASS##Type(T)); \ 447 bool Visit##CLASS##Type(CLASS##Type *T) { return true; } 448 #include "clang/AST/TypeNodes.def" 454 #define ABSTRACT_TYPELOC(CLASS, BASE) 455 #define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL); 456 #include "clang/AST/TypeLocNodes.def" 475 #define TYPE(CLASS, BASE) \ 476 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \ 477 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \ 478 TRY_TO(Visit##CLASS##TypeLoc(TL)); \ 481 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; } 482 #include "clang/AST/TypeNodes.def" 487 #define ABSTRACT_DECL(DECL) 488 #define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D); 489 #include "clang/AST/DeclNodes.inc" 495 #define DECL(CLASS, BASE) \ 496 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \ 497 TRY_TO(WalkUpFrom##BASE(D)); \ 498 TRY_TO(Visit##CLASS##Decl(D)); \ 501 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; } 502 #include "clang/AST/DeclNodes.inc" 508 bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
511 template <
typename T>
512 bool TraverseDeclTemplateParameterLists(T *D);
514 #define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \ 515 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D); 519 #undef DEF_TRAVERSE_TMPL_INST 520 bool TraverseTemplateArgumentLocsHelper(
const TemplateArgumentLoc *TAL,
522 bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
523 bool TraverseRecordHelper(RecordDecl *D);
524 bool TraverseCXXRecordHelper(CXXRecordDecl *D);
525 bool TraverseDeclaratorHelper(DeclaratorDecl *D);
526 bool TraverseDeclContextHelper(DeclContext *DC);
527 bool TraverseFunctionHelper(FunctionDecl *D);
528 bool TraverseVarHelper(VarDecl *D);
529 bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
530 bool TraverseOMPLoopDirective(OMPLoopDirective *S);
532 #define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C); 533 #include "clang/Basic/OpenMPKinds.def" 535 template <
typename T>
bool VisitOMPClauseList(T *
Node);
538 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
Node);
541 bool PostVisitStmt(Stmt *S);
544 template <
typename Derived>
545 bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
547 #define DISPATCH_STMT(NAME, CLASS, VAR) \ 548 return TRAVERSE_STMT_BASE(NAME, CLASS, VAR, Queue); 553 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
554 switch (BinOp->getOpcode()) {
555 #define OPERATOR(NAME) \ 557 DISPATCH_STMT(Bin##NAME, BinaryOperator, S); 563 #define OPERATOR(NAME) \ 564 case BO_##NAME##Assign: \ 565 DISPATCH_STMT(Bin##NAME##Assign, CompoundAssignOperator, S); 571 }
else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
572 switch (UnOp->getOpcode()) {
573 #define OPERATOR(NAME) \ 575 DISPATCH_STMT(Unary##NAME, UnaryOperator, S); 584 switch (S->getStmtClass()) {
587 #define ABSTRACT_STMT(STMT) 588 #define STMT(CLASS, PARENT) \ 589 case Stmt::CLASS##Class: \ 590 DISPATCH_STMT(CLASS, CLASS, S); 591 #include "clang/AST/StmtNodes.inc" 599 template <
typename Derived>
600 bool RecursiveASTVisitor<Derived>::PostVisitStmt(Stmt *S) {
601 switch (S->getStmtClass()) {
604 #define ABSTRACT_STMT(STMT) 605 #define STMT(CLASS, PARENT) \ 606 case Stmt::CLASS##Class: \ 607 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); break; 608 #define INITLISTEXPR(CLASS, PARENT) \ 609 case Stmt::CLASS##Class: \ 611 auto ILE = static_cast<CLASS *>(S); \ 612 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \ 613 TRY_TO(WalkUpFrom##CLASS(Syn)); \ 614 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \ 615 TRY_TO(WalkUpFrom##CLASS(Sem)); \ 618 #include "clang/AST/StmtNodes.inc" 626 template <
typename Derived>
633 Queue->push_back({S,
false});
638 LocalQueue.push_back({S,
false});
640 while (!LocalQueue.empty()) {
641 auto &CurrSAndVisited = LocalQueue.back();
642 Stmt *CurrS = CurrSAndVisited.getPointer();
643 bool Visited = CurrSAndVisited.getInt();
645 LocalQueue.pop_back();
648 TRY_TO(PostVisitStmt(CurrS));
654 CurrSAndVisited.setInt(
true);
655 size_t N = LocalQueue.size();
656 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
658 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
660 LocalQueue.pop_back();
667 #define DISPATCH(NAME, CLASS, VAR) \ 668 return getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)) 670 template <
typename Derived>
676 #define ABSTRACT_TYPE(CLASS, BASE) 677 #define TYPE(CLASS, BASE) \ 679 DISPATCH(CLASS##Type, CLASS##Type, const_cast<Type *>(T.getTypePtr())); 680 #include "clang/AST/TypeNodes.def" 686 template <
typename Derived>
692 #define ABSTRACT_TYPELOC(CLASS, BASE) 693 #define TYPELOC(CLASS, BASE) \ 694 case TypeLoc::CLASS: \ 695 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>()); 696 #include "clang/AST/TypeLocNodes.def" 703 #define VISITORCLASS RecursiveASTVisitor 704 #include "clang/AST/AttrVisitor.inc" 707 template <
typename Derived>
718 #define ABSTRACT_DECL(DECL) 719 #define DECL(CLASS, BASE) \ 721 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \ 724 #include "clang/AST/DeclNodes.inc" 728 for (
auto *I : D->
attrs()) {
737 template <
typename Derived>
762 template <
typename Derived>
788 template <
typename Derived>
817 template <
typename Derived>
827 template <
typename Derived>
858 template <
typename Derived>
873 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
897 template <
typename Derived>
900 for (
unsigned I = 0; I != NumArgs; ++I) {
907 template <
typename Derived>
919 template <
typename Derived>
934 #define DEF_TRAVERSE_TYPE(TYPE, CODE) \ 935 template <typename Derived> \ 936 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \ 937 if (!getDerived().shouldTraversePostOrder()) \ 938 TRY_TO(WalkUpFrom##TYPE(T)); \ 940 if (getDerived().shouldTraversePostOrder()) \ 941 TRY_TO(WalkUpFrom##TYPE(T)); \ 982 if (T->getSizeExpr())
992 if (T->getSizeExpr())
998 if (T->getSizeExpr())
1013 for (
const auto &A : T->param_types()) {
1017 for (
const auto &E : T->exceptions()) {
1021 if (Expr *NE = T->getNoexceptExpr())
1070 if (T->getQualifier()) {
1093 if (T->getBaseType().getTypePtr() != T)
1095 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1117 template <typename Derived> \
1118 bool RecursiveASTVisitor<Derived>::Traverse##
TYPE##Loc(
TYPE##Loc TL) { \
1120 TRY_TO(WalkUpFrom##
TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
1121 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1126 template <
typename Derived>
1128 RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1180 template <typename Derived>
1181 bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1189 return TraverseArrayTypeLocHelper(TL);
1194 return TraverseArrayTypeLocHelper(TL);
1199 return TraverseArrayTypeLocHelper(TL);
1204 return TraverseArrayTypeLocHelper(TL);
1215 if (TL.getTypePtr()->getSizeExpr())
1226 if (TL.getTypePtr()->getSizeExpr())
1244 const FunctionProtoType *T = TL.getTypePtr();
1246 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1247 if (TL.getParam(I)) {
1249 }
else if (I < T->getNumParams()) {
1254 for (
const auto &E : T->exceptions()) {
1258 if (Expr *NE = T->getNoexceptExpr())
1303 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1316 if (TL.getQualifierLoc()) {
1327 if (TL.getQualifierLoc()) {
1331 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1346 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1348 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1368 template <typename Derived>
1370 const Decl *Child) {
1373 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1376 if (
const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1377 return Cls->isLambda();
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()) {
1595 for (
auto *C : D->clauselists()) {
1596 TRY_TO(TraverseOMPClause(C));
1602 if (
auto *Initializer = D->getInitializer())
1611 template <typename Derived>
1623 template <
typename Derived>
1624 template <
typename T>
1626 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1628 TraverseTemplateParameterListHelper(TPL);
1633 template <
typename Derived>
1637 for (
auto *RD : SD->redecls()) {
1639 if (cast<CXXRecordDecl>(RD)->isInjectedClassName())
1643 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1664 template <
typename Derived>
1668 for (
auto *RD : SD->redecls()) {
1670 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1689 template <
typename Derived>
1693 for (
auto *RD : FD->redecls()) {
1694 switch (RD->getTemplateSpecializationKind()) {
1719 #define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \ 1720 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \ 1721 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \ 1722 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \ 1730 if (getDerived().shouldVisitTemplateInstantiations() && \ 1731 D == D->getCanonicalDecl()) \ 1732 TRY_TO(TraverseTemplateInstantiations(D)); \ 1747 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
1759 if (D->getTypeForDecl())
1761 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1794 TRY_TO(TraverseDeclTemplateParameterLists(D));
1796 if (D->getTypeForDecl())
1805 template <typename Derived>
1810 TRY_TO(TraverseDeclTemplateParameterLists(D));
1815 template <
typename Derived>
1822 template <
typename Derived>
1824 if (!TraverseRecordHelper(D))
1827 for (
const auto &I : D->
bases()) {
1841 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
1866 template <
typename Derived>
1869 for (
unsigned I = 0; I < Count; ++I) {
1875 #define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \ 1876 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \ 1878 if (TemplateParameterList *TPL = D->getTemplateParameters()) { \ 1879 for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \ 1881 TRY_TO(TraverseDecl(*I)); \ 1885 TRY_TO(TraverseTemplateArgumentLocsHelper( \ 1886 D->getTemplateArgsAsWritten()->getTemplateArgs(), \ 1887 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \ 1892 TRY_TO(Traverse##DECLKIND##Helper(D)); \ 1911 template <typename Derived>
1913 TRY_TO(TraverseDeclTemplateParameterLists(D));
1923 TRY_TO(TraverseVarHelper(D));
1924 for (
auto *Binding : D->bindings()) {
1937 TRY_TO(TraverseDeclaratorHelper(D));
1938 if (D->isBitField())
1940 else if (D->hasInClassInitializer())
1945 TRY_TO(TraverseDeclaratorHelper(D));
1946 if (D->isBitField())
1952 TRY_TO(TraverseDeclaratorHelper(D));
1953 if (D->isBitField())
1958 template <typename Derived>
1960 TRY_TO(TraverseDeclTemplateParameterLists(D));
1976 FTSI->TemplateArgumentsAsWritten) {
1977 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
1978 TALI->NumTemplateArgs));
2001 for (
auto *I : Ctor->inits()) {
2016 ReturnValue = TraverseFunctionHelper(D);
2023 ReturnValue = TraverseFunctionHelper(D);
2030 ReturnValue = TraverseFunctionHelper(D);
2037 ReturnValue = TraverseFunctionHelper(D);
2046 ReturnValue = TraverseFunctionHelper(D);
2053 ReturnValue = TraverseFunctionHelper(D);
2056 template <typename Derived>
2058 TRY_TO(TraverseDeclaratorHelper(D));
2060 if (!isa<ParmVarDecl>(D) &&
2072 TRY_TO(TraverseDeclaratorHelper(D));
2073 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2078 TRY_TO(TraverseVarHelper(D));
2080 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2081 !D->hasUnparsedDefaultArg())
2084 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2085 !D->hasUnparsedDefaultArg())
2102 template <typename Derived> \
2106 bool ReturnValue =
true; \
2108 TRY_TO(WalkUpFrom##
STMT(S)); \
2110 if (ShouldVisitChildren) { \
2112 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2116 TRY_TO(WalkUpFrom##
STMT(S)); \
2117 return ReturnValue; \
2122 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2125 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2128 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2146 for (
auto *I : S->decls()) {
2207 if (S->hasExplicitTemplateArgs()) {
2208 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2209 S->getNumTemplateArgs()));
2216 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2217 S->getNumTemplateArgs()));
2223 if (S->hasExplicitTemplateArgs()) {
2224 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2225 S->getNumTemplateArgs()));
2232 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2233 S->getNumTemplateArgs()));
2266 template <typename Derived>
2273 TRY_TO(WalkUpFromInitListExpr(S));
2289 template <
typename Derived>
2304 for (
unsigned i = 0; i != S->getNumAssocs(); ++i) {
2317 e = S->semantics_end();
2321 sub = OVE->getSourceExpr();
2349 if (S->isArgumentType())
2356 if (S->isTypeOperand())
2369 if (S->isTypeOperand())
2374 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2398 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2410 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2413 if (S->hasExplicitParameters()) {
2415 for (
unsigned I = 0, N = Proto.
getNumParams(); I != N; ++I)
2418 if (S->hasExplicitResultType())
2422 for (
const auto &E : T->exceptions())
2425 if (
Expr *NE = T->getNoexceptExpr())
2478 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2532 if (S->hasExplicitTemplateArgs()) {
2533 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2534 S->getNumTemplateArgs()));
2540 if (S->hasExplicitTemplateArgs()) {
2541 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2542 S->getNumTemplateArgs()));
2584 if (!
getDerived().shouldVisitImplicitCode()) {
2590 if (!
getDerived().shouldVisitImplicitCode()) {
2596 if (!
getDerived().shouldVisitImplicitCode()) {
2602 if (!
getDerived().shouldVisitImplicitCode()) {
2624 template <typename Derived>
2627 for (
auto *C : S->
clauses()) {
2628 TRY_TO(TraverseOMPClause(C));
2633 template <
typename Derived>
2636 return TraverseOMPExecutableDirective(S);
2640 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2643 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2646 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2649 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2652 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2655 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2658 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2661 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2665 TRY_TO(TraverseOMPExecutableDirective(S));
2669 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2672 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2675 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2678 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2681 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2684 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2687 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2690 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2693 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2696 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2699 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2702 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2705 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2708 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2711 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2714 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2717 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2720 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2723 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2726 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2729 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2732 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2735 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2738 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2741 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2744 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2747 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2750 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2753 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2756 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2759 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2762 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2765 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2768 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2771 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2774 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2777 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2780 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2783 template <typename Derived>
2788 #define OPENMP_CLAUSE(Name, Class) \ 2790 TRY_TO(Visit##Class(static_cast<Class *>(C))); \ 2792 #include "clang/Basic/OpenMPKinds.def" 2801 template <
typename Derived>
2808 template <
typename Derived>
2811 TRY_TO(VisitOMPClauseWithPreInit(Node));
2816 template <
typename Derived>
2818 TRY_TO(VisitOMPClauseWithPreInit(C));
2823 template <
typename Derived>
2829 template <
typename Derived>
2832 TRY_TO(VisitOMPClauseWithPreInit(C));
2837 template <
typename Derived>
2843 template <
typename Derived>
2849 template <
typename Derived>
2856 template <
typename Derived>
2861 template <
typename Derived>
2866 template <
typename Derived>
2872 template <
typename Derived>
2878 template <
typename Derived>
2884 template <
typename Derived>
2890 template <
typename Derived>
2896 template <
typename Derived>
2899 TRY_TO(VisitOMPClauseWithPreInit(C));
2904 template <
typename Derived>
2910 template <
typename Derived>
2915 template <
typename Derived>
2920 template <
typename Derived>
2926 template <
typename Derived>
2931 template <
typename Derived>
2936 template <
typename Derived>
2941 template <
typename Derived>
2946 template <
typename Derived>
2951 template <
typename Derived>
2956 template <
typename Derived>
2961 template <
typename Derived>
2966 template <
typename Derived>
2967 template <
typename T>
2969 for (
auto *E : Node->varlists()) {
2975 template <
typename Derived>
2977 TRY_TO(VisitOMPClauseList(C));
2984 template <
typename Derived>
2987 TRY_TO(VisitOMPClauseList(C));
2988 TRY_TO(VisitOMPClauseWithPreInit(C));
2992 for (
auto *E : C->
inits()) {
2998 template <
typename Derived>
3001 TRY_TO(VisitOMPClauseList(C));
3002 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3018 template <
typename Derived>
3020 TRY_TO(VisitOMPClauseList(C));
3024 template <
typename Derived>
3028 TRY_TO(VisitOMPClauseList(C));
3029 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3030 for (
auto *E : C->privates()) {
3033 for (
auto *E : C->inits()) {
3036 for (
auto *E : C->updates()) {
3039 for (
auto *E : C->finals()) {
3045 template <
typename Derived>
3048 TRY_TO(VisitOMPClauseList(C));
3052 template <
typename Derived>
3054 TRY_TO(VisitOMPClauseList(C));
3067 template <
typename Derived>
3070 TRY_TO(VisitOMPClauseList(C));
3083 template <
typename Derived>
3088 TRY_TO(VisitOMPClauseList(C));
3089 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3105 template <
typename Derived>
3110 TRY_TO(VisitOMPClauseList(C));
3111 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3127 template <
typename Derived>
3132 TRY_TO(VisitOMPClauseList(C));
3133 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3151 template <
typename Derived>
3153 TRY_TO(VisitOMPClauseList(C));
3157 template <
typename Derived>
3159 TRY_TO(VisitOMPClauseList(C));
3163 template <
typename Derived>
3165 TRY_TO(VisitOMPClauseWithPreInit(C));
3170 template <
typename Derived>
3172 TRY_TO(VisitOMPClauseList(C));
3176 template <
typename Derived>
3179 TRY_TO(VisitOMPClauseWithPreInit(C));
3184 template <
typename Derived>
3187 TRY_TO(VisitOMPClauseWithPreInit(C));
3192 template <
typename Derived>
3199 template <
typename Derived>
3206 template <
typename Derived>
3213 template <
typename Derived>
3219 template <
typename Derived>
3222 TRY_TO(VisitOMPClauseWithPreInit(C));
3227 template <
typename Derived>
3233 template <
typename Derived>
3235 TRY_TO(VisitOMPClauseList(C));
3239 template <
typename Derived>
3241 TRY_TO(VisitOMPClauseList(C));
3245 template <
typename Derived>
3248 TRY_TO(VisitOMPClauseList(C));
3252 template <
typename Derived>
3255 TRY_TO(VisitOMPClauseList(C));
3276 #undef DEF_TRAVERSE_STMT 3277 #undef TRAVERSE_STMT 3278 #undef TRAVERSE_STMT_BASE 3284 #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 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.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
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]).
This represents 'reverse_offload' clause in the '#pragma omp requires' directive. ...
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.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
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)
NameKind getNameKind() const
Determine what kind of name this is.
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.
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.
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
CaseStmt - Represent a case statement.
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.
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].
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
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.
ConstantExpr - An expression that occurs in a constant context.
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 requires...' directive.
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.
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.
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the top-level Decls in the AST traversal scope (by de...
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 'unified_address' clause in the '#pragma omp requires' 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...
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.
std::vector< Decl * > getTraversalScope() const
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 'unified_shared_memory' clause in the '#pragma omp requires' directive.
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).
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
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.