clang 10.0.0git

RecursiveASTVisitor.h
Go to the documentation of this file.
1 //===--- RecursiveASTVisitor.h - Recursive AST Visitor ----------*- C++ -*-===//
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 defines the RecursiveASTVisitor interface, which recursively
10 // traverses the entire AST.
11 //
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
14 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
15
16 #include "clang/AST/Attr.h"
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclarationName.h"
19 #include "clang/AST/DeclBase.h"
20 #include "clang/AST/DeclCXX.h"
21 #include "clang/AST/DeclFriend.h"
22 #include "clang/AST/DeclObjC.h"
23 #include "clang/AST/DeclOpenMP.h"
24 #include "clang/AST/DeclTemplate.h"
25 #include "clang/AST/Expr.h"
26 #include "clang/AST/ExprConcepts.h"
27 #include "clang/AST/ExprCXX.h"
28 #include "clang/AST/ExprObjC.h"
29 #include "clang/AST/ExprOpenMP.h"
30 #include "clang/AST/LambdaCapture.h"
31 #include "clang/AST/NestedNameSpecifier.h"
32 #include "clang/AST/OpenMPClause.h"
33 #include "clang/AST/Stmt.h"
34 #include "clang/AST/StmtCXX.h"
35 #include "clang/AST/StmtObjC.h"
36 #include "clang/AST/StmtOpenMP.h"
37 #include "clang/AST/TemplateBase.h"
38 #include "clang/AST/TemplateName.h"
39 #include "clang/AST/Type.h"
40 #include "clang/AST/TypeLoc.h"
41 #include "clang/Basic/LLVM.h"
42 #include "clang/Basic/OpenMPKinds.h"
43 #include "clang/Basic/Specifiers.h"
44 #include "llvm/ADT/PointerIntPair.h"
45 #include "llvm/ADT/SmallVector.h"
46 #include "llvm/Support/Casting.h"
47 #include <algorithm>
48 #include <cstddef>
49 #include <type_traits>
50
51 // The following three macros are used for meta programming. The code
52 // using them is responsible for defining macro OPERATOR().
53
54 // All unary operators.
55 #define UNARYOP_LIST() \
56 OPERATOR(PostInc) OPERATOR(PostDec) OPERATOR(PreInc) OPERATOR(PreDec) \
57 OPERATOR(AddrOf) OPERATOR(Deref) OPERATOR(Plus) OPERATOR(Minus) \
58 OPERATOR(Not) OPERATOR(LNot) OPERATOR(Real) OPERATOR(Imag) \
59 OPERATOR(Extension) OPERATOR(Coawait)
60
61 // All binary operators (excluding compound assign operators).
62 #define BINOP_LIST() \
63 OPERATOR(PtrMemD) OPERATOR(PtrMemI) OPERATOR(Mul) OPERATOR(Div) \
64 OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) OPERATOR(Shl) OPERATOR(Shr) \
65 OPERATOR(LT) OPERATOR(GT) OPERATOR(LE) OPERATOR(GE) OPERATOR(EQ) \
66 OPERATOR(NE) OPERATOR(Cmp) OPERATOR(And) OPERATOR(Xor) OPERATOR(Or) \
67 OPERATOR(LAnd) OPERATOR(LOr) OPERATOR(Assign) OPERATOR(Comma)
68
69 // All compound assign operators.
70 #define CAO_LIST() \
71 OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) \
72 OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or) OPERATOR(Xor)
73
74 namespace clang {
75
76 // A helper macro to implement short-circuiting when recursing. It
77 // invokes CALL_EXPR, which must be a method call, on the derived
78 // object (s.t. a user of RecursiveASTVisitor can override the method
79 // in CALL_EXPR).
80 #define TRY_TO(CALL_EXPR) \
81 do { \
82 if (!getDerived().CALL_EXPR) \
83 return false; \
84 } while (false)
85
86 /// A class that does preorder or postorder
87 /// depth-first traversal on the entire Clang AST and visits each node.
88 ///
89 /// This class performs three distinct tasks:
90 /// 1. traverse the AST (i.e. go to each node);
91 /// 2. at a given node, walk up the class hierarchy, starting from
92 /// the node's dynamic type, until the top-most class (e.g. Stmt,
93 /// Decl, or Type) is reached.
94 /// 3. given a (node, class) combination, where 'class' is some base
95 /// class of the dynamic type of 'node', call a user-overridable
96 /// function to actually visit the node.
97 ///
98 /// These tasks are done by three groups of methods, respectively:
99 /// 1. TraverseDecl(Decl *x) does task #1. It is the entry point
100 /// for traversing an AST rooted at x. This method simply
101 /// dispatches (i.e. forwards) to TraverseFoo(Foo *x) where Foo
102 /// is the dynamic type of *x, which calls WalkUpFromFoo(x) and
103 /// then recursively visits the child nodes of x.
104 /// TraverseStmt(Stmt *x) and TraverseType(QualType x) work
105 /// similarly.
106 /// 2. WalkUpFromFoo(Foo *x) does task #2. It does not try to visit
107 /// any child node of x. Instead, it first calls WalkUpFromBar(x)
108 /// where Bar is the direct parent class of Foo (unless Foo has
109 /// no parent), and then calls VisitFoo(x) (see the next list item).
110 /// 3. VisitFoo(Foo *x) does task #3.
111 ///
112 /// These three method groups are tiered (Traverse* > WalkUpFrom* >
113 /// Visit*). A method (e.g. Traverse*) may call methods from the same
114 /// tier (e.g. other Traverse*) or one tier lower (e.g. WalkUpFrom*).
115 /// It may not call methods from a higher tier.
116 ///
117 /// Note that since WalkUpFromFoo() calls WalkUpFromBar() (where Bar
118 /// is Foo's super class) before calling VisitFoo(), the result is
119 /// that the Visit*() methods for a given node are called in the
120 /// top-down order (e.g. for a node of type NamespaceDecl, the order will
121 /// be VisitDecl(), VisitNamedDecl(), and then VisitNamespaceDecl()).
122 ///
123 /// This scheme guarantees that all Visit*() calls for the same AST
124 /// node are grouped together. In other words, Visit*() methods for
125 /// different nodes are never interleaved.
126 ///
127 /// Clients of this visitor should subclass the visitor (providing
128 /// themselves as the template argument, using the curiously recurring
129 /// template pattern) and override any of the Traverse*, WalkUpFrom*,
130 /// and Visit* methods for declarations, types, statements,
131 /// expressions, or other AST nodes where the visitor should customize
132 /// behavior. Most users only need to override Visit*. Advanced
133 /// users may override Traverse* and WalkUpFrom* to implement custom
134 /// traversal strategies. Returning false from one of these overridden
135 /// functions will abort the entire traversal.
136 ///
137 /// By default, this visitor tries to visit every part of the explicit
138 /// source code exactly once. The default policy towards templates
139 /// is to descend into the 'pattern' class or function body, not any
140 /// explicit or implicit instantiations. Explicit specializations
141 /// are still visited, and the patterns of partial specializations
142 /// are visited separately. This behavior can be changed by
143 /// overriding shouldVisitTemplateInstantiations() in the derived class
144 /// to return true, in which case all known implicit and explicit
145 /// instantiations will be visited at the same time as the pattern
146 /// from which they were produced.
147 ///
148 /// By default, this visitor preorder traverses the AST. If postorder traversal
149 /// is needed, the \c shouldTraversePostOrder method needs to be overridden
150 /// to return \c true.
151 template <typename Derived> class RecursiveASTVisitor {
152 public:
153 /// A queue used for performing data recursion over statements.
154 /// Parameters involving this type are used to implement data
155 /// recursion over Stmts and Exprs within this class, and should
156 /// typically not be explicitly specified by derived classes.
157 /// The bool bit indicates whether the statement has been traversed or not.
158 typedef SmallVectorImpl<llvm::PointerIntPair<Stmt *, 1, bool>>
159 DataRecursionQueue;
160
161 /// Return a reference to the derived class.
162 Derived &getDerived() { return *static_cast<Derived *>(this); }
163
164 /// Return whether this visitor should recurse into
165 /// template instantiations.
166 bool shouldVisitTemplateInstantiations() const { return false; }
167
168 /// Return whether this visitor should recurse into the types of
169 /// TypeLocs.
170 bool shouldWalkTypesOfTypeLocs() const { return true; }
171
172 /// Return whether this visitor should recurse into implicit
173 /// code, e.g., implicit constructors and destructors.
174 bool shouldVisitImplicitCode() const { return false; }
175
176 /// Return whether this visitor should traverse post-order.
177 bool shouldTraversePostOrder() const { return false; }
178
179 /// Recursively visits an entire AST, starting from the top-level Decls
180 /// in the AST traversal scope (by default, the TranslationUnitDecl).
181 /// \returns false if visitation was terminated early.
182 bool TraverseAST(ASTContext &AST) {
183 for (Decl *D : AST.getTraversalScope())
184 if (!getDerived().TraverseDecl(D))
185 return false;
186 return true;
187 }
188
189 /// Recursively visit a statement or expression, by
190 /// dispatching to Traverse*() based on the argument's dynamic type.
191 ///
192 /// \returns false if the visitation was terminated early, true
193 /// otherwise (including when the argument is nullptr).
194 bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue = nullptr);
195
196 /// Invoked before visiting a statement or expression via data recursion.
197 ///
198 /// \returns false to skip visiting the node, true otherwise.
199 bool dataTraverseStmtPre(Stmt *S) { return true; }
200
201 /// Invoked after visiting a statement or expression via data recursion.
202 /// This is not invoked if the previously invoked \c dataTraverseStmtPre
203 /// returned false.
204 ///
205 /// \returns false if the visitation was terminated early, true otherwise.
206 bool dataTraverseStmtPost(Stmt *S) { return true; }
207
208 /// Recursively visit a type, by dispatching to
209 /// Traverse*Type() based on the argument's getTypeClass() property.
210 ///
211 /// \returns false if the visitation was terminated early, true
212 /// otherwise (including when the argument is a Null type).
213 bool TraverseType(QualType T);
214
215 /// Recursively visit a type with location, by dispatching to
216 /// Traverse*TypeLoc() based on the argument type's getTypeClass() property.
217 ///
218 /// \returns false if the visitation was terminated early, true
219 /// otherwise (including when the argument is a Null type location).
220 bool TraverseTypeLoc(TypeLoc TL);
221
222 /// Recursively visit an attribute, by dispatching to
223 /// Traverse*Attr() based on the argument's dynamic type.
224 ///
225 /// \returns false if the visitation was terminated early, true
226 /// otherwise (including when the argument is a Null type location).
227 bool TraverseAttr(Attr *At);
228
229 /// Recursively visit a declaration, by dispatching to
230 /// Traverse*Decl() based on the argument's dynamic type.
231 ///
232 /// \returns false if the visitation was terminated early, true
233 /// otherwise (including when the argument is NULL).
234 bool TraverseDecl(Decl *D);
235
236 /// Recursively visit a C++ nested-name-specifier.
237 ///
238 /// \returns false if the visitation was terminated early, true otherwise.
239 bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS);
240
241 /// Recursively visit a C++ nested-name-specifier with location
242 /// information.
243 ///
244 /// \returns false if the visitation was terminated early, true otherwise.
245 bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS);
246
247 /// Recursively visit a name with its location information.
248 ///
249 /// \returns false if the visitation was terminated early, true otherwise.
250 bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo);
251
252 /// Recursively visit a template name and dispatch to the
253 /// appropriate method.
254 ///
255 /// \returns false if the visitation was terminated early, true otherwise.
256 bool TraverseTemplateName(TemplateName Template);
257
258 /// Recursively visit a template argument and dispatch to the
259 /// appropriate method for the argument type.
260 ///
261 /// \returns false if the visitation was terminated early, true otherwise.
262 // FIXME: migrate callers to TemplateArgumentLoc instead.
263 bool TraverseTemplateArgument(const TemplateArgument &Arg);
264
265 /// Recursively visit a template argument location and dispatch to the
266 /// appropriate method for the argument type.
267 ///
268 /// \returns false if the visitation was terminated early, true otherwise.
269 bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc);
270
271 /// Recursively visit a set of template arguments.
272 /// This can be overridden by a subclass, but it's not expected that
273 /// will be needed -- this visitor always dispatches to another.
274 ///
275 /// \returns false if the visitation was terminated early, true otherwise.
276 // FIXME: take a TemplateArgumentLoc* (or TemplateArgumentListInfo) instead.
277 bool TraverseTemplateArguments(const TemplateArgument *Args,
278 unsigned NumArgs);
279
280 /// Recursively visit a base specifier. This can be overridden by a
281 /// subclass.
282 ///
283 /// \returns false if the visitation was terminated early, true otherwise.
284 bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base);
285
286 /// Recursively visit a constructor initializer. This
287 /// automatically dispatches to another visitor for the initializer
288 /// expression, but not for the name of the initializer, so may
289 /// be overridden for clients that need access to the name.
290 ///
291 /// \returns false if the visitation was terminated early, true otherwise.
292 bool TraverseConstructorInitializer(CXXCtorInitializer *Init);
293
294 /// Recursively visit a lambda capture. \c Init is the expression that
295 /// will be used to initialize the capture.
296 ///
297 /// \returns false if the visitation was terminated early, true otherwise.
298 bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C,
299 Expr *Init);
300
301 /// Recursively visit the syntactic or semantic form of an
302 /// initialization list.
303 ///
304 /// \returns false if the visitation was terminated early, true otherwise.
305 bool TraverseSynOrSemInitListExpr(InitListExpr *S,
306 DataRecursionQueue *Queue = nullptr);
307
308 /// Recursively visit a reference to a concept with potential arguments.
309 ///
310 /// \returns false if the visitation was terminated early, true otherwise.
311 bool TraverseConceptReference(const ConceptReference &C);
312
313 // ---- Methods on Attrs ----
314
315 // Visit an attribute.
316 bool VisitAttr(Attr *A) { return true; }
317
318 // Declare Traverse* and empty Visit* for all Attr classes.
319 #define ATTR_VISITOR_DECLS_ONLY
320 #include "clang/AST/AttrVisitor.inc"
321 #undef ATTR_VISITOR_DECLS_ONLY
322
323 // ---- Methods on Stmts ----
324
325 Stmt::child_range getStmtChildren(Stmt *S) { return S->children(); }
326
327 private:
328 template<typename T, typename U>
329 struct has_same_member_pointer_type : std::false_type {};
330 template<typename T, typename U, typename R, typename... P>
331 struct has_same_member_pointer_type<R (T::*)(P...), R (U::*)(P...)>
332 : std::true_type {};
333
334 // Traverse the given statement. If the most-derived traverse function takes a
335 // data recursion queue, pass it on; otherwise, discard it. Note that the
336 // first branch of this conditional must compile whether or not the derived
337 // class can take a queue, so if we're taking the second arm, make the first
338 // arm call our function rather than the derived class version.
339 #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE) \
340 (has_same_member_pointer_type<decltype( \
341 &RecursiveASTVisitor::Traverse##NAME), \
342 decltype(&Derived::Traverse##NAME)>::value \
343 ? static_cast<typename std::conditional< \
344 has_same_member_pointer_type< \
345 decltype(&RecursiveASTVisitor::Traverse##NAME), \
346 decltype(&Derived::Traverse##NAME)>::value, \
347 Derived &, RecursiveASTVisitor &>::type>(*this) \
348 .Traverse##NAME(static_cast<CLASS *>(VAR), QUEUE) \
349 : getDerived().Traverse##NAME(static_cast<CLASS *>(VAR)))
350
351 // Try to traverse the given statement, or enqueue it if we're performing data
352 // recursion in the middle of traversing another statement. Can only be called
353 // from within a DEF_TRAVERSE_STMT body or similar context.
354 #define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S) \
355 do { \
356 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
357 return false; \
358 } while (false)
359
360 public:
361 // Declare Traverse*() for all concrete Stmt classes.
362 #define ABSTRACT_STMT(STMT)
363 #define STMT(CLASS, PARENT) \
364 bool Traverse##CLASS(CLASS *S, DataRecursionQueue *Queue = nullptr);
365 #include "clang/AST/StmtNodes.inc"
366 // The above header #undefs ABSTRACT_STMT and STMT upon exit.
367
368 // Define WalkUpFrom*() and empty Visit*() for all Stmt classes.
369 bool WalkUpFromStmt(Stmt *S) { return getDerived().VisitStmt(S); }
370 bool VisitStmt(Stmt *S) { return true; }
371 #define STMT(CLASS, PARENT) \
372 bool WalkUpFrom##CLASS(CLASS *S) { \
373 TRY_TO(WalkUpFrom##PARENT(S)); \
374 TRY_TO(Visit##CLASS(S)); \
375 return true; \
376 } \
377 bool Visit##CLASS(CLASS *S) { return true; }
378 #include "clang/AST/StmtNodes.inc"
379
380 // Define Traverse*(), WalkUpFrom*(), and Visit*() for unary
381 // operator methods. Unary operators are not classes in themselves
382 // (they're all opcodes in UnaryOperator) but do have visitors.
383 #define OPERATOR(NAME) \
384 bool TraverseUnary##NAME(UnaryOperator *S, \
385 DataRecursionQueue *Queue = nullptr) { \
386 if (!getDerived().shouldTraversePostOrder()) \
387 TRY_TO(WalkUpFromUnary##NAME(S)); \
388 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getSubExpr()); \
389 return true; \
390 } \
391 bool WalkUpFromUnary##NAME(UnaryOperator *S) { \
392 TRY_TO(WalkUpFromUnaryOperator(S)); \
393 TRY_TO(VisitUnary##NAME(S)); \
394 return true; \
395 } \
396 bool VisitUnary##NAME(UnaryOperator *S) { return true; }
397
398 UNARYOP_LIST()
399 #undef OPERATOR
400
401 // Define Traverse*(), WalkUpFrom*(), and Visit*() for binary
402 // operator methods. Binary operators are not classes in themselves
403 // (they're all opcodes in BinaryOperator) but do have visitors.
404 #define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE) \
405 bool TraverseBin##NAME(BINOP_TYPE *S, DataRecursionQueue *Queue = nullptr) { \
406 if (!getDerived().shouldTraversePostOrder()) \
407 TRY_TO(WalkUpFromBin##NAME(S)); \
408 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLHS()); \
409 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getRHS()); \
410 return true; \
411 } \
412 bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \
413 TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \
414 TRY_TO(VisitBin##NAME(S)); \
415 return true; \
416 } \
417 bool VisitBin##NAME(BINOP_TYPE *S) { return true; }
418
419 #define OPERATOR(NAME) GENERAL_BINOP_FALLBACK(NAME, BinaryOperator)
420 BINOP_LIST()
421 #undef OPERATOR
422
423 // Define Traverse*(), WalkUpFrom*(), and Visit*() for compound
424 // assignment methods. Compound assignment operators are not
425 // classes in themselves (they're all opcodes in
426 // CompoundAssignOperator) but do have visitors.
427 #define OPERATOR(NAME) \
428 GENERAL_BINOP_FALLBACK(NAME##Assign, CompoundAssignOperator)
429
430 CAO_LIST()
431 #undef OPERATOR
432 #undef GENERAL_BINOP_FALLBACK
433
434 // ---- Methods on Types ----
435 // FIXME: revamp to take TypeLoc's rather than Types.
436
437 // Declare Traverse*() for all concrete Type classes.
438 #define ABSTRACT_TYPE(CLASS, BASE)
439 #define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type *T);
440 #include "clang/AST/TypeNodes.inc"
441 // The above header #undefs ABSTRACT_TYPE and TYPE upon exit.
442
443 // Define WalkUpFrom*() and empty Visit*() for all Type classes.
444 bool WalkUpFromType(Type *T) { return getDerived().VisitType(T); }
445 bool VisitType(Type *T) { return true; }
446 #define TYPE(CLASS, BASE) \
447 bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
448 TRY_TO(WalkUpFrom##BASE(T)); \
449 TRY_TO(Visit##CLASS##Type(T)); \
450 return true; \
451 } \
452 bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
453 #include "clang/AST/TypeNodes.inc"
454
455 // ---- Methods on TypeLocs ----
456 // FIXME: this currently just calls the matching Type methods
457
458 // Declare Traverse*() for all concrete TypeLoc classes.
459 #define ABSTRACT_TYPELOC(CLASS, BASE)
460 #define TYPELOC(CLASS, BASE) bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
461 #include "clang/AST/TypeLocNodes.def"
462 // The above header #undefs ABSTRACT_TYPELOC and TYPELOC upon exit.
463
464 // Define WalkUpFrom*() and empty Visit*() for all TypeLoc classes.
465 bool WalkUpFromTypeLoc(TypeLoc TL) { return getDerived().VisitTypeLoc(TL); }
466 bool VisitTypeLoc(TypeLoc TL) { return true; }
467
468 // QualifiedTypeLoc and UnqualTypeLoc are not declared in
469 // TypeNodes.inc and thus need to be handled specially.
470 bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL) {
471 return getDerived().VisitUnqualTypeLoc(TL.getUnqualifiedLoc());
472 }
473 bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL) { return true; }
474 bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL) {
475 return getDerived().VisitUnqualTypeLoc(TL.getUnqualifiedLoc());
476 }
477 bool VisitUnqualTypeLoc(UnqualTypeLoc TL) { return true; }
478
479 // Note that BASE includes trailing 'Type' which CLASS doesn't.
480 #define TYPE(CLASS, BASE) \
481 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
482 TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
483 TRY_TO(Visit##CLASS##TypeLoc(TL)); \
484 return true; \
485 } \
486 bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
487 #include "clang/AST/TypeNodes.inc"
488
489 // ---- Methods on Decls ----
490
491 // Declare Traverse*() for all concrete Decl classes.
492 #define ABSTRACT_DECL(DECL)
493 #define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl *D);
494 #include "clang/AST/DeclNodes.inc"
495 // The above header #undefs ABSTRACT_DECL and DECL upon exit.
496
497 // Define WalkUpFrom*() and empty Visit*() for all Decl classes.
498 bool WalkUpFromDecl(Decl *D) { return getDerived().VisitDecl(D); }
499 bool VisitDecl(Decl *D) { return true; }
500 #define DECL(CLASS, BASE) \
501 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
502 TRY_TO(WalkUpFrom##BASE(D)); \
503 TRY_TO(Visit##CLASS##Decl(D)); \
504 return true; \
505 } \
506 bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
507 #include "clang/AST/DeclNodes.inc"
508
509 bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child);
510
511 private:
512 // These are helper methods used by more than one Traverse* method.
513 bool TraverseTemplateParameterListHelper(TemplateParameterList *TPL);
514
515 // Traverses template parameter lists of either a DeclaratorDecl or TagDecl.
516 template <typename T>
517 bool TraverseDeclTemplateParameterLists(T *D);
518
519 #define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND) \
520 bool TraverseTemplateInstantiations(TMPLDECLKIND##TemplateDecl *D);
521 DEF_TRAVERSE_TMPL_INST(Class)
522 DEF_TRAVERSE_TMPL_INST(Var)
523 DEF_TRAVERSE_TMPL_INST(Function)
524 #undef DEF_TRAVERSE_TMPL_INST
525 bool TraverseTemplateArgumentLocsHelper(const TemplateArgumentLoc *TAL,
526 unsigned Count);
527 bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
528 bool TraverseRecordHelper(RecordDecl *D);
529 bool TraverseCXXRecordHelper(CXXRecordDecl *D);
530 bool TraverseDeclaratorHelper(DeclaratorDecl *D);
531 bool TraverseDeclContextHelper(DeclContext *DC);
532 bool TraverseFunctionHelper(FunctionDecl *D);
533 bool TraverseVarHelper(VarDecl *D);
534 bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
535 bool TraverseOMPLoopDirective(OMPLoopDirective *S);
536 bool TraverseOMPClause(OMPClause *C);
537 #define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C);
538 #include "clang/Basic/OpenMPKinds.def"
539 /// Process clauses with list of variables.
540 template <typename T> bool VisitOMPClauseList(T *Node);
541 /// Process clauses with pre-initis.
542 bool VisitOMPClauseWithPreInit(OMPClauseWithPreInit *Node);
543 bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node);
544
545 bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue);
546 bool PostVisitStmt(Stmt *S);
547 };
548
549 template <typename Derived>
550 bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
551 DataRecursionQueue *Queue) {
552 #define DISPATCH_STMT(NAME, CLASS, VAR) \
553 return TRAVERSE_STMT_BASE(NAME, CLASS, VAR, Queue);
554
555 // If we have a binary expr, dispatch to the subcode of the binop. A smart
556 // optimizer (e.g. LLVM) will fold this comparison into the switch stmt
557 // below.
558 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
559 switch (BinOp->getOpcode()) {
560 #define OPERATOR(NAME) \
561 case BO_##NAME: \
562 DISPATCH_STMT(Bin##NAME, BinaryOperator, S);
563
564 BINOP_LIST()
565 #undef OPERATOR
566 #undef BINOP_LIST
567
568 #define OPERATOR(NAME) \
569 case BO_##NAME##Assign: \
570 DISPATCH_STMT(Bin##NAME##Assign, CompoundAssignOperator, S);
571
572 CAO_LIST()
573 #undef OPERATOR
574 #undef CAO_LIST
575 }
576 } else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
577 switch (UnOp->getOpcode()) {
578 #define OPERATOR(NAME) \
579 case UO_##NAME: \
580 DISPATCH_STMT(Unary##NAME, UnaryOperator, S);
581
582 UNARYOP_LIST()
583 #undef OPERATOR
584 #undef UNARYOP_LIST
585 }
586 }
587
588 // Top switch stmt: dispatch to TraverseFooStmt for each concrete FooStmt.
589 switch (S->getStmtClass()) {
590 case Stmt::NoStmtClass:
591 break;
592 #define ABSTRACT_STMT(STMT)
593 #define STMT(CLASS, PARENT) \
594 case Stmt::CLASS##Class: \
595 DISPATCH_STMT(CLASS, CLASS, S);
596 #include "clang/AST/StmtNodes.inc"
597 }
598
599 return true;
600 }
601
602 #undef DISPATCH_STMT
603
604 template <typename Derived>
605 bool RecursiveASTVisitor<Derived>::PostVisitStmt(Stmt *S) {
606 switch (S->getStmtClass()) {
607 case Stmt::NoStmtClass:
608 break;
609 #define ABSTRACT_STMT(STMT)
610 #define STMT(CLASS, PARENT) \
611 case Stmt::CLASS##Class: \
612 TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); break;
613 #define INITLISTEXPR(CLASS, PARENT) \
614 case Stmt::CLASS##Class: \
615 { \
616 auto ILE = static_cast<CLASS *>(S); \
617 if (auto Syn = ILE->isSemanticForm() ? ILE->getSyntacticForm() : ILE) \
618 TRY_TO(WalkUpFrom##CLASS(Syn)); \
619 if (auto Sem = ILE->isSemanticForm() ? ILE : ILE->getSemanticForm()) \
620 TRY_TO(WalkUpFrom##CLASS(Sem)); \
621 break; \
622 }
623 #include "clang/AST/StmtNodes.inc"
624 }
625
626 return true;
627 }
628
629 #undef DISPATCH_STMT
630
631 template <typename Derived>
632 bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S,
633 DataRecursionQueue *Queue) {
634 if (!S)
635 return true;
636
637 if (Queue) {
638 Queue->push_back({S, false});
639 return true;
640 }
641
642 SmallVector<llvm::PointerIntPair<Stmt *, 1, bool>, 8> LocalQueue;
643 LocalQueue.push_back({S, false});
644
645 while (!LocalQueue.empty()) {
646 auto &CurrSAndVisited = LocalQueue.back();
647 Stmt *CurrS = CurrSAndVisited.getPointer();
648 bool Visited = CurrSAndVisited.getInt();
649 if (Visited) {
650 LocalQueue.pop_back();
651 TRY_TO(dataTraverseStmtPost(CurrS));
652 if (getDerived().shouldTraversePostOrder()) {
653 TRY_TO(PostVisitStmt(CurrS));
654 }
655 continue;
656 }
657
658 if (getDerived().dataTraverseStmtPre(CurrS)) {
659 CurrSAndVisited.setInt(true);
660 size_t N = LocalQueue.size();
661 TRY_TO(dataTraverseNode(CurrS, &LocalQueue));
662 // Process new children in the order they were added.
663 std::reverse(LocalQueue.begin() + N, LocalQueue.end());
664 } else {
665 LocalQueue.pop_back();
666 }
667 }
668
669 return true;
670 }
671
672 #define DISPATCH(NAME, CLASS, VAR) \
673 return getDerived().Traverse##NAME(static_cast<CLASS *>(VAR))
674
675 template <typename Derived>
676 bool RecursiveASTVisitor<Derived>::TraverseType(QualType T) {
677 if (T.isNull())
678 return true;
679
680 switch (T->getTypeClass()) {
681 #define ABSTRACT_TYPE(CLASS, BASE)
682 #define TYPE(CLASS, BASE) \
683 case Type::CLASS: \
684 DISPATCH(CLASS##Type, CLASS##Type, const_cast<Type *>(T.getTypePtr()));
685 #include "clang/AST/TypeNodes.inc"
686 }
687
688 return true;
689 }
690
691 template <typename Derived>
692 bool RecursiveASTVisitor<Derived>::TraverseTypeLoc(TypeLoc TL) {
693 if (TL.isNull())
694 return true;
695
696 switch (TL.getTypeLocClass()) {
697 #define ABSTRACT_TYPELOC(CLASS, BASE)
698 #define TYPELOC(CLASS, BASE) \
699 case TypeLoc::CLASS: \
700 return getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
701 #include "clang/AST/TypeLocNodes.def"
702 }
703
704 return true;
705 }
706
707 // Define the Traverse*Attr(Attr* A) methods
708 #define VISITORCLASS RecursiveASTVisitor
709 #include "clang/AST/AttrVisitor.inc"
710 #undef VISITORCLASS
711
712 template <typename Derived>
713 bool RecursiveASTVisitor<Derived>::TraverseDecl(Decl *D) {
714 if (!D)
715 return true;
716
717 // As a syntax visitor, by default we want to ignore declarations for
718 // implicit declarations (ones not typed explicitly by the user).
719 if (!getDerived().shouldVisitImplicitCode() && D->isImplicit())
720 return true;
721
722 switch (D->getKind()) {
723 #define ABSTRACT_DECL(DECL)
724 #define DECL(CLASS, BASE) \
725 case Decl::CLASS: \
726 if (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl *>(D))) \
727 return false; \
728 break;
729 #include "clang/AST/DeclNodes.inc"
730 }
731 return true;
732 }
733
734 #undef DISPATCH
735
736 template <typename Derived>
737 bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifier(
738 NestedNameSpecifier *NNS) {
739 if (!NNS)
740 return true;
741
742 if (NNS->getPrefix())
743 TRY_TO(TraverseNestedNameSpecifier(NNS->getPrefix()));
744
745 switch (NNS->getKind()) {
746 case NestedNameSpecifier::Identifier:
747 case NestedNameSpecifier::Namespace:
748 case NestedNameSpecifier::NamespaceAlias:
749 case NestedNameSpecifier::Global:
750 case NestedNameSpecifier::Super:
751 return true;
752
753 case NestedNameSpecifier::TypeSpec:
754 case NestedNameSpecifier::TypeSpecWithTemplate:
755 TRY_TO(TraverseType(QualType(NNS->getAsType(), 0)));
756 }
757
758 return true;
759 }
760
761 template <typename Derived>
762 bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifierLoc(
763 NestedNameSpecifierLoc NNS) {
764 if (!NNS)
765 return true;
766
767 if (NestedNameSpecifierLoc Prefix = NNS.getPrefix())
768 TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
769
770 switch (NNS.getNestedNameSpecifier()->getKind()) {
771 case NestedNameSpecifier::Identifier:
772 case NestedNameSpecifier::Namespace:
773 case NestedNameSpecifier::NamespaceAlias:
774 case NestedNameSpecifier::Global:
775 case NestedNameSpecifier::Super:
776 return true;
777
778 case NestedNameSpecifier::TypeSpec:
779 case NestedNameSpecifier::TypeSpecWithTemplate:
780 TRY_TO(TraverseTypeLoc(NNS.getTypeLoc()));
781 break;
782 }
783
784 return true;
785 }
786
787 template <typename Derived>
788 bool RecursiveASTVisitor<Derived>::TraverseDeclarationNameInfo(
789 DeclarationNameInfo NameInfo) {
790 switch (NameInfo.getName().getNameKind()) {
791 case DeclarationName::CXXConstructorName:
792 case DeclarationName::CXXDestructorName:
793 case DeclarationName::CXXConversionFunctionName:
794 if (TypeSourceInfo *TSInfo = NameInfo.getNamedTypeInfo())
795 TRY_TO(TraverseTypeLoc(TSInfo->getTypeLoc()));
796 break;
797
798 case DeclarationName::CXXDeductionGuideName:
799 TRY_TO(TraverseTemplateName(
800 TemplateName(NameInfo.getName().getCXXDeductionGuideTemplate())));
801 break;
802
803 case DeclarationName::Identifier:
804 case DeclarationName::ObjCZeroArgSelector:
805 case DeclarationName::ObjCOneArgSelector:
806 case DeclarationName::ObjCMultiArgSelector:
807 case DeclarationName::CXXOperatorName:
808 case DeclarationName::CXXLiteralOperatorName:
809 case DeclarationName::CXXUsingDirective:
810 break;
811 }
812
813 return true;
814 }
815
816 template <typename Derived>
817 bool RecursiveASTVisitor<Derived>::TraverseTemplateName(TemplateName Template) {
818 if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
819 TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
820 else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
821 TRY_TO(TraverseNestedNameSpecifier(QTN->getQualifier()));
822
823 return true;
824 }
825
826 template <typename Derived>
827 bool RecursiveASTVisitor<Derived>::TraverseTemplateArgument(
828 const TemplateArgument &Arg) {
829 switch (Arg.getKind()) {
830 case TemplateArgument::Null:
831 case TemplateArgument::Declaration:
832 case TemplateArgument::Integral:
833 case TemplateArgument::NullPtr:
834 return true;
835
836 case TemplateArgument::Type:
837 return getDerived().TraverseType(Arg.getAsType());
838
839 case TemplateArgument::Template:
840 case TemplateArgument::TemplateExpansion:
841 return getDerived().TraverseTemplateName(
842 Arg.getAsTemplateOrTemplatePattern());
843
844 case TemplateArgument::Expression:
845 return getDerived().TraverseStmt(Arg.getAsExpr());
846
847 case TemplateArgument::Pack:
848 return getDerived().TraverseTemplateArguments(Arg.pack_begin(),
849 Arg.pack_size());
850 }
851
852 return true;
853 }
854
855 // FIXME: no template name location?
856 // FIXME: no source locations for a template argument pack?
857 template <typename Derived>
858 bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLoc(
859 const TemplateArgumentLoc &ArgLoc) {
860 const TemplateArgument &Arg = ArgLoc.getArgument();
861
862 switch (Arg.getKind()) {
863 case TemplateArgument::Null:
864 case TemplateArgument::Declaration:
865 case TemplateArgument::Integral:
866 case TemplateArgument::NullPtr:
867 return true;
868
869 case TemplateArgument::Type: {
870 // FIXME: how can TSI ever be NULL?
871 if (TypeSourceInfo *TSI = ArgLoc.getTypeSourceInfo())
872 return getDerived().TraverseTypeLoc(TSI->getTypeLoc());
873 else
874 return getDerived().TraverseType(Arg.getAsType());
875 }
876
877 case TemplateArgument::Template:
878 case TemplateArgument::TemplateExpansion:
879 if (ArgLoc.getTemplateQualifierLoc())
880 TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
881 ArgLoc.getTemplateQualifierLoc()));
882 return getDerived().TraverseTemplateName(
883 Arg.getAsTemplateOrTemplatePattern());
884
885 case TemplateArgument::Expression:
886 return getDerived().TraverseStmt(ArgLoc.getSourceExpression());
887
888 case TemplateArgument::Pack:
889 return getDerived().TraverseTemplateArguments(Arg.pack_begin(),
890 Arg.pack_size());
891 }
892
893 return true;
894 }
895
896 template <typename Derived>
897 bool RecursiveASTVisitor<Derived>::TraverseTemplateArguments(
898 const TemplateArgument *Args, unsigned NumArgs) {
899 for (unsigned I = 0; I != NumArgs; ++I) {
900 TRY_TO(TraverseTemplateArgument(Args[I]));
901 }
902
903 return true;
904 }
905
906 template <typename Derived>
907 bool RecursiveASTVisitor<Derived>::TraverseConstructorInitializer(
908 CXXCtorInitializer *Init) {
909 if (TypeSourceInfo *TInfo = Init->getTypeSourceInfo())
910 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
911
912 if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
913 TRY_TO(TraverseStmt(Init->getInit()));
914
915 return true;
916 }
917
918 template <typename Derived>
919 bool
920 RecursiveASTVisitor<Derived>::TraverseLambdaCapture(LambdaExpr *LE,
921 const LambdaCapture *C,
922 Expr *Init) {
923 if (LE->isInitCapture(C))
924 TRY_TO(TraverseDecl(C->getCapturedVar()));
925 else
926 TRY_TO(TraverseStmt(Init));
927 return true;
928 }
929
930 // ----------------- Type traversal -----------------
931
932 // This macro makes available a variable T, the passed-in type.
933 #define DEF_TRAVERSE_TYPE(TYPE, CODE) \
934 template <typename Derived> \
935 bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) { \
936 if (!getDerived().shouldTraversePostOrder()) \
937 TRY_TO(WalkUpFrom##TYPE(T)); \
938 { CODE; } \
939 if (getDerived().shouldTraversePostOrder()) \
940 TRY_TO(WalkUpFrom##TYPE(T)); \
941 return true; \
942 }
943
944 DEF_TRAVERSE_TYPE(BuiltinType, {})
945
946 DEF_TRAVERSE_TYPE(ComplexType, { TRY_TO(TraverseType(T->getElementType())); })
947
948 DEF_TRAVERSE_TYPE(PointerType, { TRY_TO(TraverseType(T->getPointeeType())); })
949
950 DEF_TRAVERSE_TYPE(BlockPointerType,
951 { TRY_TO(TraverseType(T->getPointeeType())); })
952
953 DEF_TRAVERSE_TYPE(LValueReferenceType,
954 { TRY_TO(TraverseType(T->getPointeeType())); })
955
956 DEF_TRAVERSE_TYPE(RValueReferenceType,
957 { TRY_TO(TraverseType(T->getPointeeType())); })
958
959 DEF_TRAVERSE_TYPE(MemberPointerType, {
960 TRY_TO(TraverseType(QualType(T->getClass(), 0)));
961 TRY_TO(TraverseType(T->getPointeeType()));
962 })
963
964 DEF_TRAVERSE_TYPE(AdjustedType, { TRY_TO(TraverseType(T->getOriginalType())); })
965
966 DEF_TRAVERSE_TYPE(DecayedType, { TRY_TO(TraverseType(T->getOriginalType())); })
967
968 DEF_TRAVERSE_TYPE(ConstantArrayType, {
969 TRY_TO(TraverseType(T->getElementType()));
970 if (T->getSizeExpr())
971 TRY_TO(TraverseStmt(const_cast<Expr*>(T->getSizeExpr())));
972 })
973
974 DEF_TRAVERSE_TYPE(IncompleteArrayType,
975 { TRY_TO(TraverseType(T->getElementType())); })
976
977 DEF_TRAVERSE_TYPE(VariableArrayType, {
978 TRY_TO(TraverseType(T->getElementType()));
979 TRY_TO(TraverseStmt(T->getSizeExpr()));
980 })
981
982 DEF_TRAVERSE_TYPE(DependentSizedArrayType, {
983 TRY_TO(TraverseType(T->getElementType()));
984 if (T->getSizeExpr())
985 TRY_TO(TraverseStmt(T->getSizeExpr()));
986 })
987
988 DEF_TRAVERSE_TYPE(DependentAddressSpaceType, {
989 TRY_TO(TraverseStmt(T->getAddrSpaceExpr()));
990 TRY_TO(TraverseType(T->getPointeeType()));
991 })
992
993 DEF_TRAVERSE_TYPE(DependentVectorType, {
994 if (T->getSizeExpr())
995 TRY_TO(TraverseStmt(T->getSizeExpr()));
996 TRY_TO(TraverseType(T->getElementType()));
997 })
998
999 DEF_TRAVERSE_TYPE(DependentSizedExtVectorType, {
1000 if (T->getSizeExpr())
1001 TRY_TO(TraverseStmt(T->getSizeExpr()));
1002 TRY_TO(TraverseType(T->getElementType()));
1003 })
1004
1005 DEF_TRAVERSE_TYPE(VectorType, { TRY_TO(TraverseType(T->getElementType())); })
1006
1007 DEF_TRAVERSE_TYPE(ExtVectorType, { TRY_TO(TraverseType(T->getElementType())); })
1008
1009 DEF_TRAVERSE_TYPE(FunctionNoProtoType,
1010 { TRY_TO(TraverseType(T->getReturnType())); })
1011
1012 DEF_TRAVERSE_TYPE(FunctionProtoType, {
1013 TRY_TO(TraverseType(T->getReturnType()));
1014
1015 for (const auto &A : T->param_types()) {
1016 TRY_TO(TraverseType(A));
1017 }
1018
1019 for (const auto &E : T->exceptions()) {
1020 TRY_TO(TraverseType(E));
1021 }
1022
1023 if (Expr *NE = T->getNoexceptExpr())
1024 TRY_TO(TraverseStmt(NE));
1025 })
1026
1027 DEF_TRAVERSE_TYPE(UnresolvedUsingType, {})
1028 DEF_TRAVERSE_TYPE(TypedefType, {})
1029
1030 DEF_TRAVERSE_TYPE(TypeOfExprType,
1031 { TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1032
1033 DEF_TRAVERSE_TYPE(TypeOfType, { TRY_TO(TraverseType(T->getUnderlyingType())); })
1034
1035 DEF_TRAVERSE_TYPE(DecltypeType,
1036 { TRY_TO(TraverseStmt(T->getUnderlyingExpr())); })
1037
1038 DEF_TRAVERSE_TYPE(UnaryTransformType, {
1039 TRY_TO(TraverseType(T->getBaseType()));
1040 TRY_TO(TraverseType(T->getUnderlyingType()));
1041 })
1042
1043 DEF_TRAVERSE_TYPE(AutoType, {
1044 TRY_TO(TraverseType(T->getDeducedType()));
1045 if (T->isConstrained()) {
1046 TRY_TO(TraverseDecl(T->getTypeConstraintConcept()));
1047 TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
1048 }
1049 })
1050 DEF_TRAVERSE_TYPE(DeducedTemplateSpecializationType, {
1051 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1052 TRY_TO(TraverseType(T->getDeducedType()));
1053 })
1054
1055 DEF_TRAVERSE_TYPE(RecordType, {})
1056 DEF_TRAVERSE_TYPE(EnumType, {})
1057 DEF_TRAVERSE_TYPE(TemplateTypeParmType, {})
1058 DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, {
1059 TRY_TO(TraverseType(T->getReplacementType()));
1060 })
1061 DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, {
1062 TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
1063 })
1064
1065 DEF_TRAVERSE_TYPE(TemplateSpecializationType, {
1066 TRY_TO(TraverseTemplateName(T->getTemplateName()));
1067 TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
1068 })
1069
1070 DEF_TRAVERSE_TYPE(InjectedClassNameType, {})
1071
1072 DEF_TRAVERSE_TYPE(AttributedType,
1073 { TRY_TO(TraverseType(T->getModifiedType())); })
1074
1075 DEF_TRAVERSE_TYPE(ParenType, { TRY_TO(TraverseType(T->getInnerType())); })
1076
1077 DEF_TRAVERSE_TYPE(MacroQualifiedType,
1078 { TRY_TO(TraverseType(T->getUnderlyingType())); })
1079
1080 DEF_TRAVERSE_TYPE(ElaboratedType, {
1081 if (T->getQualifier()) {
1082 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1083 }
1084 TRY_TO(TraverseType(T->getNamedType()));
1085 })
1086
1087 DEF_TRAVERSE_TYPE(DependentNameType,
1088 { TRY_TO(TraverseNestedNameSpecifier(T->getQualifier())); })
1089
1090 DEF_TRAVERSE_TYPE(DependentTemplateSpecializationType, {
1091 TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1092 TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
1093 })
1094
1095 DEF_TRAVERSE_TYPE(PackExpansionType, { TRY_TO(TraverseType(T->getPattern())); })
1096
1097 DEF_TRAVERSE_TYPE(ObjCTypeParamType, {})
1098
1099 DEF_TRAVERSE_TYPE(ObjCInterfaceType, {})
1100
1101 DEF_TRAVERSE_TYPE(ObjCObjectType, {
1102 // We have to watch out here because an ObjCInterfaceType's base
1103 // type is itself.
1104 if (T->getBaseType().getTypePtr() != T)
1105 TRY_TO(TraverseType(T->getBaseType()));
1106 for (auto typeArg : T->getTypeArgsAsWritten()) {
1107 TRY_TO(TraverseType(typeArg));
1108 }
1109 })
1110
1111 DEF_TRAVERSE_TYPE(ObjCObjectPointerType,
1112 { TRY_TO(TraverseType(T->getPointeeType())); })
1113
1114 DEF_TRAVERSE_TYPE(AtomicType, { TRY_TO(TraverseType(T->getValueType())); })
1115
1116 DEF_TRAVERSE_TYPE(PipeType, { TRY_TO(TraverseType(T->getElementType())); })
1117
1118 #undef DEF_TRAVERSE_TYPE
1119
1120 // ----------------- TypeLoc traversal -----------------
1121
1122 // This macro makes available a variable TL, the passed-in TypeLoc.
1123 // If requested, it calls WalkUpFrom* for the Type in the given TypeLoc,
1124 // in addition to WalkUpFrom* for the TypeLoc itself, such that existing
1125 // clients that override the WalkUpFrom*Type() and/or Visit*Type() methods
1126 // continue to work.
1127 #define DEF_TRAVERSE_TYPELOC(TYPE, CODE) \
1128 template <typename Derived> \
1129 bool RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) { \
1130 if (getDerived().shouldWalkTypesOfTypeLocs()) \
1131 TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE *>(TL.getTypePtr()))); \
1132 TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
1133 { CODE; } \
1134 return true; \
1135 }
1136
1137 template <typename Derived>
1138 bool
1139 RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(QualifiedTypeLoc TL) {
1140 // Move this over to the 'main' typeloc tree. Note that this is a
1141 // move -- we pretend that we were really looking at the unqualified
1142 // typeloc all along -- rather than a recursion, so we don't follow
1143 // the normal CRTP plan of going through
1144 // getDerived().TraverseTypeLoc. If we did, we'd be traversing
1145 // twice for the same type (once as a QualifiedTypeLoc version of
1146 // the type, once as an UnqualifiedTypeLoc version of the type),
1147 // which in effect means we'd call VisitTypeLoc twice with the
1148 // 'same' type. This solves that problem, at the cost of never
1149 // seeing the qualified version of the type (unless the client
1150 // subclasses TraverseQualifiedTypeLoc themselves). It's not a
1151 // perfect solution. A perfect solution probably requires making
1152 // QualifiedTypeLoc a wrapper around TypeLoc -- like QualType is a
1153 // wrapper around Type* -- rather than being its own class in the
1154 // type hierarchy.
1155 return TraverseTypeLoc(TL.getUnqualifiedLoc());
1156 }
1157
1158 DEF_TRAVERSE_TYPELOC(BuiltinType, {})
1159
1160 // FIXME: ComplexTypeLoc is unfinished
1161 DEF_TRAVERSE_TYPELOC(ComplexType, {
1162 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1163 })
1164
1165 DEF_TRAVERSE_TYPELOC(PointerType,
1166 { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1167
1168 DEF_TRAVERSE_TYPELOC(BlockPointerType,
1169 { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1170
1171 DEF_TRAVERSE_TYPELOC(LValueReferenceType,
1172 { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1173
1174 DEF_TRAVERSE_TYPELOC(RValueReferenceType,
1175 { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1176
1177 // We traverse this in the type case as well, but how is it not reached through
1178 // the pointee type?
1179 DEF_TRAVERSE_TYPELOC(MemberPointerType, {
1180 if (auto *TSI = TL.getClassTInfo())
1181 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
1182 else
1183 TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
1184 TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
1185 })
1186
1187 DEF_TRAVERSE_TYPELOC(AdjustedType,
1188 { TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1189
1190 DEF_TRAVERSE_TYPELOC(DecayedType,
1191 { TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
1192
1193 template <typename Derived>
1194 bool RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(ArrayTypeLoc TL) {
1195 // This isn't available for ArrayType, but is for the ArrayTypeLoc.
1196 TRY_TO(TraverseStmt(TL.getSizeExpr()));
1197 return true;
1198 }
1199
1200 DEF_TRAVERSE_TYPELOC(ConstantArrayType, {
1201 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1202 return TraverseArrayTypeLocHelper(TL);
1203 })
1204
1205 DEF_TRAVERSE_TYPELOC(IncompleteArrayType, {
1206 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1207 return TraverseArrayTypeLocHelper(TL);
1208 })
1209
1210 DEF_TRAVERSE_TYPELOC(VariableArrayType, {
1211 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1212 return TraverseArrayTypeLocHelper(TL);
1213 })
1214
1215 DEF_TRAVERSE_TYPELOC(DependentSizedArrayType, {
1216 TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
1217 return TraverseArrayTypeLocHelper(TL);
1218 })
1219
1220 DEF_TRAVERSE_TYPELOC(DependentAddressSpaceType, {
1221 TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr()));
1222 TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType()));
1223 })
1224
1225 // FIXME: order? why not size expr first?
1226 // FIXME: base VectorTypeLoc is unfinished
1227 DEF_TRAVERSE_TYPELOC(DependentSizedExtVectorType, {
1228 if (TL.getTypePtr()->getSizeExpr())
1229 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1230 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1231 })
1232
1233 // FIXME: VectorTypeLoc is unfinished
1234 DEF_TRAVERSE_TYPELOC(VectorType, {
1235 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1236 })
1237
1238 DEF_TRAVERSE_TYPELOC(DependentVectorType, {
1239 if (TL.getTypePtr()->getSizeExpr())
1240 TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
1241 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1242 })
1243
1244 // FIXME: size and attributes
1245 // FIXME: base VectorTypeLoc is unfinished
1246 DEF_TRAVERSE_TYPELOC(ExtVectorType, {
1247 TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
1248 })
1249
1250 DEF_TRAVERSE_TYPELOC(FunctionNoProtoType,
1251 { TRY_TO(TraverseTypeLoc(TL.getReturnLoc())); })
1252
1253 // FIXME: location of exception specifications (attributes?)
1254 DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
1255 TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
1256
1257 const FunctionProtoType *T = TL.getTypePtr();
1258
1259 for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
1260 if (TL.getParam(I)) {
1261 TRY_TO(TraverseDecl(TL.getParam(I)));
1262 } else if (I < T->getNumParams()) {
1263 TRY_TO(TraverseType(T->getParamType(I)));
1264 }
1265 }
1266
1267 for (const auto &E : T->exceptions()) {
1268 TRY_TO(TraverseType(E));
1269 }
1270
1271 if (Expr *NE = T->getNoexceptExpr())
1272 TRY_TO(TraverseStmt(NE));
1273 })
1274
1275 DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, {})
1276 DEF_TRAVERSE_TYPELOC(TypedefType, {})
1277
1278 DEF_TRAVERSE_TYPELOC(TypeOfExprType,
1279 { TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
1280
1281 DEF_TRAVERSE_TYPELOC(TypeOfType, {
1282 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1283 })
1284
1285 // FIXME: location of underlying expr
1286 DEF_TRAVERSE_TYPELOC(DecltypeType, {
1287 TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
1288 })
1289
1290 DEF_TRAVERSE_TYPELOC(UnaryTransformType, {
1291 TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
1292 })
1293
1294 DEF_TRAVERSE_TYPELOC(AutoType, {
1295 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1296 if (TL.isConstrained()) {
1297 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getNestedNameSpecifierLoc()));
1298 TRY_TO(TraverseDeclarationNameInfo(TL.getConceptNameInfo()));
1299 for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
1300 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1301 }
1302 })
1303
1304 DEF_TRAVERSE_TYPELOC(DeducedTemplateSpecializationType, {
1305 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1306 TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
1307 })
1308
1309 DEF_TRAVERSE_TYPELOC(RecordType, {})
1310 DEF_TRAVERSE_TYPELOC(EnumType, {})
1311 DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, {})
1312 DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, {
1313 TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
1314 })
1315 DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, {
1316 TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
1317 })
1318
1319 // FIXME: use the loc for the template name?
1320 DEF_TRAVERSE_TYPELOC(TemplateSpecializationType, {
1321 TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
1322 for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1323 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1324 }
1325 })
1326
1327 DEF_TRAVERSE_TYPELOC(InjectedClassNameType, {})
1328
1329 DEF_TRAVERSE_TYPELOC(ParenType, { TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1330
1331 DEF_TRAVERSE_TYPELOC(MacroQualifiedType,
1332 { TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
1333
1334 DEF_TRAVERSE_TYPELOC(AttributedType,
1335 { TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
1336
1337 DEF_TRAVERSE_TYPELOC(ElaboratedType, {
1338 if (TL.getQualifierLoc()) {
1339 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1340 }
1341 TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
1342 })
1343
1344 DEF_TRAVERSE_TYPELOC(DependentNameType, {
1345 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1346 })
1347
1348 DEF_TRAVERSE_TYPELOC(DependentTemplateSpecializationType, {
1349 if (TL.getQualifierLoc()) {
1350 TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
1351 }
1352
1353 for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
1354 TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
1355 }
1356 })
1357
1358 DEF_TRAVERSE_TYPELOC(PackExpansionType,
1359 { TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
1360
1361 DEF_TRAVERSE_TYPELOC(ObjCTypeParamType, {})
1362
1363 DEF_TRAVERSE_TYPELOC(ObjCInterfaceType, {})
1364
1365 DEF_TRAVERSE_TYPELOC(ObjCObjectType, {
1366 // We have to watch out here because an ObjCInterfaceType's base
1367 // type is itself.
1368 if (TL.getTypePtr()->getBaseType().getTypePtr() != TL.getTypePtr())
1369 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
1370 for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
1371 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
1372 })
1373
1374 DEF_TRAVERSE_TYPELOC(ObjCObjectPointerType,
1375 { TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
1376
1377 DEF_TRAVERSE_TYPELOC(AtomicType, { TRY_TO(TraverseTypeLoc(TL.getValueLoc())); })
1378
1379 DEF_TRAVERSE_TYPELOC(PipeType, { TRY_TO(TraverseTypeLoc(TL.getValueLoc())); })
1380
1381 #undef DEF_TRAVERSE_TYPELOC
1382
1383 // ----------------- Decl traversal -----------------
1384 //
1385 // For a Decl, we automate (in the DEF_TRAVERSE_DECL macro) traversing
1386 // the children that come from the DeclContext associated with it.
1387 // Therefore each Traverse* only needs to worry about children other
1388 // than those.
1389
1390 template <typename Derived>
1391 bool RecursiveASTVisitor<Derived>::canIgnoreChildDeclWhileTraversingDeclContext(
1392 const Decl *Child) {
1393 // BlockDecls are traversed through BlockExprs,
1394 // CapturedDecls are traversed through CapturedStmts.
1395 if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child))
1396 return true;
1397 // Lambda classes are traversed through LambdaExprs.
1398 if (const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child))
1399 return Cls->isLambda();
1400 return false;
1401 }
1402
1403 template <typename Derived>
1404 bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {
1405 if (!DC)
1406 return true;
1407
1408 for (auto *Child : DC->decls()) {
1409 if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))
1410 TRY_TO(TraverseDecl(Child));
1411 }
1412
1413 return true;
1414 }
1415
1416 // This macro makes available a variable D, the passed-in decl.
1417 #define DEF_TRAVERSE_DECL(DECL, CODE) \
1418 template <typename Derived> \
1419 bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) { \
1420 bool ShouldVisitChildren = true; \
1421 bool ReturnValue = true; \
1422 if (!getDerived().shouldTraversePostOrder()) \
1423 TRY_TO(WalkUpFrom##DECL(D)); \
1424 { CODE; } \
1425 if (ReturnValue && ShouldVisitChildren) \
1426 TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
1427 if (ReturnValue) { \
1428 /* Visit any attributes attached to this declaration. */ \
1429 for (auto *I : D->attrs()) \
1430 TRY_TO(getDerived().TraverseAttr(I)); \
1431 } \
1432 if (ReturnValue && getDerived().shouldTraversePostOrder()) \
1433 TRY_TO(WalkUpFrom##DECL(D)); \
1434 return ReturnValue; \
1435 }
1436
1437 DEF_TRAVERSE_DECL(AccessSpecDecl, {})
1438
1439 DEF_TRAVERSE_DECL(BlockDecl, {
1440 if (TypeSourceInfo *TInfo = D->getSignatureAsWritten())
1441 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
1442 TRY_TO(TraverseStmt(D->getBody()));
1443 for (const auto &I : D->captures()) {
1444 if (I.hasCopyExpr()) {
1445 TRY_TO(TraverseStmt(I.getCopyExpr()));
1446 }
1447 }
1448 ShouldVisitChildren = false;
1449 })
1450
1451 DEF_TRAVERSE_DECL(CapturedDecl, {
1452 TRY_TO(TraverseStmt(D->getBody()));
1453 ShouldVisitChildren = false;
1454 })
1455
1456 DEF_TRAVERSE_DECL(EmptyDecl, {})
1457
1458 DEF_TRAVERSE_DECL(LifetimeExtendedTemporaryDecl, {
1459 TRY_TO(TraverseStmt(D->getTemporaryExpr()));
1460 })
1461
1462 DEF_TRAVERSE_DECL(FileScopeAsmDecl,
1463 { TRY_TO(TraverseStmt(D->getAsmString())); })
1464
1465 DEF_TRAVERSE_DECL(ImportDecl, {})
1466
1467 DEF_TRAVERSE_DECL(FriendDecl, {
1468 // Friend is either decl or a type.
1469 if (D->getFriendType())
1470 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1471 else
1472 TRY_TO(TraverseDecl(D->getFriendDecl()));
1473 })
1474
1475 DEF_TRAVERSE_DECL(FriendTemplateDecl, {
1476 if (D->getFriendType())
1477 TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
1478 else
1479 TRY_TO(TraverseDecl(D->getFriendDecl()));
1480 for (unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
1481 TemplateParameterList *TPL = D->getTemplateParameterList(I);
1482 for (TemplateParameterList::iterator ITPL = TPL->begin(), ETPL = TPL->end();
1483 ITPL != ETPL; ++ITPL) {
1484 TRY_TO(TraverseDecl(*ITPL));
1485 }
1486 }
1487 })
1488
1489 DEF_TRAVERSE_DECL(ClassScopeFunctionSpecializationDecl, {
1490 TRY_TO(TraverseDecl(D->getSpecialization()));
1491
1492 if (D->hasExplicitTemplateArgs()) {
1493 TRY_TO(TraverseTemplateArgumentLocsHelper(
1494 D->getTemplateArgsAsWritten()->getTemplateArgs(),
1495 D->getTemplateArgsAsWritten()->NumTemplateArgs));
1496 }
1497 })
1498
1499 DEF_TRAVERSE_DECL(LinkageSpecDecl, {})
1500
1501 DEF_TRAVERSE_DECL(ExportDecl, {})
1502
1503 DEF_TRAVERSE_DECL(ObjCPropertyImplDecl, {// FIXME: implement this
1504 })
1505
1506 DEF_TRAVERSE_DECL(StaticAssertDecl, {
1507 TRY_TO(TraverseStmt(D->getAssertExpr()));
1508 TRY_TO(TraverseStmt(D->getMessage()));
1509 })
1510
1511 DEF_TRAVERSE_DECL(
1512 TranslationUnitDecl,
1513 {// Code in an unnamed namespace shows up automatically in
1514 // decls_begin()/decls_end(). Thus we don't need to recurse on
1515 // D->getAnonymousNamespace().
1516 })
1517
1518 DEF_TRAVERSE_DECL(PragmaCommentDecl, {})
1519
1520 DEF_TRAVERSE_DECL(PragmaDetectMismatchDecl, {})
1521
1522 DEF_TRAVERSE_DECL(ExternCContextDecl, {})
1523
1524 DEF_TRAVERSE_DECL(NamespaceAliasDecl, {
1525 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1526
1527 // We shouldn't traverse an aliased namespace, since it will be
1528 // defined (and, therefore, traversed) somewhere else.
1529 ShouldVisitChildren = false;
1530 })
1531
1532 DEF_TRAVERSE_DECL(LabelDecl, {// There is no code in a LabelDecl.
1533 })
1534
1535 DEF_TRAVERSE_DECL(
1536 NamespaceDecl,
1537 {// Code in an unnamed namespace shows up automatically in
1538 // decls_begin()/decls_end(). Thus we don't need to recurse on
1539 // D->getAnonymousNamespace().
1540 })
1541
1542 DEF_TRAVERSE_DECL(ObjCCompatibleAliasDecl, {// FIXME: implement
1543 })
1544
1545 DEF_TRAVERSE_DECL(ObjCCategoryDecl, {// FIXME: implement
1546 if (ObjCTypeParamList *typeParamList = D->getTypeParamList()) {
1547 for (auto typeParam : *typeParamList) {
1548 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1549 }
1550 }
1551 })
1552
1553 DEF_TRAVERSE_DECL(ObjCCategoryImplDecl, {// FIXME: implement
1554 })
1555
1556 DEF_TRAVERSE_DECL(ObjCImplementationDecl, {// FIXME: implement
1557 })
1558
1559 DEF_TRAVERSE_DECL(ObjCInterfaceDecl, {// FIXME: implement
1560 if (ObjCTypeParamList *typeParamList = D->getTypeParamListAsWritten()) {
1561 for (auto typeParam : *typeParamList) {
1562 TRY_TO(TraverseObjCTypeParamDecl(typeParam));
1563 }
1564 }
1565
1566 if (TypeSourceInfo *superTInfo = D->getSuperClassTInfo()) {
1567 TRY_TO(TraverseTypeLoc(superTInfo->getTypeLoc()));
1568 }
1569 })
1570
1571 DEF_TRAVERSE_DECL(ObjCProtocolDecl, {// FIXME: implement
1572 })
1573
1574 DEF_TRAVERSE_DECL(ObjCMethodDecl, {
1575 if (D->getReturnTypeSourceInfo()) {
1576 TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc()));
1577 }
1578 for (ParmVarDecl *Parameter : D->parameters()) {
1579 TRY_TO(TraverseDecl(Parameter));
1580 }
1581 if (D->isThisDeclarationADefinition()) {
1582 TRY_TO(TraverseStmt(D->getBody()));
1583 }
1584 ShouldVisitChildren = false;
1585 })
1586
1587 DEF_TRAVERSE_DECL(ObjCTypeParamDecl, {
1588 if (D->hasExplicitBound()) {
1589 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1590 // We shouldn't traverse D->getTypeForDecl(); it's a result of
1591 // declaring the type alias, not something that was written in the
1592 // source.
1593 }
1594 })
1595
1596 DEF_TRAVERSE_DECL(ObjCPropertyDecl, {
1597 if (D->getTypeSourceInfo())
1598 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1599 else
1600 TRY_TO(TraverseType(D->getType()));
1601 ShouldVisitChildren = false;
1602 })
1603
1604 DEF_TRAVERSE_DECL(UsingDecl, {
1605 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1606 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1607 })
1608
1609 DEF_TRAVERSE_DECL(UsingPackDecl, {})
1610
1611 DEF_TRAVERSE_DECL(UsingDirectiveDecl, {
1612 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1613 })
1614
1615 DEF_TRAVERSE_DECL(UsingShadowDecl, {})
1616
1617 DEF_TRAVERSE_DECL(ConstructorUsingShadowDecl, {})
1618
1619 DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
1620 for (auto *I : D->varlists()) {
1621 TRY_TO(TraverseStmt(I));
1622 }
1623 })
1624
1625 DEF_TRAVERSE_DECL(OMPRequiresDecl, {
1626 for (auto *C : D->clauselists()) {
1627 TRY_TO(TraverseOMPClause(C));
1628 }
1629 })
1630
1631 DEF_TRAVERSE_DECL(OMPDeclareReductionDecl, {
1632 TRY_TO(TraverseStmt(D->getCombiner()));
1633 if (auto *Initializer = D->getInitializer())
1634 TRY_TO(TraverseStmt(Initializer));
1635 TRY_TO(TraverseType(D->getType()));
1636 return true;
1637 })
1638
1639 DEF_TRAVERSE_DECL(OMPDeclareMapperDecl, {
1640 for (auto *C : D->clauselists())
1641 TRY_TO(TraverseOMPClause(C));
1642 TRY_TO(TraverseType(D->getType()));
1643 return true;
1644 })
1645
1646 DEF_TRAVERSE_DECL(OMPCapturedExprDecl, { TRY_TO(TraverseVarHelper(D)); })
1647
1648 DEF_TRAVERSE_DECL(OMPAllocateDecl, {
1649 for (auto *I : D->varlists())
1650 TRY_TO(TraverseStmt(I));
1651 for (auto *C : D->clauselists())
1652 TRY_TO(TraverseOMPClause(C));
1653 })
1654
1655 // A helper method for TemplateDecl's children.
1656 template <typename Derived>
1657 bool RecursiveASTVisitor<Derived>::TraverseTemplateParameterListHelper(
1658 TemplateParameterList *TPL) {
1659 if (TPL) {
1660 for (NamedDecl *D : *TPL) {
1661 TRY_TO(TraverseDecl(D));
1662 }
1663 if (Expr *RequiresClause = TPL->getRequiresClause()) {
1664 TRY_TO(TraverseStmt(RequiresClause));
1665 }
1666 }
1667 return true;
1668 }
1669
1670 template <typename Derived>
1671 template <typename T>
1672 bool RecursiveASTVisitor<Derived>::TraverseDeclTemplateParameterLists(T *D) {
1673 for (unsigned i = 0; i < D->getNumTemplateParameterLists(); i++) {
1674 TemplateParameterList *TPL = D->getTemplateParameterList(i);
1675 TraverseTemplateParameterListHelper(TPL);
1676 }
1677 return true;
1678 }
1679
1680 template <typename Derived>
1681 bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1682 ClassTemplateDecl *D) {
1683 for (auto *SD : D->specializations()) {
1684 for (auto *RD : SD->redecls()) {
1685 // We don't want to visit injected-class-names in this traversal.
1686 if (cast<CXXRecordDecl>(RD)->isInjectedClassName())
1687 continue;
1688
1689 switch (
1690 cast<ClassTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1691 // Visit the implicit instantiations with the requested pattern.
1692 case TSK_Undeclared:
1693 case TSK_ImplicitInstantiation:
1694 TRY_TO(TraverseDecl(RD));
1695 break;
1696
1697 // We don't need to do anything on an explicit instantiation
1698 // or explicit specialization because there will be an explicit
1699 // node for it elsewhere.
1700 case TSK_ExplicitInstantiationDeclaration:
1701 case TSK_ExplicitInstantiationDefinition:
1702 case TSK_ExplicitSpecialization:
1703 break;
1704 }
1705 }
1706 }
1707
1708 return true;
1709 }
1710
1711 template <typename Derived>
1712 bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1713 VarTemplateDecl *D) {
1714 for (auto *SD : D->specializations()) {
1715 for (auto *RD : SD->redecls()) {
1716 switch (
1717 cast<VarTemplateSpecializationDecl>(RD)->getSpecializationKind()) {
1718 case TSK_Undeclared:
1719 case TSK_ImplicitInstantiation:
1720 TRY_TO(TraverseDecl(RD));
1721 break;
1722
1723 case TSK_ExplicitInstantiationDeclaration:
1724 case TSK_ExplicitInstantiationDefinition:
1725 case TSK_ExplicitSpecialization:
1726 break;
1727 }
1728 }
1729 }
1730
1731 return true;
1732 }
1733
1734 // A helper method for traversing the instantiations of a
1735 // function while skipping its specializations.
1736 template <typename Derived>
1737 bool RecursiveASTVisitor<Derived>::TraverseTemplateInstantiations(
1738 FunctionTemplateDecl *D) {
1739 for (auto *FD : D->specializations()) {
1740 for (auto *RD : FD->redecls()) {
1741 switch (RD->getTemplateSpecializationKind()) {
1742 case TSK_Undeclared:
1743 case TSK_ImplicitInstantiation:
1744 // We don't know what kind of FunctionDecl this is.
1745 TRY_TO(TraverseDecl(RD));
1746 break;
1747
1748 // FIXME: For now traverse explicit instantiations here. Change that
1749 // once they are represented as dedicated nodes in the AST.
1750 case TSK_ExplicitInstantiationDeclaration:
1751 case TSK_ExplicitInstantiationDefinition:
1752 TRY_TO(TraverseDecl(RD));
1753 break;
1754
1755 case TSK_ExplicitSpecialization:
1756 break;
1757 }
1758 }
1759 }
1760
1761 return true;
1762 }
1763
1764 // This macro unifies the traversal of class, variable and function
1765 // template declarations.
1766 #define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND) \
1767 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, { \
1768 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
1769 TRY_TO(TraverseDecl(D->getTemplatedDecl())); \
1770 \
1771 /* By default, we do not traverse the instantiations of \
1772 class templates since they do not appear in the user code. The \
1773 following code optionally traverses them. \
1774 \
1775 We only traverse the class instantiations when we see the canonical \
1776 declaration of the template, to ensure we only visit them once. */ \
1777 if (getDerived().shouldVisitTemplateInstantiations() && \
1778 D == D->getCanonicalDecl()) \
1779 TRY_TO(TraverseTemplateInstantiations(D)); \
1780 \
1781 /* Note that getInstantiatedFromMemberTemplate() is just a link \
1782 from a template instantiation back to the template from which \
1783 it was instantiated, and thus should not be traversed. */ \
1784 })
1785
1786 DEF_TRAVERSE_TMPL_DECL(Class)
1787 DEF_TRAVERSE_TMPL_DECL(Var)
1788 DEF_TRAVERSE_TMPL_DECL(Function)
1789
1790 DEF_TRAVERSE_DECL(TemplateTemplateParmDecl, {
1791 // D is the "T" in something like
1792 // template <template <typename> class T> class container { };
1793 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
1794 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1795 TRY_TO(TraverseTemplateArgumentLoc(D->getDefaultArgument()));
1796 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1797 })
1798
1799 DEF_TRAVERSE_DECL(BuiltinTemplateDecl, {
1800 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1801 })
1802
1803 DEF_TRAVERSE_DECL(TemplateTypeParmDecl, {
1804 // D is the "T" in something like "template<typename T> class vector;"
1805 if (D->getTypeForDecl())
1806 TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
1807 if (const auto *TC = D->getTypeConstraint())
1808 TRY_TO(TraverseConceptReference(*TC));
1809 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
1810 TRY_TO(TraverseTypeLoc(D->getDefaultArgumentInfo()->getTypeLoc()));
1811 })
1812
1813 DEF_TRAVERSE_DECL(TypedefDecl, {
1814 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1815 // We shouldn't traverse D->getTypeForDecl(); it's a result of
1816 // declaring the typedef, not something that was written in the
1817 // source.
1818 })
1819
1820 DEF_TRAVERSE_DECL(TypeAliasDecl, {
1821 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1822 // We shouldn't traverse D->getTypeForDecl(); it's a result of
1823 // declaring the type alias, not something that was written in the
1824 // source.
1825 })
1826
1827 DEF_TRAVERSE_DECL(TypeAliasTemplateDecl, {
1828 TRY_TO(TraverseDecl(D->getTemplatedDecl()));
1829 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1830 })
1831
1832 DEF_TRAVERSE_DECL(ConceptDecl, {
1833 TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));
1834 TRY_TO(TraverseStmt(D->getConstraintExpr()));
1835 })
1836
1837 DEF_TRAVERSE_DECL(UnresolvedUsingTypenameDecl, {
1838 // A dependent using declaration which was marked with 'typename'.
1839 // template<class T> class A : public B<T> { using typename B<T>::foo; };
1840 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1841 // We shouldn't traverse D->getTypeForDecl(); it's a result of
1842 // declaring the type, not something that was written in the
1843 // source.
1844 })
1845
1846 DEF_TRAVERSE_DECL(EnumDecl, {
1847 TRY_TO(TraverseDeclTemplateParameterLists(D));
1848
1849 if (D->getTypeForDecl())
1850 TRY_TO(TraverseType(QualType(D->getTypeForDecl(), 0)));
1851
1852 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1853 // The enumerators are already traversed by
1854 // decls_begin()/decls_end().
1855 })
1856
1857 // Helper methods for RecordDecl and its children.
1858 template <typename Derived>
1859 bool RecursiveASTVisitor<Derived>::TraverseRecordHelper(RecordDecl *D) {
1860 // We shouldn't traverse D->getTypeForDecl(); it's a result of
1861 // declaring the type, not something that was written in the source.
1862
1863 TRY_TO(TraverseDeclTemplateParameterLists(D));
1864 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1865 return true;
1866 }
1867
1868 template <typename Derived>
1869 bool RecursiveASTVisitor<Derived>::TraverseCXXBaseSpecifier(
1870 const CXXBaseSpecifier &Base) {
1871 TRY_TO(TraverseTypeLoc(Base.getTypeSourceInfo()->getTypeLoc()));
1872 return true;
1873 }
1874
1875 template <typename Derived>
1876 bool RecursiveASTVisitor<Derived>::TraverseCXXRecordHelper(CXXRecordDecl *D) {
1877 if (!TraverseRecordHelper(D))
1878 return false;
1879 if (D->isCompleteDefinition()) {
1880 for (const auto &I : D->bases()) {
1881 TRY_TO(TraverseCXXBaseSpecifier(I));
1882 }
1883 // We don't traverse the friends or the conversions, as they are
1884 // already in decls_begin()/decls_end().
1885 }
1886 return true;
1887 }
1888
1889 DEF_TRAVERSE_DECL(RecordDecl, { TRY_TO(TraverseRecordHelper(D)); })
1890
1891 DEF_TRAVERSE_DECL(CXXRecordDecl, { TRY_TO(TraverseCXXRecordHelper(D)); })
1892
1893 #define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND) \
1894 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateSpecializationDecl, { \
1895 /* For implicit instantiations ("set<int> x;"), we don't want to \
1896 recurse at all, since the instatiated template isn't written in \
1897 the source code anywhere. (Note the instatiated *type* -- \
1898 set<int> -- is written, and will still get a callback of \
1899 TemplateSpecializationType). For explicit instantiations \
1900 ("template set<int>;"), we do need a callback, since this \
1901 is the only callback that's made for this instantiation. \
1902 We use getTypeAsWritten() to distinguish. */ \
1903 if (TypeSourceInfo *TSI = D->getTypeAsWritten()) \
1904 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc())); \
1905 \
1906 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); \
1907 if (!getDerived().shouldVisitTemplateInstantiations() && \
1908 D->getTemplateSpecializationKind() != TSK_ExplicitSpecialization) \
1909 /* Returning from here skips traversing the \
1910 declaration context of the *TemplateSpecializationDecl \
1911 (embedded in the DEF_TRAVERSE_DECL() macro) \
1912 which contains the instantiated members of the template. */ \
1913 return true; \
1914 })
1915
1916 DEF_TRAVERSE_TMPL_SPEC_DECL(Class)
1917 DEF_TRAVERSE_TMPL_SPEC_DECL(Var)
1918
1919 template <typename Derived>
1920 bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
1921 const TemplateArgumentLoc *TAL, unsigned Count) {
1922 for (unsigned I = 0; I < Count; ++I) {
1923 TRY_TO(TraverseTemplateArgumentLoc(TAL[I]));
1924 }
1925 return true;
1926 }
1927
1928 #define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND) \
1929 DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplatePartialSpecializationDecl, { \
1930 /* The partial specialization. */ \
1931 if (TemplateParameterList *TPL = D->getTemplateParameters()) { \
1932 for (TemplateParameterList::iterator I = TPL->begin(), E = TPL->end(); \
1933 I != E; ++I) { \
1934 TRY_TO(TraverseDecl(*I)); \
1935 } \
1936 } \
1937 /* The args that remains unspecialized. */ \
1938 TRY_TO(TraverseTemplateArgumentLocsHelper( \
1939 D->getTemplateArgsAsWritten()->getTemplateArgs(), \
1940 D->getTemplateArgsAsWritten()->NumTemplateArgs)); \
1941 \
1942 /* Don't need the *TemplatePartialSpecializationHelper, even \
1943 though that's our parent class -- we already visit all the \
1944 template args here. */ \
1945 TRY_TO(Traverse##DECLKIND##Helper(D)); \
1946 \
1947 /* Instantiations will have been visited with the primary template. */ \
1948 })
1949
1950 DEF_TRAVERSE_TMPL_PART_SPEC_DECL(Class, CXXRecord)
1951 DEF_TRAVERSE_TMPL_PART_SPEC_DECL(Var, Var)
1952
1953 DEF_TRAVERSE_DECL(EnumConstantDecl, { TRY_TO(TraverseStmt(D->getInitExpr())); })
1954
1955 DEF_TRAVERSE_DECL(UnresolvedUsingValueDecl, {
1956 // Like UnresolvedUsingTypenameDecl, but without the 'typename':
1957 // template <class T> Class A : public Base<T> { using Base<T>::foo; };
1958 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1959 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
1960 })
1961
1962 DEF_TRAVERSE_DECL(IndirectFieldDecl, {})
1963
1964 template <typename Derived>
1965 bool RecursiveASTVisitor<Derived>::TraverseDeclaratorHelper(DeclaratorDecl *D) {
1966 TRY_TO(TraverseDeclTemplateParameterLists(D));
1967 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
1968 if (D->getTypeSourceInfo())
1969 TRY_TO(TraverseTypeLoc(D->getTypeSourceInfo()->getTypeLoc()));
1970 else
1971 TRY_TO(TraverseType(D->getType()));
1972 return true;
1973 }
1974
1975 DEF_TRAVERSE_DECL(DecompositionDecl, {
1976 TRY_TO(TraverseVarHelper(D));
1977 for (auto *Binding : D->bindings()) {
1978 TRY_TO(TraverseDecl(Binding));
1979 }
1980 })
1981
1982 DEF_TRAVERSE_DECL(BindingDecl, {
1983 if (getDerived().shouldVisitImplicitCode())
1984 TRY_TO(TraverseStmt(D->getBinding()));
1985 })
1986
1987 DEF_TRAVERSE_DECL(MSPropertyDecl, { TRY_TO(TraverseDeclaratorHelper(D)); })
1988
1989 DEF_TRAVERSE_DECL(FieldDecl, {
1990 TRY_TO(TraverseDeclaratorHelper(D));
1991 if (D->isBitField())
1992 TRY_TO(TraverseStmt(D->getBitWidth()));
1993 else if (D->hasInClassInitializer())
1994 TRY_TO(TraverseStmt(D->getInClassInitializer()));
1995 })
1996
1997 DEF_TRAVERSE_DECL(ObjCAtDefsFieldDecl, {
1998 TRY_TO(TraverseDeclaratorHelper(D));
1999 if (D->isBitField())
2000 TRY_TO(TraverseStmt(D->getBitWidth()));
2001 // FIXME: implement the rest.
2002 })
2003
2004 DEF_TRAVERSE_DECL(ObjCIvarDecl, {
2005 TRY_TO(TraverseDeclaratorHelper(D));
2006 if (D->isBitField())
2007 TRY_TO(TraverseStmt(D->getBitWidth()));
2008 // FIXME: implement the rest.
2009 })
2010
2011 template <typename Derived>
2012 bool RecursiveASTVisitor<Derived>::TraverseFunctionHelper(FunctionDecl *D) {
2013 TRY_TO(TraverseDeclTemplateParameterLists(D));
2014 TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
2015 TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
2016
2017 // If we're an explicit template specialization, iterate over the
2018 // template args that were explicitly specified. If we were doing
2019 // this in typing order, we'd do it between the return type and
2020 // the function args, but both are handled by the FunctionTypeLoc
2021 // above, so we have to choose one side. I've decided to do before.
2022 if (const FunctionTemplateSpecializationInfo *FTSI =
2023 D->getTemplateSpecializationInfo()) {
2024 if (FTSI->getTemplateSpecializationKind() != TSK_Undeclared &&
2025 FTSI->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
2026 // A specialization might not have explicit template arguments if it has
2027 // a templated return type and concrete arguments.
2028 if (const ASTTemplateArgumentListInfo *TALI =
2029 FTSI->TemplateArgumentsAsWritten) {
2030 TRY_TO(TraverseTemplateArgumentLocsHelper(TALI->getTemplateArgs(),
2031 TALI->NumTemplateArgs));
2032 }
2033 }
2034 }
2035
2036 // Visit the function type itself, which can be either
2037 // FunctionNoProtoType or FunctionProtoType, or a typedef. This
2038 // also covers the return type and the function parameters,
2039 // including exception specifications.
2040 if (TypeSourceInfo *TSI = D->getTypeSourceInfo()) {
2041 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2042 } else if (getDerived().shouldVisitImplicitCode()) {
2043 // Visit parameter variable declarations of the implicit function
2044 // if the traverser is visiting implicit code. Parameter variable
2045 // declarations do not have valid TypeSourceInfo, so to visit them
2046 // we need to traverse the declarations explicitly.
2047 for (ParmVarDecl *Parameter : D->parameters()) {
2048 TRY_TO(TraverseDecl(Parameter));
2049 }
2050 }
2051
2052 // Visit the trailing requires clause, if any.
2053 if (Expr *TrailingRequiresClause = D->getTrailingRequiresClause()) {
2054 TRY_TO(TraverseStmt(TrailingRequiresClause));
2055 }
2056
2057 if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
2058 // Constructor initializers.
2059 for (auto *I : Ctor->inits()) {
2060 if (I->isWritten() || getDerived().shouldVisitImplicitCode())
2061 TRY_TO(TraverseConstructorInitializer(I));
2062 }
2063 }
2064
2065 bool VisitBody = D->isThisDeclarationADefinition();
2066 // If a method is set to default outside the class definition the compiler
2067 // generates the method body and adds it to the AST.
2068 if (const auto *MD = dyn_cast<CXXMethodDecl>(D))
2069 VisitBody &= !MD->isDefaulted() || getDerived().shouldVisitImplicitCode();
2070
2071 if (VisitBody) {
2072 TRY_TO(TraverseStmt(D->getBody())); // Function body.
2073 }
2074 return true;
2075 }
2076
2077 DEF_TRAVERSE_DECL(FunctionDecl, {
2078 // We skip decls_begin/decls_end, which are already covered by
2079 // TraverseFunctionHelper().
2080 ShouldVisitChildren = false;
2081 ReturnValue = TraverseFunctionHelper(D);
2082 })
2083
2084 DEF_TRAVERSE_DECL(CXXDeductionGuideDecl, {
2085 // We skip decls_begin/decls_end, which are already covered by
2086 // TraverseFunctionHelper().
2087 ShouldVisitChildren = false;
2088 ReturnValue = TraverseFunctionHelper(D);
2089 })
2090
2091 DEF_TRAVERSE_DECL(CXXMethodDecl, {
2092 // We skip decls_begin/decls_end, which are already covered by
2093 // TraverseFunctionHelper().
2094 ShouldVisitChildren = false;
2095 ReturnValue = TraverseFunctionHelper(D);
2096 })
2097
2098 DEF_TRAVERSE_DECL(CXXConstructorDecl, {
2099 // We skip decls_begin/decls_end, which are already covered by
2100 // TraverseFunctionHelper().
2101 ShouldVisitChildren = false;
2102 ReturnValue = TraverseFunctionHelper(D);
2103 })
2104
2105 // CXXConversionDecl is the declaration of a type conversion operator.
2106 // It's not a cast expression.
2107 DEF_TRAVERSE_DECL(CXXConversionDecl, {
2108 // We skip decls_begin/decls_end, which are already covered by
2109 // TraverseFunctionHelper().
2110 ShouldVisitChildren = false;
2111 ReturnValue = TraverseFunctionHelper(D);
2112 })
2113
2114 DEF_TRAVERSE_DECL(CXXDestructorDecl, {
2115 // We skip decls_begin/decls_end, which are already covered by
2116 // TraverseFunctionHelper().
2117 ShouldVisitChildren = false;
2118 ReturnValue = TraverseFunctionHelper(D);
2119 })
2120
2121 template <typename Derived>
2122 bool RecursiveASTVisitor<Derived>::TraverseVarHelper(VarDecl *D) {
2123 TRY_TO(TraverseDeclaratorHelper(D));
2124 // Default params are taken care of when we traverse the ParmVarDecl.
2125 if (!isa<ParmVarDecl>(D) &&
2126 (!D->isCXXForRangeDecl() || getDerived().shouldVisitImplicitCode()))
2127 TRY_TO(TraverseStmt(D->getInit()));
2128 return true;
2129 }
2130
2131 DEF_TRAVERSE_DECL(VarDecl, { TRY_TO(TraverseVarHelper(D)); })
2132
2133 DEF_TRAVERSE_DECL(ImplicitParamDecl, { TRY_TO(TraverseVarHelper(D)); })
2134
2135 DEF_TRAVERSE_DECL(NonTypeTemplateParmDecl, {
2136 // A non-type template parameter, e.g. "S" in template<int S> class Foo ...
2137 TRY_TO(TraverseDeclaratorHelper(D));
2138 if (D->hasDefaultArgument() && !D->defaultArgumentWasInherited())
2139 TRY_TO(TraverseStmt(D->getDefaultArgument()));
2140 })
2141
2142 DEF_TRAVERSE_DECL(ParmVarDecl, {
2143 TRY_TO(TraverseVarHelper(D));
2144
2145 if (D->hasDefaultArg() && D->hasUninstantiatedDefaultArg() &&
2146 !D->hasUnparsedDefaultArg())
2147 TRY_TO(TraverseStmt(D->getUninstantiatedDefaultArg()));
2148
2149 if (D->hasDefaultArg() && !D->hasUninstantiatedDefaultArg() &&
2150 !D->hasUnparsedDefaultArg())
2151 TRY_TO(TraverseStmt(D->getDefaultArg()));
2152 })
2153
2154 DEF_TRAVERSE_DECL(RequiresExprBodyDecl, {})
2155
2156 #undef DEF_TRAVERSE_DECL
2157
2158 // ----------------- Stmt traversal -----------------
2159 //
2160 // For stmts, we automate (in the DEF_TRAVERSE_STMT macro) iterating
2161 // over the children defined in children() (every stmt defines these,
2162 // though sometimes the range is empty). Each individual Traverse*
2163 // method only needs to worry about children other than those. To see
2164 // what children() does for a given class, see, e.g.,
2165 // http://clang.llvm.org/doxygen/Stmt_8cpp_source.html
2166
2167 // This macro makes available a variable S, the passed-in stmt.
2168 #define DEF_TRAVERSE_STMT(STMT, CODE) \
2169 template <typename Derived> \
2170 bool RecursiveASTVisitor<Derived>::Traverse##STMT( \
2171 STMT *S, DataRecursionQueue *Queue) { \
2172 bool ShouldVisitChildren = true; \
2173 bool ReturnValue = true; \
2174 if (!getDerived().shouldTraversePostOrder()) \
2175 TRY_TO(WalkUpFrom##STMT(S)); \
2176 { CODE; } \
2177 if (ShouldVisitChildren) { \
2178 for (Stmt * SubStmt : getDerived().getStmtChildren(S)) { \
2179 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt); \
2180 } \
2181 } \
2182 if (!Queue && ReturnValue && getDerived().shouldTraversePostOrder()) \
2183 TRY_TO(WalkUpFrom##STMT(S)); \
2184 return ReturnValue; \
2185 }
2186
2187 DEF_TRAVERSE_STMT(GCCAsmStmt, {
2188 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getAsmString());
2189 for (unsigned I = 0, E = S->getNumInputs(); I < E; ++I) {
2190 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getInputConstraintLiteral(I));
2191 }
2192 for (unsigned I = 0, E = S->getNumOutputs(); I < E; ++I) {
2193 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getOutputConstraintLiteral(I));
2194 }
2195 for (unsigned I = 0, E = S->getNumClobbers(); I < E; ++I) {
2196 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getClobberStringLiteral(I));
2197 }
2198 // children() iterates over inputExpr and outputExpr.
2199 })
2200
2201 DEF_TRAVERSE_STMT(
2202 MSAsmStmt,
2203 {// FIXME: MS Asm doesn't currently parse Constraints, Clobbers, etc. Once
2204 // added this needs to be implemented.
2205 })
2206
2207 DEF_TRAVERSE_STMT(CXXCatchStmt, {
2208 TRY_TO(TraverseDecl(S->getExceptionDecl()));
2209 // children() iterates over the handler block.
2210 })
2211
2212 DEF_TRAVERSE_STMT(DeclStmt, {
2213 for (auto *I : S->decls()) {
2214 TRY_TO(TraverseDecl(I));
2215 }
2216 // Suppress the default iteration over children() by
2217 // returning. Here's why: A DeclStmt looks like 'type var [=
2218 // initializer]'. The decls above already traverse over the
2219 // initializers, so we don't have to do it again (which
2220 // children() would do).
2221 ShouldVisitChildren = false;
2222 })
2223
2224 // These non-expr stmts (most of them), do not need any action except
2225 // iterating over the children.
2226 DEF_TRAVERSE_STMT(BreakStmt, {})
2227 DEF_TRAVERSE_STMT(CXXTryStmt, {})
2228 DEF_TRAVERSE_STMT(CaseStmt, {})
2229 DEF_TRAVERSE_STMT(CompoundStmt, {})
2230 DEF_TRAVERSE_STMT(ContinueStmt, {})
2231 DEF_TRAVERSE_STMT(DefaultStmt, {})
2232 DEF_TRAVERSE_STMT(DoStmt, {})
2233 DEF_TRAVERSE_STMT(ForStmt, {})
2234 DEF_TRAVERSE_STMT(GotoStmt, {})
2235 DEF_TRAVERSE_STMT(IfStmt, {})
2236 DEF_TRAVERSE_STMT(IndirectGotoStmt, {})
2237 DEF_TRAVERSE_STMT(LabelStmt, {})
2238 DEF_TRAVERSE_STMT(AttributedStmt, {})
2239 DEF_TRAVERSE_STMT(NullStmt, {})
2240 DEF_TRAVERSE_STMT(ObjCAtCatchStmt, {})
2241 DEF_TRAVERSE_STMT(ObjCAtFinallyStmt, {})
2242 DEF_TRAVERSE_STMT(ObjCAtSynchronizedStmt, {})
2243 DEF_TRAVERSE_STMT(ObjCAtThrowStmt, {})
2244 DEF_TRAVERSE_STMT(ObjCAtTryStmt, {})
2245 DEF_TRAVERSE_STMT(ObjCForCollectionStmt, {})
2246 DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStmt, {})
2247
2248 DEF_TRAVERSE_STMT(CXXForRangeStmt, {
2249 if (!getDerived().shouldVisitImplicitCode()) {
2250 if (S->getInit())
2251 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getInit());
2252 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLoopVarStmt());
2253 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getRangeInit());
2254 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody());
2255 // Visit everything else only if shouldVisitImplicitCode().
2256 ShouldVisitChildren = false;
2257 }
2258 })
2259
2260 DEF_TRAVERSE_STMT(MSDependentExistsStmt, {
2261 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2262 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2263 })
2264
2265 DEF_TRAVERSE_STMT(ReturnStmt, {})
2266 DEF_TRAVERSE_STMT(SwitchStmt, {})
2267 DEF_TRAVERSE_STMT(WhileStmt, {})
2268
2269 DEF_TRAVERSE_STMT(ConstantExpr, {})
2270
2271 DEF_TRAVERSE_STMT(CXXDependentScopeMemberExpr, {
2272 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2273 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2274 if (S->hasExplicitTemplateArgs()) {
2275 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2276 S->getNumTemplateArgs()));
2277 }
2278 })
2279
2280 DEF_TRAVERSE_STMT(DeclRefExpr, {
2281 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2282 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2283 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2284 S->getNumTemplateArgs()));
2285 })
2286
2287 DEF_TRAVERSE_STMT(DependentScopeDeclRefExpr, {
2288 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2289 TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
2290 if (S->hasExplicitTemplateArgs()) {
2291 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2292 S->getNumTemplateArgs()));
2293 }
2294 })
2295
2296 DEF_TRAVERSE_STMT(MemberExpr, {
2297 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2298 TRY_TO(TraverseDeclarationNameInfo(S->getMemberNameInfo()));
2299 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2300 S->getNumTemplateArgs()));
2301 })
2302
2303 DEF_TRAVERSE_STMT(
2304 ImplicitCastExpr,
2305 {// We don't traverse the cast type, as it's not written in the
2306 // source code.
2307 })
2308
2309 DEF_TRAVERSE_STMT(CStyleCastExpr, {
2310 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2311 })
2312
2313 DEF_TRAVERSE_STMT(CXXFunctionalCastExpr, {
2314 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2315 })
2316
2317 DEF_TRAVERSE_STMT(CXXConstCastExpr, {
2318 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2319 })
2320
2321 DEF_TRAVERSE_STMT(CXXDynamicCastExpr, {
2322 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2323 })
2324
2325 DEF_TRAVERSE_STMT(CXXReinterpretCastExpr, {
2326 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2327 })
2328
2329 DEF_TRAVERSE_STMT(CXXStaticCastExpr, {
2330 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2331 })
2332
2333 DEF_TRAVERSE_STMT(BuiltinBitCastExpr, {
2334 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2335 })
2336
2337 template <typename Derived>
2338 bool RecursiveASTVisitor<Derived>::TraverseSynOrSemInitListExpr(
2339 InitListExpr *S, DataRecursionQueue *Queue) {
2340 if (S) {
2341 // Skip this if we traverse postorder. We will visit it later
2342 // in PostVisitStmt.
2343 if (!getDerived().shouldTraversePostOrder())
2344 TRY_TO(WalkUpFromInitListExpr(S));
2345
2346 // All we need are the default actions. FIXME: use a helper function.
2347 for (Stmt *SubStmt : S->children()) {
2348 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(SubStmt);
2349 }
2350 }
2351 return true;
2352 }
2353
2354 template<typename Derived>
2355 bool RecursiveASTVisitor<Derived>::TraverseConceptReference(
2356 const ConceptReference &C) {
2357 TRY_TO(TraverseNestedNameSpecifierLoc(C.getNestedNameSpecifierLoc()));
2358 TRY_TO(TraverseDeclarationNameInfo(C.getConceptNameInfo()));
2359 if (C.hasExplicitTemplateArgs())
2360 TRY_TO(TraverseTemplateArgumentLocsHelper(
2361 C.getTemplateArgsAsWritten()->getTemplateArgs(),
2362 C.getTemplateArgsAsWritten()->NumTemplateArgs));
2363 return true;
2364 }
2365
2366 // If shouldVisitImplicitCode() returns false, this method traverses only the
2367 // syntactic form of InitListExpr.
2368 // If shouldVisitImplicitCode() return true, this method is called once for
2369 // each pair of syntactic and semantic InitListExpr, and it traverses the
2370 // subtrees defined by the two forms. This may cause some of the children to be
2371 // visited twice, if they appear both in the syntactic and the semantic form.
2372 //
2373 // There is no guarantee about which form \p S takes when this method is called.
2374 template <typename Derived>
2375 bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(
2376 InitListExpr *S, DataRecursionQueue *Queue) {
2377 if (S->isSemanticForm() && S->isSyntacticForm()) {
2378 // `S` does not have alternative forms, traverse only once.
2379 TRY_TO(TraverseSynOrSemInitListExpr(S, Queue));
2380 return true;
2381 }
2382 TRY_TO(TraverseSynOrSemInitListExpr(
2383 S->isSemanticForm() ? S->getSyntacticForm() : S, Queue));
2384 if (getDerived().shouldVisitImplicitCode()) {
2385 // Only visit the semantic form if the clients are interested in implicit
2386 // compiler-generated.
2387 TRY_TO(TraverseSynOrSemInitListExpr(
2388 S->isSemanticForm() ? S : S->getSemanticForm(), Queue));
2389 }
2390 return true;
2391 }
2392
2393 // GenericSelectionExpr is a special case because the types and expressions
2394 // are interleaved. We also need to watch out for null types (default
2395 // generic associations).
2396 DEF_TRAVERSE_STMT(GenericSelectionExpr, {
2397 TRY_TO(TraverseStmt(S->getControllingExpr()));
2398 for (const GenericSelectionExpr::Association Assoc : S->associations()) {
2399 if (TypeSourceInfo *TSI = Assoc.getTypeSourceInfo())
2400 TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
2401 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(Assoc.getAssociationExpr());
2402 }
2403 ShouldVisitChildren = false;
2404 })
2405
2406 // PseudoObjectExpr is a special case because of the weirdness with
2407 // syntactic expressions and opaque values.
2408 DEF_TRAVERSE_STMT(PseudoObjectExpr, {
2409 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getSyntacticForm());
2410 for (PseudoObjectExpr::semantics_iterator i = S->semantics_begin(),
2411 e = S->semantics_end();
2412 i != e; ++i) {
2413 Expr *sub = *i;
2414 if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(sub))
2415 sub = OVE->getSourceExpr();
2416 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(sub);
2417 }
2418 ShouldVisitChildren = false;
2419 })
2420
2421 DEF_TRAVERSE_STMT(CXXScalarValueInitExpr, {
2422 // This is called for code like 'return T()' where T is a built-in
2423 // (i.e. non-class) type.
2424 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2425 })
2426
2427 DEF_TRAVERSE_STMT(CXXNewExpr, {
2428 // The child-iterator will pick up the other arguments.
2429 TRY_TO(TraverseTypeLoc(S->getAllocatedTypeSourceInfo()->getTypeLoc()));
2430 })
2431
2432 DEF_TRAVERSE_STMT(OffsetOfExpr, {
2433 // The child-iterator will pick up the expression representing
2434 // the field.
2435 // FIMXE: for code like offsetof(Foo, a.b.c), should we get
2436 // making a MemberExpr callbacks for Foo.a, Foo.a.b, and Foo.a.b.c?
2437 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2438 })
2439
2440 DEF_TRAVERSE_STMT(UnaryExprOrTypeTraitExpr, {
2441 // The child-iterator will pick up the arg if it's an expression,
2442 // but not if it's a type.
2443 if (S->isArgumentType())
2444 TRY_TO(TraverseTypeLoc(S->getArgumentTypeInfo()->getTypeLoc()));
2445 })
2446
2447 DEF_TRAVERSE_STMT(CXXTypeidExpr, {
2448 // The child-iterator will pick up the arg if it's an expression,
2449 // but not if it's a type.
2450 if (S->isTypeOperand())
2451 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2452 })
2453
2454 DEF_TRAVERSE_STMT(MSPropertyRefExpr, {
2455 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2456 })
2457
2458 DEF_TRAVERSE_STMT(MSPropertySubscriptExpr, {})
2459
2460 DEF_TRAVERSE_STMT(CXXUuidofExpr, {
2461 // The child-iterator will pick up the arg if it's an expression,
2462 // but not if it's a type.
2463 if (S->isTypeOperand())
2464 TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
2465 })
2466
2467 DEF_TRAVERSE_STMT(TypeTraitExpr, {
2468 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2469 TRY_TO(TraverseTypeLoc(S->getArg(I)->getTypeLoc()));
2470 })
2471
2472 DEF_TRAVERSE_STMT(ArrayTypeTraitExpr, {
2473 TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
2474 })
2475
2476 DEF_TRAVERSE_STMT(ExpressionTraitExpr,
2477 { TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getQueriedExpression()); })
2478
2479 DEF_TRAVERSE_STMT(VAArgExpr, {
2480 // The child-iterator will pick up the expression argument.
2481 TRY_TO(TraverseTypeLoc(S->getWrittenTypeInfo()->getTypeLoc()));
2482 })
2483
2484 DEF_TRAVERSE_STMT(CXXTemporaryObjectExpr, {
2485 // This is called for code like 'return T()' where T is a class type.
2486 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2487 })
2488
2489 // Walk only the visible parts of lambda expressions.
2490 DEF_TRAVERSE_STMT(LambdaExpr, {
2491 // Visit the capture list.
2492 for (unsigned I = 0, N = S->capture_size(); I != N; ++I) {
2493 const LambdaCapture *C = S->capture_begin() + I;
2494 if (C->isExplicit() || getDerived().shouldVisitImplicitCode()) {
2495 TRY_TO(TraverseLambdaCapture(S, C, S->capture_init_begin()[I]));
2496 }
2497 }
2498
2499 if (getDerived().shouldVisitImplicitCode()) {
2500 // The implicit model is simple: everything else is in the lambda class.
2501 TRY_TO(TraverseDecl(S->getLambdaClass()));
2502 } else {
2503 // We need to poke around to find the bits that might be explicitly written.
2504 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
2505 FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
2506
2507 for (Decl *D : S->getExplicitTemplateParameters()) {
2508 // Visit explicit template parameters.
2509 TRY_TO(TraverseDecl(D));
2510 }
2511 if (S->hasExplicitParameters()) {
2512 // Visit parameters.
2513 for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)
2514 TRY_TO(TraverseDecl(Proto.getParam(I)));
2515 }
2516 if (S->hasExplicitResultType())
2517 TRY_TO(TraverseTypeLoc(Proto.getReturnLoc()));
2518
2519 auto *T = Proto.getTypePtr();
2520 for (const auto &E : T->exceptions())
2521 TRY_TO(TraverseType(E));
2522
2523 if (Expr *NE = T->getNoexceptExpr())
2524 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(NE);
2525
2526 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody());
2527 }
2528 ShouldVisitChildren = false;
2529 })
2530
2531 DEF_TRAVERSE_STMT(CXXUnresolvedConstructExpr, {
2532 // This is called for code like 'T()', where T is a template argument.
2533 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2534 })
2535
2536 // These expressions all might take explicit template arguments.
2537 // We traverse those if so. FIXME: implement these.
2538 DEF_TRAVERSE_STMT(CXXConstructExpr, {})
2539 DEF_TRAVERSE_STMT(CallExpr, {})
2540 DEF_TRAVERSE_STMT(CXXMemberCallExpr, {})
2541
2542 // These exprs (most of them), do not need any action except iterating
2543 // over the children.
2544 DEF_TRAVERSE_STMT(AddrLabelExpr, {})
2545 DEF_TRAVERSE_STMT(ArraySubscriptExpr, {})
2546 DEF_TRAVERSE_STMT(OMPArraySectionExpr, {})
2547
2548 DEF_TRAVERSE_STMT(BlockExpr, {
2549 TRY_TO(TraverseDecl(S->getBlockDecl()));
2550 return true; // no child statements to loop through.
2551 })
2552
2553 DEF_TRAVERSE_STMT(ChooseExpr, {})
2554 DEF_TRAVERSE_STMT(CompoundLiteralExpr, {
2555 TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
2556 })
2557 DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, {})
2558 DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, {})
2559
2560 DEF_TRAVERSE_STMT(CXXDefaultArgExpr, {
2561 if (getDerived().shouldVisitImplicitCode())
2562 TRY_TO(TraverseStmt(S->getExpr()));
2563 })
2564
2565 DEF_TRAVERSE_STMT(CXXDefaultInitExpr, {})
2566 DEF_TRAVERSE_STMT(CXXDeleteExpr, {})
2567 DEF_TRAVERSE_STMT(ExprWithCleanups, {})
2568 DEF_TRAVERSE_STMT(CXXInheritedCtorInitExpr, {})
2569 DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, {})
2570 DEF_TRAVERSE_STMT(CXXStdInitializerListExpr, {})
2571
2572 DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, {
2573 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2574 if (TypeSourceInfo *ScopeInfo = S->getScopeTypeInfo())
2575 TRY_TO(TraverseTypeLoc(ScopeInfo->getTypeLoc()));
2576 if (TypeSourceInfo *DestroyedTypeInfo = S->getDestroyedTypeInfo())
2577 TRY_TO(TraverseTypeLoc(DestroyedTypeInfo->getTypeLoc()));
2578 })
2579
2580 DEF_TRAVERSE_STMT(CXXThisExpr, {})
2581 DEF_TRAVERSE_STMT(CXXThrowExpr, {})
2582 DEF_TRAVERSE_STMT(UserDefinedLiteral, {})
2583 DEF_TRAVERSE_STMT(DesignatedInitExpr, {})
2584 DEF_TRAVERSE_STMT(DesignatedInitUpdateExpr, {})
2585 DEF_TRAVERSE_STMT(ExtVectorElementExpr, {})
2586 DEF_TRAVERSE_STMT(GNUNullExpr, {})
2587 DEF_TRAVERSE_STMT(ImplicitValueInitExpr, {})
2588 DEF_TRAVERSE_STMT(NoInitExpr, {})
2589 DEF_TRAVERSE_STMT(ArrayInitLoopExpr, {
2590 // FIXME: The source expression of the OVE should be listed as
2591 // a child of the ArrayInitLoopExpr.
2592 if (OpaqueValueExpr *OVE = S->getCommonExpr())
2593 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(OVE->getSourceExpr());
2594 })
2595 DEF_TRAVERSE_STMT(ArrayInitIndexExpr, {})
2596 DEF_TRAVERSE_STMT(ObjCBoolLiteralExpr, {})
2597
2598 DEF_TRAVERSE_STMT(ObjCEncodeExpr, {
2599 if (TypeSourceInfo *TInfo = S->getEncodedTypeSourceInfo())
2600 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2601 })
2602
2603 DEF_TRAVERSE_STMT(ObjCIsaExpr, {})
2604 DEF_TRAVERSE_STMT(ObjCIvarRefExpr, {})
2605
2606 DEF_TRAVERSE_STMT(ObjCMessageExpr, {
2607 if (TypeSourceInfo *TInfo = S->getClassReceiverTypeInfo())
2608 TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
2609 })
2610
2611 DEF_TRAVERSE_STMT(ObjCPropertyRefExpr, {})
2612 DEF_TRAVERSE_STMT(ObjCSubscriptRefExpr, {})
2613 DEF_TRAVERSE_STMT(ObjCProtocolExpr, {})
2614 DEF_TRAVERSE_STMT(ObjCSelectorExpr, {})
2615 DEF_TRAVERSE_STMT(ObjCIndirectCopyRestoreExpr, {})
2616
2617 DEF_TRAVERSE_STMT(ObjCBridgedCastExpr, {
2618 TRY_TO(TraverseTypeLoc(S->getTypeInfoAsWritten()->getTypeLoc()));
2619 })
2620
2621 DEF_TRAVERSE_STMT(ObjCAvailabilityCheckExpr, {})
2622 DEF_TRAVERSE_STMT(ParenExpr, {})
2623 DEF_TRAVERSE_STMT(ParenListExpr, {})
2624 DEF_TRAVERSE_STMT(PredefinedExpr, {})
2625 DEF_TRAVERSE_STMT(ShuffleVectorExpr, {})
2626 DEF_TRAVERSE_STMT(ConvertVectorExpr, {})
2627 DEF_TRAVERSE_STMT(StmtExpr, {})
2628 DEF_TRAVERSE_STMT(SourceLocExpr, {})
2629
2630 DEF_TRAVERSE_STMT(UnresolvedLookupExpr, {
2631 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2632 if (S->hasExplicitTemplateArgs()) {
2633 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2634 S->getNumTemplateArgs()));
2635 }
2636 })
2637
2638 DEF_TRAVERSE_STMT(UnresolvedMemberExpr, {
2639 TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
2640 if (S->hasExplicitTemplateArgs()) {
2641 TRY_TO(TraverseTemplateArgumentLocsHelper(S->getTemplateArgs(),
2642 S->getNumTemplateArgs()));
2643 }
2644 })
2645
2646 DEF_TRAVERSE_STMT(SEHTryStmt, {})
2647 DEF_TRAVERSE_STMT(SEHExceptStmt, {})
2648 DEF_TRAVERSE_STMT(SEHFinallyStmt, {})
2649 DEF_TRAVERSE_STMT(SEHLeaveStmt, {})
2650 DEF_TRAVERSE_STMT(CapturedStmt, { TRY_TO(TraverseDecl(S->getCapturedDecl())); })
2651
2652 DEF_TRAVERSE_STMT(CXXOperatorCallExpr, {})
2653 DEF_TRAVERSE_STMT(CXXRewrittenBinaryOperator, {
2654 if (!getDerived().shouldVisitImplicitCode()) {
2655 CXXRewrittenBinaryOperator::DecomposedForm Decomposed =
2656 S->getDecomposedForm();
2657 TRY_TO(TraverseStmt(const_cast<Expr*>(Decomposed.LHS)));
2658 TRY_TO(TraverseStmt(const_cast<Expr*>(Decomposed.RHS)));
2659 ShouldVisitChildren = false;
2660 }
2661 })
2662 DEF_TRAVERSE_STMT(OpaqueValueExpr, {})
2663 DEF_TRAVERSE_STMT(TypoExpr, {})
2664 DEF_TRAVERSE_STMT(CUDAKernelCallExpr, {})
2665
2666 // These operators (all of them) do not need any action except
2667 // iterating over the children.
2668 DEF_TRAVERSE_STMT(BinaryConditionalOperator, {})
2669 DEF_TRAVERSE_STMT(ConditionalOperator, {})
2670 DEF_TRAVERSE_STMT(UnaryOperator, {})
2671 DEF_TRAVERSE_STMT(BinaryOperator, {})
2672 DEF_TRAVERSE_STMT(CompoundAssignOperator, {})
2673 DEF_TRAVERSE_STMT(CXXNoexceptExpr, {})
2674 DEF_TRAVERSE_STMT(PackExpansionExpr, {})
2675 DEF_TRAVERSE_STMT(SizeOfPackExpr, {})
2676 DEF_TRAVERSE_STMT(SubstNonTypeTemplateParmPackExpr, {})
2677 DEF_TRAVERSE_STMT(SubstNonTypeTemplateParmExpr, {})
2678 DEF_TRAVERSE_STMT(FunctionParmPackExpr, {})
2679 DEF_TRAVERSE_STMT(CXXFoldExpr, {})
2680 DEF_TRAVERSE_STMT(AtomicExpr, {})
2681
2682 DEF_TRAVERSE_STMT(MaterializeTemporaryExpr, {
2683 if (S->getLifetimeExtendedTemporaryDecl()) {
2684 TRY_TO(TraverseLifetimeExtendedTemporaryDecl(
2685 S->getLifetimeExtendedTemporaryDecl()));
2686 ShouldVisitChildren = false;
2687 }
2688 })
2689 // For coroutines expressions, traverse either the operand
2690 // as written or the implied calls, depending on what the
2691 // derived class requests.
2692 DEF_TRAVERSE_STMT(CoroutineBodyStmt, {
2693 if (!getDerived().shouldVisitImplicitCode()) {
2694 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody());
2695 ShouldVisitChildren = false;
2696 }
2697 })
2698 DEF_TRAVERSE_STMT(CoreturnStmt, {
2699 if (!getDerived().shouldVisitImplicitCode()) {
2700 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getOperand());
2701 ShouldVisitChildren = false;
2702 }
2703 })
2704 DEF_TRAVERSE_STMT(CoawaitExpr, {
2705 if (!getDerived().shouldVisitImplicitCode()) {
2706 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getOperand());
2707 ShouldVisitChildren = false;
2708 }
2709 })
2710 DEF_TRAVERSE_STMT(DependentCoawaitExpr, {
2711 if (!getDerived().shouldVisitImplicitCode()) {
2712 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getOperand());
2713 ShouldVisitChildren = false;
2714 }
2715 })
2716 DEF_TRAVERSE_STMT(CoyieldExpr, {
2717 if (!getDerived().shouldVisitImplicitCode()) {
2718 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getOperand());
2719 ShouldVisitChildren = false;
2720 }
2721 })
2722
2723 DEF_TRAVERSE_STMT(ConceptSpecializationExpr, {
2724 TRY_TO(TraverseConceptReference(*S));
2725 })
2726
2727 DEF_TRAVERSE_STMT(RequiresExpr, {
2728 TRY_TO(TraverseDecl(S->getBody()));
2729 for (ParmVarDecl *Parm : S->getLocalParameters())
2730 TRY_TO(TraverseDecl(Parm));
2731 for (concepts::Requirement *Req : S->getRequirements())
2732 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
2733 if (!TypeReq->isSubstitutionFailure())
2734 TRY_TO(TraverseTypeLoc(TypeReq->getType()->getTypeLoc()));
2735 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
2736 if (!ExprReq->isExprSubstitutionFailure())
2737 TRY_TO(TraverseStmt(ExprReq->getExpr()));
2738 auto &RetReq = ExprReq->getReturnTypeRequirement();
2739 if (RetReq.isTypeConstraint())
2740 TRY_TO(TraverseTemplateParameterListHelper(
2741 RetReq.getTypeConstraintTemplateParameterList()));
2742 } else {
2743 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
2744 if (!NestedReq->isSubstitutionFailure())
2745 TRY_TO(TraverseStmt(NestedReq->getConstraintExpr()));
2746 }
2747 })
2748
2749 // These literals (all of them) do not need any action.
2750 DEF_TRAVERSE_STMT(IntegerLiteral, {})
2751 DEF_TRAVERSE_STMT(FixedPointLiteral, {})
2752 DEF_TRAVERSE_STMT(CharacterLiteral, {})
2753 DEF_TRAVERSE_STMT(FloatingLiteral, {})
2754 DEF_TRAVERSE_STMT(ImaginaryLiteral, {})
2755 DEF_TRAVERSE_STMT(StringLiteral, {})
2756 DEF_TRAVERSE_STMT(ObjCStringLiteral, {})
2757 DEF_TRAVERSE_STMT(ObjCBoxedExpr, {})
2758 DEF_TRAVERSE_STMT(ObjCArrayLiteral, {})
2759 DEF_TRAVERSE_STMT(ObjCDictionaryLiteral, {})
2760
2761 // Traverse OpenCL: AsType, Convert.
2762 DEF_TRAVERSE_STMT(AsTypeExpr, {})
2763
2764 // OpenMP directives.
2765 template <typename Derived>
2766 bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
2767 OMPExecutableDirective *S) {
2768 for (auto *C : S->clauses()) {
2769 TRY_TO(TraverseOMPClause(C));
2770 }
2771 return true;
2772 }
2773
2774 template <typename Derived>
2775 bool
2776 RecursiveASTVisitor<Derived>::TraverseOMPLoopDirective(OMPLoopDirective *S) {
2777 return TraverseOMPExecutableDirective(S);
2778 }
2779
2780 DEF_TRAVERSE_STMT(OMPParallelDirective,
2781 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2782
2783 DEF_TRAVERSE_STMT(OMPSimdDirective,
2784 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2785
2786 DEF_TRAVERSE_STMT(OMPForDirective,
2787 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2788
2789 DEF_TRAVERSE_STMT(OMPForSimdDirective,
2790 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2791
2792 DEF_TRAVERSE_STMT(OMPSectionsDirective,
2793 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2794
2795 DEF_TRAVERSE_STMT(OMPSectionDirective,
2796 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2797
2798 DEF_TRAVERSE_STMT(OMPSingleDirective,
2799 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2800
2801 DEF_TRAVERSE_STMT(OMPMasterDirective,
2802 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2803
2804 DEF_TRAVERSE_STMT(OMPCriticalDirective, {
2805 TRY_TO(TraverseDeclarationNameInfo(S->getDirectiveName()));
2806 TRY_TO(TraverseOMPExecutableDirective(S));
2807 })
2808
2809 DEF_TRAVERSE_STMT(OMPParallelForDirective,
2810 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2811
2812 DEF_TRAVERSE_STMT(OMPParallelForSimdDirective,
2813 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2814
2815 DEF_TRAVERSE_STMT(OMPParallelMasterDirective,
2816 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2817
2818 DEF_TRAVERSE_STMT(OMPParallelSectionsDirective,
2819 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2820
2821 DEF_TRAVERSE_STMT(OMPTaskDirective,
2822 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2823
2824 DEF_TRAVERSE_STMT(OMPTaskyieldDirective,
2825 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2826
2827 DEF_TRAVERSE_STMT(OMPBarrierDirective,
2828 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2829
2830 DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
2831 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2832
2833 DEF_TRAVERSE_STMT(OMPTaskgroupDirective,
2834 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2835
2836 DEF_TRAVERSE_STMT(OMPCancellationPointDirective,
2837 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2838
2839 DEF_TRAVERSE_STMT(OMPCancelDirective,
2840 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2841
2842 DEF_TRAVERSE_STMT(OMPFlushDirective,
2843 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2844
2845 DEF_TRAVERSE_STMT(OMPOrderedDirective,
2846 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2847
2848 DEF_TRAVERSE_STMT(OMPAtomicDirective,
2849 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2850
2851 DEF_TRAVERSE_STMT(OMPTargetDirective,
2852 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2853
2854 DEF_TRAVERSE_STMT(OMPTargetDataDirective,
2855 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2856
2857 DEF_TRAVERSE_STMT(OMPTargetEnterDataDirective,
2858 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2859
2860 DEF_TRAVERSE_STMT(OMPTargetExitDataDirective,
2861 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2862
2863 DEF_TRAVERSE_STMT(OMPTargetParallelDirective,
2864 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2865
2866 DEF_TRAVERSE_STMT(OMPTargetParallelForDirective,
2867 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2868
2869 DEF_TRAVERSE_STMT(OMPTeamsDirective,
2870 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2871
2872 DEF_TRAVERSE_STMT(OMPTargetUpdateDirective,
2873 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2874
2875 DEF_TRAVERSE_STMT(OMPTaskLoopDirective,
2876 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2877
2878 DEF_TRAVERSE_STMT(OMPTaskLoopSimdDirective,
2879 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2880
2881 DEF_TRAVERSE_STMT(OMPMasterTaskLoopDirective,
2882 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2883
2884 DEF_TRAVERSE_STMT(OMPMasterTaskLoopSimdDirective,
2885 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2886
2887 DEF_TRAVERSE_STMT(OMPParallelMasterTaskLoopDirective,
2888 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2889
2890 DEF_TRAVERSE_STMT(OMPParallelMasterTaskLoopSimdDirective,
2891 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2892
2893 DEF_TRAVERSE_STMT(OMPDistributeDirective,
2894 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2895
2896 DEF_TRAVERSE_STMT(OMPDistributeParallelForDirective,
2897 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2898
2899 DEF_TRAVERSE_STMT(OMPDistributeParallelForSimdDirective,
2900 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2901
2902 DEF_TRAVERSE_STMT(OMPDistributeSimdDirective,
2903 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2904
2905 DEF_TRAVERSE_STMT(OMPTargetParallelForSimdDirective,
2906 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2907
2908 DEF_TRAVERSE_STMT(OMPTargetSimdDirective,
2909 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2910
2911 DEF_TRAVERSE_STMT(OMPTeamsDistributeDirective,
2912 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2913
2914 DEF_TRAVERSE_STMT(OMPTeamsDistributeSimdDirective,
2915 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2916
2917 DEF_TRAVERSE_STMT(OMPTeamsDistributeParallelForSimdDirective,
2918 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2919
2920 DEF_TRAVERSE_STMT(OMPTeamsDistributeParallelForDirective,
2921 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2922
2923 DEF_TRAVERSE_STMT(OMPTargetTeamsDirective,
2924 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2925
2926 DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeDirective,
2927 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2928
2929 DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeParallelForDirective,
2930 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2931
2932 DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeParallelForSimdDirective,
2933 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2934
2935 DEF_TRAVERSE_STMT(OMPTargetTeamsDistributeSimdDirective,
2936 { TRY_TO(TraverseOMPExecutableDirective(S)); })
2937
2938 // OpenMP clauses.
2939 template <typename Derived>
2940 bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
2941 if (!C)
2942 return true;
2943 switch (C->getClauseKind()) {
2944 #define OPENMP_CLAUSE(Name, Class) \
2945 case OMPC_##Name: \
2946 TRY_TO(Visit##Class(static_cast<Class *>(C))); \
2947 break;
2948 #include "clang/Basic/OpenMPKinds.def"
2949 case OMPC_threadprivate:
2950 case OMPC_uniform:
2951 case OMPC_device_type:
2952 case OMPC_match:
2953 case OMPC_unknown:
2954 break;
2955 }
2956 return true;
2957 }
2958
2959 template <typename Derived>
2960 bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPreInit(
2961 OMPClauseWithPreInit *Node) {
2962 TRY_TO(TraverseStmt(Node->getPreInitStmt()));
2963 return true;
2964 }
2965
2966 template <typename Derived>
2967 bool RecursiveASTVisitor<Derived>::VisitOMPClauseWithPostUpdate(
2968 OMPClauseWithPostUpdate *Node) {
2969 TRY_TO(VisitOMPClauseWithPreInit(Node));
2970 TRY_TO(TraverseStmt(Node->getPostUpdateExpr()));
2971 return true;
2972 }
2973
2974 template <typename Derived>
2975 bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
2976 OMPAllocatorClause *C) {
2977 TRY_TO(TraverseStmt(C->getAllocator()));
2978 return true;
2979 }
2980
2981 template <typename Derived>
2982 bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
2983 TRY_TO(TraverseStmt(C->getAllocator()));
2984 TRY_TO(VisitOMPClauseList(C));
2985 return true;
2986 }
2987
2988 template <typename Derived>
2989 bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
2990 TRY_TO(VisitOMPClauseWithPreInit(C));
2991 TRY_TO(TraverseStmt(C->getCondition()));
2992 return true;
2993 }
2994
2995 template <typename Derived>
2996 bool RecursiveASTVisitor<Derived>::VisitOMPFinalClause(OMPFinalClause *C) {
2997 TRY_TO(VisitOMPClauseWithPreInit(C));
2998 TRY_TO(TraverseStmt(C->getCondition()));
2999 return true;
3000 }
3001
3002 template <typename Derived>
3003 bool
3004 RecursiveASTVisitor<Derived>::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) {
3005 TRY_TO(VisitOMPClauseWithPreInit(C));
3006 TRY_TO(TraverseStmt(C->getNumThreads()));
3007 return true;
3008 }
3009
3010 template <typename Derived>
3011 bool RecursiveASTVisitor<Derived>::VisitOMPSafelenClause(OMPSafelenClause *C) {
3012 TRY_TO(TraverseStmt(C->getSafelen()));
3013 return true;
3014 }
3015
3016 template <typename Derived>
3017 bool RecursiveASTVisitor<Derived>::VisitOMPSimdlenClause(OMPSimdlenClause *C) {
3018 TRY_TO(TraverseStmt(C->getSimdlen()));
3019 return true;
3020 }
3021
3022 template <typename Derived>
3023 bool
3024 RecursiveASTVisitor<Derived>::VisitOMPCollapseClause(OMPCollapseClause *C) {
3025 TRY_TO(TraverseStmt(C->getNumForLoops()));
3026 return true;
3027 }
3028
3029 template <typename Derived>
3030 bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *) {
3031 return true;
3032 }
3033
3034 template <typename Derived>
3035 bool RecursiveASTVisitor<Derived>::VisitOMPProcBindClause(OMPProcBindClause *) {
3036 return true;
3037 }
3038
3039 template <typename Derived>
3040 bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedAddressClause(
3041 OMPUnifiedAddressClause *) {
3042 return true;
3043 }
3044
3045 template <typename Derived>
3046 bool RecursiveASTVisitor<Derived>::VisitOMPUnifiedSharedMemoryClause(
3047 OMPUnifiedSharedMemoryClause *) {
3048 return true;
3049 }
3050
3051 template <typename Derived>
3052 bool RecursiveASTVisitor<Derived>::VisitOMPReverseOffloadClause(
3053 OMPReverseOffloadClause *) {
3054 return true;
3055 }
3056
3057 template <typename Derived>
3058 bool RecursiveASTVisitor<Derived>::VisitOMPDynamicAllocatorsClause(
3059 OMPDynamicAllocatorsClause *) {
3060 return true;
3061 }
3062
3063 template <typename Derived>
3064 bool RecursiveASTVisitor<Derived>::VisitOMPAtomicDefaultMemOrderClause(
3065 OMPAtomicDefaultMemOrderClause *) {
3066 return true;
3067 }
3068
3069 template <typename Derived>
3070 bool
3071 RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
3072 TRY_TO(VisitOMPClauseWithPreInit(C));
3073 TRY_TO(TraverseStmt(C->getChunkSize()));
3074 return true;
3075 }
3076
3077 template <typename Derived>
3078 bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
3079 TRY_TO(TraverseStmt(C->getNumForLoops()));
3080 return true;
3081 }
3082
3083 template <typename Derived>
3084 bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
3085 return true;
3086 }
3087
3088 template <typename Derived>
3089 bool RecursiveASTVisitor<Derived>::VisitOMPUntiedClause(OMPUntiedClause *) {
3090 return true;
3091 }
3092
3093 template <typename Derived>
3094 bool
3095 RecursiveASTVisitor<Derived>::VisitOMPMergeableClause(OMPMergeableClause *) {
3096 return true;
3097 }
3098
3099 template <typename Derived>
3100 bool RecursiveASTVisitor<Derived>::VisitOMPReadClause(OMPReadClause *) {
3101 return true;
3102 }
3103
3104 template <typename Derived>
3105 bool RecursiveASTVisitor<Derived>::VisitOMPWriteClause(OMPWriteClause *) {
3106 return true;
3107 }
3108
3109 template <typename Derived>
3110 bool RecursiveASTVisitor<Derived>::VisitOMPUpdateClause(OMPUpdateClause *) {
3111 return true;
3112 }
3113
3114 template <typename Derived>
3115 bool RecursiveASTVisitor<Derived>::VisitOMPCaptureClause(OMPCaptureClause *) {
3116 return true;
3117 }
3118
3119 template <typename Derived>
3120 bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
3121 return true;
3122 }
3123
3124 template <typename Derived>
3125 bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
3126 return true;
3127 }
3128
3129 template <typename Derived>
3130 bool RecursiveASTVisitor<Derived>::VisitOMPSIMDClause(OMPSIMDClause *) {
3131 return true;
3132 }
3133
3134 template <typename Derived>
3135 bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
3136 return true;
3137 }
3138
3139 template <typename Derived>
3140 template <typename T>
3141 bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
3142 for (auto *E : Node->varlists()) {
3143 TRY_TO(TraverseStmt(E));
3144 }
3145 return true;
3146 }
3147
3148 template <typename Derived>
3149 bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
3150 TRY_TO(VisitOMPClauseList(C));
3151 for (auto *E : C->private_copies()) {
3152 TRY_TO(TraverseStmt(E));
3153 }
3154 return true;
3155 }
3156
3157 template <typename Derived>
3158 bool RecursiveASTVisitor<Derived>::VisitOMPFirstprivateClause(
3159 OMPFirstprivateClause *C) {
3160 TRY_TO(VisitOMPClauseList(C));
3161 TRY_TO(VisitOMPClauseWithPreInit(C));
3162 for (auto *E : C->private_copies()) {
3163 TRY_TO(TraverseStmt(E));
3164 }
3165 for (auto *E : C->inits()) {
3166 TRY_TO(TraverseStmt(E));
3167 }
3168 return true;
3169 }
3170
3171 template <typename Derived>
3172 bool RecursiveASTVisitor<Derived>::VisitOMPLastprivateClause(
3173 OMPLastprivateClause *C) {
3174 TRY_TO(VisitOMPClauseList(C));
3175 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3176 for (auto *E : C->private_copies()) {
3177 TRY_TO(TraverseStmt(E));
3178 }
3179 for (auto *E : C->source_exprs()) {
3180 TRY_TO(TraverseStmt(E));
3181 }
3182 for (auto *E : C->destination_exprs()) {
3183 TRY_TO(TraverseStmt(E));
3184 }
3185 for (auto *E : C->assignment_ops()) {
3186 TRY_TO(TraverseStmt(E));
3187 }
3188 return true;
3189 }
3190
3191 template <typename Derived>
3192 bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
3193 TRY_TO(VisitOMPClauseList(C));
3194 return true;
3195 }
3196
3197 template <typename Derived>
3198 bool RecursiveASTVisitor<Derived>::VisitOMPLinearClause(OMPLinearClause *C) {
3199 TRY_TO(TraverseStmt(C->getStep()));
3200 TRY_TO(TraverseStmt(C->getCalcStep()));
3201 TRY_TO(VisitOMPClauseList(C));
3202 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3203 for (auto *E : C->privates()) {
3204 TRY_TO(TraverseStmt(E));
3205 }
3206 for (auto *E : C->inits()) {
3207 TRY_TO(TraverseStmt(E));
3208 }
3209 for (auto *E : C->updates()) {
3210 TRY_TO(TraverseStmt(E));
3211 }
3212 for (auto *E : C->finals()) {
3213 TRY_TO(TraverseStmt(E));
3214 }
3215 return true;
3216 }
3217
3218 template <typename Derived>
3219 bool RecursiveASTVisitor<Derived>::VisitOMPAlignedClause(OMPAlignedClause *C) {
3220 TRY_TO(TraverseStmt(C->getAlignment()));
3221 TRY_TO(VisitOMPClauseList(C));
3222 return true;
3223 }
3224
3225 template <typename Derived>
3226 bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) {
3227 TRY_TO(VisitOMPClauseList(C));
3228 for (auto *E : C->source_exprs()) {
3229 TRY_TO(TraverseStmt(E));
3230 }
3231 for (auto *E : C->destination_exprs()) {
3232 TRY_TO(TraverseStmt(E));
3233 }
3234 for (auto *E : C->assignment_ops()) {
3235 TRY_TO(TraverseStmt(E));
3236 }
3237 return true;
3238 }
3239
3240 template <typename Derived>
3241 bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause(
3242 OMPCopyprivateClause *C) {
3243 TRY_TO(VisitOMPClauseList(C));
3244 for (auto *E : C->source_exprs()) {
3245 TRY_TO(TraverseStmt(E));
3246 }
3247 for (auto *E : C->destination_exprs()) {
3248 TRY_TO(TraverseStmt(E));
3249 }
3250 for (auto *E : C->assignment_ops()) {
3251 TRY_TO(TraverseStmt(E));
3252 }
3253 return true;
3254 }
3255
3256 template <typename Derived>
3257 bool
3258 RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) {
3259 TRY_TO(TraverseNestedNameSpecifierLoc(C->getQualifierLoc()));
3260 TRY_TO(TraverseDeclarationNameInfo(C->getNameInfo()));
3261 TRY_TO(VisitOMPClauseList(C));
3262 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3263 for (auto *E : C->privates()) {
3264 TRY_TO(TraverseStmt(E));
3265 }
3266 for (auto *E : C->lhs_exprs()) {
3267 TRY_TO(TraverseStmt(E));
3268 }
3269 for (auto *E : C->rhs_exprs()) {
3270 TRY_TO(TraverseStmt(E));
3271 }
3272 for (auto *E : C->reduction_ops()) {
3273 TRY_TO(TraverseStmt(E));
3274 }
3275 return true;
3276 }
3277
3278 template <typename Derived>
3279 bool RecursiveASTVisitor<Derived>::VisitOMPTaskReductionClause(
3280 OMPTaskReductionClause *C) {
3281 TRY_TO(TraverseNestedNameSpecifierLoc(C->getQualifierLoc()));
3282 TRY_TO(TraverseDeclarationNameInfo(C->getNameInfo()));
3283 TRY_TO(VisitOMPClauseList(C));
3284 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3285 for (auto *E : C->privates()) {
3286 TRY_TO(TraverseStmt(E));
3287 }
3288 for (auto *E : C->lhs_exprs()) {
3289 TRY_TO(TraverseStmt(E));
3290 }
3291 for (auto *E : C->rhs_exprs()) {
3292 TRY_TO(TraverseStmt(E));
3293 }
3294 for (auto *E : C->reduction_ops()) {
3295 TRY_TO(TraverseStmt(E));
3296 }
3297 return true;
3298 }
3299
3300 template <typename Derived>
3301 bool RecursiveASTVisitor<Derived>::VisitOMPInReductionClause(
3302 OMPInReductionClause *C) {
3303 TRY_TO(TraverseNestedNameSpecifierLoc(C->getQualifierLoc()));
3304 TRY_TO(TraverseDeclarationNameInfo(C->getNameInfo()));
3305 TRY_TO(VisitOMPClauseList(C));
3306 TRY_TO(VisitOMPClauseWithPostUpdate(C));
3307 for (auto *E : C->privates()) {
3308 TRY_TO(TraverseStmt(E));
3309 }
3310 for (auto *E : C->lhs_exprs()) {
3311 TRY_TO(TraverseStmt(E));
3312 }
3313 for (auto *E : C->rhs_exprs()) {
3314 TRY_TO(TraverseStmt(E));
3315 }
3316 for (auto *E : C->reduction_ops()) {
3317 TRY_TO(TraverseStmt(E));
3318 }
3319 for (auto *E : C->taskgroup_descriptors())
3320 TRY_TO(TraverseStmt(E));
3321 return true;
3322 }
3323
3324 template <typename Derived>
3325 bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
3326 TRY_TO(VisitOMPClauseList(C));
3327 return true;
3328 }
3329
3330 template <typename Derived>
3331 bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
3332 TRY_TO(VisitOMPClauseList(C));
3333 return true;
3334 }
3335
3336 template <typename Derived>
3337 bool RecursiveASTVisitor<Derived>::VisitOMPDeviceClause(OMPDeviceClause *C) {
3338 TRY_TO(VisitOMPClauseWithPreInit(C));
3339 TRY_TO(TraverseStmt(C->getDevice()));
3340 return true;
3341 }
3342
3343 template <typename Derived>
3344 bool RecursiveASTVisitor<Derived>::VisitOMPMapClause(OMPMapClause *C) {
3345 TRY_TO(VisitOMPClauseList(C));
3346 return true;
3347 }
3348
3349 template <typename Derived>
3350 bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
3351 OMPNumTeamsClause *C) {
3352 TRY_TO(VisitOMPClauseWithPreInit(C));
3353 TRY_TO(TraverseStmt(C->getNumTeams()));
3354 return true;
3355 }
3356
3357 template <typename Derived>
3358 bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
3359 OMPThreadLimitClause *C) {
3360 TRY_TO(VisitOMPClauseWithPreInit(C));
3361 TRY_TO(TraverseStmt(C->getThreadLimit()));
3362 return true;
3363 }
3364
3365 template <typename Derived>
3366 bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause(
3367 OMPPriorityClause *C) {
3368 TRY_TO(VisitOMPClauseWithPreInit(C));
3369 TRY_TO(TraverseStmt(C->getPriority()));
3370 return true;
3371 }
3372
3373 template <typename Derived>
3374 bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
3375 OMPGrainsizeClause *C) {
3376 TRY_TO(VisitOMPClauseWithPreInit(C));
3377 TRY_TO(TraverseStmt(C->getGrainsize()));
3378 return true;
3379 }
3380
3381 template <typename Derived>
3382 bool RecursiveASTVisitor<Derived>::VisitOMPNumTasksClause(
3383 OMPNumTasksClause *C) {
3384 TRY_TO(VisitOMPClauseWithPreInit(C));
3385 TRY_TO(TraverseStmt(C->getNumTasks()));
3386 return true;
3387 }
3388
3389 template <typename Derived>
3390 bool RecursiveASTVisitor<Derived>::VisitOMPHintClause(OMPHintClause *C) {
3391 TRY_TO(TraverseStmt(C->getHint()));
3392 return true;
3393 }
3394
3395 template <typename Derived>
3396 bool RecursiveASTVisitor<Derived>::VisitOMPDistScheduleClause(
3397 OMPDistScheduleClause *C) {
3398 TRY_TO(VisitOMPClauseWithPreInit(C));
3399 TRY_TO(TraverseStmt(C->getChunkSize()));
3400 return true;
3401 }
3402
3403 template <typename Derived>
3404 bool
3405 RecursiveASTVisitor<Derived>::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
3406 return true;
3407 }
3408
3409 template <typename Derived>
3410 bool RecursiveASTVisitor<Derived>::VisitOMPToClause(OMPToClause *C) {
3411 TRY_TO(VisitOMPClauseList(C));
3412 return true;
3413 }
3414
3415 template <typename Derived>
3416 bool RecursiveASTVisitor<Derived>::VisitOMPFromClause(OMPFromClause *C) {
3417 TRY_TO(VisitOMPClauseList(C));
3418 return true;
3419 }
3420
3421 template <typename Derived>
3422 bool RecursiveASTVisitor<Derived>::VisitOMPUseDevicePtrClause(
3423 OMPUseDevicePtrClause *C) {
3424 TRY_TO(VisitOMPClauseList(C));
3425 return true;
3426 }
3427
3428 template <typename Derived>
3429 bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
3430 OMPIsDevicePtrClause *C) {
3431 TRY_TO(VisitOMPClauseList(C));
3432 return true;
3433 }
3434
3435 template <typename Derived>
3436 bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
3437 OMPNontemporalClause *C) {
3438 TRY_TO(VisitOMPClauseList(C));
3439 for (auto *E : C->private_refs()) {
3440 TRY_TO(TraverseStmt(E));
3441 }
3442 return true;
3443 }
3444
3445 // FIXME: look at the following tricky-seeming exprs to see if we
3446 // need to recurse on anything. These are ones that have methods
3447 // returning decls or qualtypes or nestednamespecifier -- though I'm
3448 // not sure if they own them -- or just seemed very complicated, or
3449 // had lots of sub-types to explore.
3450 //
3451 // VisitOverloadExpr and its children: recurse on template args? etc?
3452
3453 // FIXME: go through all the stmts and exprs again, and see which of them
3454 // create new types, and recurse on the types (TypeLocs?) of those.
3455 // Candidates:
3456 //
3457 // http://clang.llvm.org/doxygen/classclang_1_1CXXTypeidExpr.html
3458 // http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html
3459 // http://clang.llvm.org/doxygen/classclang_1_1TypesCompatibleExpr.html
3460 // Every class that has getQualifier.
3461
3462 #undef DEF_TRAVERSE_STMT
3463 #undef TRAVERSE_STMT
3464 #undef TRAVERSE_STMT_BASE
3465
3466 #undef TRY_TO
3467
3468 } // end namespace clang
3469
3470 #endif // LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
clang::ObjCPropertyRefExpr
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
clang::CXXOperatorCallExpr
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:78
clang::ObjCIndirectCopyRestoreExpr
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1577
clang::OMPDistributeSimdDirective
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3757
clang::OMPMasterDirective
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1591
clang::ElaboratedType
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
Definition: Type.h:5285
clang::LambdaCapture::getCapturedVar
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
Definition: LambdaCapture.h:104
clang::CXXNullPtrLiteralExpr
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:683
clang::OMPTaskDirective
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:1986
clang::GCCAsmStmt
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:2878
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1783
clang::DependentCoawaitExpr
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4735
clang::OMPReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:2637
OMPThreadLimitClause
This represents &#39;thread_limit&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5164
clang::CXXCtorInitializer::getInit
Expr * getInit() const
Get the initializer.
Definition: DeclCXX.h:2353
clang::DynamicInitKind::Initializer
clang::RecursiveASTVisitor::TraverseCXXBaseSpecifier
bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)
Recursively visit a base specifier.
clang::OMPTaskReductionClause::lhs_exprs
helper_expr_const_range lhs_exprs() const
Definition: OpenMPClause.h:2855
OMPCopyinClause
This represents clause &#39;copyin&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3541
clang::InheritingConcreteTypeLoc::getTypePtr
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:502
clang::PointerType
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2614
clang::UnresolvedUsingType
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4210
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
clang::CXXRecordDecl::bases
base_class_range bases()
Definition: DeclCXX.h:587
DEF_TRAVERSE_TMPL_SPEC_DECL
#define DEF_TRAVERSE_TMPL_SPEC_DECL(TMPLDECLKIND)
clang::OMPExecutableDirective::clauses
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:325
clang::RecursiveASTVisitor::shouldWalkTypesOfTypeLocs
bool shouldWalkTypesOfTypeLocs() const
Return whether this visitor should recurse into the types of TypeLocs.
Definition: RecursiveASTVisitor.h:170
clang::ConcreteTypeLoc::getTypePtr
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:409
clang::TypeTraitExpr
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2627
clang::OMPC_match
Definition: OpenMPKinds.h:72
clang::OMPAtomicDefaultMemOrderClause
This represents &#39;atomic_default_mem_order&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1192
clang::DEF_TRAVERSE_TYPE
DEF_TRAVERSE_TYPE(ComplexType, { TRY_TO(TraverseType(T->getElementType()));}) DEF_TRAVERSE_TYPE(PointerType
clang::TemplateArgumentLoc::getTemplateQualifierLoc
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Definition: TemplateBase.h:531
clang::Decl::getBody
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition: DeclBase.h:986
clang::OMPTaskReductionClause::rhs_exprs
helper_expr_const_range rhs_exprs() const
Definition: OpenMPClause.h:2863
clang::OMPPrivateClause::private_copies
private_copies_range private_copies()
Definition: OpenMPClause.h:1951
clang::PseudoObjectExpr::semantics_iterator
Expr *const * semantics_iterator
Definition: Expr.h:5781
clang::CoreturnStmt
Represents a &#39;co_return&#39; statement in the C++ Coroutines TS.
Definition: StmtCXX.h:456
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::OMPInReductionClause
This represents clause &#39;in_reduction&#39; in the &#39;#pragma omp task&#39; directives.
Definition: OpenMPClause.h:2910
clang::OMPAllocateDecl
This represents &#39;#pragma omp allocate ...&#39; directive.
Definition: DeclOpenMP.h:422
clang::IfStmt
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1834
UNARYOP_LIST
#define UNARYOP_LIST()
Definition: RecursiveASTVisitor.h:55
clang::Type::getPointeeType
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Definition: Type.cpp:557
clang::OMPFirstprivateClause::inits
inits_range inits()
Definition: OpenMPClause.h:2093
clang::OMPClauseWithPreInit
Class that handles pre-initialization statement for some clauses, like &#39;shedule&#39;, &#39;firstprivate&#39; etc...
Definition: OpenMPClause.h:108
clang::TemplateParameterList::begin
iterator begin()
Definition: DeclTemplate.h:124
clang::EnumConstantDecl
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2941
Base
clang::TypedefDecl
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3173
Type.h
C Language Family Type Representation.
clang::NestedNameSpecifier::Super
Microsoft&#39;s &#39;__super&#39; specifier, stored as a CXXRecordDecl* of the class it appeared in...
Definition: NestedNameSpecifier.h:99
clang::DependentNameType
Represents a qualified type name for which the type name is dependent.
Definition: Type.h:5368
clang::OMPForSimdDirective
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1337
clang::ClassTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:2405
clang::TemplateArgument::Expression
The template argument is an expression, and we&#39;ve not resolved it to one of the other forms yet...
Definition: TemplateBase.h:86
clang::OMPAllocatorClause::getAllocator
Expr * getAllocator() const
Returns allocator.
Definition: OpenMPClause.h:301
TRY_TO_TRAVERSE_OR_ENQUEUE_STMT
#define TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S)
Definition: RecursiveASTVisitor.h:354
clang::OMPInReductionClause::rhs_exprs
helper_expr_const_range rhs_exprs() const
Definition: OpenMPClause.h:3108
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
OMPGrainsizeClause
This represents &#39;grainsize&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5314
clang::RecursiveASTVisitor::shouldTraversePostOrder
bool shouldTraversePostOrder() const
Return whether this visitor should traverse post-order.
Definition: RecursiveASTVisitor.h:177
clang::OMPTeamsDistributeParallelForDirective
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:4171
clang::ArrayInitIndexExpr
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5082
clang::UnresolvedLookupExpr
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3037
clang::NestedNameSpecifier::getPrefix
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
Definition: NestedNameSpecifier.h:167
clang::OMPIfClause
This represents &#39;if&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:425
DeclTemplate.h
Defines the C++ template declaration subclasses.
clang::CXXCtorInitializer::isWritten
bool isWritten() const
Determine whether this initializer is explicitly written in the source code.
Definition: DeclCXX.h:2323
P
StringRef P
Definition: ASTMatchersInternal.cpp:485
clang::OMPParallelMasterDirective
This represents &#39;#pragma omp parallel master&#39; directive.
Definition: StmtOpenMP.h:1863
clang::AutoType
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:4874
clang::AttributedStmt
Represents an attribute applied to a statement.
Definition: Stmt.h:1776
clang::ParenExpr
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1994
OMPCopyinClause::assignment_ops
helper_expr_const_range assignment_ops() const
Definition: OpenMPClause.h:3678
clang::IntegerLiteral
Definition: Expr.h:1446
clang::VarDecl::isCXXForRangeDecl
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
Definition: Decl.h:1365
OMPPriorityClause
This represents &#39;priority&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5240
clang::RecursiveASTVisitor::VisitTypeLoc
bool VisitTypeLoc(TypeLoc TL)
Definition: RecursiveASTVisitor.h:466
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1450
clang::EmptyDecl
Represents an empty-declaration.
Definition: Decl.h:4443
clang::OMPReductionClause::lhs_exprs
helper_expr_const_range lhs_exprs() const
Definition: OpenMPClause.h:2621
clang::OMPTargetTeamsDistributeDirective
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:4310
clang::ObjCAtThrowStmt
Represents Objective-C&#39;s @throw statement.
Definition: StmtObjC.h:332
clang::InitListExpr::isSemanticForm
bool isSemanticForm() const
Definition: Expr.h:4555
clang::Stmt::child_range
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1180
clang::VarTemplateDecl
Declaration of a variable template.
Definition: DeclTemplate.h:3070
clang::TemplateArgument::Declaration
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:63
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:497
clang::CXXConstructExpr
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
clang::ObjCSubscriptRefExpr
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:845
clang::ArrayTypeTraitExpr
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2715
clang::OMPFinalClause::getCondition
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:567
DeclObjC.h
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6227
clang::OMPUpdateClause
This represents &#39;update&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1765
clang::CXXRewrittenBinaryOperator::DecomposedForm::RHS
const Expr * RHS
The original right-hand side.
Definition: ExprCXX.h:302
clang::OMPIfClause::getCondition
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:493
clang::OMPParallelForDirective
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1715
clang::MSPropertySubscriptExpr
MS property subscript expression.
Definition: ExprCXX.h:937
clang::OMPTargetTeamsDistributeParallelForDirective
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:4379
clang::RecursiveASTVisitor::TraverseTemplateName
bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
Definition: RecursiveASTVisitor.h:817
clang::LambdaCapture
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:25
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2383
clang::MaterializeTemporaryExpr
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4419
OMPAlignedClause::getAlignment
Expr * getAlignment()
Returns alignment.
Definition: OpenMPClause.h:3507
clang::OMPOrderedClause::getNumForLoops
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:1532
clang::ArrayType::getElementType
QualType getElementType() const
Definition: Type.h:2910
clang::TagDecl::isCompleteDefinition
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3324
clang::PragmaCommentDecl
Represents a #pragma comment line.
Definition: Decl.h:114
clang::NestedNameSpecifier::Identifier
An identifier, stored as an IdentifierInfo*.
Definition: NestedNameSpecifier.h:79
clang::OMPTargetExitDataDirective
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2690
clang::OMPReadClause
This represents &#39;read&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1687
clang::FriendDecl
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:53
OMPCopyprivateClause::assignment_ops
helper_expr_const_range assignment_ops() const
Definition: OpenMPClause.h:3841
clang::TRY_TO
TRY_TO(TraverseType(T->getPointeeType()))
clang::interp::ReturnValue
bool ReturnValue(const T &V, APValue &R)
Convers a value to an APValue.
Definition: Interp.h:41
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:820
clang::OMPPrivateClause
This represents clause &#39;private&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:1885
clang::ObjCIsaExpr
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1492
clang::OMPNumThreadsClause
This represents &#39;num_threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:594
clang::CompoundLiteralExpr
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3077
clang::QualifiedTypeLoc
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
Definition: TypeLoc.h:277
clang::RecursiveASTVisitor::getDerived
Derived & getDerived()
Return a reference to the derived class.
Definition: RecursiveASTVisitor.h:162
clang::TemplateArgument::Null
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:56
OMPDefaultmapClause
This represents &#39;defaultmap&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5668
clang::DeclContext::decls
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition: DeclBase.h:2033
clang::ExternCContextDecl
Declaration context for names declared as extern "C" in C++.
Definition: Decl.h:196
clang::DeducedTemplateSpecializationType
Represents a C++17 deduced template specialization type.
Definition: Type.h:4940
clang::TemplateName::getAsQualifiedTemplateName
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Definition: TemplateName.cpp:146
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
clang::RecursiveASTVisitor::dataTraverseStmtPre
bool dataTraverseStmtPre(Stmt *S)
Invoked before visiting a statement or expression via data recursion.
Definition: RecursiveASTVisitor.h:199
clang::DeclarationName::CXXUsingDirective
Definition: DeclarationName.h:215
clang::ASTTemplateArgumentListInfo
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:603
clang::NestedNameSpecifier::Namespace
A namespace, stored as a NamespaceDecl*.
Definition: NestedNameSpecifier.h:82
clang::CXXStdInitializerListExpr
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:715
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
BINOP_LIST
#define BINOP_LIST()
Definition: RecursiveASTVisitor.h:62
OMPFlushClause
This represents implicit clause &#39;flush&#39; for the &#39;#pragma omp flush&#39; directive.
Definition: OpenMPClause.h:3885
StmtObjC.h
Defines the Objective-C statement AST node classes.
clang::DeclarationName::ObjCOneArgSelector
Definition: DeclarationName.h:205
clang::OMPReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:2602
clang::NestedNameSpecifier::getKind
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Definition: NestedNameSpecifier.cpp:142
clang::CXXThrowExpr
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1140
clang::OMPReverseOffloadClause
This represents &#39;reverse_offload&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
Definition: OpenMPClause.h:1107
clang::ExprWithCleanups
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3306
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1595
clang::SubstTemplateTypeParmType
Represents the result of substituting a type for a template type parameter.
Definition: Type.h:4728
ExprCXX.h
Defines the clang::Expr interface and subclasses for C++ expressions.
clang::RecursiveASTVisitor::DataRecursionQueue
SmallVectorImpl< llvm::PointerIntPair< Stmt *, 1, bool > > DataRecursionQueue
A queue used for performing data recursion over statements.
Definition: RecursiveASTVisitor.h:159
OMPGrainsizeClause::getGrainsize
Expr * getGrainsize() const
Return safe iteration space distance.
Definition: OpenMPClause.h:5355
OMPNogroupClause
This represents &#39;nogroup&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5380
clang::RecursiveASTVisitor::TraverseDecl
bool TraverseDecl(Decl *D)
Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument&#39;s dynamic ty...
Definition: RecursiveASTVisitor.h:713
clang::BuiltinTemplateDecl
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
Definition: DeclTemplate.h:1763
clang::OMPAllocatorClause
This represents &#39;allocator&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:266
clang::TypeLoc::getTypePtr
const Type * getTypePtr() const
Definition: TypeLoc.h:136
clang::OMPSafelenClause
This represents &#39;safelen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:670
clang::PipeType
PipeType - OpenCL20.
Definition: Type.h:6159
clang::CXXStaticCastExpr
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:409
clang::DeclarationName::CXXDeductionGuideName
Definition: DeclarationName.h:210
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::LabelStmt
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1732
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3748
clang::DesignatedInitExpr
Represents a C99 designated initializer expression.
Definition: Expr.h:4639
clang::SourceLocExpr
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
Definition: Expr.h:4295
clang::RequiresExpr
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:457
clang::OMPParallelDirective
This represents &#39;#pragma omp parallel&#39; directive.
Definition: StmtOpenMP.h:357
clang::ShuffleVectorExpr
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3999
clang::ObjCObjectType
Represents a class type in Objective C.
Definition: Type.h:5694
clang::TemplateArgument::getAsExpr
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:329
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:236
clang::DependentTemplateName
Represents a dependent template name that cannot be resolved prior to template instantiation.
Definition: TemplateName.h:446
OMPSIMDClause
This represents &#39;simd&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4200
clang::TemplateArgumentLoc::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: TemplateBase.h:506
clang::TemplateArgument::Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:71
TYPE
#define TYPE(CLASS, BASE)
Definition: RecursiveASTVisitor.h:480
clang::DeclarationName::getNameKind
NameKind getNameKind() const
Determine what kind of name this is.
Definition: DeclarationName.h:384
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2729
clang::NestedNameSpecifier::getAsType
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Definition: NestedNameSpecifier.h:194
clang::OMPLastprivateClause
This represents clause &#39;lastprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2132
clang::CXXCtorInitializer::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2285
clang::OMPAllocateClause
This represents clause &#39;allocate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:328
clang::NoInitExpr
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4937
clang::SEHFinallyStmt
Definition: Stmt.h:3249
OMPDistScheduleClause::getChunkSize
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:5634
clang::GNUNullExpr
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4210
clang::TemplateParameterList::end
iterator end()
Definition: DeclTemplate.h:126
OMPMapClause
This represents clause &#39;map&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:4833
OMPToClause
This represents clause &#39;to&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:5781
clang::SubstTemplateTypeParmPackType
Represents the result of substituting a set of types for a template type parameter pack...
Definition: Type.h:4784
clang::FunctionTypeLoc::getParam
ParmVarDecl * getParam(unsigned i) const
Definition: TypeLoc.h:1432
clang::FixedPointLiteral
Definition: Expr.h:1489
clang::OMPTargetSimdDirective
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:3895
clang::UnresolvedMemberExpr
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3771
OpenMPKinds.h
Defines some OpenMP-specific enums and functions.
clang::ExtVectorElementExpr
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5518
clang::OMPSafelenClause::getSafelen
Expr * getSafelen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:704
clang::DeclarationName::ObjCZeroArgSelector
Definition: DeclarationName.h:204
clang::RecursiveASTVisitor::TraverseSynOrSemInitListExpr
bool TraverseSynOrSemInitListExpr(InitListExpr *S, DataRecursionQueue *Queue=nullptr)
Recursively visit the syntactic or semantic form of an initialization list.
clang::AccessSpecDecl
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:85
clang::OMPBarrierDirective
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:2101
clang::UnqualTypeLoc
Wrapper of type source information for a type with no direct qualifiers.
Definition: TypeLoc.h:251
clang::ClassScopeFunctionSpecializationDecl
Declaration of a function specialization at template class scope.
Definition: DeclTemplate.h:2595
clang::ObjCArrayLiteral
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:188
clang::DeclarationName::CXXLiteralOperatorName
Definition: DeclarationName.h:212
clang::OMPLoopDirective
This is a common base class for loop directives (&#39;omp simd&#39;, &#39;omp for&#39;, &#39;omp for simd&#39; etc...
Definition: StmtOpenMP.h:420
OMPNumTeamsClause::getNumTeams
Expr * getNumTeams()
Return NumTeams number.
Definition: OpenMPClause.h:5133
clang::SubstNonTypeTemplateParmPackExpr
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4269
clang::SEHTryStmt
Definition: Stmt.h:3284
clang::OMPCriticalDirective
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1640
llvm::SmallVectorImpl
Definition: LLVM.h:36
StmtCXX.h
clang::FunctionDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2399
clang::RecursiveASTVisitor::TraverseConceptReference
bool TraverseConceptReference(const ConceptReference &C)
Recursively visit a reference to a concept with potential arguments.
clang::ObjCAtCatchStmt
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
TRY_TO
#define TRY_TO(CALL_EXPR)
Definition: RecursiveASTVisitor.h:80
DEF_TRAVERSE_TMPL_DECL
#define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)
clang::FunctionTemplateSpecializationInfo
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:470
clang::RecursiveASTVisitor::getStmtChildren
Stmt::child_range getStmtChildren(Stmt *S)
Definition: RecursiveASTVisitor.h:325
OMPCopyprivateClause
This represents clause &#39;copyprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3718
clang::ConceptReference::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
Definition: ASTConcept.h:164
clang::IndirectGotoStmt
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2520
clang::RecursiveASTVisitor::VisitAttr
bool VisitAttr(Attr *A)
Definition: RecursiveASTVisitor.h:316
clang::InitListExpr
Describes an C or C++ initializer list.
Definition: Expr.h:4403
clang::CXXTypeidExpr
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:764
clang::UsingDecl
Represents a C++ using-declaration.
Definition: DeclCXX.h:3369
clang::OMPDistributeParallelForDirective
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3606
clang::OMPTeamsDistributeParallelForSimdDirective
This represents &#39;#pragma omp teams distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:4100
clang::OMPC_uniform
Definition: OpenMPKinds.h:70
clang::RValueReferenceType
An rvalue reference type, per C++11 [dcl.ref].
Definition: Type.h:2815
clang::ForStmt
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:2410
clang::OMPInReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:3084
clang::FunctionDecl::getBody
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2894
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::RecursiveASTVisitor::TraverseDeclarationNameInfo
bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)
Recursively visit a name with its location information.
Definition: RecursiveASTVisitor.h:788
DEF_TRAVERSE_DECL
#define DEF_TRAVERSE_DECL(DECL, CODE)
clang::OMPClauseWithPreInit::getPreInitStmt
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
Definition: OpenMPClause.h:132
clang::Stmt::children
child_range children()
Definition: Stmt.cpp:224
clang::MacroQualifiedType
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
Definition: Type.h:4266
clang::TypeOfExprType
Represents a typeof (or typeof) expression (a GCC extension).
Definition: Type.h:4300
clang::BinaryOperator
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3434
clang::DeclaratorDecl::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Definition: Decl.h:737
clang::CXXForRangeStmt
CXXForRangeStmt - This represents C++0x [stmt.ranged]&#39;s ranged for statement, represented as &#39;for (ra...
Definition: StmtCXX.h:134
clang::TypeLoc::isNull
bool isNull() const
Definition: TypeLoc.h:120
clang::InitListExpr::children
child_range children()
Definition: Expr.h:4588
ExprObjC.h
clang::OMPClauseWithPostUpdate
Class that handles post-update expression for some clauses, like &#39;lastprivate&#39;, &#39;reduction&#39; etc...
Definition: OpenMPClause.h:146
clang::OMPCancellationPointDirective
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:2946
clang::FunctionDecl::getTemplateSpecializationInfo
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3663
clang::OMPDefaultClause
This represents &#39;default&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:862
clang::ObjCStringLiteral
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:50
clang::FunctionTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:1084
clang::CaseStmt
CaseStmt - Represent a case statement.
Definition: Stmt.h:1500
clang::TypoExpr
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5978
clang::OMPFinalClause
This represents &#39;final&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:525
clang::OMPMergeableClause
This represents &#39;mergeable&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1648
clang::OMPTeamsDirective
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:2888
clang::ParenListExpr
Definition: Expr.h:5143
clang::RecursiveASTVisitor::WalkUpFromType
bool WalkUpFromType(Type *T)
Definition: RecursiveASTVisitor.h:444
clang::OMPReductionClause
This represents clause &#39;reduction&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2443
clang::OMPTeamsDistributeSimdDirective
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4029
clang::ObjCProtocolDecl
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2078
clang::GenericSelectionExpr::Association
AssociationTy< false > Association
Definition: Expr.h:5393
clang::CXXBindTemporaryExpr
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1373
clang::LambdaExpr
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1818
OMPCopyinClause::source_exprs
helper_expr_const_range source_exprs() const
Definition: OpenMPClause.h:3659
clang::RecursiveASTVisitor::WalkUpFromStmt
bool WalkUpFromStmt(Stmt *S)
Definition: RecursiveASTVisitor.h:369
clang::CXXDependentScopeMemberExpr
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
OMPIsDevicePtrClause
This represents clause &#39;is_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6179
clang::FloatingLiteral
Definition: Expr.h:1583
clang::RecursiveASTVisitor
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
Definition: RecursiveASTVisitor.h:151
clang::CapturedDecl
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4226
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1186
clang::RecursiveASTVisitor::VisitType
bool VisitType(Type *T)
Definition: RecursiveASTVisitor.h:445
TemplateName.h
DEF_TRAVERSE_TMPL_PART_SPEC_DECL
#define DEF_TRAVERSE_TMPL_PART_SPEC_DECL(TMPLDECLKIND, DECLKIND)
clang::LinkageSpecDecl
Represents a linkage specification.
Definition: DeclCXX.h:2778
clang::LambdaExpr::isInitCapture
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda&#39;s captures is an init-capture.
Definition: ExprCXX.cpp:1240
clang::BindingDecl
A binding in a decomposition declaration.
Definition: DeclCXX.h:3812
OMPCopyprivateClause::source_exprs
helper_expr_const_range source_exprs() const
Definition: OpenMPClause.h:3822
clang::CXXDefaultArgExpr
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1202
clang::DependentSizedExtVectorType
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3195
clang::OMPReductionClause::privates
helper_expr_const_range privates() const
Definition: OpenMPClause.h:2613
OMPFromClause
This represents clause &#39;from&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:5898
clang::CXXThisExpr
Represents the this expression in C++.
Definition: ExprCXX.h:1097
clang::FunctionNoProtoType
Represents a K&R-style &#39;int foo()&#39; function, which has no information available about its arguments...
Definition: Type.h:3717
clang::ObjCPropertyImplDecl
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2773
clang::OMPTaskReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:2871
clang::OMPTargetParallelForSimdDirective
This represents &#39;#pragma omp target parallel for simd&#39; directive.
Definition: StmtOpenMP.h:3825
clang::OMPArraySectionExpr
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:44
clang::OMPDynamicAllocatorsClause
This represents &#39;dynamic_allocators&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1149
clang::ConditionalOperator
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3732
clang::RecursiveASTVisitor::WalkUpFromTypeLoc
bool WalkUpFromTypeLoc(TypeLoc TL)
Definition: RecursiveASTVisitor.h:465
CAO_LIST
#define CAO_LIST()
Definition: RecursiveASTVisitor.h:70
clang::CXXPseudoDestructorExpr
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2479
clang::TypeAliasDecl
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3193
clang::CompoundStmt
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1332
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3754
OMPThreadsClause
This represents &#39;threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4161
clang::OMPLastprivateClause::destination_exprs
helper_expr_const_range destination_exprs() const
Definition: OpenMPClause.h:2321
clang::OMPTaskgroupDirective
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:2193
clang::OMPSimdlenClause::getSimdlen
Expr * getSimdlen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:769
clang::OMPLastprivateClause::source_exprs
helper_expr_const_range source_exprs() const
Definition: OpenMPClause.h:2312
clang::CXXRecordDecl::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition: DeclCXX.cpp:1700
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:671
OMPAlignedClause
This represents clause &#39;aligned&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3443
clang::OMPClause::getClauseKind
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
Definition: OpenMPClause.h:79
clang::UnaryExprOrTypeTraitExpr
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2372
clang::OMPLastprivateClause::private_copies
helper_expr_const_range private_copies() const
Definition: OpenMPClause.h:2302
clang::OMPTaskReductionClause
This represents clause &#39;task_reduction&#39; in the &#39;#pragma omp taskgroup&#39; directives.
Definition: OpenMPClause.h:2679
clang::ConstantExpr
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:978
clang::VAArgExpr
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4244
OMPCopyprivateClause::destination_exprs
helper_expr_const_range destination_exprs() const
Definition: OpenMPClause.h:3831
clang::VarTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:3208
clang::OMPRequiresDecl
This represents &#39;#pragma omp requires...&#39; directive.
Definition: DeclOpenMP.h:345
clang::OMPDistributeDirective
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:3480
OMPDependClause
This represents implicit clause &#39;depend&#39; for the &#39;#pragma omp task&#39; directive.
Definition: OpenMPClause.h:3958
clang::DEF_TRAVERSE_TYPELOC
DEF_TRAVERSE_TYPELOC(ComplexType, { TRY_TO(TraverseType(TL.getTypePtr() ->getElementType()));}) DEF_TRAVERSE_TYPELOC(PointerType
clang::DependentSizedArrayType
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3093
clang::Stmt::NoStmtClass
Definition: Stmt.h:69
clang::TemplateDecl::getTemplateParameters
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:421
clang::CXXScalarValueInitExpr
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:2053
clang::ConstructorUsingShadowDecl
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3263
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
clang::OMPProcBindClause
This represents &#39;proc_bind&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:942
clang::OMPCaptureClause
This represents &#39;capture&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1805
clang::Expr
This represents one expression.
Definition: Expr.h:108
clang::RequiresExprBodyDecl
Represents the body of a requires-expression.
Definition: DeclCXX.h:1909
clang::RecursiveASTVisitor::TraverseConstructorInitializer
bool TraverseConstructorInitializer(CXXCtorInitializer *Init)
Recursively visit a constructor initializer.
Definition: RecursiveASTVisitor.h:907
clang::OMPSimdlenClause
This represents &#39;simdlen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:735
clang::TemplateTypeParmDecl
Declaration of a template type parameter.
Definition: DeclTemplate.h:1177
OMPNumTasksClause::getNumTasks
Expr * getNumTasks() const
Return safe iteration space distance.
Definition: OpenMPClause.h:5462
clang::RecursiveASTVisitor::WalkUpFromDecl
bool WalkUpFromDecl(Decl *D)
Definition: RecursiveASTVisitor.h:498
clang::OMPMasterTaskLoopDirective
This represents &#39;#pragma omp master taskloop&#39; directive.
Definition: StmtOpenMP.h:3204
clang::ASTTemplateArgumentListInfo::NumTemplateArgs
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:620
clang::OMPC_threadprivate
Definition: OpenMPKinds.h:69
clang::TypeLoc::getUnqualifiedLoc
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
Definition: TypeLoc.h:326
clang::CXXTemporaryObjectExpr
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1750
clang::TemplateArgument::NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:67
clang::DesignatedInitUpdateExpr
Definition: Expr.h:4973
clang::CXXConstCastExpr
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:527
clang::BlockExpr
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5579
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2649
clang::FunctionDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
Definition: Decl.h:2071
clang::RecursiveASTVisitor::WalkUpFromQualifiedTypeLoc
bool WalkUpFromQualifiedTypeLoc(QualifiedTypeLoc TL)
Definition: RecursiveASTVisitor.h:470
DeclBase.h
clang::RecursiveASTVisitor::canIgnoreChildDeclWhileTraversingDeclContext
bool canIgnoreChildDeclWhileTraversingDeclContext(const Decl *Child)
clang::Decl::isImplicit
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:558
clang::OMPTargetTeamsDistributeParallelForSimdDirective
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:4463
clang::OMPAllocateClause::getAllocator
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
Definition: OpenMPClause.h:385
clang::ObjCDictionaryLiteral
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:304
clang::ObjCAtSynchronizedStmt
Represents Objective-C&#39;s @synchronized statement.
Definition: StmtObjC.h:277
clang::ObjCSelectorExpr
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
clang::DeclarationNameInfo::getNamedTypeInfo
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
Definition: DeclarationName.h:730
clang::NestedNameSpecifierLoc::getPrefix
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
Definition: NestedNameSpecifier.h:320
clang::SizeOfPackExpr
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4091
clang::CXXTryStmt
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:68
clang::AsTypeExpr
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:5642
clang::RecursiveASTVisitor::VisitQualifiedTypeLoc
bool VisitQualifiedTypeLoc(QualifiedTypeLoc TL)
Definition: RecursiveASTVisitor.h:473
clang::NonTypeTemplateParmDecl
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Definition: DeclTemplate.h:1383
clang::TemplateName
Represents a C++ template name within the type system.
Definition: TemplateName.h:191
clang::DecltypeType
Represents the type decltype(expr) (C++11).
Definition: Type.h:4370
clang::OMPTargetTeamsDistributeSimdDirective
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4536
clang::OMPReductionClause::rhs_exprs
helper_expr_const_range rhs_exprs() const
Definition: OpenMPClause.h:2629
TypeLoc.h
Defines the clang::TypeLoc interface and its subclasses.
clang::NestedNameSpecifier::NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
Definition: NestedNameSpecifier.h:85
clang::OMPOrderedClause
This represents &#39;ordered&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1474
clang::RecursiveASTVisitor::TraverseAST
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the top-level Decls in the AST traversal scope (by de...
Definition: RecursiveASTVisitor.h:182
clang::OMPForDirective
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1259
clang::UnaryTransformType
A unary type transform, which is a type constructed from another.
Definition: Type.h:4413
clang::ConceptReference::getConceptNameInfo
const DeclarationNameInfo & getConceptNameInfo() const
Definition: ASTConcept.h:142
Stmt.h
clang::TypeAliasTemplateDecl
Declaration of an alias template.
Definition: DeclTemplate.h:2511
clang::CXXFoldExpr
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4529
clang::ReturnStmt
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2636
clang::OMPTargetTeamsDirective
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:4251
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
clang::MSAsmStmt
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3101
clang::UnaryOperator
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2046
clang::VectorType
Represents a GCC generic vector type.
Definition: Type.h:3235
clang::MSPropertyRefExpr
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:863
clang::LValueReferenceType
An lvalue reference type, per C++11 [dcl.ref].
Definition: Type.h:2797
clang::TemplateTemplateParmDecl
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Definition: DeclTemplate.h:1600
clang::SubstNonTypeTemplateParmExpr
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4209
clang::DefaultStmt
Definition: Stmt.h:1656
OMPDeviceClause::getDevice
Expr * getDevice()
Return device number.
Definition: OpenMPClause.h:4132
clang::OMPCancelDirective
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:3005
clang::OMPCollapseClause
This represents &#39;collapse&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:800
clang::OMPFirstprivateClause
This represents clause &#39;firstprivate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:1991
clang::CXXDeductionGuideDecl
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1842
clang::CXXConversionDecl
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2713
clang::TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:181
clang::CStyleCastExpr
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
Definition: Expr.h:3371
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:719
clang::NestedNameSpecifier::TypeSpec
A type, stored as a Type*.
Definition: NestedNameSpecifier.h:88
clang::TraverseArrayTypeLocHelper
return TraverseArrayTypeLocHelper(TL)
clang::ConceptReference::getTemplateArgsAsWritten
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: ASTConcept.h:158
clang::TypeLoc::getAsAdjusted
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Definition: TypeLoc.h:2435
clang::FunctionTypeLoc::getReturnLoc
TypeLoc getReturnLoc() const
Definition: TypeLoc.h:1435
OpenMPClause.h
This file defines OpenMP AST classes for clauses.
clang::ImaginaryLiteral
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1662
clang::OMPFlushDirective
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:2267
clang::OMPParallelForSimdDirective
This represents &#39;#pragma omp parallel for simd&#39; directive.
Definition: StmtOpenMP.h:1796
clang::DoStmt
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:2354
clang::OMPC_device_type
Definition: OpenMPKinds.h:71
clang::OMPSeqCstClause
This represents &#39;seq_cst&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1845
clang::OMPLastprivateClause::assignment_ops
helper_expr_const_range assignment_ops() const
Definition: OpenMPClause.h:2331
clang::OMPUntiedClause
This represents &#39;untied&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1608
clang::OMPParallelMasterTaskLoopDirective
This represents &#39;#pragma omp parallel master taskloop&#39; directive.
Definition: StmtOpenMP.h:3340
clang::OMPUnifiedAddressClause
This represents &#39;unified_address&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
Definition: OpenMPClause.h:1023
clang::OMPTargetEnterDataDirective
This represents &#39;#pragma omp target enter data&#39; directive.
Definition: StmtOpenMP.h:2631
clang::DeclaratorDecl::getTrailingRequiresClause
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
Definition: Decl.h:747
clang::ArrayTypeLoc
Wrapper for source info for arrays.
Definition: TypeLoc.h:1484
clang::ExportDecl
Represents a C++ Modules TS module export declaration.
Definition: Decl.h:4396
clang::OMPMasterTaskLoopSimdDirective
This represents &#39;#pragma omp master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3272
clang::RecursiveASTVisitor::WalkUpFromUnqualTypeLoc
bool WalkUpFromUnqualTypeLoc(UnqualTypeLoc TL)
Definition: RecursiveASTVisitor.h:474
OMPNumTeamsClause
This represents &#39;num_teams&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5089
clang::CXXDynamicCastExpr
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:445
clang::OpaqueValueExpr
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:1075
clang::ConvertVectorExpr
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4067
clang::CapturedStmt
This captures a statement into a function.
Definition: Stmt.h:3376
Attr.h
clang::CXXInheritedCtorInitExpr
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1613
clang::PseudoObjectExpr
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5715
clang::RecursiveASTVisitor::shouldVisitTemplateInstantiations
bool shouldVisitTemplateInstantiations() const
Return whether this visitor should recurse into template instantiations.
Definition: RecursiveASTVisitor.h:166
clang::OMPInReductionClause::taskgroup_descriptors
helper_expr_const_range taskgroup_descriptors() const
Definition: OpenMPClause.h:3126
clang::RecursiveASTVisitor::VisitDecl
bool VisitDecl(Decl *D)
Definition: RecursiveASTVisitor.h:499
clang::OMPSingleDirective
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1535
clang::FunctionTemplateDecl::getTemplatedDecl
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Definition: DeclTemplate.h:1032
clang::CXXRewrittenBinaryOperator::DecomposedForm::LHS
const Expr * LHS
The original left-hand side.
Definition: ExprCXX.h:300
clang::ParenType
Sugar for parentheses used when specifying types.
Definition: Type.h:2584
clang::DeclarationName::CXXConstructorName
Definition: DeclarationName.h:206
OMPHintClause
This represents &#39;hint&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5488
clang::EnumType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Definition: Type.h:4521
clang::DeclarationName::Identifier
Definition: DeclarationName.h:203
clang::OMPDeclareReductionDecl
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:102
clang::OMPCapturedExprDecl
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:312
clang::TypeOfType
Represents typeof(type), a GCC extension.
Definition: Type.h:4343
clang::ObjCInterfaceType
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5894
clang::RecursiveASTVisitor::TraverseTypeLoc
bool TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
Definition: RecursiveASTVisitor.h:692
clang::OMPExecutableDirective
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
clang::OMPFirstprivateClause::private_copies
private_copies_range private_copies()
Definition: OpenMPClause.h:2079
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2100
clang::UserDefinedLiteral
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:564
clang::DeclarationNameInfo::getName
DeclarationName getName() const
getName - Returns the embedded declaration name.
Definition: DeclarationName.h:713
clang::BuiltinBitCastExpr
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:4812
clang::OMPScheduleClause
This represents &#39;schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1281
clang::CXXMemberCallExpr
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:171
clang::SEHExceptStmt
Definition: Stmt.h:3205
clang::ConceptReference
Common data class for constructs that reference concepts with template arguments. ...
Definition: ASTConcept.h:100
clang::DeclStmt
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1225
clang::LabelDecl
Represents the declaration of a label.
Definition: Decl.h:451
clang::OMPSharedClause
This represents clause &#39;shared&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:2370
clang::DependentVectorType
Represents a vector type where either the type or size is dependent.
Definition: Type.h:3312
clang::UnresolvedUsingValueDecl
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3588
clang::RecursiveASTVisitor::TraverseNestedNameSpecifierLoc
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
Definition: RecursiveASTVisitor.h:762
DeclarationName.h
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1931
OMPPriorityClause::getPriority
Expr * getPriority()
Return Priority number.
Definition: OpenMPClause.h:5284
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:48
clang::OMPTaskwaitDirective
This represents &#39;#pragma omp taskwait&#39; directive.
Definition: StmtOpenMP.h:2147
DeclOpenMP.h
This file defines OpenMP nodes for declarative directives.
clang::ObjCCategoryDecl
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2294
clang::TemplateArgument::pack_size
unsigned pack_size() const
The number of template arguments in the given template argument pack.
Definition: TemplateBase.h:359
clang::OMPClause
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
clang::AtomicExpr
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:5849
clang::FunctionProtoType::getNoexceptExpr
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
Definition: Type.h:4047
clang::ObjCProtocolExpr
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:503
llvm::SmallVector
Definition: LLVM.h:35
clang::RecursiveASTVisitor::TraverseStmt
bool TraverseStmt(Stmt *S, DataRecursionQueue *Queue=nullptr)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument&#39;s dy...
Definition: RecursiveASTVisitor.h:632
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:741
clang::ImplicitCastExpr
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3274
clang::FunctionProtoTypeLoc
Definition: TypeLoc.h:1466
clang::OMPTargetDirective
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2514
clang::OMPCollapseClause::getNumForLoops
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:835
clang::Type::getTypeClass
TypeClass getTypeClass() const
Definition: Type.h:1876
clang::TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:193
clang::TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
Definition: Specifiers.h:178
clang::LambdaCapture::isExplicit
bool isExplicit() const
Determine whether this was an explicit capture (written between the square brackets introducing the l...
Definition: LambdaCapture.h:117
clang::AtomicType
Definition: Type.h:6125
clang::CharacterLiteral
Definition: Expr.h:1530
clang::ExpressionTraitExpr
An expression trait intrinsic.
Definition: ExprCXX.h:2785
clang::FunctionDecl::getNameInfo
DeclarationNameInfo getNameInfo() const
Definition: Decl.h:1977
ExprOpenMP.h
clang::StaticAssertDecl
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3763
clang::concepts::Requirement
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:132
clang::OMPOrderedDirective
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2323
clang::StmtExpr
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3954
clang::OMPTargetUpdateDirective
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:3547
clang::ObjCBoxedExpr
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:124
clang::RecursiveASTVisitor::TraverseType
bool TraverseType(QualType T)
Recursively visit a type, by dispatching to Traverse*Type() based on the argument&#39;s getTypeClass() pr...
Definition: RecursiveASTVisitor.h:676
clang::CXXBaseSpecifier::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
Definition: DeclCXX.h:249
clang::ASTContext::getTraversalScope
std::vector< Decl * > getTraversalScope() const
Definition: ASTContext.h:638
clang::OMPInReductionClause::lhs_exprs
helper_expr_const_range lhs_exprs() const
Definition: OpenMPClause.h:3100
clang::TemplateName::getAsDependentTemplateName
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Definition: TemplateName.cpp:150
clang::OMPParallelMasterTaskLoopSimdDirective
This represents &#39;#pragma omp parallel master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3411
clang::MSDependentExistsStmt
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:252
clang::RecursiveASTVisitor::TraverseLambdaCapture
bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)
Recursively visit a lambda capture.
Definition: RecursiveASTVisitor.h:920
clang::ImportDecl
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4331
clang::DecayedType
Represents a pointer type decayed from an array or function type.
Definition: Type.h:2699
clang::InjectedClassNameType
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5133
clang::DependentScopeDeclRefExpr
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3155
clang::ArrayTypeLoc::getElementLoc
TypeLoc getElementLoc() const
Definition: TypeLoc.h:1517
clang::PackExpansionType
Represents a pack expansion of types.
Definition: Type.h:5511
clang::CompoundAssignOperator
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3654
Specifiers.h
Defines various enumerations that describe declaration and type specifiers.
clang::ImplicitParamDecl
Definition: Decl.h:1531
clang::GenericSelectionExpr
Represents a C11 generic selection.
Definition: Expr.h:5234
clang::TagDecl::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Definition: Decl.h:3446
NestedNameSpecifier.h
clang::ASTTemplateArgumentListInfo::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
Definition: TemplateBase.h:626
clang::RecursiveASTVisitor::shouldVisitImplicitCode
bool shouldVisitImplicitCode() const
Return whether this visitor should recurse into implicit code, e.g., implicit constructors and destru...
Definition: RecursiveASTVisitor.h:174
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3910
clang::ObjCBridgedCastExpr
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1638
Node
ast_type_traits::DynTypedNode Node
Definition: ASTMatchFinder.cpp:60
clang::FunctionParmPackExpr
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4337
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:50
clang::AdjustedType
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Definition: Type.h:2662
clang::QualifiedTemplateName
Represents a template name that was expressed as a qualified name.
Definition: TemplateName.h:390
clang::NullStmt
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1297
Decl.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
OMPDeviceClause
This represents &#39;device&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:4089
clang::NestedNameSpecifierLoc::getNestedNameSpecifier
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Definition: NestedNameSpecifier.h:267
clang::ConceptDecl
Definition: DeclTemplate.h:3226
clang::TemplateArgumentLoc::getArgument
const TemplateArgument & getArgument() const
Definition: TemplateBase.h:498
clang::PredefinedExpr
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1903
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2359
clang::OMPInReductionClause::privates
helper_expr_const_range privates() const
Definition: OpenMPClause.h:3092
clang::TemplateArgument::TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:79
clang::interp::NE
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:223
clang::OMPSectionDirective
This represents &#39;#pragma omp section&#39; directive.
Definition: StmtOpenMP.h:1472
clang::OMPTeamsDistributeDirective
This represents &#39;#pragma omp teams distribute&#39; directive.
Definition: StmtOpenMP.h:3961
DEF_TRAVERSE_TMPL_INST
#define DEF_TRAVERSE_TMPL_INST(TMPLDECLKIND)
Definition: RecursiveASTVisitor.h:519
clang::IndirectFieldDecl
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2980
clang::TemplateArgumentLoc::getSourceExpression
Expr * getSourceExpression() const
Definition: TemplateBase.h:511
OMPClause
clang::VarDecl::getInit
const Expr * getInit() const
Definition: Decl.h:1229
clang::ObjCAvailabilityCheckExpr
A runtime availability query.
Definition: ExprObjC.h:1699
clang::DecompositionDecl
A decomposition declaration.
Definition: DeclCXX.h:3869
clang::TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:189
clang::CXXReinterpretCastExpr
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:487
clang::OMPSimdDirective
This represents &#39;#pragma omp simd&#39; directive.
Definition: StmtOpenMP.h:1194
clang::CoyieldExpr
Represents a &#39;co_yield&#39; expression.
Definition: ExprCXX.h:4786
clang::UnresolvedUsingTypenameDecl
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3684
clang::ObjCTypeParamDecl
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:571
clang::FunctionProtoType::exceptions
ArrayRef< QualType > exceptions() const
Definition: Type.h:4133
clang::Decl::getKind
Kind getKind() const
Definition: DeclBase.h:432
clang::PackExpansionExpr
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4015
clang::OMPUnifiedSharedMemoryClause
This represents &#39;unified_shared_memory&#39; clause in the &#39;#pragma omp requires&#39; directive.
Definition: OpenMPClause.h:1065
clang::OMPLinearClause
This represents clause &#39;linear&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:3166
clang::ConceptReference::getNestedNameSpecifierLoc
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
Definition: ASTConcept.h:138
clang::EnumDecl
Represents an enum.
Definition: Decl.h:3481
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2833
clang::DeclarationName::CXXDestructorName
Definition: DeclarationName.h:207
clang::DeclarationName::CXXConversionFunctionName
Definition: DeclarationName.h:208
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:690
clang::OMPAtomicDirective
This represents &#39;#pragma omp atomic&#39; directive.
Definition: StmtOpenMP.h:2379
clang::NestedNameSpecifier::TypeSpecWithTemplate
A type that was preceded by the &#39;template&#39; keyword, stored as a Type*.
Definition: NestedNameSpecifier.h:92
clang::TemplateArgument::pack_begin
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Definition: TemplateBase.h:339
clang::SEHLeaveStmt
Represents a __leave statement.
Definition: Stmt.h:3337
clang::FunctionTypeLoc::getNumParams
unsigned getNumParams() const
Definition: TypeLoc.h:1426
clang::ObjCObjectPointerType
Represents a pointer to an Objective C object.
Definition: Type.h:5951
clang::OMPTaskReductionClause::privates
helper_expr_const_range privates() const
Definition: OpenMPClause.h:2847
clang::CXXNoexceptExpr
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3958
clang::SwitchStmt
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2043
clang::BlockPointerType
Pointer to a block type.
Definition: Type.h:2716
clang::DeclarationName::ObjCMultiArgSelector
Definition: DeclarationName.h:217
clang::ObjCImplementationDecl
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2566
clang::CoroutineBodyStmt
Represents the body of a coroutine.
Definition: StmtCXX.h:317
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4495
clang::ComplexType
Complex values, per C99 6.2.5p11.
Definition: Type.h:2554
clang::TemplateArgumentLoc
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:449
TemplateBase.h
DeclFriend.h
clang::ArraySubscriptExpr
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2462
StmtOpenMP.h
This file defines OpenMP AST classes for executable directives and clauses.
clang::ObjCForCollectionStmt
Represents Objective-C&#39;s collection statement.
Definition: StmtObjC.h:23
clang::RecursiveASTVisitor::TraverseTemplateArgument
bool TraverseTemplateArgument(const TemplateArgument &Arg)
Recursively visit a template argument and dispatch to the appropriate method for the argument type...
Definition: RecursiveASTVisitor.h:827
clang::CXXCtorInitializer
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2155
clang::TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp...
Definition: Specifiers.h:185
clang::ObjCEncodeExpr
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:407
OMPCopyinClause::destination_exprs
helper_expr_const_range destination_exprs() const
Definition: OpenMPClause.h:3668
clang::CUDAKernelCallExpr
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:224
clang::CoawaitExpr
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4699
clang::DeclaratorDecl::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:700
clang::ExtVectorType
ExtVectorType - Extended vector type.
Definition: Type.h:3354
clang::ArrayTypeLoc::getSizeExpr
Expr * getSizeExpr() const
Definition: TypeLoc.h:1509
clang::TypeLoc::getTypeLocClass
TypeLocClass getTypeLocClass() const
Definition: TypeLoc.h:115
clang::ObjCAtFinallyStmt
Represents Objective-C&#39;s @finally statement.
Definition: StmtObjC.h:127
clang::TemplateArgument::Type
The template argument is a type.
Definition: TemplateBase.h:59
OMPNontemporalClause::private_refs
child_range private_refs()
Definition: OpenMPClause.h:6348
clang::RecursiveASTVisitor::TraverseNestedNameSpecifier
bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS)
Recursively visit a C++ nested-name-specifier.
Definition: RecursiveASTVisitor.h:737
clang::TemplateArgument::Pack
The template argument is actually a parameter pack.
Definition: TemplateBase.h:90
clang::OMPTaskReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:2836
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:145
clang::OMPWriteClause
This represents &#39;write&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Definition: OpenMPClause.h:1725
clang::ObjCIvarRefExpr
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:546
clang::QualifiedTypeLoc::getUnqualifiedLoc
UnqualTypeLoc getUnqualifiedLoc() const
Definition: TypeLoc.h:281
clang::CXXUnresolvedConstructExpr
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
clang::GotoStmt
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2481
clang::CXXDefaultInitExpr
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1279
clang::TypeSourceInfo::getTypeLoc
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Definition: TypeLoc.h:244
clang::TemplateArgument::getKind
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:234
clang::AttributedType
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:4550
DeclCXX.h
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
clang::FunctionProtoType::getParamType
QualType getParamType(unsigned i) const
Definition: Type.h:3966
clang::DeclarationName::getCXXDeductionGuideTemplate
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
Definition: DeclarationName.h:451
clang::OMPInReductionClause::getNameInfo
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Definition: OpenMPClause.h:3081
clang::ObjCTypeParamType
Represents a type parameter type in Objective C.
Definition: Type.h:5620
clang::ObjCAtDefsFieldDecl
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2026
clang::MemberExpr
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2836
clang::OMPTargetParallelDirective
This represents &#39;#pragma omp target parallel&#39; directive.
Definition: StmtOpenMP.h:2748
clang::OMPNowaitClause
This represents &#39;nowait&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:1569
ExprConcepts.h
Defines Expressions and AST nodes for C++2a concepts.
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
clang::DependentTemplateSpecializationType
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:5420
clang::ContinueStmt
ContinueStmt - This represents a continue.
Definition: Stmt.h:2569
clang::ArrayInitLoopExpr
Represents a loop initializing the elements of an array.
Definition: Expr.h:5027
OMPNumTasksClause
This represents &#39;num_tasks&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5421
clang::InitListExpr::isSyntacticForm
bool isSyntacticForm() const
Definition: Expr.h:4559
clang::TemplateArgument::Template
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:75
clang::FileScopeAsmDecl
Definition: Decl.h:4002
clang::IncompleteArrayType
Represents a C array with an unspecified size.
Definition: Type.h:2995
clang::ChooseExpr
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4130
clang::BinaryConditionalOperator
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:3808
clang::CXXCatchStmt
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
clang::interp::LE
bool LE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:237
clang::CXXFunctionalCastExpr
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1688
clang::RecursiveASTVisitor::dataTraverseStmtPost
bool dataTraverseStmtPost(Stmt *S)
Invoked after visiting a statement or expression via data recursion.
Definition: RecursiveASTVisitor.h:206
clang::ObjCSubstitutionContext::Parameter
The parameter type of a method or function.
clang::ObjCIvarDecl
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1959
clang::WhileStmt
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2226
clang::AttrSyntax::C
clang::ConceptSpecializationExpr
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
Definition: ExprConcepts.h:40
clang::OMPInReductionClause::reduction_ops
helper_expr_const_range reduction_ops() const
Definition: OpenMPClause.h:3116
clang::ClassTemplateDecl
Declaration of a class template.
Definition: DeclTemplate.h:2238
OMPThreadLimitClause::getThreadLimit
Expr * getThreadLimit()
Return ThreadLimit number.
Definition: OpenMPClause.h:5209
Expr.h
clang::ObjCTypeParamList
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:649
clang::OMPC_unknown
Definition: OpenMPKinds.h:73
clang::BuiltinType
This class is used for builtin types like &#39;int&#39;.
Definition: Type.h:2465
clang::NestedNameSpecifierLoc::getTypeLoc
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
Definition: NestedNameSpecifier.cpp:463
clang::ObjCAtTryStmt
Represents Objective-C&#39;s @try ... @catch ... @finally statement.
Definition: StmtObjC.h:165
clang::OMPDeclareMapperDecl
This represents &#39;#pragma omp declare mapper ...&#39; directive.
Definition: DeclOpenMP.h:217
clang::OMPTaskLoopSimdDirective
This represents &#39;#pragma omp taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3137
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1711
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2546
clang::LifetimeExtendedTemporaryDecl
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3075
clang::RecursiveASTVisitor::TraverseTemplateArguments
bool TraverseTemplateArguments(const TemplateArgument *Args, unsigned NumArgs)
Recursively visit a set of template arguments.
Definition: RecursiveASTVisitor.h:897
DEF_TRAVERSE_STMT
#define DEF_TRAVERSE_STMT(STMT, CODE)
OMPDistScheduleClause
This represents &#39;dist_schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:5550
clang::OMPSectionsDirective
This represents &#39;#pragma omp sections&#39; directive.
Definition: StmtOpenMP.h:1403
OMPHintClause::getHint
Expr * getHint() const
Returns number of threads.
Definition: OpenMPClause.h:5522
clang::OMPTaskReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:2839
clang::ObjCBoolLiteralExpr
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
clang::TranslationUnitDecl
The top declaration context.
Definition: Decl.h:82
clang::OMPTargetDataDirective
This represents &#39;#pragma omp target data&#39; directive.
Definition: StmtOpenMP.h:2573
clang::TemplateArgument::getAsType
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:256
clang::CXXRewrittenBinaryOperator
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:273
clang::DeclRefExpr
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1171
clang::DependentAddressSpaceType
Represents an extended address space qualifier where the input address space value is dependent...
Definition: Type.h:3153
clang::TemplateSpecializationType
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4996
clang::OMPReductionClause::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Definition: OpenMPClause.h:2605
clang::BreakStmt
BreakStmt - This represents a break.
Definition: Stmt.h:2599
clang::OMPScheduleClause::getChunkSize
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:1440
clang::TypedefType
Definition: Type.h:4240
OMPClauseWithPreInit
clang::OMPNumThreadsClause::getNumThreads
Expr * getNumThreads() const
Returns number of threads.
Definition: OpenMPClause.h:638
clang::MSPropertyDecl
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3940
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:630
clang::RecursiveASTVisitor::TraverseAttr
bool TraverseAttr(Attr *At)
Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument&#39;s dynamic typ...
clang::OMPTaskyieldDirective
This represents &#39;#pragma omp taskyield&#39; directive.
Definition: StmtOpenMP.h:2055
clang::DeclarationName::CXXOperatorName
Definition: DeclarationName.h:209
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:223
clang::OMPDistributeParallelForSimdDirective
This represents &#39;#pragma omp distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3688
clang::CXXBoolLiteralExpr
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:645
clang::TemplateTypeParmType
Definition: Type.h:4647
clang::OffsetOfExpr
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2267
clang::RecursiveASTVisitor::VisitStmt
bool VisitStmt(Stmt *S)
Definition: RecursiveASTVisitor.h:370
clang::VariableArrayType
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:3039
clang::OMPParallelSectionsDirective
This represents &#39;#pragma omp parallel sections&#39; directive.
Definition: StmtOpenMP.h:1914
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:2967
clang::CXXUuidofExpr
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1000
clang::RecursiveASTVisitor::VisitUnqualTypeLoc
bool VisitUnqualTypeLoc(UnqualTypeLoc TL)
Definition: RecursiveASTVisitor.h:477
clang::FriendTemplateDecl
Declaration of a friend template.
Definition: DeclTemplate.h:2435
clang::UsingDirectiveDecl
Represents C++ using-directive.
Definition: DeclCXX.h:2863
clang::PragmaDetectMismatchDecl
Represents a #pragma detect_mismatch line.
Definition: Decl.h:148
clang::OMPClauseWithPostUpdate::getPostUpdateExpr
const Expr * getPostUpdateExpr() const
Get post-update expression for the clause.
Definition: OpenMPClause.h:162
clang::NestedNameSpecifier::Global
The global specifier &#39;::&#39;. There is no stored value.
Definition: NestedNameSpecifier.h:95
clang::TemplateArgument::getAsTemplateOrTemplatePattern
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:287
OMPNontemporalClause
This represents clause &#39;nontemporal&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6281
clang::ObjCAutoreleasePoolStmt
Represents Objective-C&#39;s @autoreleasepool Statement.
Definition: StmtObjC.h:368
clang::OMPThreadPrivateDecl
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:39
clang::ObjCCategoryImplDecl
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2513
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2935
clang::InitListExpr::getSyntacticForm
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4562
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:977
clang::ImplicitValueInitExpr
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5117
clang::RecursiveASTVisitor::TraverseTemplateArgumentLoc
bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)
Recursively visit a template argument location and dispatch to the appropriate method for the argumen...
Definition: RecursiveASTVisitor.h:858
clang::CXXRewrittenBinaryOperator::DecomposedForm
Definition: ExprCXX.h:296
clang::OMPTargetParallelForDirective
This represents &#39;#pragma omp target parallel for&#39; directive.
Definition: StmtOpenMP.h:2808
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:45
OMPUseDevicePtrClause
This represents clause &#39;use_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:6016
clang::UsingShadowDecl
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3162
clang::UsingPackDecl
Represents a pack of using declarations that a single using-declarator pack-expanded into...
Definition: DeclCXX.h:3519
clang::InitListExpr::getSemanticForm
InitListExpr * getSemanticForm() const
Definition: Expr.h:4556
LambdaCapture.h
Defines the LambdaCapture class.
clang::ObjCCompatibleAliasDecl
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2743
STMT
#define STMT(CLASS, PARENT)
Definition: RecursiveASTVisitor.h:371
clang::OMPTaskLoopDirective
This represents &#39;#pragma omp taskloop&#39; directive.
Definition: StmtOpenMP.h:3071