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())
1012 for (
const auto &A : T->param_types()) {
1016 for (
const auto &E : T->exceptions()) {
1020 if (
Expr *NE = T->getNoexceptExpr())
1069 if (T->getQualifier()) {
1092 if (T->getBaseType().getTypePtr() !=
T)
1094 for (
auto typeArg : T->getTypeArgsAsWritten()) {
1116 template <typename Derived> \
1119 TRY_TO(WalkUpFrom##
TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
1120 TRY_TO(WalkUpFrom##
TYPE##Loc(TL)); \
1125 template <
typename Derived>
1179 template <typename Derived>
1239 for (
unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1240 if (TL.getParam(I)) {
1242 }
else if (I < T->getNumParams()) {
1296 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1309 if (TL.getQualifierLoc()) {
1320 if (TL.getQualifierLoc()) {
1324 for (
unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1341 for (
unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1361 template <typename Derived>
1363 const Decl *Child) {
1366 return isa<BlockDecl>(Child) || isa<CapturedDecl>(Child);
1369 template <
typename Derived>
1374 for (
auto *Child : DC->
decls()) {
1383 #define DEF_TRAVERSE_DECL(DECL, CODE) \ 1384 template <typename Derived> \ 1385 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \ 1386 bool ShouldVisitChildren = true; \ 1387 bool ReturnValue = true; \ 1388 if (!getDerived().shouldTraversePostOrder()) \ 1389 TRY_TO(WalkUpFrom##DECL(D)); \ 1391 if (ReturnValue && ShouldVisitChildren) \ 1392 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \ 1393 if (ReturnValue && getDerived().shouldTraversePostOrder()) \ 1394 TRY_TO(WalkUpFrom##DECL(D)); \ 1395 return ReturnValue; \ 1404 for (
const auto &I : D->captures()) {
1405 if (I.hasCopyExpr()) {
1409 ShouldVisitChildren =
false;
1414 ShouldVisitChildren =
false;
1426 if (D->getFriendType())
1433 if (D->getFriendType())
1437 for (
unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1440 ITPL != ETPL; ++ITPL) {
1449 if (D->hasExplicitTemplateArgs()) {
1486 ShouldVisitChildren =
false;
1504 for (
auto typeParam : *typeParamList) {
1505 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1518 for (
auto typeParam : *typeParamList) {
1519 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1532 if (D->getReturnTypeSourceInfo()) {
1538 if (D->isThisDeclarationADefinition()) {
1541 ShouldVisitChildren =
false;
1545 if (D->hasExplicitBound()) {
1554 if (D->getTypeSourceInfo())
1558 ShouldVisitChildren =
false;
1577 for (
auto *I : D->varlists()) {
1584 if (
auto *Initializer = D->getInitializer())
1593 template <typename Derived>
1605 template <
typename Derived>
1606 template <
typename T>
1608 for (
unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1610 TraverseTemplateParameterListHelper(TPL);
1615 template <
typename Derived>
1619 for (
auto *RD : SD->redecls()) {
1621 if (cast<CXXRecordDecl>(RD)->isInjectedClassName())
1625 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1646 template <
typename Derived>
1650 for (
auto *RD : SD->redecls()) {
1652 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1671 template <
typename Derived>
1675 for (
auto *RD : FD->redecls()) {
1676 switch (RD->getTemplateSpecializationKind()) {
1701 #define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \ 1702 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \ 1703 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \ 1704 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \ 1712 if (getDerived().shouldVisitTemplateInstantiations() && \ 1713 D == D->getCanonicalDecl()) \ 1714 TRY_TO(TraverseTemplateInstantiations(D)); \ 1729 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited()) {
1741 if (D->getTypeForDecl())
1743 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1776 TRY_TO(TraverseDeclTemplateParameterLists(D));
1778 if (D->getTypeForDecl())
1787 template <typename Derived>
1792 TRY_TO(TraverseDeclTemplateParameterLists(D));
1797 template <
typename Derived>
1804 template <
typename Derived>
1806 if (!TraverseRecordHelper(D))
1809 for (
const auto &I : D->
bases()) {
1823 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
1848 template <
typename Derived>
1851 for (
unsigned I = 0; I < Count; ++I) {
1857 #define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \ 1858 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \ 1860 if (TemplateParameterList *TPL = D->getTemplateParameters()) { \ 1861 for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \ 1863 TRY_TO(TraverseDecl(*I)); \ 1867 TRY_TO(TraverseTemplateArgumentLocsHelper( \ 1868 D->getTemplateArgsAsWritten()->getTemplateArgs(), \ 1869 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \ 1874 TRY_TO(Traverse##DECLKIND##Helper(D)); \ 1893 template <typename Derived>
1895 TRY_TO(TraverseDeclTemplateParameterLists(D));
1905 TRY_TO(TraverseVarHelper(D));
1906 for (
auto *Binding : D->bindings()) {
1919 TRY_TO(TraverseDeclaratorHelper(D));
1920 if (D->isBitField())
1922 else if (D->hasInClassInitializer())
1927 TRY_TO(TraverseDeclaratorHelper(D));
1928 if (D->isBitField())
1934 TRY_TO(TraverseDeclaratorHelper(D));
1935 if (D->isBitField())
1940 template <typename Derived>
1942 TRY_TO(TraverseDeclTemplateParameterLists(D));
1958 FTSI->TemplateArgumentsAsWritten) {
1959 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
1960 TALI->NumTemplateArgs));
1983 for (
auto *I : Ctor->inits()) {
1997 ShouldVisitChildren =
false;
1998 ReturnValue = TraverseFunctionHelper(D);
2004 ShouldVisitChildren =
false;
2005 ReturnValue = TraverseFunctionHelper(D);
2011 ShouldVisitChildren =
false;
2012 ReturnValue = TraverseFunctionHelper(D);
2018 ShouldVisitChildren =
false;
2019 ReturnValue = TraverseFunctionHelper(D);
2027 ShouldVisitChildren =
false;
2028 ReturnValue = TraverseFunctionHelper(D);
2034 ShouldVisitChildren =
false;
2035 ReturnValue = TraverseFunctionHelper(D);
2038 template <typename Derived>
2040 TRY_TO(TraverseDeclaratorHelper(D));
2042 if (!isa<ParmVarDecl>(D) &&
2054 TRY_TO(TraverseDeclaratorHelper(D));
2055 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2060 TRY_TO(TraverseVarHelper(D));
2062 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2063 !D->hasUnparsedDefaultArg())
2066 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2067 !D->hasUnparsedDefaultArg())
2084 template <typename Derived> \
2087 bool ShouldVisitChildren =
true; \
2088 bool ReturnValue =
true; \
2090 TRY_TO(WalkUpFrom##
STMT(S)); \
2092 if (ShouldVisitChildren) { \
2094 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2098 TRY_TO(WalkUpFrom##
STMT(S)); \
2099 return ReturnValue; \
2104 for (
unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2107 for (
unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2110 for (
unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2128 for (
auto *I : S->decls()) {
2136 ShouldVisitChildren =
false;
2169 ShouldVisitChildren =
false;
2185 if (S->hasExplicitTemplateArgs()) {
2186 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2187 S->getNumTemplateArgs()));
2194 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2195 S->getNumTemplateArgs()));
2201 if (S->hasExplicitTemplateArgs()) {
2202 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2203 S->getNumTemplateArgs()));
2210 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2211 S->getNumTemplateArgs()));
2244 template <typename Derived>
2251 TRY_TO(WalkUpFromInitListExpr(S));
2267 template <
typename Derived>
2282 for (
unsigned i = 0; i != S->getNumAssocs(); ++i) {
2287 ShouldVisitChildren =
false;
2295 e = S->semantics_end();
2299 sub = OVE->getSourceExpr();
2302 ShouldVisitChildren =
false;
2327 if (S->isArgumentType())
2334 if (S->isTypeOperand())
2347 if (S->isTypeOperand())
2352 for (
unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2375 for (
unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2382 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2385 if (S->hasExplicitParameters() && S->hasExplicitResultType()) {
2389 if (S->hasExplicitParameters()) {
2391 for (
unsigned I = 0, N = Proto.
getNumParams(); I != N; ++I) {
2394 }
else if (S->hasExplicitResultType()) {
2408 ShouldVisitChildren =
false;
2456 if (
TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2510 if (S->hasExplicitTemplateArgs()) {
2511 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2512 S->getNumTemplateArgs()));
2518 if (S->hasExplicitTemplateArgs()) {
2519 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2520 S->getNumTemplateArgs()));
2558 ShouldVisitChildren =
false;
2562 if (!
getDerived().shouldVisitImplicitCode()) {
2564 ShouldVisitChildren =
false;
2568 if (!
getDerived().shouldVisitImplicitCode()) {
2570 ShouldVisitChildren =
false;
2574 if (!
getDerived().shouldVisitImplicitCode()) {
2576 ShouldVisitChildren =
false;
2580 if (!
getDerived().shouldVisitImplicitCode()) {
2582 ShouldVisitChildren =
false;
2601 template <typename Derived>
2604 for (
auto *C : S->
clauses()) {
2605 TRY_TO(TraverseOMPClause(C));
2610 template <
typename Derived>
2613 return TraverseOMPExecutableDirective(S);
2617 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2620 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2623 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2626 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2629 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2632 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2635 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2638 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2642 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)); })
2664 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2667 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2670 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2673 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2676 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2679 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2682 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2685 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2688 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2691 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2694 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2697 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2700 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2703 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2706 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2709 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2712 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2715 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2718 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2721 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2724 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2727 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2730 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2733 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2736 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2739 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2742 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2745 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2748 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2751 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2754 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2757 {
TRY_TO(TraverseOMPExecutableDirective(S)); })
2760 template <typename Derived>
2765 #define OPENMP_CLAUSE(Name, Class) \ 2767 TRY_TO(Visit##Class(static_cast<Class *>(C))); \ 2769 #include "clang/Basic/OpenMPKinds.def" 2778 template <
typename Derived>
2785 template <
typename Derived>
2788 TRY_TO(VisitOMPClauseWithPreInit(Node));
2793 template <
typename Derived>
2795 TRY_TO(VisitOMPClauseWithPreInit(C));
2800 template <
typename Derived>
2806 template <
typename Derived>
2809 TRY_TO(VisitOMPClauseWithPreInit(C));
2814 template <
typename Derived>
2820 template <
typename Derived>
2826 template <
typename Derived>
2833 template <
typename Derived>
2838 template <
typename Derived>
2843 template <
typename Derived>
2846 TRY_TO(VisitOMPClauseWithPreInit(C));
2851 template <
typename Derived>
2857 template <
typename Derived>
2862 template <
typename Derived>
2867 template <
typename Derived>
2873 template <
typename Derived>
2878 template <
typename Derived>
2883 template <
typename Derived>
2888 template <
typename Derived>
2893 template <
typename Derived>
2898 template <
typename Derived>
2903 template <
typename Derived>
2908 template <
typename Derived>
2913 template <
typename Derived>
2914 template <
typename T>
2916 for (
auto *E : Node->varlists()) {
2922 template <
typename Derived>
2924 TRY_TO(VisitOMPClauseList(C));
2931 template <
typename Derived>
2934 TRY_TO(VisitOMPClauseList(C));
2935 TRY_TO(VisitOMPClauseWithPreInit(C));
2939 for (
auto *E : C->
inits()) {
2945 template <
typename Derived>
2948 TRY_TO(VisitOMPClauseList(C));
2949 TRY_TO(VisitOMPClauseWithPostUpdate(C));
2965 template <
typename Derived>
2967 TRY_TO(VisitOMPClauseList(C));
2971 template <
typename Derived>
2975 TRY_TO(VisitOMPClauseList(C));
2976 TRY_TO(VisitOMPClauseWithPostUpdate(C));
2977 for (
auto *E : C->privates()) {
2980 for (
auto *E : C->inits()) {
2983 for (
auto *E : C->updates()) {
2986 for (
auto *E : C->finals()) {
2992 template <
typename Derived>
2995 TRY_TO(VisitOMPClauseList(C));
2999 template <
typename Derived>
3001 TRY_TO(VisitOMPClauseList(C));
3014 template <
typename Derived>
3017 TRY_TO(VisitOMPClauseList(C));
3030 template <
typename Derived>
3035 TRY_TO(VisitOMPClauseList(C));
3036 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3052 template <
typename Derived>
3057 TRY_TO(VisitOMPClauseList(C));
3058 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3074 template <
typename Derived>
3079 TRY_TO(VisitOMPClauseList(C));
3080 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3098 template <
typename Derived>
3100 TRY_TO(VisitOMPClauseList(C));
3104 template <
typename Derived>
3106 TRY_TO(VisitOMPClauseList(C));
3110 template <
typename Derived>
3112 TRY_TO(VisitOMPClauseWithPreInit(C));
3117 template <
typename Derived>
3119 TRY_TO(VisitOMPClauseList(C));
3123 template <
typename Derived>
3126 TRY_TO(VisitOMPClauseWithPreInit(C));
3131 template <
typename Derived>
3134 TRY_TO(VisitOMPClauseWithPreInit(C));
3139 template <
typename Derived>
3146 template <
typename Derived>
3153 template <
typename Derived>
3160 template <
typename Derived>
3166 template <
typename Derived>
3169 TRY_TO(VisitOMPClauseWithPreInit(C));
3174 template <
typename Derived>
3180 template <
typename Derived>
3182 TRY_TO(VisitOMPClauseList(C));
3186 template <
typename Derived>
3188 TRY_TO(VisitOMPClauseList(C));
3192 template <
typename Derived>
3195 TRY_TO(VisitOMPClauseList(C));
3199 template <
typename Derived>
3202 TRY_TO(VisitOMPClauseList(C));
3223 #undef DEF_TRAVERSE_STMT 3224 #undef TRAVERSE_STMT 3225 #undef TRAVERSE_STMT_BASE 3231 #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.
An instance of this class is created to represent 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
PointerType - C99 6.7.5.1 - Pointer Declarators.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
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.
const TypeClass * getTypePtr() const
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.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Class that handles pre-initialization statement for some clauses, like 'shedule', 'firstprivate' etc...
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
TypedefDecl - 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 a C++11 auto or C++14 decltype(auto) type.
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.
NamespaceDecl - 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.
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.
QualType getElementType() const
bool isCompleteDefinition() const
isCompleteDefinition - 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()))
VarDecl - An instance of this class is created to represent 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++.
Represents a C++17 deduced template specialization type.
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 ...
ParmVarDecl - Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
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...
const Type * getTypePtr() const
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.
RecordDecl - 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)
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
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.
Represents the result of substituting a set of types for a template type parameter pack...
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.
Represents an access specifier followed by colon ':'.
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.
An rvalue reference type, per C++11 [dcl.ref].
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.
#define DEF_TRAVERSE_DECL(DECL, CODE)
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
Represents a typeof (or typeof) expression (a GCC extension).
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...
This represents the body of a CapturedStmt, and serves as its DeclContext.
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]).
Represents an extended vector type where either the type or size is dependent.
helper_expr_const_range privates() const
This represents clause 'from' in the '#pragma omp ...' directives.
Represents the this expression in C++.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
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]).
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents a prototype with parameter type info, e.g.
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
Represents an array type in C++ whose size is a value-dependent expression.
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...
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
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.
const FunctionProtoType * T
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.
Represents the type decltype(expr) (C++11).
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.
Represents a GCC generic vector type.
A member reference to an MSPropertyDecl.
An lvalue reference type, per C++11 [dcl.ref].
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*.
return TraverseArrayTypeLocHelper(TL)
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLock is not of the desire...
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.
Wrapper for source info for arrays.
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.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
This represents '#pragma omp declare reduction ...' directive.
Pseudo declaration for capturing expressions.
Represents typeof(type), a GCC extension.
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. ...
LabelDecl - 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.
Expr * getNoexceptExpr() const
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...
Represents a pointer type decayed from an array or function type.
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.
TypeLoc getElementLoc() const
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 type which was implicitly adjusted by the semantic engine for arbitrary reasons...
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)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
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.
ArrayRef< QualType > exceptions() const
Represents a C++11 pack expansion that produces a sequence of expressions.
This represents clause 'linear' in the '#pragma omp ...' directives.
EnumDecl - Represents an enum.
A pointer to member type per C++ 8.3.3 - Pointers to members.
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.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
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
ExtVectorType - Extended vector type.
Expr * getSizeExpr() 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).
QualType getParamType(unsigned i) const
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...
Represents a C array with an unspecified size.
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...
This class is used for builtin types like 'int'.
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.
TranslationUnitDecl - 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.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
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.
NamedDecl - This represents a decl with 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).
Represents a C array with a specified size that is not an integer-constant-expression.
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...
Represents the canonical version of C arrays with a specified constant size.
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.