clang: include/clang/AST/ASTNodeTraverser.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_CLANG_AST_ASTNODETRAVERSER_H
16#define LLVM_CLANG_AST_ASTNODETRAVERSER_H
17
28#include "llvm/Support/SaveAndRestore.h"
29
31
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64template <typename Derived, typename NodeDelegateType>
69 const comments::FullComment *>,
74
75
76
77 bool Deserialize = false;
78
79
80
81
82
83
84
85 bool VisitLocs = false;
86
88
89 NodeDelegateType &getNodeDelegate() {
90 return getDerived().doGetNodeDelegate();
91 }
92 Derived &getDerived() { return *static_cast<Derived *>(this); }
93
94public:
97
100
101 void Visit(const Decl *D, bool VisitLocs = false) {
103 return;
104
105 getNodeDelegate().AddChild([=] {
106 getNodeDelegate().Visit(D);
107 if (!D)
108 return;
109
110 {
113 }
114
115 for (const auto &A : D->attrs())
117
120 Visit(Comment, Comment);
121
122
124 if (Traversal != TK_AsIs) {
125 if (const auto *CTSD = dyn_cast(D)) {
126 auto SK = CTSD->getSpecializationKind();
129 return;
130 }
131 }
132 if (const auto *DC = dyn_cast(D))
134 }
135 });
136 }
137
138 void Visit(const Stmt *Node, StringRef Label = {}) {
139 getNodeDelegate().AddChild(Label, [=] {
140 const Stmt *S = Node;
141
142 if (auto *E = dyn_cast_or_null(S)) {
143 switch (Traversal) {
145 break;
147 S = E->IgnoreUnlessSpelledInSource();
148 break;
149 }
150 }
151
152 getNodeDelegate().Visit(S);
153
154 if (!S) {
155 return;
156 }
157
159
160
162 OpenACCWaitConstruct, SYCLKernelCallStmt>(S))
163 return;
164
167 CXXRewrittenBinaryOperator>(S))
168 return;
169
170 for (const Stmt *SubStmt : S->children())
172 });
173 }
174
179
180 getNodeDelegate().AddChild([=] {
181 getNodeDelegate().Visit(T);
183 });
184 }
185
187 getNodeDelegate().AddChild([=] {
188 getNodeDelegate().Visit(T);
189 if ()
190 return;
192
194 T->getLocallyUnqualifiedSingleStepDesugaredType();
195 if (SingleStepDesugar != QualType(T, 0))
196 Visit(SingleStepDesugar);
197 });
198 }
199
201 getNodeDelegate().AddChild([=] {
202 getNodeDelegate().Visit(T);
203 if (T.isNull())
204 return;
206 if (auto Inner = T.getNextTypeLoc())
208 });
209 }
210
212 getNodeDelegate().AddChild([=] {
213 getNodeDelegate().Visit(A);
215 });
216 }
217
220 return;
221 getNodeDelegate().AddChild([=] {
222 getNodeDelegate().Visit(Init);
224 });
225 }
226
228 const Decl *From = nullptr, const char *Label = nullptr) {
229 getNodeDelegate().AddChild([=] {
230 getNodeDelegate().Visit(A, R, From, Label);
232 });
233 }
234
236 getNodeDelegate().AddChild([=] {
237 getNodeDelegate().Visit(C);
238 if (C.hasCopyExpr())
240 });
241 }
242
244 getNodeDelegate().AddChild([=] {
245 getNodeDelegate().Visit(C);
246 for (const auto *S : C->children())
248 });
249 }
250
252 getNodeDelegate().AddChild([=] {
253 getNodeDelegate().Visit(C);
254 for (const auto *S : C->children())
256 });
257 }
258
260 getNodeDelegate().AddChild([=] {
261 getNodeDelegate().Visit(A);
262 if (const TypeSourceInfo *TSI = A.getTypeSourceInfo())
263 Visit(TSI->getType());
264 Visit(A.getAssociationExpr());
265 });
266 }
267
269 getNodeDelegate().AddChild([=] {
270 getNodeDelegate().Visit(R);
271 if (!R)
272 return;
273 if (auto *TR = dyn_castconcepts::TypeRequirement(R)) {
274 if (!TR->isSubstitutionFailure())
275 Visit(TR->getType()->getType().getTypePtr());
276 } else if (auto *ER = dyn_castconcepts::ExprRequirement(R)) {
277 if (!ER->isExprSubstitutionFailure())
278 Visit(ER->getExpr());
279 if (!ER->getReturnTypeRequirement().isEmpty())
280 Visit(ER->getReturnTypeRequirement()
281 .getTypeConstraint()
282 ->getImmediatelyDeclaredConstraint());
283 } else if (auto *NR = dyn_castconcepts::NestedRequirement(R)) {
284 if (!NR->hasInvalidConstraint())
285 Visit(NR->getConstraintExpr());
286 }
287 });
288 }
289
291 getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(R); });
292 }
293
295 getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(Value, Ty); });
296 }
297
299 getNodeDelegate().AddChild([=] {
300 getNodeDelegate().Visit(C, FC);
301 if () {
302 return;
303 }
306 FC);
308 E = C->child_end();
309 I != E; ++I)
311 });
312 }
313
315
316 if (const auto *D = N.get<Decl>())
318 else if (const auto *S = N.get<Stmt>())
320 else if (const auto *QT = N.get<QualType>())
322 else if (const auto *T = N.get<Type>())
324 else if (const auto *TL = N.get<TypeLoc>())
334 }
335
337 if (!DC)
338 return;
339
340 for (const auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
342 }
343
345 if (!TPL)
346 return;
347
348 for (const auto &TP : *TPL)
350
353 }
354
355 void
357 if (!TALI)
358 return;
359
360 for (const auto &TA : TALI->arguments())
362 }
363
365 const Decl *From = nullptr,
366 const char *Label = nullptr) {
368 }
369
371 for (unsigned i = 0, e = TAL.size(); i < e; ++i)
373 }
374
376 if (!typeParams)
377 return;
378
379 for (const auto &typeParam : *typeParams) {
380 Visit(typeParam);
381 }
382 }
383
386 Visit(T->getTypeSourceInfo()->getTypeLoc());
387 }
390 Visit(T->getPointeeType());
391 }
393 Visit(T->getPointeeType());
394 }
396
400 Visit(Qualifier.getAsType());
401 if (T->isSugared())
403 ->getQualifier()
404 .getAsType());
405 Visit(T->getPointeeType());
406 }
411 }
413 Visit(T->getElementType());
415 }
417 Visit(T->getElementType());
419 }
424 for (const QualType &PT : T->getParamTypes())
426 }
428 Visit(T->getUnderlyingExpr());
429 }
431 Visit(T->getUnderlyingExpr());
432 }
433
437 }
438
441 }
443
444 if (T->getModifiedType() != T->getEquivalentType())
445 Visit(T->getModifiedType());
446 }
448 Visit(T->getWrappedType());
449 }
451 QualType Contained = T->getContainedType();
452 if (!Contained.isNull())
453 Visit(Contained);
454 }
456 for (auto &Operand : T->getOperands()) {
457 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
458
459 switch (Operand.getKind()) {
460 case SpirvOperandKind::ConstantId:
461 case SpirvOperandKind::Literal:
462 break;
463
464 case SpirvOperandKind::TypeId:
465 Visit(Operand.getResultType());
466 break;
467
468 default:
469 llvm_unreachable("Invalid SpirvOperand kind!");
470 }
471 }
472 }
474 void
476 Visit(T->getArgumentPack());
477 }
479 for (const auto &Arg : T->template_arguments())
481 }
483 Visit(T->getPointeeType());
484 }
489 if (->isSugared())
491 }
493 for (const auto &Arg : T->getTypeConstraintArguments())
495 }
496
497
498
499
500
503 for (const auto *Param : TL.getParams())
504 Visit(Param, true);
505 }
508 if (auto *Args = CR->getTemplateArgsAsWritten())
509 for (const auto &Arg : Args->arguments())
511 }
512 }
530 Visit(TL.getUnderlyingExpr());
531 }
533 for (unsigned I=0, N=TL.getNumArgs(); I < N; ++I)
535 }
536
538
543
551
555
557 Visit(TRC.ConstraintExpr);
558
560 return;
561
562 if (const auto *C = dyn_cast(D))
563 for (const auto *I : C->inits())
565
568 }
569
576
579 return;
580
582 Visit(TSI->getTypeLoc());
585 }
586
589 for (const auto *B : D->bindings())
591 }
592
595 return;
596
599
602 }
603
607
609
615
617
619 for (const auto *E : D->varlist())
621 }
622
624 for (const auto *E : D->varlist())
626 }
627
633
638
642
644 for (const auto *E : D->varlist())
648 }
649
650 template
652 for (const auto *Redecl : D->redecls())
654 }
655
656 template
659
661
662 if (Traversal == TK_AsIs) {
663 for (const auto *Child : D->specializations())
665 }
666 }
667
671
676
681
685
689
694
700
702
706
707 void
712
718
721 Visit(TC->getImmediatelyDeclaredConstraint());
726 }
727
736
744
749
755
762
766
769
770
772 if (TT->isTagOwned())
773 Visit(TT->getDecl());
774 } else {
776 }
777 }
778
789
793
797
799 for (const auto &I : D->inits())
801 }
802
804 for (const auto &I : D->parameters())
806
807 for (const auto &I : D->captures())
810 }
811
813 for (const auto &D : Node->decls())
815 }
816
818 for (const auto *A : Node->getAttrs())
820 }
821
828
832
836
842
844 for (const auto *C : Node->clauses())
846 }
847
849 for (const auto *C : Node->clauses())
851 }
852
854
855
856
859 for (const auto *C : Node->clauses())
861 }
862
865 Visit(Filler, "array_filler");
866 }
867 }
868
871 Visit(Filler, "array_filler");
872 }
873 }
874
876
881
886 } else
888
891 }
892 }
893
897 Visit(Arg.getArgument());
898 }
899
906
908
909 for (auto *A : E->getArgs())
910 Visit(A->getType());
911 }
912
915 for (unsigned I = 0, N = Node->capture_size(); I != N; ++I) {
917 if (->isExplicit())
918 continue;
920 Visit(C->getCapturedVar());
921 else
923 }
928 } else {
930 }
931 }
932
938
947
950 Visit(CatchParam);
951 }
952
961
963 for (const auto *Child :
964 make_filter_range(Node->children(), [this](const Stmt *Child) {
965 if (Traversal != TK_IgnoreUnlessSpelledInSource)
966 return false;
967 return !isa(Child);
968 })) {
970 }
971 }
972
981
985
989
994
998
1002
1003
1004#include "clang/AST/AttrNodeTraverse.inc"
1005};
1006
1007}
1008
1009#endif
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
ASTNodeTraverser traverses the Clang AST for dumping purposes.
Definition ASTNodeTraverser.h:73
void VisitSubstNonTypeTemplateParmPackExpr(const SubstNonTypeTemplateParmPackExpr *E)
Definition ASTNodeTraverser.h:942
void VisitDeclStmt(const DeclStmt *Node)
Definition ASTNodeTraverser.h:812
void VisitFunctionType(const FunctionType *T)
Definition ASTNodeTraverser.h:421
void VisitCapturedDecl(const CapturedDecl *D)
Definition ASTNodeTraverser.h:616
void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node)
Definition ASTNodeTraverser.h:999
void Visit(const BlockDecl::Capture &C)
Definition ASTNodeTraverser.h:235
void VisitAdjustedType(const AdjustedType *T)
Definition ASTNodeTraverser.h:487
void VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL)
Definition ASTNodeTraverser.h:523
void VisitSizeOfPackExpr(const SizeOfPackExpr *Node)
Definition ASTNodeTraverser.h:933
void VisitMemberPointerType(const MemberPointerType *T)
Definition ASTNodeTraverser.h:395
void VisitDependentSizedArrayType(const DependentSizedArrayType *T)
Definition ASTNodeTraverser.h:412
void VisitTypeOfExprType(const TypeOfExprType *T)
Definition ASTNodeTraverser.h:427
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *E)
Definition ASTNodeTraverser.h:894
void VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *Node)
Definition ASTNodeTraverser.h:853
void VisitLocInfoType(const LocInfoType *T)
Definition ASTNodeTraverser.h:385
void dumpTemplateDeclSpecialization(const SpecializationDecl *D)
Definition ASTNodeTraverser.h:651
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *Node)
Definition ASTNodeTraverser.h:848
void VisitHLSLInlineSpirvType(const HLSLInlineSpirvType *T)
Definition ASTNodeTraverser.h:455
void Visit(const comments::Comment *C, const comments::FullComment *FC)
Definition ASTNodeTraverser.h:298
void VisitDependentSizedArrayTypeLoc(DependentSizedArrayTypeLoc TL)
Definition ASTNodeTraverser.h:520
void VisitClassTemplateSpecializationDecl(const ClassTemplateSpecializationDecl *D)
Definition ASTNodeTraverser.h:690
void VisitBlockDecl(const BlockDecl *D)
Definition ASTNodeTraverser.h:803
void VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL)
Definition ASTNodeTraverser.h:501
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
Definition ASTNodeTraverser.h:798
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
Definition ASTNodeTraverser.h:737
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node)
Definition ASTNodeTraverser.h:948
void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL)
Definition ASTNodeTraverser.h:532
void VisitPackIndexingType(const PackIndexingType *T)
Definition ASTNodeTraverser.h:434
void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D)
Definition ASTNodeTraverser.h:672
void VisitCXXParenListInitExpr(const CXXParenListInitExpr *PLIE)
Definition ASTNodeTraverser.h:869
void dumpTemplateArgumentList(const TemplateArgumentList &TAL)
Definition ASTNodeTraverser.h:370
void Visit(const OMPClause *C)
Definition ASTNodeTraverser.h:251
void VisitImplicitConceptSpecializationDecl(const ImplicitConceptSpecializationDecl *CSD)
Definition ASTNodeTraverser.h:750
void VisitReferenceType(const ReferenceType *T)
Definition ASTNodeTraverser.h:392
void VisitBlockExpr(const BlockExpr *Node)
Definition ASTNodeTraverser.h:875
void VisitDecltypeType(DecltypeType TL)
Definition ASTNodeTraverser.h:529
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
Definition ASTNodeTraverser.h:794
void VisitStaticAssertDecl(const StaticAssertDecl *D)
Definition ASTNodeTraverser.h:677
void VisitBlockPointerType(const BlockPointerType *T)
Definition ASTNodeTraverser.h:389
void VisitFieldDecl(const FieldDecl *D)
Definition ASTNodeTraverser.h:570
void VisitAttributedStmt(const AttributedStmt *Node)
Definition ASTNodeTraverser.h:817
void Visit(const Type *T)
Definition ASTNodeTraverser.h:186
void VisitPipeType(const PipeType *T)
Definition ASTNodeTraverser.h:486
void Visit(TypeLoc T)
Definition ASTNodeTraverser.h:200
void Visit(QualType T)
Definition ASTNodeTraverser.h:175
void Visit(const Attr *A)
Definition ASTNodeTraverser.h:211
void VisitInitListExpr(const InitListExpr *ILE)
Definition ASTNodeTraverser.h:863
void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node)
Definition ASTNodeTraverser.h:995
void VisitVarTemplateDecl(const VarTemplateDecl *D)
Definition ASTNodeTraverser.h:701
void VisitPackExpansionType(const PackExpansionType *T)
Definition ASTNodeTraverser.h:488
void VisitBTFTagAttributedType(const BTFTagAttributedType *T)
Definition ASTNodeTraverser.h:447
void VisitTypeAliasDecl(const TypeAliasDecl *D)
Definition ASTNodeTraverser.h:668
void VisitDecompositionDecl(const DecompositionDecl *D)
Definition ASTNodeTraverser.h:587
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
Definition ASTNodeTraverser.h:779
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
Definition ASTNodeTraverser.h:686
void Visit(const Decl *D, bool VisitLocs=false)
Definition ASTNodeTraverser.h:101
void SetTraversalKind(TraversalKind TK)
Definition ASTNodeTraverser.h:98
void Visit(const concepts::Requirement *R)
Definition ASTNodeTraverser.h:268
void VisitLabelStmt(const LabelStmt *Node)
Definition ASTNodeTraverser.h:822
void VisitTypeTraitExpr(const TypeTraitExpr *E)
Definition ASTNodeTraverser.h:907
void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D)
Definition ASTNodeTraverser.h:639
void VisitComplexType(const ComplexType *T)
Definition ASTNodeTraverser.h:384
void dumpDeclContext(const DeclContext *DC)
Definition ASTNodeTraverser.h:336
void VisitUsingShadowDecl(const UsingShadowDecl *D)
Definition ASTNodeTraverser.h:763
void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams)
Definition ASTNodeTraverser.h:375
void VisitVarTemplateSpecializationDecl(const VarTemplateSpecializationDecl *D)
Definition ASTNodeTraverser.h:708
void Visit(const DynTypedNode &N)
Definition ASTNodeTraverser.h:314
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
Definition ASTNodeTraverser.h:982
void VisitOMPGroupPrivateDecl(const OMPGroupPrivateDecl *D)
Definition ASTNodeTraverser.h:623
void dumpTemplateDecl(const TemplateDecl *D)
Definition ASTNodeTraverser.h:657
void VisitHLSLAttributedResourceType(const HLSLAttributedResourceType *T)
Definition ASTNodeTraverser.h:450
void VisitVectorType(const VectorType *T)
Definition ASTNodeTraverser.h:420
void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A, const Decl *From=nullptr, const char *Label=nullptr)
Definition ASTNodeTraverser.h:364
void Visit(const OpenACCClause *C)
Definition ASTNodeTraverser.h:243
bool getDeserialize() const
Definition ASTNodeTraverser.h:96
void VisitCXXCatchStmt(const CXXCatchStmt *Node)
Definition ASTNodeTraverser.h:829
void VisitClassTemplatePartialSpecializationDecl(const ClassTemplatePartialSpecializationDecl *D)
Definition ASTNodeTraverser.h:695
void VisitTypedefDecl(const TypedefDecl *D)
Definition ASTNodeTraverser.h:537
void Visit(const ConceptReference *R)
Definition ASTNodeTraverser.h:290
void VisitBindingDecl(const BindingDecl *D)
Definition ASTNodeTraverser.h:593
void Visit(const APValue &Value, QualType Ty)
Definition ASTNodeTraverser.h:294
void VisitVariableArrayTypeLoc(VariableArrayTypeLoc TL)
Definition ASTNodeTraverser.h:517
void VisitRequiresExpr(const RequiresExpr *E)
Definition ASTNodeTraverser.h:900
void VisitGenericSelectionExpr(const GenericSelectionExpr *E)
Definition ASTNodeTraverser.h:882
void VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T)
Definition ASTNodeTraverser.h:475
void VisitOpaqueValueExpr(const OpaqueValueExpr *Node)
Definition ASTNodeTraverser.h:877
void setDeserialize(bool D)
Definition ASTNodeTraverser.h:95
void VisitArrayType(const ArrayType *T)
Definition ASTNodeTraverser.h:407
void Visit(const CXXCtorInitializer *Init)
Definition ASTNodeTraverser.h:218
void VisitVarDecl(const VarDecl *D)
Definition ASTNodeTraverser.h:577
void VisitVarTemplatePartialSpecializationDecl(const VarTemplatePartialSpecializationDecl *D)
Definition ASTNodeTraverser.h:713
void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D)
Definition ASTNodeTraverser.h:604
void VisitAutoType(const AutoType *T)
Definition ASTNodeTraverser.h:492
void VisitFunctionProtoType(const FunctionProtoType *T)
Definition ASTNodeTraverser.h:422
void VisitUnaryTransformType(const UnaryTransformType *T)
Definition ASTNodeTraverser.h:439
void VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL)
Definition ASTNodeTraverser.h:526
void VisitLambdaExpr(const LambdaExpr *Node)
Definition ASTNodeTraverser.h:913
void VisitCallExpr(const CallExpr *Node)
Definition ASTNodeTraverser.h:962
void VisitDecltypeType(const DecltypeType *T)
Definition ASTNodeTraverser.h:430
void VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL)
Definition ASTNodeTraverser.h:513
void VisitOMPExecutableDirective(const OMPExecutableDirective *Node)
Definition ASTNodeTraverser.h:843
void VisitEnumConstantDecl(const EnumConstantDecl *D)
Definition ASTNodeTraverser.h:539
void VisitTemplateSpecializationType(const TemplateSpecializationType *T)
Definition ASTNodeTraverser.h:478
void VisitAtomicType(const AtomicType *T)
Definition ASTNodeTraverser.h:485
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T)
Definition ASTNodeTraverser.h:416
void Visit(const Stmt *Node, StringRef Label={})
Definition ASTNodeTraverser.h:138
void VisitOutlinedFunctionDecl(const OutlinedFunctionDecl *D)
Definition ASTNodeTraverser.h:610
void Visit(const GenericSelectionExpr::ConstAssociation &A)
Definition ASTNodeTraverser.h:259
void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D)
Definition ASTNodeTraverser.h:703
void VisitConceptDecl(const ConceptDecl *D)
Definition ASTNodeTraverser.h:745
void VisitTopLevelStmtDecl(const TopLevelStmtDecl *D)
Definition ASTNodeTraverser.h:608
void dumpASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *TALI)
Definition ASTNodeTraverser.h:356
void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *CSE)
Definition ASTNodeTraverser.h:756
void VisitVariableArrayType(const VariableArrayType *T)
Definition ASTNodeTraverser.h:408
void VisitTypeTemplateArgument(const TemplateArgument &TA)
Definition ASTNodeTraverser.h:986
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
Definition ASTNodeTraverser.h:719
void VisitOMPAllocateDecl(const OMPAllocateDecl *D)
Definition ASTNodeTraverser.h:643
void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
Definition ASTNodeTraverser.h:618
void VisitCapturedStmt(const CapturedStmt *Node)
Definition ASTNodeTraverser.h:833
void VisitFriendDecl(const FriendDecl *D)
Definition ASTNodeTraverser.h:767
void VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E)
Definition ASTNodeTraverser.h:939
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
Definition ASTNodeTraverser.h:728
void VisitCXXForRangeStmt(const CXXForRangeStmt *Node)
Definition ASTNodeTraverser.h:953
void VisitOMPDeclareMapperDecl(const OMPDeclareMapperDecl *D)
Definition ASTNodeTraverser.h:634
void VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
Definition ASTNodeTraverser.h:482
void VisitAttributedType(const AttributedType *T)
Definition ASTNodeTraverser.h:442
void Visit(const TemplateArgument &A, SourceRange R={}, const Decl *From=nullptr, const char *Label=nullptr)
Definition ASTNodeTraverser.h:227
void VisitPackTemplateArgument(const TemplateArgument &TA)
Definition ASTNodeTraverser.h:990
TraversalKind GetTraversalKind() const
Definition ASTNodeTraverser.h:99
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
Definition ASTNodeTraverser.h:790
void VisitAutoTypeLoc(AutoTypeLoc TL)
Definition ASTNodeTraverser.h:506
void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *)
Definition ASTNodeTraverser.h:473
void VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *Node)
Definition ASTNodeTraverser.h:973
void VisitSYCLKernelCallStmt(const SYCLKernelCallStmt *Node)
Definition ASTNodeTraverser.h:837
void dumpTemplateParameters(const TemplateParameterList *TPL)
Definition ASTNodeTraverser.h:344
void VisitFunctionDecl(const FunctionDecl *D)
Definition ASTNodeTraverser.h:544
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D)
Definition ASTNodeTraverser.h:682
void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D)
Definition ASTNodeTraverser.h:628
void VisitPointerType(const PointerType *T)
Definition ASTNodeTraverser.h:388
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Expr * getSizeExpr() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Attr - This represents one attribute.
Represents an attribute applied to a statement.
ArrayRef< const Attr * > getAttrs() const
ConceptReference * getConceptReference() const
A binding in a decomposition declaration.
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Expr * getBinding() const
Get the expression to which this declaration is bound.
A class which contains all the information about a particular captured value.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
ArrayRef< Capture > captures() const
ArrayRef< ParmVarDecl * > parameters() const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
const BlockDecl * getBlockDecl() const
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
CXXCatchStmt - This represents a C++ catch block.
VarDecl * getExceptionDecl() const
Represents a C++ base or member initializer.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Expr * getExpr()
Get the initialization expression that will be used.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
VarDecl * getLoopVariable()
Represents a list-initialization with parenthesis.
A rewritten comparison expression that was originally written using operator syntax.
const Expr * getLHS() const
const Expr * getRHS() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Declaration of a class template.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
Complex values, per C99 6.2.5p11.
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
A reference to a concept and its template args, as it appears in the code.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
bool hasExplicitTemplateArgs() const
const ImplicitConceptSpecializationDecl * getSpecializationDecl() const
A simple visitor class that helps create attribute visitors.
A simple visitor class that helps create declaration visitors.
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
A simple visitor class that helps create template argument visitors.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const AssociatedConstraint & getTrailingRequiresClause() const
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
TypeSourceInfo * getTypeSourceInfo() const
A decomposition declaration.
ArrayRef< BindingDecl * > bindings() const
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
Provides information about a dependent function-template specialization declaration.
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
A dynamically typed AST node container.
const T * get() const
Retrieve the stored node as type T.
An instance of this object exists for each enum constant that is defined.
const Expr * getInitExpr() const
This represents one expression.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
bool isBitField() const
Determines whether this field is a bitfield.
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
const Expr * getAsmStringExpr() const
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Represents a function declaration or definition.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
ArrayRef< ParmVarDecl * > parameters() const
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
param_iterator param_begin()
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
bool isDefaulted() const
Whether this function is defaulted.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
ArrayRef< ParmVarDecl * > getParams() const
FunctionType - C99 6.7.5.3 - Function Declarators.
Represents a C11 generic selection.
TypeSourceInfo * getControllingType()
Return the controlling type of this generic selection expression.
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
association_range associations()
AssociationTy< true > ConstAssociation
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes an C or C++ initializer list.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
LabelStmt - Represents a label, which has a substatement.
LabelDecl * getDecl() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
Stmt * getBody() const
Retrieve the body of the lambda.
unsigned capture_size() const
Determine the number of captures in this lambda.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it,...
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Wrapper for source info for member pointers.
NestedNameSpecifierLoc getQualifierLoc() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Represents a C++ nested name specifier, such as "\::std::vector::".
Kind
The kind of specifier that completes this nested name specifier.
@ Type
A type, stored as a Type*.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
const DefArgStorage & getDefaultArgStorage() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
This represents 'pragma omp allocate ...' directive.
clauselist_range clauselists()
Pseudo declaration for capturing expressions.
This is a basic class for representing single OpenMP clause.
This represents 'pragma omp declare mapper ...' directive.
clauselist_range clauselists()
This represents 'pragma omp declare reduction ...' directive.
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
This represents 'pragma omp groupprivate ...' directive.
This represents 'pragma omp threadprivate ...' directive.
Represents Objective-C's @catch statement.
const VarDecl * getCatchParamDecl() const
ObjCCategoryDecl - Represents a category declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class.
ObjCMethodDecl - Represents an instance or class method declaration.
bool hasBody() const override
Determine whether this method has a body.
ArrayRef< ParmVarDecl * > parameters() const
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Represents a pointer to an Objective C object.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This is the base type for all OpenACC Clauses.
This is the base class for an OpenACC statement-level construct, other construct types are expected t...
ArrayRef< const OpenACCClause * > clauses() const
Represents a partial function definition.
parameter_const_range parameters() const
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
ArrayRef< TemplateArgumentLoc > template_arguments() const
Represents a parameter to a function.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Base for LValueReferenceType and RValueReferenceType.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ArrayRef< concepts::Requirement * > getRequirements() const
ArrayRef< ParmVarDecl * > getLocalParameters() const
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
CompoundStmt * getOriginalStmt()
Retrieve the model statement.
OutlinedFunctionDecl * getOutlinedFunctionDecl()
Retrieve the outlined function declaration.
Represents an expression that computes the length of a parameter pack.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
A trivial tuple used to represent a source range.
Represents a C++11 static_assert declaration.
void Visit(PTR(Stmt) S, ParamTys... P)
Stmt - This represents one statement.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
NonTypeTemplateParmDecl * getParameter() const
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceRange getSourceRange() const LLVM_READONLY
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
The base class of all kinds of template declarations (e.g., class, function, etc.).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
unsigned getNumArgs() const
TemplateArgumentLoc getArgLoc(unsigned i) const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
const DefArgStorage & getDefaultArgStorage() const
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
const DefArgStorage & getDefaultArgStorage() const
A declaration that models statements at global scope.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
RetTy Visit(TypeLoc TyLoc)
Base wrapper for a particular "section" of type source info.
QualType getType() const
Get the type for which this source info wrapper provides information.
Expr * getUnderlyingExpr() const
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
The base class of the type hierarchy.
const T * getAs() const
Member-template getAs'.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
QualType getUnderlyingType() const
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Represents a variable declaration or definition.
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
const Expr * getInit() const
Declaration of a variable template.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a variable template specialization, which refers to a variable template with a given set o...
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
A static requirement that can be used in a requires-expression to check properties of types and expre...
void Visit(REF(TemplateArgument) TA, ParamTys... P)
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
TraversalKind
Defines how we descend a level in the AST when we pass through expressions.
@ TK_AsIs
Will traverse all child nodes.
@ TK_IgnoreUnlessSpelledInSource
Ignore AST nodes not written in the source.
@ Parameter
The parameter type of a method or function.
const FunctionProtoType * T
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
U cast(CodeGen::Address addr)
Represents an explicit template argument list in C++, e.g., the "" in "sort".
ArrayRef< TemplateArgumentLoc > arguments() const
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.