clang 23.0.0git
ASTNodeTraverser.h
Go to the documentation of this file.
1//===--- ASTNodeTraverser.h - Traversal of AST nodes ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the AST traversal facilities. Other users
10// of this class may make use of the same traversal logic by inheriting it,
11// similar to RecursiveASTVisitor.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_AST_ASTNODETRAVERSER_H
16#define LLVM_CLANG_AST_ASTNODETRAVERSER_H
17
25#include "clang/AST/Type.h"
28#include "llvm/Support/SaveAndRestore.h"
29
30namespace clang {
31
32class APValue;
33
34/**
35
36ASTNodeTraverser traverses the Clang AST for dumping purposes.
37
38The `Derived::doGetNodeDelegate()` method is required to be an accessible member
39which returns a reference of type `NodeDelegateType &` which implements the
40following interface:
41
42struct {
43 template <typename Fn> void AddChild(Fn DoAddChild);
44 template <typename Fn> void AddChild(StringRef Label, Fn DoAddChild);
45
46 void Visit(const comments::Comment *C, const comments::FullComment *FC);
47 void Visit(const Attr *A);
48 void Visit(const TemplateArgument &TA, SourceRange R = {},
49 const Decl *From = nullptr, StringRef Label = {});
50 void Visit(const Stmt *Node);
51 void Visit(const Type *T);
52 void Visit(QualType T);
53 void Visit(TypeLoc);
54 void Visit(const Decl *D);
55 void Visit(const CXXCtorInitializer *Init);
56 void Visit(const OpenACCClause *C);
57 void Visit(const OMPClause *C);
58 void Visit(const BlockDecl::Capture &C);
59 void Visit(const GenericSelectionExpr::ConstAssociation &A);
60 void Visit(const concepts::Requirement *R);
61 void Visit(const APValue &Value, QualType Ty);
62};
63*/
64template <typename Derived, typename NodeDelegateType>
66 : public ConstDeclVisitor<Derived>,
67 public ConstStmtVisitor<Derived>,
68 public comments::ConstCommentVisitor<Derived, void,
69 const comments::FullComment *>,
70 public TypeVisitor<Derived>,
71 public TypeLocVisitor<Derived>,
72 public ConstAttrVisitor<Derived>,
73 public ConstTemplateArgumentVisitor<Derived> {
74
75 /// Indicates whether we should trigger deserialization of nodes that had
76 /// not already been loaded.
77 bool Deserialize = false;
78
79 /// Tracks whether we should dump TypeLocs etc.
80 ///
81 /// Detailed location information such as TypeLoc nodes is not usually
82 /// included in the dump (too verbose).
83 /// But when explicitly asked to dump a Loc node, we do so recursively,
84 /// including e.g. FunctionTypeLoc => ParmVarDecl => TypeLoc.
85 bool VisitLocs = false;
86
88
89 NodeDelegateType &getNodeDelegate() {
90 return getDerived().doGetNodeDelegate();
91 }
92 Derived &getDerived() { return *static_cast<Derived *>(this); }
93
94public:
95 void setDeserialize(bool D) { Deserialize = D; }
96 bool getDeserialize() const { return Deserialize; }
97
98 void SetTraversalKind(TraversalKind TK) { Traversal = TK; }
99 TraversalKind GetTraversalKind() const { return Traversal; }
100
101 void Visit(const Decl *D, bool VisitLocs = false) {
102 if (Traversal == TK_IgnoreUnlessSpelledInSource && D && D->isImplicit())
103 return;
104
105 getNodeDelegate().AddChild([=] {
106 getNodeDelegate().Visit(D);
107 if (!D)
108 return;
109
110 {
111 llvm::SaveAndRestore RestoreVisitLocs(this->VisitLocs, VisitLocs);
113 }
114
115 for (const auto &A : D->attrs())
116 Visit(A);
117
118 if (const comments::FullComment *Comment =
120 Visit(Comment, Comment);
121
122 // Decls within functions are visited by the body.
124 if (Traversal != TK_AsIs) {
125 if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
126 auto SK = CTSD->getSpecializationKind();
129 return;
130 }
131 }
132 if (const auto *DC = dyn_cast<DeclContext>(D))
133 dumpDeclContext(DC);
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<Expr>(S)) {
143 switch (Traversal) {
144 case TK_AsIs:
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 // Some statements have custom mechanisms for dumping their children.
161 if (isa<DeclStmt, GenericSelectionExpr, RequiresExpr,
162 OpenACCWaitConstruct, SYCLKernelCallStmt,
163 UnresolvedSYCLKernelCallStmt>(S))
164 return;
165
166 if (Traversal == TK_IgnoreUnlessSpelledInSource &&
167 isa<LambdaExpr, CXXForRangeStmt, CallExpr,
168 CXXRewrittenBinaryOperator>(S))
169 return;
170
171 for (const Stmt *SubStmt : S->children())
172 Visit(SubStmt);
173 });
174 }
175
176 void Visit(QualType T) {
177 SplitQualType SQT = T.split();
178 if (!SQT.Quals.hasQualifiers())
179 return Visit(SQT.Ty);
180
181 getNodeDelegate().AddChild([=] {
182 getNodeDelegate().Visit(T);
183 Visit(T.split().Ty);
184 });
185 }
186
187 void Visit(const Type *T) {
188 getNodeDelegate().AddChild([=] {
189 getNodeDelegate().Visit(T);
190 if (!T)
191 return;
193
194 QualType SingleStepDesugar =
196 if (SingleStepDesugar != QualType(T, 0))
197 Visit(SingleStepDesugar);
198 });
199 }
200
201 void Visit(TypeLoc T) {
202 getNodeDelegate().AddChild([=] {
203 getNodeDelegate().Visit(T);
204 if (T.isNull())
205 return;
207 if (auto Inner = T.getNextTypeLoc())
208 Visit(Inner);
209 });
210 }
211
212 void Visit(const Attr *A) {
213 getNodeDelegate().AddChild([=] {
214 getNodeDelegate().Visit(A);
216 });
217 }
218
220 if (Traversal == TK_IgnoreUnlessSpelledInSource && !Init->isWritten())
221 return;
222 getNodeDelegate().AddChild([=] {
223 getNodeDelegate().Visit(Init);
224 Visit(Init->getInit());
225 });
226 }
227
228 void Visit(const TemplateArgument &A, SourceRange R = {},
229 const Decl *From = nullptr, const char *Label = nullptr) {
230 getNodeDelegate().AddChild([=] {
231 getNodeDelegate().Visit(A, R, From, Label);
233 });
234 }
235
237 getNodeDelegate().AddChild([=] {
238 getNodeDelegate().Visit(C);
239 if (C.hasCopyExpr())
240 Visit(C.getCopyExpr());
241 });
242 }
243
244 void Visit(const OpenACCClause *C) {
245 getNodeDelegate().AddChild([=] {
246 getNodeDelegate().Visit(C);
247 for (const auto *S : C->children())
248 Visit(S);
249 });
250 }
251
252 void Visit(const OMPClause *C) {
253 getNodeDelegate().AddChild([=] {
254 getNodeDelegate().Visit(C);
255 for (const auto *S : C->children())
256 Visit(S);
257 });
258 }
259
261 getNodeDelegate().AddChild([=] {
262 getNodeDelegate().Visit(A);
263 if (const TypeSourceInfo *TSI = A.getTypeSourceInfo())
264 Visit(TSI->getType());
265 Visit(A.getAssociationExpr());
266 });
267 }
268
270 getNodeDelegate().AddChild([=] {
271 getNodeDelegate().Visit(R);
272 if (!R)
273 return;
274 if (auto *TR = dyn_cast<concepts::TypeRequirement>(R)) {
275 if (!TR->isSubstitutionFailure())
276 Visit(TR->getType()->getType().getTypePtr());
277 } else if (auto *ER = dyn_cast<concepts::ExprRequirement>(R)) {
278 if (!ER->isExprSubstitutionFailure())
279 Visit(ER->getExpr());
280 if (!ER->getReturnTypeRequirement().isEmpty())
281 Visit(ER->getReturnTypeRequirement()
282 .getTypeConstraint()
283 ->getImmediatelyDeclaredConstraint());
284 } else if (auto *NR = dyn_cast<concepts::NestedRequirement>(R)) {
285 if (!NR->hasInvalidConstraint())
286 Visit(NR->getConstraintExpr());
287 }
288 });
289 }
290
291 void Visit(const ConceptReference *R) {
292 getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(R); });
293 }
294
295 void Visit(const APValue &Value, QualType Ty) {
296 getNodeDelegate().AddChild([=] { getNodeDelegate().Visit(Value, Ty); });
297 }
298
300 getNodeDelegate().AddChild([=] {
301 getNodeDelegate().Visit(C, FC);
302 if (!C) {
303 return;
304 }
305 comments::ConstCommentVisitor<Derived, void,
307 FC);
308 for (comments::Comment::child_iterator I = C->child_begin(),
309 E = C->child_end();
310 I != E; ++I)
311 Visit(*I, FC);
312 });
313 }
314
315 void Visit(const DynTypedNode &N) {
316 // FIXME: Improve this with a switch or a visitor pattern.
317 if (const auto *D = N.get<Decl>())
318 Visit(D);
319 else if (const auto *S = N.get<Stmt>())
320 Visit(S);
321 else if (const auto *QT = N.get<QualType>())
322 Visit(*QT);
323 else if (const auto *T = N.get<Type>())
324 Visit(T);
325 else if (const auto *TL = N.get<TypeLoc>())
326 Visit(*TL);
327 else if (const auto *C = N.get<CXXCtorInitializer>())
328 Visit(C);
329 else if (const auto *C = N.get<OMPClause>())
330 Visit(C);
331 else if (const auto *T = N.get<TemplateArgument>())
332 Visit(*T);
333 else if (const auto *CR = N.get<ConceptReference>())
334 Visit(CR);
335 }
336
337 void dumpDeclContext(const DeclContext *DC) {
338 if (!DC)
339 return;
340
341 for (const auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
342 Visit(D);
343 }
344
346 if (!TPL)
347 return;
348
349 for (const auto &TP : *TPL)
350 Visit(TP);
351
352 if (const Expr *RC = TPL->getRequiresClause())
353 Visit(RC);
354 }
355
356 void
358 if (!TALI)
359 return;
360
361 for (const auto &TA : TALI->arguments())
363 }
364
366 const Decl *From = nullptr,
367 const char *Label = nullptr) {
368 Visit(A.getArgument(), A.getSourceRange(), From, Label);
369 }
370
372 for (unsigned i = 0, e = TAL.size(); i < e; ++i)
373 Visit(TAL[i]);
374 }
375
376 void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
377 if (!typeParams)
378 return;
379
380 for (const auto &typeParam : *typeParams) {
381 Visit(typeParam);
382 }
383 }
384
385 void VisitComplexType(const ComplexType *T) { Visit(T->getElementType()); }
387 Visit(T->getTypeSourceInfo()->getTypeLoc());
388 }
389 void VisitPointerType(const PointerType *T) { Visit(T->getPointeeType()); }
391 Visit(T->getPointeeType());
392 }
394 Visit(T->getPointeeType());
395 }
397 // FIXME: Provide a NestedNameSpecifier visitor.
398 NestedNameSpecifier Qualifier = T->getQualifier();
399 if (NestedNameSpecifier::Kind K = Qualifier.getKind();
401 Visit(Qualifier.getAsType());
402 if (T->isSugared())
403 Visit(cast<MemberPointerType>(T->getCanonicalTypeUnqualified())
404 ->getQualifier()
405 .getAsType());
406 Visit(T->getPointeeType());
407 }
408 void VisitArrayType(const ArrayType *T) { Visit(T->getElementType()); }
411 Visit(T->getSizeExpr());
412 }
414 Visit(T->getElementType());
415 Visit(T->getSizeExpr());
416 }
418 Visit(T->getElementType());
419 Visit(T->getSizeExpr());
420 }
421 void VisitVectorType(const VectorType *T) { Visit(T->getElementType()); }
422 void VisitFunctionType(const FunctionType *T) { Visit(T->getReturnType()); }
425 for (const QualType &PT : T->getParamTypes())
426 Visit(PT);
427 }
429 Visit(T->getUnderlyingExpr());
430 }
431 void VisitDecltypeType(const DecltypeType *T) {
432 Visit(T->getUnderlyingExpr());
433 }
434
435 void VisitPackIndexingType(const PackIndexingType *T) {
436 Visit(T->getPattern());
437 Visit(T->getIndexExpr());
438 }
439
440 void VisitUnaryTransformType(const UnaryTransformType *T) {
441 Visit(T->getBaseType());
442 }
443 void VisitAttributedType(const AttributedType *T) {
444 // FIXME: AttrKind
445 if (T->getModifiedType() != T->getEquivalentType())
446 Visit(T->getModifiedType());
447 }
448 void VisitBTFTagAttributedType(const BTFTagAttributedType *T) {
449 Visit(T->getWrappedType());
450 }
451 void VisitOverflowBehaviorType(const OverflowBehaviorType *T) {
452 Visit(T->getUnderlyingType());
453 }
454 void VisitHLSLAttributedResourceType(const HLSLAttributedResourceType *T) {
455 QualType Contained = T->getContainedType();
456 if (!Contained.isNull())
457 Visit(Contained);
458 }
459 void VisitHLSLInlineSpirvType(const HLSLInlineSpirvType *T) {
460 for (auto &Operand : T->getOperands()) {
461 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
462
463 switch (Operand.getKind()) {
464 case SpirvOperandKind::ConstantId:
465 case SpirvOperandKind::Literal:
466 break;
467
468 case SpirvOperandKind::TypeId:
469 Visit(Operand.getResultType());
470 break;
471
472 default:
473 llvm_unreachable("Invalid SpirvOperand kind!");
474 }
475 }
476 }
477 void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *) {}
478 void
479 VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T) {
480 Visit(T->getArgumentPack());
481 }
482 void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
483 for (const auto &Arg : T->template_arguments())
484 Visit(Arg);
485 }
487 Visit(T->getPointeeType());
488 }
489 void VisitAtomicType(const AtomicType *T) { Visit(T->getValueType()); }
490 void VisitPipeType(const PipeType *T) { Visit(T->getElementType()); }
491 void VisitAdjustedType(const AdjustedType *T) { Visit(T->getOriginalType()); }
492 void VisitPackExpansionType(const PackExpansionType *T) {
493 if (!T->isSugared())
494 Visit(T->getPattern());
495 }
496 void VisitAutoType(const AutoType *T) {
497 for (const auto &Arg : T->getTypeConstraintArguments())
498 Visit(Arg);
499 }
500 // FIXME: ElaboratedType, DependentNameType,
501 // DependentTemplateSpecializationType, ObjCObjectType
502
503 // For TypeLocs, we automatically visit the inner type loc (pointee type etc).
504 // We must explicitly visit other lexically-nested nodes.
507 for (const auto *Param : TL.getParams())
508 Visit(Param, /*VisitTypeLocs=*/true);
509 }
511 if (const auto *CR = TL.getConceptReference()) {
512 if (auto *Args = CR->getTemplateArgsAsWritten())
513 for (const auto &Arg : Args->arguments())
515 }
516 }
518 // FIXME: Provide NestedNamespecifierLoc visitor.
520 }
533 void VisitDecltypeType(DecltypeType TL) {
534 Visit(TL.getUnderlyingExpr());
535 }
537 for (unsigned I=0, N=TL.getNumArgs(); I < N; ++I)
539 }
540
542
544 if (const Expr *Init = D->getInitExpr())
545 Visit(Init);
546 }
547
551 dumpTemplateArgumentList(*FTSI->TemplateArguments);
554 dumpASTTemplateArgumentListInfo(DFTSI->TemplateArgumentsAsWritten);
555
556 if (D->param_begin())
557 for (const auto *Parameter : D->parameters())
559
561 Visit(TRC.ConstraintExpr);
562
563 if (Traversal == TK_IgnoreUnlessSpelledInSource && D->isDefaulted())
564 return;
565
566 if (const auto *C = dyn_cast<CXXConstructorDecl>(D))
567 for (const auto *I : C->inits())
568 Visit(I);
569
571 Visit(D->getBody());
572 }
573
574 void VisitFieldDecl(const FieldDecl *D) {
575 if (D->isBitField())
576 Visit(D->getBitWidth());
577 if (Expr *Init = D->getInClassInitializer())
578 Visit(Init);
579 }
580
581 void VisitVarDecl(const VarDecl *D) {
582 if (Traversal == TK_IgnoreUnlessSpelledInSource && D->isCXXForRangeDecl())
583 return;
584
585 if (const auto *TSI = D->getTypeSourceInfo(); VisitLocs && TSI)
586 Visit(TSI->getTypeLoc());
587 if (D->hasInit())
588 Visit(D->getInit());
589 }
590
592 VisitVarDecl(D);
593 for (const auto *B : D->bindings())
594 Visit(B);
595 }
596
598 if (Traversal == TK_IgnoreUnlessSpelledInSource)
599 return;
600
601 if (const auto *V = D->getHoldingVar())
602 Visit(V);
603
604 if (const auto *E = D->getBinding())
605 Visit(E);
606 }
607
611
613
615 for (const ImplicitParamDecl *Parameter : D->parameters())
617 Visit(D->getBody());
618 }
619
620 void VisitCapturedDecl(const CapturedDecl *D) { Visit(D->getBody()); }
621
623 for (const auto *E : D->varlist())
624 Visit(E);
625 }
626
628 for (const auto *E : D->varlist())
629 Visit(E);
630 }
631
633 Visit(D->getCombiner());
634 if (const auto *Initializer = D->getInitializer())
636 }
637
639 for (const auto *C : D->clauselists())
640 Visit(C);
641 }
642
646
648 for (const auto *E : D->varlist())
649 Visit(E);
650 for (const auto *C : D->clauselists())
651 Visit(C);
652 }
653
654 template <typename SpecializationDecl>
655 void dumpTemplateDeclSpecialization(const SpecializationDecl *D) {
656 for (const auto *Redecl : D->redecls())
658 }
659
660 template <typename TemplateDecl>
663
665
666 if (Traversal == TK_AsIs) {
667 for (const auto *Child : D->specializations())
669 }
670 }
671
674 }
675
680
682 Visit(D->getAssertExpr());
683 Visit(D->getMessage());
684 }
685
687 if (TypeSourceInfo *TSI = D->getTypeAsWritten())
688 Visit(TSI->getTypeLoc());
689 for (unsigned I = 0, E = D->getNumTemplateArgs(); I != E; ++I) {
691 Visit(Loc.getArgument(), Loc.getSourceRange());
692 }
693 }
694
698
702
707
713
715
719
720 void
725
731
733 if (const auto *TC = D->getTypeConstraint())
734 Visit(TC->getImmediatelyDeclaredConstraint());
735 if (D->hasDefaultArgument())
738 D->defaultArgumentWasInherited() ? "inherited from" : "previous");
739 }
740
742 if (const auto *E = D->getPlaceholderTypeConstraint())
743 Visit(E);
744 if (D->hasDefaultArgument())
747 D->defaultArgumentWasInherited() ? "inherited from" : "previous");
748 }
749
757
762
768
771 if (CSE->hasExplicitTemplateArgs())
772 for (const auto &ArgLoc : CSE->getTemplateArgsAsWritten()->arguments())
774 }
775
777 Visit(D->getTargetDecl());
778 }
779
781 if (D->getFriendType()) {
782 // Traverse any CXXRecordDecl owned by this type, since
783 // it will not be in the parent context:
784 if (auto *TT = D->getFriendType()->getType()->getAs<TagType>())
785 if (TT->isTagOwned())
786 Visit(TT->getDecl());
787 } else {
788 Visit(D->getFriendDecl());
789 }
790 }
791
795 else
796 for (const ParmVarDecl *Parameter : D->parameters())
798
799 if (D->hasBody())
800 Visit(D->getBody());
801 }
802
806
810
812 for (const auto &I : D->inits())
813 Visit(I);
814 }
815
816 void VisitBlockDecl(const BlockDecl *D) {
817 for (const auto &I : D->parameters())
818 Visit(I);
819
820 for (const auto &I : D->captures())
821 Visit(I);
822 Visit(D->getBody());
823 }
824
825 void VisitDeclStmt(const DeclStmt *Node) {
826 for (const auto &D : Node->decls())
827 Visit(D);
828 }
829
831 for (const auto *A : Node->getAttrs())
832 Visit(A);
833 }
834
835 void VisitLabelStmt(const LabelStmt *Node) {
836 if (Node->getDecl()->hasAttrs()) {
837 for (const auto *A : Node->getDecl()->getAttrs())
838 Visit(A);
839 }
840 }
841
842 void VisitCXXCatchStmt(const CXXCatchStmt *Node) {
843 Visit(Node->getExceptionDecl());
844 }
845
846 void VisitCapturedStmt(const CapturedStmt *Node) {
847 Visit(Node->getCapturedDecl());
848 }
849
851 Visit(Node->getOriginalStmt());
852 if (Traversal != TK_IgnoreUnlessSpelledInSource) {
853 Visit(Node->getKernelLaunchStmt());
855 }
856 }
857
858 void
864
866 for (const auto *C : Node->clauses())
867 Visit(C);
868 }
869
871 for (const auto *C : Node->clauses())
872 Visit(C);
873 }
874
876 // Needs custom child checking to put clauses AFTER the children, which are
877 // the expressions in the 'wait' construct. Others likely need this as well,
878 // and might need to do the associated statement after it.
879 for (const Stmt *S : Node->children())
880 Visit(S);
881 for (const auto *C : Node->clauses())
882 Visit(C);
883 }
884
886 if (auto *Filler = ILE->getArrayFiller()) {
887 Visit(Filler, "array_filler");
888 }
889 }
890
892 if (auto *Filler = PLIE->getArrayFiller()) {
893 Visit(Filler, "array_filler");
894 }
895 }
896
897 void VisitBlockExpr(const BlockExpr *Node) { Visit(Node->getBlockDecl()); }
898
900 if (Expr *Source = Node->getSourceExpr())
901 Visit(Source);
902 }
903
905 if (E->isExprPredicate()) {
907 Visit(E->getControllingExpr()->getType()); // FIXME: remove
908 } else
910
911 for (const auto Assoc : E->associations()) {
912 Visit(Assoc);
913 }
914 }
915
918 for (auto Arg : E->template_arguments())
919 Visit(Arg.getArgument());
920 }
921
923 for (auto *D : E->getLocalParameters())
924 Visit(D);
925 for (auto *R : E->getRequirements())
926 Visit(R);
927 }
928
930 // Argument types are not children of the TypeTraitExpr.
931 for (auto *A : E->getArgs())
932 Visit(A->getType());
933 }
934
935 void VisitLambdaExpr(const LambdaExpr *Node) {
936 if (Traversal == TK_IgnoreUnlessSpelledInSource) {
937 for (unsigned I = 0, N = Node->capture_size(); I != N; ++I) {
938 const auto *C = Node->capture_begin() + I;
939 if (!C->isExplicit())
940 continue;
941 if (Node->isInitCapture(C))
942 Visit(C->getCapturedVar());
943 else
944 Visit(Node->capture_init_begin()[I]);
945 }
947 for (const auto *P : Node->getCallOperator()->parameters())
948 Visit(P);
949 Visit(Node->getBody());
950 } else {
951 return Visit(Node->getLambdaClass());
952 }
953 }
954
956 if (Node->isPartiallySubstituted())
957 for (const auto &A : Node->getPartialArguments())
958 Visit(A);
959 }
960
969
971 if (const VarDecl *CatchParam = Node->getCatchParamDecl())
972 Visit(CatchParam);
973 }
974
976 if (Traversal == TK_IgnoreUnlessSpelledInSource) {
977 Visit(Node->getInit());
978 Visit(Node->getLoopVariable());
979 Visit(Node->getRangeInit());
980 Visit(Node->getBody());
981 }
982 }
983
984 void VisitCallExpr(const CallExpr *Node) {
985 for (const auto *Child :
986 make_filter_range(Node->children(), [this](const Stmt *Child) {
987 if (Traversal != TK_IgnoreUnlessSpelledInSource)
988 return false;
989 return !isa<CXXDefaultArgExpr>(Child);
990 })) {
991 Visit(Child);
992 }
993 }
994
996 if (Traversal == TK_IgnoreUnlessSpelledInSource) {
997 Visit(Node->getLHS());
998 Visit(Node->getRHS());
999 } else {
1001 }
1002 }
1003
1007
1009 Visit(TA.getAsType());
1010 }
1011
1013 for (const auto &TArg : TA.pack_elements())
1014 Visit(TArg);
1015 }
1016
1018 Visit(Node->getExpr());
1019 }
1020
1022 Visit(Node->getExpr());
1023 }
1024
1025 // Implements Visit methods for Attrs.
1026#include "clang/AST/AttrNodeTraverse.inc"
1027};
1028
1029} // namespace clang
1030
1031#endif // LLVM_CLANG_AST_ASTNODETRAVERSER_H
#define V(N, I)
C Language Family Type Representation.
child_range children()
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
ASTNodeTraverser traverses the Clang AST for dumping purposes.
void VisitSubstNonTypeTemplateParmPackExpr(const SubstNonTypeTemplateParmPackExpr *E)
void VisitDeclStmt(const DeclStmt *Node)
void VisitFunctionType(const FunctionType *T)
void VisitCapturedDecl(const CapturedDecl *D)
void VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node)
void Visit(const BlockDecl::Capture &C)
void VisitAdjustedType(const AdjustedType *T)
void VisitUnresolvedSYCLKernelCallStmt(const UnresolvedSYCLKernelCallStmt *Node)
void VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL)
void VisitSizeOfPackExpr(const SizeOfPackExpr *Node)
void VisitMemberPointerType(const MemberPointerType *T)
void VisitDependentSizedArrayType(const DependentSizedArrayType *T)
void VisitTypeOfExprType(const TypeOfExprType *T)
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *E)
void VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *Node)
void VisitExplicitInstantiationDecl(const ExplicitInstantiationDecl *D)
void VisitLocInfoType(const LocInfoType *T)
void dumpTemplateDeclSpecialization(const SpecializationDecl *D)
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *Node)
void VisitHLSLInlineSpirvType(const HLSLInlineSpirvType *T)
void Visit(const comments::Comment *C, const comments::FullComment *FC)
void VisitDependentSizedArrayTypeLoc(DependentSizedArrayTypeLoc TL)
void VisitClassTemplateSpecializationDecl(const ClassTemplateSpecializationDecl *D)
void VisitBlockDecl(const BlockDecl *D)
void VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL)
void VisitObjCImplementationDecl(const ObjCImplementationDecl *D)
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D)
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node)
void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL)
void VisitPackIndexingType(const PackIndexingType *T)
void VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D)
void VisitCXXParenListInitExpr(const CXXParenListInitExpr *PLIE)
void dumpTemplateArgumentList(const TemplateArgumentList &TAL)
void Visit(const OMPClause *C)
void VisitImplicitConceptSpecializationDecl(const ImplicitConceptSpecializationDecl *CSD)
void VisitReferenceType(const ReferenceType *T)
void VisitBlockExpr(const BlockExpr *Node)
void VisitDecltypeType(DecltypeType TL)
void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D)
void VisitStaticAssertDecl(const StaticAssertDecl *D)
void VisitBlockPointerType(const BlockPointerType *T)
void VisitFieldDecl(const FieldDecl *D)
void VisitAttributedStmt(const AttributedStmt *Node)
void Visit(const Type *T)
void VisitPipeType(const PipeType *T)
void Visit(const Attr *A)
void VisitInitListExpr(const InitListExpr *ILE)
void VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node)
void VisitVarTemplateDecl(const VarTemplateDecl *D)
void VisitPackExpansionType(const PackExpansionType *T)
void VisitBTFTagAttributedType(const BTFTagAttributedType *T)
void VisitOverflowBehaviorType(const OverflowBehaviorType *T)
void VisitTypeAliasDecl(const TypeAliasDecl *D)
void VisitDecompositionDecl(const DecompositionDecl *D)
void VisitObjCMethodDecl(const ObjCMethodDecl *D)
void VisitClassTemplateDecl(const ClassTemplateDecl *D)
void Visit(const Decl *D, bool VisitLocs=false)
void SetTraversalKind(TraversalKind TK)
void Visit(const concepts::Requirement *R)
void VisitLabelStmt(const LabelStmt *Node)
void VisitTypeTraitExpr(const TypeTraitExpr *E)
void VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D)
void VisitComplexType(const ComplexType *T)
void dumpDeclContext(const DeclContext *DC)
void VisitUsingShadowDecl(const UsingShadowDecl *D)
void dumpObjCTypeParamList(const ObjCTypeParamList *typeParams)
void VisitVarTemplateSpecializationDecl(const VarTemplateSpecializationDecl *D)
void Visit(const DynTypedNode &N)
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
void VisitOMPGroupPrivateDecl(const OMPGroupPrivateDecl *D)
void dumpTemplateDecl(const TemplateDecl *D)
void VisitHLSLAttributedResourceType(const HLSLAttributedResourceType *T)
void VisitVectorType(const VectorType *T)
void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A, const Decl *From=nullptr, const char *Label=nullptr)
void Visit(const OpenACCClause *C)
void VisitCXXCatchStmt(const CXXCatchStmt *Node)
void VisitClassTemplatePartialSpecializationDecl(const ClassTemplatePartialSpecializationDecl *D)
void VisitTypedefDecl(const TypedefDecl *D)
void Visit(const ConceptReference *R)
void VisitBindingDecl(const BindingDecl *D)
void Visit(const APValue &Value, QualType Ty)
void VisitVariableArrayTypeLoc(VariableArrayTypeLoc TL)
void VisitRequiresExpr(const RequiresExpr *E)
void VisitGenericSelectionExpr(const GenericSelectionExpr *E)
void VisitSubstTemplateTypeParmPackType(const SubstTemplateTypeParmPackType *T)
void VisitOpaqueValueExpr(const OpaqueValueExpr *Node)
void VisitArrayType(const ArrayType *T)
void Visit(const CXXCtorInitializer *Init)
void VisitVarDecl(const VarDecl *D)
void VisitVarTemplatePartialSpecializationDecl(const VarTemplatePartialSpecializationDecl *D)
void VisitFileScopeAsmDecl(const FileScopeAsmDecl *D)
void VisitAutoType(const AutoType *T)
void VisitFunctionProtoType(const FunctionProtoType *T)
void VisitUnaryTransformType(const UnaryTransformType *T)
void VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL)
void VisitLambdaExpr(const LambdaExpr *Node)
void VisitCallExpr(const CallExpr *Node)
void VisitDecltypeType(const DecltypeType *T)
void VisitMemberPointerTypeLoc(MemberPointerTypeLoc TL)
void VisitOMPExecutableDirective(const OMPExecutableDirective *Node)
void VisitEnumConstantDecl(const EnumConstantDecl *D)
void VisitTemplateSpecializationType(const TemplateSpecializationType *T)
void VisitAtomicType(const AtomicType *T)
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T)
void Visit(const Stmt *Node, StringRef Label={})
void VisitOutlinedFunctionDecl(const OutlinedFunctionDecl *D)
void Visit(const GenericSelectionExpr::ConstAssociation &A)
void VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D)
void VisitConceptDecl(const ConceptDecl *D)
void VisitTopLevelStmtDecl(const TopLevelStmtDecl *D)
void dumpASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *TALI)
void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *CSE)
void VisitVariableArrayType(const VariableArrayType *T)
void VisitTypeTemplateArgument(const TemplateArgument &TA)
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D)
void VisitOMPAllocateDecl(const OMPAllocateDecl *D)
void VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
void VisitCapturedStmt(const CapturedStmt *Node)
void VisitFriendDecl(const FriendDecl *D)
void VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E)
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D)
void VisitCXXForRangeStmt(const CXXForRangeStmt *Node)
void VisitOMPDeclareMapperDecl(const OMPDeclareMapperDecl *D)
void VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
void VisitAttributedType(const AttributedType *T)
void Visit(const TemplateArgument &A, SourceRange R={}, const Decl *From=nullptr, const char *Label=nullptr)
void VisitPackTemplateArgument(const TemplateArgument &TA)
TraversalKind GetTraversalKind() const
void VisitObjCCategoryDecl(const ObjCCategoryDecl *D)
void VisitAutoTypeLoc(AutoTypeLoc TL)
void VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *)
void VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *Node)
void VisitSYCLKernelCallStmt(const SYCLKernelCallStmt *Node)
void dumpTemplateParameters(const TemplateParameterList *TPL)
void VisitFunctionDecl(const FunctionDecl *D)
void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D)
void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D)
void VisitPointerType(const PointerType *T)
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Definition TypeBase.h:3544
Expr * getSizeExpr() const
Definition TypeLoc.h:1799
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition TypeBase.h:3777
Attr - This represents one attribute.
Definition Attr.h:46
Represents an attribute applied to a statement.
Definition Stmt.h:2209
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2241
ConceptReference * getConceptReference() const
Definition TypeLoc.h:2407
A binding in a decomposition declaration.
Definition DeclCXX.h:4190
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Definition DeclCXX.cpp:3710
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition DeclCXX.h:4216
A class which contains all the information about a particular captured value.
Definition Decl.h:4696
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4690
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition Decl.h:4769
ArrayRef< Capture > captures() const
Definition Decl.h:4817
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:4776
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition Expr.h:6673
const BlockDecl * getBlockDecl() const
Definition Expr.h:6685
Pointer to a block type.
Definition TypeBase.h:3597
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
CXXCatchStmt - This represents a C++ catch block.
Definition StmtCXX.h:28
VarDecl * getExceptionDecl() const
Definition StmtCXX.h:49
Represents a C++ base or member initializer.
Definition DeclCXX.h:2385
A default argument (C++ [dcl.fct.default]).
Definition ExprCXX.h:1274
A use of a default initializer in a constructor or in aggregate initialization.
Definition ExprCXX.h:1381
Expr * getExpr()
Get the initialization expression that will be used.
Definition ExprCXX.cpp:1107
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition StmtCXX.h:135
VarDecl * getLoopVariable()
Definition StmtCXX.cpp:77
Represents a list-initialization with parenthesis.
Definition ExprCXX.h:5141
A rewritten comparison expression that was originally written using operator syntax.
Definition ExprCXX.h:290
const Expr * getLHS() const
Definition ExprCXX.h:339
const Expr * getRHS() const
Definition ExprCXX.h:340
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2946
child_range children()
Definition Expr.h:3349
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4962
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition Decl.cpp:5698
This captures a statement into a function.
Definition Stmt.h:3943
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition Stmt.cpp:1493
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.
Definition TypeBase.h:3330
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
A reference to a concept and its template args, as it appears in the code.
Definition ASTConcept.h:130
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
const ImplicitConceptSpecializationDecl * getSpecializationDecl() const
A simple visitor class that helps create attribute visitors.
Definition AttrVisitor.h:71
A simple visitor class that helps create declaration visitors.
Definition DeclVisitor.h:75
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...
Definition DeclBase.h:1462
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
Definition DeclBase.h:2394
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition DeclBase.h:2386
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1637
decl_range decls()
Definition Stmt.h:1685
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
bool hasAttrs() const
Definition DeclBase.h:526
ASTContext & getASTContext() const LLVM_READONLY
Definition DeclBase.cpp:547
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition DeclBase.h:601
attr_range attrs() const
Definition DeclBase.h:543
AttrVec & getAttrs()
Definition DeclBase.h:532
const AssociatedConstraint & getTrailingRequiresClause() const
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
Definition Decl.h:855
TypeSourceInfo * getTypeSourceInfo() const
Definition Decl.h:809
A decomposition declaration.
Definition DeclCXX.h:4254
ArrayRef< BindingDecl * > bindings() const
Definition DeclCXX.h:4292
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.
Definition TypeBase.h:4066
Represents an extended vector type where either the type or size is dependent.
Definition TypeBase.h:4156
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.
Definition Decl.h:3441
const Expr * getInitExpr() const
Definition Decl.h:3459
Represents an explicit instantiation of a template entity in source code.
TypeSourceInfo * getTypeAsWritten() const
For function / variable templates, returns the declared type (return type or variable type).
TemplateArgumentLoc getTemplateArg(unsigned I) const
unsigned getNumTemplateArgs() const
Number of explicit template arguments, regardless of storage.
This represents one expression.
Definition Expr.h:112
QualType getType() const
Definition Expr.h:144
Represents a member of a struct/union/class.
Definition Decl.h:3178
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Definition Decl.cpp:4720
bool isBitField() const
Determines whether this field is a bitfield.
Definition Decl.h:3281
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition Decl.h:3294
const Expr * getAsmStringExpr() const
Definition Decl.h:4638
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition DeclFriend.h:54
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition DeclFriend.h:139
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition DeclFriend.h:125
Represents a function declaration or definition.
Definition Decl.h:2018
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition Decl.cpp:3274
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:2792
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition Decl.cpp:4318
param_iterator param_begin()
Definition Decl.h:2804
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition Decl.h:2344
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition Decl.cpp:4384
bool isDefaulted() const
Whether this function is defaulted.
Definition Decl.h:2403
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5362
Declaration of a template function.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
ArrayRef< ParmVarDecl * > getParams() const
Definition TypeLoc.h:1707
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition TypeBase.h:4558
Represents a C11 generic selection.
Definition Expr.h:6183
TypeSourceInfo * getControllingType()
Return the controlling type of this generic selection expression.
Definition Expr.h:6460
bool isExprPredicate() const
Whether this generic selection uses an expression as its controlling argument.
Definition Expr.h:6441
association_range associations()
Definition Expr.h:6516
AssociationTy< true > ConstAssociation
Definition Expr.h:6417
Expr * getControllingExpr()
Return the controlling expression of this generic selection expression.
Definition Expr.h:6448
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes an C or C++ initializer list.
Definition Expr.h:5302
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Definition Expr.h:5402
LabelStmt - Represents a label, which has a substatement.
Definition Stmt.h:2152
LabelDecl * getDecl() const
Definition Stmt.h:2170
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition ExprCXX.h:1972
capture_iterator capture_begin() const
Retrieve an iterator pointing to the first lambda capture.
Definition ExprCXX.cpp:1365
Stmt * getBody() const
Retrieve the body of the lambda.
Definition ExprCXX.cpp:1348
unsigned capture_size() const
Determine the number of captures in this lambda.
Definition ExprCXX.h:2053
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
Definition ExprCXX.cpp:1360
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Definition ExprCXX.cpp:1406
TemplateParameterList * getTemplateParameterList() const
If this is a generic lambda expression, retrieve the template parameter list associated with it,...
Definition ExprCXX.cpp:1416
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
Definition ExprCXX.h:2098
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Definition ExprCXX.cpp:1402
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
Definition LocInfoType.h:28
Wrapper for source info for member pointers.
Definition TypeLoc.h:1544
NestedNameSpecifierLoc getQualifierLoc() const
Definition TypeLoc.h:1554
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition TypeBase.h:3708
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Kind
The kind of specifier that completes this nested name specifier.
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.
Definition DeclOpenMP.h:536
clauselist_range clauselists()
Definition DeclOpenMP.h:589
varlist_range varlist()
Definition DeclOpenMP.h:578
Pseudo declaration for capturing expressions.
Definition DeclOpenMP.h:445
This is a basic class for representing single OpenMP clause.
This represents 'pragma omp declare mapper ...' directive.
Definition DeclOpenMP.h:349
clauselist_range clauselists()
Definition DeclOpenMP.h:395
This represents 'pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:239
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition DeclOpenMP.h:300
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition DeclOpenMP.h:282
This represents 'pragma omp groupprivate ...' directive.
Definition DeclOpenMP.h:173
varlist_range varlist()
Definition DeclOpenMP.h:208
This represents 'pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Represents Objective-C's @catch statement.
Definition StmtObjC.h:77
const VarDecl * getCatchParamDecl() const
Definition StmtObjC.h:97
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2329
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Definition DeclObjC.h:2377
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2597
Represents an ObjC class declaration.
Definition DeclObjC.h:1154
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class.
Definition DeclObjC.h:1303
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:140
bool hasBody() const override
Determine whether this method has a body.
Definition DeclObjC.h:523
ArrayRef< ParmVarDecl * > parameters() const
Definition DeclObjC.h:373
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition DeclObjC.cpp:906
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition DeclObjC.h:534
Represents a pointer to an Objective C object.
Definition TypeBase.h:8054
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition DeclObjC.h:662
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition Expr.h:1181
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition Expr.h:1231
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...
Definition StmtOpenACC.h:26
ArrayRef< const OpenACCClause * > clauses() const
Definition StmtOpenACC.h:67
Represents a partial function definition.
Definition Decl.h:4897
parameter_const_range parameters() const
Definition Decl.h:4941
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition Decl.cpp:5672
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition ExprCXX.h:3284
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition ExprCXX.h:3337
Represents a parameter to a function.
Definition Decl.h:1808
PipeType - OpenCL20.
Definition TypeBase.h:8254
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition TypeBase.h:3383
A (possibly-)qualified type.
Definition TypeBase.h:937
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition TypeBase.h:1004
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Definition TypeBase.h:646
Base for LValueReferenceType and RValueReferenceType.
Definition TypeBase.h:3628
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...
Definition StmtSYCL.h:36
CompoundStmt * getOriginalStmt()
Definition StmtSYCL.h:54
OutlinedFunctionDecl * getOutlinedFunctionDecl()
Definition StmtSYCL.h:66
Represents an expression that computes the length of a parameter pack.
Definition ExprCXX.h:4441
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
Definition ExprCXX.h:4526
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition ExprCXX.h:4531
A trivial tuple used to represent a source range.
Represents a C++11 static_assert declaration.
Definition DeclCXX.h:4141
Stmt - This represents one statement.
Definition Stmt.h:86
child_range children()
Definition Stmt.cpp:304
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition ExprCXX.h:4664
NonTypeTemplateParmDecl * getParameter() const
Definition ExprCXX.cpp:1730
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition ExprCXX.h:4754
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition ExprCXX.cpp:1799
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Definition ExprCXX.cpp:1794
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.
TemplateArgumentLoc getArgLoc(unsigned i) const
Definition TypeLoc.h:1917
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.
Definition Decl.h:4653
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3706
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.
Definition TypeLoc.h:59
QualType getType() const
Get the type for which this source info wrapper provides information.
Definition TypeLoc.h:133
Expr * getUnderlyingExpr() const
Definition TypeLoc.h:2244
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Definition TypeBase.h:6273
A container of type source information.
Definition TypeBase.h:8407
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8418
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition ExprCXX.h:2900
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
Definition ExprCXX.h:2971
An operation on a type.
Definition TypeVisitor.h:64
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition TypeVisitor.h:68
The base class of the type hierarchy.
Definition TypeBase.h:1871
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition Type.cpp:558
const T * getAs() const
Member-template getAs<specific type>'.
Definition TypeBase.h:9266
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3685
QualType getUnderlyingType() const
Definition Decl.h:3635
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3390
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3404
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition DeclCXX.h:3468
Represents a variable declaration or definition.
Definition Decl.h:924
bool hasInit() const
Definition Decl.cpp:2377
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition Decl.h:1535
const Expr * getInit() const
Definition Decl.h:1381
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.
Definition TypeBase.h:4021
Represents a GCC generic vector type.
Definition TypeBase.h:4230
Any part of the comment.
Definition Comment.h:66
Comment *const * child_iterator
Definition Comment.h:257
A full comment attached to a declaration, contains block content.
Definition Comment.h:1104
A static requirement that can be used in a requires-expression to check properties of types and expre...
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
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.
Definition TypeBase.h:908
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition Specifiers.h:207
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition Specifiers.h:203
U cast(CodeGen::Address addr)
Definition Address.h:327
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
ArrayRef< TemplateArgumentLoc > arguments() const
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition TypeBase.h:870
const Type * Ty
The locally-unqualified type.
Definition TypeBase.h:872
Qualifiers Quals
The local qualifiers.
Definition TypeBase.h:875