clang 17.0.0git
StmtProfile.cpp
Go to the documentation of this file.
1//===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the Stmt::Profile method, which builds a unique bit
10// representation that identifies a statement/expression.
11//
12//===----------------------------------------------------------------------===//
14#include "clang/AST/DeclCXX.h"
15#include "clang/AST/DeclObjC.h"
17#include "clang/AST/Expr.h"
18#include "clang/AST/ExprCXX.h"
19#include "clang/AST/ExprObjC.h"
21#include "clang/AST/ODRHash.h"
24#include "llvm/ADT/FoldingSet.h"
25using namespace clang;
26
27namespace {
28 class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
29 protected:
30 llvm::FoldingSetNodeID &ID;
31 bool Canonical;
32
33 public:
34 StmtProfiler(llvm::FoldingSetNodeID &ID, bool Canonical)
35 : ID(ID), Canonical(Canonical) {}
36
37 virtual ~StmtProfiler() {}
38
39 void VisitStmt(const Stmt *S);
40
41 void VisitStmtNoChildren(const Stmt *S) {
42 HandleStmtClass(S->getStmtClass());
43 }
44
45 virtual void HandleStmtClass(Stmt::StmtClass SC) = 0;
46
47#define STMT(Node, Base) void Visit##Node(const Node *S);
48#include "clang/AST/StmtNodes.inc"
49
50 /// Visit a declaration that is referenced within an expression
51 /// or statement.
52 virtual void VisitDecl(const Decl *D) = 0;
53
54 /// Visit a type that is referenced within an expression or
55 /// statement.
56 virtual void VisitType(QualType T) = 0;
57
58 /// Visit a name that occurs within an expression or statement.
59 virtual void VisitName(DeclarationName Name, bool TreatAsDecl = false) = 0;
60
61 /// Visit identifiers that are not in Decl's or Type's.
62 virtual void VisitIdentifierInfo(IdentifierInfo *II) = 0;
63
64 /// Visit a nested-name-specifier that occurs within an expression
65 /// or statement.
66 virtual void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) = 0;
67
68 /// Visit a template name that occurs within an expression or
69 /// statement.
70 virtual void VisitTemplateName(TemplateName Name) = 0;
71
72 /// Visit template arguments that occur within an expression or
73 /// statement.
74 void VisitTemplateArguments(const TemplateArgumentLoc *Args,
75 unsigned NumArgs);
76
77 /// Visit a single template argument.
78 void VisitTemplateArgument(const TemplateArgument &Arg);
79 };
80
81 class StmtProfilerWithPointers : public StmtProfiler {
82 const ASTContext &Context;
83
84 public:
85 StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
86 const ASTContext &Context, bool Canonical)
87 : StmtProfiler(ID, Canonical), Context(Context) {}
88 private:
89 void HandleStmtClass(Stmt::StmtClass SC) override {
90 ID.AddInteger(SC);
91 }
92
93 void VisitDecl(const Decl *D) override {
94 ID.AddInteger(D ? D->getKind() : 0);
95
96 if (Canonical && D) {
97 if (const NonTypeTemplateParmDecl *NTTP =
98 dyn_cast<NonTypeTemplateParmDecl>(D)) {
99 ID.AddInteger(NTTP->getDepth());
100 ID.AddInteger(NTTP->getIndex());
101 ID.AddBoolean(NTTP->isParameterPack());
102 // C++20 [temp.over.link]p6:
103 // Two template-parameters are equivalent under the following
104 // conditions: [...] if they declare non-type template parameters,
105 // they have equivalent types ignoring the use of type-constraints
106 // for placeholder types
107 //
108 // TODO: Why do we need to include the type in the profile? It's not
109 // part of the mangling.
110 VisitType(Context.getUnconstrainedType(NTTP->getType()));
111 return;
112 }
113
114 if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
115 // The Itanium C++ ABI uses the type, scope depth, and scope
116 // index of a parameter when mangling expressions that involve
117 // function parameters, so we will use the parameter's type for
118 // establishing function parameter identity. That way, our
119 // definition of "equivalent" (per C++ [temp.over.link]) is at
120 // least as strong as the definition of "equivalent" used for
121 // name mangling.
122 //
123 // TODO: The Itanium C++ ABI only uses the top-level cv-qualifiers,
124 // not the entirety of the type.
125 VisitType(Parm->getType());
126 ID.AddInteger(Parm->getFunctionScopeDepth());
127 ID.AddInteger(Parm->getFunctionScopeIndex());
128 return;
129 }
130
131 if (const TemplateTypeParmDecl *TTP =
132 dyn_cast<TemplateTypeParmDecl>(D)) {
133 ID.AddInteger(TTP->getDepth());
134 ID.AddInteger(TTP->getIndex());
135 ID.AddBoolean(TTP->isParameterPack());
136 return;
137 }
138
139 if (const TemplateTemplateParmDecl *TTP =
140 dyn_cast<TemplateTemplateParmDecl>(D)) {
141 ID.AddInteger(TTP->getDepth());
142 ID.AddInteger(TTP->getIndex());
143 ID.AddBoolean(TTP->isParameterPack());
144 return;
145 }
146 }
147
148 ID.AddPointer(D ? D->getCanonicalDecl() : nullptr);
149 }
150
151 void VisitType(QualType T) override {
152 if (Canonical && !T.isNull())
153 T = Context.getCanonicalType(T);
154
155 ID.AddPointer(T.getAsOpaquePtr());
156 }
157
158 void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override {
159 ID.AddPointer(Name.getAsOpaquePtr());
160 }
161
162 void VisitIdentifierInfo(IdentifierInfo *II) override {
163 ID.AddPointer(II);
164 }
165
166 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
167 if (Canonical)
168 NNS = Context.getCanonicalNestedNameSpecifier(NNS);
169 ID.AddPointer(NNS);
170 }
171
172 void VisitTemplateName(TemplateName Name) override {
173 if (Canonical)
174 Name = Context.getCanonicalTemplateName(Name);
175
176 Name.Profile(ID);
177 }
178 };
179
180 class StmtProfilerWithoutPointers : public StmtProfiler {
181 ODRHash &Hash;
182 public:
183 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
184 : StmtProfiler(ID, false), Hash(Hash) {}
185
186 private:
187 void HandleStmtClass(Stmt::StmtClass SC) override {
188 if (SC == Stmt::UnresolvedLookupExprClass) {
189 // Pretend that the name looked up is a Decl due to how templates
190 // handle some Decl lookups.
191 ID.AddInteger(Stmt::DeclRefExprClass);
192 } else {
193 ID.AddInteger(SC);
194 }
195 }
196
197 void VisitType(QualType T) override {
198 Hash.AddQualType(T);
199 }
200
201 void VisitName(DeclarationName Name, bool TreatAsDecl) override {
202 if (TreatAsDecl) {
203 // A Decl can be null, so each Decl is preceded by a boolean to
204 // store its nullness. Add a boolean here to match.
205 ID.AddBoolean(true);
206 }
207 Hash.AddDeclarationName(Name, TreatAsDecl);
208 }
209 void VisitIdentifierInfo(IdentifierInfo *II) override {
210 ID.AddBoolean(II);
211 if (II) {
212 Hash.AddIdentifierInfo(II);
213 }
214 }
215 void VisitDecl(const Decl *D) override {
216 ID.AddBoolean(D);
217 if (D) {
218 Hash.AddDecl(D);
219 }
220 }
221 void VisitTemplateName(TemplateName Name) override {
222 Hash.AddTemplateName(Name);
223 }
224 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
225 ID.AddBoolean(NNS);
226 if (NNS) {
227 Hash.AddNestedNameSpecifier(NNS);
228 }
229 }
230 };
231}
232
233void StmtProfiler::VisitStmt(const Stmt *S) {
234 assert(S && "Requires non-null Stmt pointer");
235
236 VisitStmtNoChildren(S);
237
238 for (const Stmt *SubStmt : S->children()) {
239 if (SubStmt)
240 Visit(SubStmt);
241 else
242 ID.AddInteger(0);
243 }
244}
245
246void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
247 VisitStmt(S);
248 for (const auto *D : S->decls())
249 VisitDecl(D);
250}
251
252void StmtProfiler::VisitNullStmt(const NullStmt *S) {
253 VisitStmt(S);
254}
255
256void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
257 VisitStmt(S);
258}
259
260void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
261 VisitStmt(S);
262}
263
264void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
265 VisitStmt(S);
266}
267
268void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
269 VisitStmt(S);
270 VisitDecl(S->getDecl());
271}
272
273void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
274 VisitStmt(S);
275 // TODO: maybe visit attributes?
276}
277
278void StmtProfiler::VisitIfStmt(const IfStmt *S) {
279 VisitStmt(S);
280 VisitDecl(S->getConditionVariable());
281}
282
283void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
284 VisitStmt(S);
285 VisitDecl(S->getConditionVariable());
286}
287
288void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
289 VisitStmt(S);
290 VisitDecl(S->getConditionVariable());
291}
292
293void StmtProfiler::VisitDoStmt(const DoStmt *S) {
294 VisitStmt(S);
295}
296
297void StmtProfiler::VisitForStmt(const ForStmt *S) {
298 VisitStmt(S);
299}
300
301void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
302 VisitStmt(S);
303 VisitDecl(S->getLabel());
304}
305
306void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
307 VisitStmt(S);
308}
309
310void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
311 VisitStmt(S);
312}
313
314void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
315 VisitStmt(S);
316}
317
318void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
319 VisitStmt(S);
320}
321
322void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
323 VisitStmt(S);
324 ID.AddBoolean(S->isVolatile());
325 ID.AddBoolean(S->isSimple());
326 VisitStringLiteral(S->getAsmString());
327 ID.AddInteger(S->getNumOutputs());
328 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
329 ID.AddString(S->getOutputName(I));
330 VisitStringLiteral(S->getOutputConstraintLiteral(I));
331 }
332 ID.AddInteger(S->getNumInputs());
333 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
334 ID.AddString(S->getInputName(I));
335 VisitStringLiteral(S->getInputConstraintLiteral(I));
336 }
337 ID.AddInteger(S->getNumClobbers());
338 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
339 VisitStringLiteral(S->getClobberStringLiteral(I));
340 ID.AddInteger(S->getNumLabels());
341 for (auto *L : S->labels())
342 VisitDecl(L->getLabel());
343}
344
345void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
346 // FIXME: Implement MS style inline asm statement profiler.
347 VisitStmt(S);
348}
349
350void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
351 VisitStmt(S);
352 VisitType(S->getCaughtType());
353}
354
355void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
356 VisitStmt(S);
357}
358
359void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
360 VisitStmt(S);
361}
362
363void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
364 VisitStmt(S);
365 ID.AddBoolean(S->isIfExists());
366 VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
367 VisitName(S->getNameInfo().getName());
368}
369
370void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
371 VisitStmt(S);
372}
373
374void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
375 VisitStmt(S);
376}
377
378void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
379 VisitStmt(S);
380}
381
382void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
383 VisitStmt(S);
384}
385
386void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
387 VisitStmt(S);
388}
389
390void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
391 VisitStmt(S);
392}
393
394void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
395 VisitStmt(S);
396 ID.AddBoolean(S->hasEllipsis());
397 if (S->getCatchParamDecl())
398 VisitType(S->getCatchParamDecl()->getType());
399}
400
401void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
402 VisitStmt(S);
403}
404
405void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
406 VisitStmt(S);
407}
408
409void
410StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
411 VisitStmt(S);
412}
413
414void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
415 VisitStmt(S);
416}
417
418void
419StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
420 VisitStmt(S);
421}
422
423namespace {
424class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
425 StmtProfiler *Profiler;
426 /// Process clauses with list of variables.
427 template <typename T>
428 void VisitOMPClauseList(T *Node);
429
430public:
431 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
432#define GEN_CLANG_CLAUSE_CLASS
433#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
434#include "llvm/Frontend/OpenMP/OMP.inc"
435 void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
436 void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
437};
438
439void OMPClauseProfiler::VistOMPClauseWithPreInit(
440 const OMPClauseWithPreInit *C) {
441 if (auto *S = C->getPreInitStmt())
442 Profiler->VisitStmt(S);
443}
444
445void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
446 const OMPClauseWithPostUpdate *C) {
447 VistOMPClauseWithPreInit(C);
448 if (auto *E = C->getPostUpdateExpr())
449 Profiler->VisitStmt(E);
450}
451
452void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
453 VistOMPClauseWithPreInit(C);
454 if (C->getCondition())
455 Profiler->VisitStmt(C->getCondition());
456}
457
458void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
459 VistOMPClauseWithPreInit(C);
460 if (C->getCondition())
461 Profiler->VisitStmt(C->getCondition());
462}
463
464void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
465 VistOMPClauseWithPreInit(C);
466 if (C->getNumThreads())
467 Profiler->VisitStmt(C->getNumThreads());
468}
469
470void OMPClauseProfiler::VisitOMPAlignClause(const OMPAlignClause *C) {
471 if (C->getAlignment())
472 Profiler->VisitStmt(C->getAlignment());
473}
474
475void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
476 if (C->getSafelen())
477 Profiler->VisitStmt(C->getSafelen());
478}
479
480void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) {
481 if (C->getSimdlen())
482 Profiler->VisitStmt(C->getSimdlen());
483}
484
485void OMPClauseProfiler::VisitOMPSizesClause(const OMPSizesClause *C) {
486 for (auto *E : C->getSizesRefs())
487 if (E)
488 Profiler->VisitExpr(E);
489}
490
491void OMPClauseProfiler::VisitOMPFullClause(const OMPFullClause *C) {}
492
493void OMPClauseProfiler::VisitOMPPartialClause(const OMPPartialClause *C) {
494 if (const Expr *Factor = C->getFactor())
495 Profiler->VisitExpr(Factor);
496}
497
498void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) {
499 if (C->getAllocator())
500 Profiler->VisitStmt(C->getAllocator());
501}
502
503void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
504 if (C->getNumForLoops())
505 Profiler->VisitStmt(C->getNumForLoops());
506}
507
508void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) {
509 if (Expr *Evt = C->getEventHandler())
510 Profiler->VisitStmt(Evt);
511}
512
513void OMPClauseProfiler::VisitOMPNovariantsClause(const OMPNovariantsClause *C) {
514 VistOMPClauseWithPreInit(C);
515 if (C->getCondition())
516 Profiler->VisitStmt(C->getCondition());
517}
518
519void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) {
520 VistOMPClauseWithPreInit(C);
521 if (C->getCondition())
522 Profiler->VisitStmt(C->getCondition());
523}
524
525void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
526
527void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
528
529void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
530 const OMPUnifiedAddressClause *C) {}
531
532void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
534
535void OMPClauseProfiler::VisitOMPReverseOffloadClause(
536 const OMPReverseOffloadClause *C) {}
537
538void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
540
541void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
543
544void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {}
545
546void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {}
547
548void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) {
549 if (C->getMessageString())
550 Profiler->VisitStmt(C->getMessageString());
551}
552
553void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
554 VistOMPClauseWithPreInit(C);
555 if (auto *S = C->getChunkSize())
556 Profiler->VisitStmt(S);
557}
558
559void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
560 if (auto *Num = C->getNumForLoops())
561 Profiler->VisitStmt(Num);
562}
563
564void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
565
566void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
567
568void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
569
570void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
571
572void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
573
574void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
575
576void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
577
578void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
579
580void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
581
582void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
583
584void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
585
586void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
587
588void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {}
589
590void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
591
592void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
593
594void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
595
596void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) {
597 VisitOMPClauseList(C);
598}
599
600void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) {
601 if (C->getInteropVar())
602 Profiler->VisitStmt(C->getInteropVar());
603}
604
605void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) {
606 if (C->getInteropVar())
607 Profiler->VisitStmt(C->getInteropVar());
608}
609
610void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) {
611 VistOMPClauseWithPreInit(C);
612 if (C->getThreadID())
613 Profiler->VisitStmt(C->getThreadID());
614}
615
616template<typename T>
617void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
618 for (auto *E : Node->varlists()) {
619 if (E)
620 Profiler->VisitStmt(E);
621 }
622}
623
624void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
625 VisitOMPClauseList(C);
626 for (auto *E : C->private_copies()) {
627 if (E)
628 Profiler->VisitStmt(E);
629 }
630}
631void
632OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
633 VisitOMPClauseList(C);
634 VistOMPClauseWithPreInit(C);
635 for (auto *E : C->private_copies()) {
636 if (E)
637 Profiler->VisitStmt(E);
638 }
639 for (auto *E : C->inits()) {
640 if (E)
641 Profiler->VisitStmt(E);
642 }
643}
644void
645OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
646 VisitOMPClauseList(C);
647 VistOMPClauseWithPostUpdate(C);
648 for (auto *E : C->source_exprs()) {
649 if (E)
650 Profiler->VisitStmt(E);
651 }
652 for (auto *E : C->destination_exprs()) {
653 if (E)
654 Profiler->VisitStmt(E);
655 }
656 for (auto *E : C->assignment_ops()) {
657 if (E)
658 Profiler->VisitStmt(E);
659 }
660}
661void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
662 VisitOMPClauseList(C);
663}
664void OMPClauseProfiler::VisitOMPReductionClause(
665 const OMPReductionClause *C) {
666 Profiler->VisitNestedNameSpecifier(
667 C->getQualifierLoc().getNestedNameSpecifier());
668 Profiler->VisitName(C->getNameInfo().getName());
669 VisitOMPClauseList(C);
670 VistOMPClauseWithPostUpdate(C);
671 for (auto *E : C->privates()) {
672 if (E)
673 Profiler->VisitStmt(E);
674 }
675 for (auto *E : C->lhs_exprs()) {
676 if (E)
677 Profiler->VisitStmt(E);
678 }
679 for (auto *E : C->rhs_exprs()) {
680 if (E)
681 Profiler->VisitStmt(E);
682 }
683 for (auto *E : C->reduction_ops()) {
684 if (E)
685 Profiler->VisitStmt(E);
686 }
687 if (C->getModifier() == clang::OMPC_REDUCTION_inscan) {
688 for (auto *E : C->copy_ops()) {
689 if (E)
690 Profiler->VisitStmt(E);
691 }
692 for (auto *E : C->copy_array_temps()) {
693 if (E)
694 Profiler->VisitStmt(E);
695 }
696 for (auto *E : C->copy_array_elems()) {
697 if (E)
698 Profiler->VisitStmt(E);
699 }
700 }
701}
702void OMPClauseProfiler::VisitOMPTaskReductionClause(
703 const OMPTaskReductionClause *C) {
704 Profiler->VisitNestedNameSpecifier(
705 C->getQualifierLoc().getNestedNameSpecifier());
706 Profiler->VisitName(C->getNameInfo().getName());
707 VisitOMPClauseList(C);
708 VistOMPClauseWithPostUpdate(C);
709 for (auto *E : C->privates()) {
710 if (E)
711 Profiler->VisitStmt(E);
712 }
713 for (auto *E : C->lhs_exprs()) {
714 if (E)
715 Profiler->VisitStmt(E);
716 }
717 for (auto *E : C->rhs_exprs()) {
718 if (E)
719 Profiler->VisitStmt(E);
720 }
721 for (auto *E : C->reduction_ops()) {
722 if (E)
723 Profiler->VisitStmt(E);
724 }
725}
726void OMPClauseProfiler::VisitOMPInReductionClause(
727 const OMPInReductionClause *C) {
728 Profiler->VisitNestedNameSpecifier(
729 C->getQualifierLoc().getNestedNameSpecifier());
730 Profiler->VisitName(C->getNameInfo().getName());
731 VisitOMPClauseList(C);
732 VistOMPClauseWithPostUpdate(C);
733 for (auto *E : C->privates()) {
734 if (E)
735 Profiler->VisitStmt(E);
736 }
737 for (auto *E : C->lhs_exprs()) {
738 if (E)
739 Profiler->VisitStmt(E);
740 }
741 for (auto *E : C->rhs_exprs()) {
742 if (E)
743 Profiler->VisitStmt(E);
744 }
745 for (auto *E : C->reduction_ops()) {
746 if (E)
747 Profiler->VisitStmt(E);
748 }
749 for (auto *E : C->taskgroup_descriptors()) {
750 if (E)
751 Profiler->VisitStmt(E);
752 }
753}
754void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
755 VisitOMPClauseList(C);
756 VistOMPClauseWithPostUpdate(C);
757 for (auto *E : C->privates()) {
758 if (E)
759 Profiler->VisitStmt(E);
760 }
761 for (auto *E : C->inits()) {
762 if (E)
763 Profiler->VisitStmt(E);
764 }
765 for (auto *E : C->updates()) {
766 if (E)
767 Profiler->VisitStmt(E);
768 }
769 for (auto *E : C->finals()) {
770 if (E)
771 Profiler->VisitStmt(E);
772 }
773 if (C->getStep())
774 Profiler->VisitStmt(C->getStep());
775 if (C->getCalcStep())
776 Profiler->VisitStmt(C->getCalcStep());
777}
778void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
779 VisitOMPClauseList(C);
780 if (C->getAlignment())
781 Profiler->VisitStmt(C->getAlignment());
782}
783void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
784 VisitOMPClauseList(C);
785 for (auto *E : C->source_exprs()) {
786 if (E)
787 Profiler->VisitStmt(E);
788 }
789 for (auto *E : C->destination_exprs()) {
790 if (E)
791 Profiler->VisitStmt(E);
792 }
793 for (auto *E : C->assignment_ops()) {
794 if (E)
795 Profiler->VisitStmt(E);
796 }
797}
798void
799OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
800 VisitOMPClauseList(C);
801 for (auto *E : C->source_exprs()) {
802 if (E)
803 Profiler->VisitStmt(E);
804 }
805 for (auto *E : C->destination_exprs()) {
806 if (E)
807 Profiler->VisitStmt(E);
808 }
809 for (auto *E : C->assignment_ops()) {
810 if (E)
811 Profiler->VisitStmt(E);
812 }
813}
814void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
815 VisitOMPClauseList(C);
816}
817void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) {
818 if (const Expr *Depobj = C->getDepobj())
819 Profiler->VisitStmt(Depobj);
820}
821void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
822 VisitOMPClauseList(C);
823}
824void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
825 if (C->getDevice())
826 Profiler->VisitStmt(C->getDevice());
827}
828void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
829 VisitOMPClauseList(C);
830}
831void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
832 if (Expr *Allocator = C->getAllocator())
833 Profiler->VisitStmt(Allocator);
834 VisitOMPClauseList(C);
835}
836void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
837 VistOMPClauseWithPreInit(C);
838 if (C->getNumTeams())
839 Profiler->VisitStmt(C->getNumTeams());
840}
841void OMPClauseProfiler::VisitOMPThreadLimitClause(
842 const OMPThreadLimitClause *C) {
843 VistOMPClauseWithPreInit(C);
844 if (C->getThreadLimit())
845 Profiler->VisitStmt(C->getThreadLimit());
846}
847void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
848 VistOMPClauseWithPreInit(C);
849 if (C->getPriority())
850 Profiler->VisitStmt(C->getPriority());
851}
852void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
853 VistOMPClauseWithPreInit(C);
854 if (C->getGrainsize())
855 Profiler->VisitStmt(C->getGrainsize());
856}
857void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
858 VistOMPClauseWithPreInit(C);
859 if (C->getNumTasks())
860 Profiler->VisitStmt(C->getNumTasks());
861}
862void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
863 if (C->getHint())
864 Profiler->VisitStmt(C->getHint());
865}
866void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
867 VisitOMPClauseList(C);
868}
869void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
870 VisitOMPClauseList(C);
871}
872void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
873 const OMPUseDevicePtrClause *C) {
874 VisitOMPClauseList(C);
875}
876void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
877 const OMPUseDeviceAddrClause *C) {
878 VisitOMPClauseList(C);
879}
880void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
881 const OMPIsDevicePtrClause *C) {
882 VisitOMPClauseList(C);
883}
884void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
885 const OMPHasDeviceAddrClause *C) {
886 VisitOMPClauseList(C);
887}
888void OMPClauseProfiler::VisitOMPNontemporalClause(
889 const OMPNontemporalClause *C) {
890 VisitOMPClauseList(C);
891 for (auto *E : C->private_refs())
892 Profiler->VisitStmt(E);
893}
894void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
895 VisitOMPClauseList(C);
896}
897void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) {
898 VisitOMPClauseList(C);
899}
900void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
901 const OMPUsesAllocatorsClause *C) {
902 for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
903 OMPUsesAllocatorsClause::Data D = C->getAllocatorData(I);
904 Profiler->VisitStmt(D.Allocator);
905 if (D.AllocatorTraits)
906 Profiler->VisitStmt(D.AllocatorTraits);
907 }
908}
909void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
910 if (const Expr *Modifier = C->getModifier())
911 Profiler->VisitStmt(Modifier);
912 for (const Expr *E : C->varlists())
913 Profiler->VisitStmt(E);
914}
915void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
916void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {}
917void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
918 const OMPXDynCGroupMemClause *C) {
919 VistOMPClauseWithPreInit(C);
920 if (Expr *Size = C->getSize())
921 Profiler->VisitStmt(Size);
922}
923} // namespace
924
925void
926StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
927 VisitStmt(S);
928 OMPClauseProfiler P(this);
929 ArrayRef<OMPClause *> Clauses = S->clauses();
930 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
931 I != E; ++I)
932 if (*I)
933 P.Visit(*I);
934}
935
936void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) {
937 VisitStmt(L);
938}
939
940void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) {
941 VisitOMPExecutableDirective(S);
942}
943
944void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
945 VisitOMPLoopBasedDirective(S);
946}
947
948void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) {
949 VisitOMPExecutableDirective(S);
950}
951
952void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
953 VisitOMPExecutableDirective(S);
954}
955
956void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
957 VisitOMPLoopDirective(S);
958}
959
960void StmtProfiler::VisitOMPLoopTransformationDirective(
962 VisitOMPLoopBasedDirective(S);
963}
964
965void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) {
966 VisitOMPLoopTransformationDirective(S);
967}
968
969void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) {
970 VisitOMPLoopTransformationDirective(S);
971}
972
973void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
974 VisitOMPLoopDirective(S);
975}
976
977void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
978 VisitOMPLoopDirective(S);
979}
980
981void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
982 VisitOMPExecutableDirective(S);
983}
984
985void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
986 VisitOMPExecutableDirective(S);
987}
988
989void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
990 VisitOMPExecutableDirective(S);
991}
992
993void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
994 VisitOMPExecutableDirective(S);
995}
996
997void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
998 VisitOMPExecutableDirective(S);
999 VisitName(S->getDirectiveName().getName());
1000}
1001
1002void
1003StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
1004 VisitOMPLoopDirective(S);
1005}
1006
1007void StmtProfiler::VisitOMPParallelForSimdDirective(
1008 const OMPParallelForSimdDirective *S) {
1009 VisitOMPLoopDirective(S);
1010}
1011
1012void StmtProfiler::VisitOMPParallelMasterDirective(
1013 const OMPParallelMasterDirective *S) {
1014 VisitOMPExecutableDirective(S);
1015}
1016
1017void StmtProfiler::VisitOMPParallelMaskedDirective(
1018 const OMPParallelMaskedDirective *S) {
1019 VisitOMPExecutableDirective(S);
1020}
1021
1022void StmtProfiler::VisitOMPParallelSectionsDirective(
1024 VisitOMPExecutableDirective(S);
1025}
1026
1027void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
1028 VisitOMPExecutableDirective(S);
1029}
1030
1031void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
1032 VisitOMPExecutableDirective(S);
1033}
1034
1035void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
1036 VisitOMPExecutableDirective(S);
1037}
1038
1039void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
1040 VisitOMPExecutableDirective(S);
1041}
1042
1043void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) {
1044 VisitOMPExecutableDirective(S);
1045}
1046void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
1047 VisitOMPExecutableDirective(S);
1048 if (const Expr *E = S->getReductionRef())
1049 VisitStmt(E);
1050}
1051
1052void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
1053 VisitOMPExecutableDirective(S);
1054}
1055
1056void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1057 VisitOMPExecutableDirective(S);
1058}
1059
1060void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1061 VisitOMPExecutableDirective(S);
1062}
1063
1064void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1065 VisitOMPExecutableDirective(S);
1066}
1067
1068void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1069 VisitOMPExecutableDirective(S);
1070}
1071
1072void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1073 VisitOMPExecutableDirective(S);
1074}
1075
1076void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
1077 VisitOMPExecutableDirective(S);
1078}
1079
1080void StmtProfiler::VisitOMPTargetEnterDataDirective(
1081 const OMPTargetEnterDataDirective *S) {
1082 VisitOMPExecutableDirective(S);
1083}
1084
1085void StmtProfiler::VisitOMPTargetExitDataDirective(
1086 const OMPTargetExitDataDirective *S) {
1087 VisitOMPExecutableDirective(S);
1088}
1089
1090void StmtProfiler::VisitOMPTargetParallelDirective(
1091 const OMPTargetParallelDirective *S) {
1092 VisitOMPExecutableDirective(S);
1093}
1094
1095void StmtProfiler::VisitOMPTargetParallelForDirective(
1097 VisitOMPExecutableDirective(S);
1098}
1099
1100void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1101 VisitOMPExecutableDirective(S);
1102}
1103
1104void StmtProfiler::VisitOMPCancellationPointDirective(
1106 VisitOMPExecutableDirective(S);
1107}
1108
1109void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1110 VisitOMPExecutableDirective(S);
1111}
1112
1113void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1114 VisitOMPLoopDirective(S);
1115}
1116
1117void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1118 const OMPTaskLoopSimdDirective *S) {
1119 VisitOMPLoopDirective(S);
1120}
1121
1122void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1123 const OMPMasterTaskLoopDirective *S) {
1124 VisitOMPLoopDirective(S);
1125}
1126
1127void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1128 const OMPMaskedTaskLoopDirective *S) {
1129 VisitOMPLoopDirective(S);
1130}
1131
1132void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1134 VisitOMPLoopDirective(S);
1135}
1136
1137void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1139 VisitOMPLoopDirective(S);
1140}
1141
1142void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1144 VisitOMPLoopDirective(S);
1145}
1146
1147void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1149 VisitOMPLoopDirective(S);
1150}
1151
1152void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1154 VisitOMPLoopDirective(S);
1155}
1156
1157void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1159 VisitOMPLoopDirective(S);
1160}
1161
1162void StmtProfiler::VisitOMPDistributeDirective(
1163 const OMPDistributeDirective *S) {
1164 VisitOMPLoopDirective(S);
1165}
1166
1167void OMPClauseProfiler::VisitOMPDistScheduleClause(
1168 const OMPDistScheduleClause *C) {
1169 VistOMPClauseWithPreInit(C);
1170 if (auto *S = C->getChunkSize())
1171 Profiler->VisitStmt(S);
1172}
1173
1174void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1175
1176void StmtProfiler::VisitOMPTargetUpdateDirective(
1177 const OMPTargetUpdateDirective *S) {
1178 VisitOMPExecutableDirective(S);
1179}
1180
1181void StmtProfiler::VisitOMPDistributeParallelForDirective(
1183 VisitOMPLoopDirective(S);
1184}
1185
1186void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1188 VisitOMPLoopDirective(S);
1189}
1190
1191void StmtProfiler::VisitOMPDistributeSimdDirective(
1192 const OMPDistributeSimdDirective *S) {
1193 VisitOMPLoopDirective(S);
1194}
1195
1196void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1198 VisitOMPLoopDirective(S);
1199}
1200
1201void StmtProfiler::VisitOMPTargetSimdDirective(
1202 const OMPTargetSimdDirective *S) {
1203 VisitOMPLoopDirective(S);
1204}
1205
1206void StmtProfiler::VisitOMPTeamsDistributeDirective(
1207 const OMPTeamsDistributeDirective *S) {
1208 VisitOMPLoopDirective(S);
1209}
1210
1211void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1213 VisitOMPLoopDirective(S);
1214}
1215
1216void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1218 VisitOMPLoopDirective(S);
1219}
1220
1221void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1223 VisitOMPLoopDirective(S);
1224}
1225
1226void StmtProfiler::VisitOMPTargetTeamsDirective(
1227 const OMPTargetTeamsDirective *S) {
1228 VisitOMPExecutableDirective(S);
1229}
1230
1231void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1233 VisitOMPLoopDirective(S);
1234}
1235
1236void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1238 VisitOMPLoopDirective(S);
1239}
1240
1241void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1243 VisitOMPLoopDirective(S);
1244}
1245
1246void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1248 VisitOMPLoopDirective(S);
1249}
1250
1251void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1252 VisitOMPExecutableDirective(S);
1253}
1254
1255void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1256 VisitOMPExecutableDirective(S);
1257}
1258
1259void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1260 VisitOMPExecutableDirective(S);
1261}
1262
1263void StmtProfiler::VisitOMPGenericLoopDirective(
1264 const OMPGenericLoopDirective *S) {
1265 VisitOMPLoopDirective(S);
1266}
1267
1268void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1270 VisitOMPLoopDirective(S);
1271}
1272
1273void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1275 VisitOMPLoopDirective(S);
1276}
1277
1278void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1280 VisitOMPLoopDirective(S);
1281}
1282
1283void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1285 VisitOMPLoopDirective(S);
1286}
1287
1288void StmtProfiler::VisitExpr(const Expr *S) {
1289 VisitStmt(S);
1290}
1291
1292void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1293 VisitExpr(S);
1294}
1295
1296void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1297 VisitExpr(S);
1298 if (!Canonical)
1299 VisitNestedNameSpecifier(S->getQualifier());
1300 VisitDecl(S->getDecl());
1301 if (!Canonical) {
1302 ID.AddBoolean(S->hasExplicitTemplateArgs());
1303 if (S->hasExplicitTemplateArgs())
1304 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1305 }
1306}
1307
1308void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1309 const SYCLUniqueStableNameExpr *S) {
1310 VisitExpr(S);
1311 VisitType(S->getTypeSourceInfo()->getType());
1312}
1313
1314void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1315 VisitExpr(S);
1316 ID.AddInteger(S->getIdentKind());
1317}
1318
1319void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1320 VisitExpr(S);
1321 S->getValue().Profile(ID);
1322 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1323}
1324
1325void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1326 VisitExpr(S);
1327 S->getValue().Profile(ID);
1328 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1329}
1330
1331void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1332 VisitExpr(S);
1333 ID.AddInteger(S->getKind());
1334 ID.AddInteger(S->getValue());
1335}
1336
1337void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1338 VisitExpr(S);
1339 S->getValue().Profile(ID);
1340 ID.AddBoolean(S->isExact());
1341 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1342}
1343
1344void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1345 VisitExpr(S);
1346}
1347
1348void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1349 VisitExpr(S);
1350 ID.AddString(S->getBytes());
1351 ID.AddInteger(S->getKind());
1352}
1353
1354void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1355 VisitExpr(S);
1356}
1357
1358void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1359 VisitExpr(S);
1360}
1361
1362void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1363 VisitExpr(S);
1364 ID.AddInteger(S->getOpcode());
1365}
1366
1367void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1368 VisitType(S->getTypeSourceInfo()->getType());
1369 unsigned n = S->getNumComponents();
1370 for (unsigned i = 0; i < n; ++i) {
1371 const OffsetOfNode &ON = S->getComponent(i);
1372 ID.AddInteger(ON.getKind());
1373 switch (ON.getKind()) {
1375 // Expressions handled below.
1376 break;
1377
1379 VisitDecl(ON.getField());
1380 break;
1381
1383 VisitIdentifierInfo(ON.getFieldName());
1384 break;
1385
1386 case OffsetOfNode::Base:
1387 // These nodes are implicit, and therefore don't need profiling.
1388 break;
1389 }
1390 }
1391
1392 VisitExpr(S);
1393}
1394
1395void
1396StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1397 VisitExpr(S);
1398 ID.AddInteger(S->getKind());
1399 if (S->isArgumentType())
1400 VisitType(S->getArgumentType());
1401}
1402
1403void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1404 VisitExpr(S);
1405}
1406
1407void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1408 VisitExpr(S);
1409}
1410
1411void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) {
1412 VisitExpr(S);
1413}
1414
1415void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1416 VisitExpr(S);
1417}
1418
1419void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1420 VisitExpr(S);
1421 for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1422 VisitDecl(S->getIteratorDecl(I));
1423}
1424
1425void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1426 VisitExpr(S);
1427}
1428
1429void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1430 VisitExpr(S);
1431 VisitDecl(S->getMemberDecl());
1432 if (!Canonical)
1433 VisitNestedNameSpecifier(S->getQualifier());
1434 ID.AddBoolean(S->isArrow());
1435}
1436
1437void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1438 VisitExpr(S);
1439 ID.AddBoolean(S->isFileScope());
1440}
1441
1442void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1443 VisitExpr(S);
1444}
1445
1446void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1447 VisitCastExpr(S);
1448 ID.AddInteger(S->getValueKind());
1449}
1450
1451void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1452 VisitCastExpr(S);
1453 VisitType(S->getTypeAsWritten());
1454}
1455
1456void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1457 VisitExplicitCastExpr(S);
1458}
1459
1460void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1461 VisitExpr(S);
1462 ID.AddInteger(S->getOpcode());
1463}
1464
1465void
1466StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1467 VisitBinaryOperator(S);
1468}
1469
1470void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1471 VisitExpr(S);
1472}
1473
1474void StmtProfiler::VisitBinaryConditionalOperator(
1475 const BinaryConditionalOperator *S) {
1476 VisitExpr(S);
1477}
1478
1479void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1480 VisitExpr(S);
1481 VisitDecl(S->getLabel());
1482}
1483
1484void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1485 VisitExpr(S);
1486}
1487
1488void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1489 VisitExpr(S);
1490}
1491
1492void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1493 VisitExpr(S);
1494}
1495
1496void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1497 VisitExpr(S);
1498}
1499
1500void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1501 VisitExpr(S);
1502}
1503
1504void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1505 VisitExpr(S);
1506}
1507
1508void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1509 if (S->getSyntacticForm()) {
1510 VisitInitListExpr(S->getSyntacticForm());
1511 return;
1512 }
1513
1514 VisitExpr(S);
1515}
1516
1517void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1518 VisitExpr(S);
1519 ID.AddBoolean(S->usesGNUSyntax());
1520 for (const DesignatedInitExpr::Designator &D : S->designators()) {
1521 if (D.isFieldDesignator()) {
1522 ID.AddInteger(0);
1523 VisitName(D.getFieldName());
1524 continue;
1525 }
1526
1527 if (D.isArrayDesignator()) {
1528 ID.AddInteger(1);
1529 } else {
1530 assert(D.isArrayRangeDesignator());
1531 ID.AddInteger(2);
1532 }
1533 ID.AddInteger(D.getArrayIndex());
1534 }
1535}
1536
1537// Seems that if VisitInitListExpr() only works on the syntactic form of an
1538// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1539void StmtProfiler::VisitDesignatedInitUpdateExpr(
1540 const DesignatedInitUpdateExpr *S) {
1541 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1542 "initializer");
1543}
1544
1545void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1546 VisitExpr(S);
1547}
1548
1549void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1550 VisitExpr(S);
1551}
1552
1553void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1554 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1555}
1556
1557void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1558 VisitExpr(S);
1559}
1560
1561void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1562 VisitExpr(S);
1563 VisitName(&S->getAccessor());
1564}
1565
1566void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1567 VisitExpr(S);
1568 VisitDecl(S->getBlockDecl());
1569}
1570
1571void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1572 VisitExpr(S);
1574 S->associations()) {
1575 QualType T = Assoc.getType();
1576 if (T.isNull())
1577 ID.AddPointer(nullptr);
1578 else
1579 VisitType(T);
1580 VisitExpr(Assoc.getAssociationExpr());
1581 }
1582}
1583
1584void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1585 VisitExpr(S);
1587 i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1588 // Normally, we would not profile the source expressions of OVEs.
1589 if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1590 Visit(OVE->getSourceExpr());
1591}
1592
1593void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1594 VisitExpr(S);
1595 ID.AddInteger(S->getOp());
1596}
1597
1598void StmtProfiler::VisitConceptSpecializationExpr(
1599 const ConceptSpecializationExpr *S) {
1600 VisitExpr(S);
1601 VisitDecl(S->getNamedConcept());
1602 for (const TemplateArgument &Arg : S->getTemplateArguments())
1603 VisitTemplateArgument(Arg);
1604}
1605
1606void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1607 VisitExpr(S);
1608 ID.AddInteger(S->getLocalParameters().size());
1609 for (ParmVarDecl *LocalParam : S->getLocalParameters())
1610 VisitDecl(LocalParam);
1611 ID.AddInteger(S->getRequirements().size());
1612 for (concepts::Requirement *Req : S->getRequirements()) {
1613 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1615 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1616 if (!TypeReq->isSubstitutionFailure())
1617 VisitType(TypeReq->getType()->getType());
1618 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1620 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1621 if (!ExprReq->isExprSubstitutionFailure())
1622 Visit(ExprReq->getExpr());
1623 // C++2a [expr.prim.req.compound]p1 Example:
1624 // [...] The compound-requirement in C1 requires that x++ is a valid
1625 // expression. It is equivalent to the simple-requirement x++; [...]
1626 // We therefore do not profile isSimple() here.
1627 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1629 ExprReq->getReturnTypeRequirement();
1630 if (RetReq.isEmpty()) {
1631 ID.AddInteger(0);
1632 } else if (RetReq.isTypeConstraint()) {
1633 ID.AddInteger(1);
1635 } else {
1636 assert(RetReq.isSubstitutionFailure());
1637 ID.AddInteger(2);
1638 }
1639 } else {
1641 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1642 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1643 if (!NestedReq->hasInvalidConstraint())
1644 Visit(NestedReq->getConstraintExpr());
1645 }
1646 }
1647}
1648
1650 UnaryOperatorKind &UnaryOp,
1651 BinaryOperatorKind &BinaryOp) {
1652 switch (S->getOperator()) {
1653 case OO_None:
1654 case OO_New:
1655 case OO_Delete:
1656 case OO_Array_New:
1657 case OO_Array_Delete:
1658 case OO_Arrow:
1659 case OO_Conditional:
1661 llvm_unreachable("Invalid operator call kind");
1662
1663 case OO_Plus:
1664 if (S->getNumArgs() == 1) {
1665 UnaryOp = UO_Plus;
1666 return Stmt::UnaryOperatorClass;
1667 }
1668
1669 BinaryOp = BO_Add;
1670 return Stmt::BinaryOperatorClass;
1671
1672 case OO_Minus:
1673 if (S->getNumArgs() == 1) {
1674 UnaryOp = UO_Minus;
1675 return Stmt::UnaryOperatorClass;
1676 }
1677
1678 BinaryOp = BO_Sub;
1679 return Stmt::BinaryOperatorClass;
1680
1681 case OO_Star:
1682 if (S->getNumArgs() == 1) {
1683 UnaryOp = UO_Deref;
1684 return Stmt::UnaryOperatorClass;
1685 }
1686
1687 BinaryOp = BO_Mul;
1688 return Stmt::BinaryOperatorClass;
1689
1690 case OO_Slash:
1691 BinaryOp = BO_Div;
1692 return Stmt::BinaryOperatorClass;
1693
1694 case OO_Percent:
1695 BinaryOp = BO_Rem;
1696 return Stmt::BinaryOperatorClass;
1697
1698 case OO_Caret:
1699 BinaryOp = BO_Xor;
1700 return Stmt::BinaryOperatorClass;
1701
1702 case OO_Amp:
1703 if (S->getNumArgs() == 1) {
1704 UnaryOp = UO_AddrOf;
1705 return Stmt::UnaryOperatorClass;
1706 }
1707
1708 BinaryOp = BO_And;
1709 return Stmt::BinaryOperatorClass;
1710
1711 case OO_Pipe:
1712 BinaryOp = BO_Or;
1713 return Stmt::BinaryOperatorClass;
1714
1715 case OO_Tilde:
1716 UnaryOp = UO_Not;
1717 return Stmt::UnaryOperatorClass;
1718
1719 case OO_Exclaim:
1720 UnaryOp = UO_LNot;
1721 return Stmt::UnaryOperatorClass;
1722
1723 case OO_Equal:
1724 BinaryOp = BO_Assign;
1725 return Stmt::BinaryOperatorClass;
1726
1727 case OO_Less:
1728 BinaryOp = BO_LT;
1729 return Stmt::BinaryOperatorClass;
1730
1731 case OO_Greater:
1732 BinaryOp = BO_GT;
1733 return Stmt::BinaryOperatorClass;
1734
1735 case OO_PlusEqual:
1736 BinaryOp = BO_AddAssign;
1737 return Stmt::CompoundAssignOperatorClass;
1738
1739 case OO_MinusEqual:
1740 BinaryOp = BO_SubAssign;
1741 return Stmt::CompoundAssignOperatorClass;
1742
1743 case OO_StarEqual:
1744 BinaryOp = BO_MulAssign;
1745 return Stmt::CompoundAssignOperatorClass;
1746
1747 case OO_SlashEqual:
1748 BinaryOp = BO_DivAssign;
1749 return Stmt::CompoundAssignOperatorClass;
1750
1751 case OO_PercentEqual:
1752 BinaryOp = BO_RemAssign;
1753 return Stmt::CompoundAssignOperatorClass;
1754
1755 case OO_CaretEqual:
1756 BinaryOp = BO_XorAssign;
1757 return Stmt::CompoundAssignOperatorClass;
1758
1759 case OO_AmpEqual:
1760 BinaryOp = BO_AndAssign;
1761 return Stmt::CompoundAssignOperatorClass;
1762
1763 case OO_PipeEqual:
1764 BinaryOp = BO_OrAssign;
1765 return Stmt::CompoundAssignOperatorClass;
1766
1767 case OO_LessLess:
1768 BinaryOp = BO_Shl;
1769 return Stmt::BinaryOperatorClass;
1770
1771 case OO_GreaterGreater:
1772 BinaryOp = BO_Shr;
1773 return Stmt::BinaryOperatorClass;
1774
1775 case OO_LessLessEqual:
1776 BinaryOp = BO_ShlAssign;
1777 return Stmt::CompoundAssignOperatorClass;
1778
1779 case OO_GreaterGreaterEqual:
1780 BinaryOp = BO_ShrAssign;
1781 return Stmt::CompoundAssignOperatorClass;
1782
1783 case OO_EqualEqual:
1784 BinaryOp = BO_EQ;
1785 return Stmt::BinaryOperatorClass;
1786
1787 case OO_ExclaimEqual:
1788 BinaryOp = BO_NE;
1789 return Stmt::BinaryOperatorClass;
1790
1791 case OO_LessEqual:
1792 BinaryOp = BO_LE;
1793 return Stmt::BinaryOperatorClass;
1794
1795 case OO_GreaterEqual:
1796 BinaryOp = BO_GE;
1797 return Stmt::BinaryOperatorClass;
1798
1799 case OO_Spaceship:
1800 BinaryOp = BO_Cmp;
1801 return Stmt::BinaryOperatorClass;
1802
1803 case OO_AmpAmp:
1804 BinaryOp = BO_LAnd;
1805 return Stmt::BinaryOperatorClass;
1806
1807 case OO_PipePipe:
1808 BinaryOp = BO_LOr;
1809 return Stmt::BinaryOperatorClass;
1810
1811 case OO_PlusPlus:
1812 UnaryOp = S->getNumArgs() == 1? UO_PreInc
1813 : UO_PostInc;
1814 return Stmt::UnaryOperatorClass;
1815
1816 case OO_MinusMinus:
1817 UnaryOp = S->getNumArgs() == 1? UO_PreDec
1818 : UO_PostDec;
1819 return Stmt::UnaryOperatorClass;
1820
1821 case OO_Comma:
1822 BinaryOp = BO_Comma;
1823 return Stmt::BinaryOperatorClass;
1824
1825 case OO_ArrowStar:
1826 BinaryOp = BO_PtrMemI;
1827 return Stmt::BinaryOperatorClass;
1828
1829 case OO_Subscript:
1830 return Stmt::ArraySubscriptExprClass;
1831
1832 case OO_Call:
1833 return Stmt::CallExprClass;
1834
1835 case OO_Coawait:
1836 UnaryOp = UO_Coawait;
1837 return Stmt::UnaryOperatorClass;
1838 }
1839
1840 llvm_unreachable("Invalid overloaded operator expression");
1841}
1842
1843#if defined(_MSC_VER) && !defined(__clang__)
1844#if _MSC_VER == 1911
1845// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1846// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1847// will crash in stage 2 of a bootstrap build.
1848#pragma optimize("", off)
1849#endif
1850#endif
1851
1852void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1853 if (S->isTypeDependent()) {
1854 // Type-dependent operator calls are profiled like their underlying
1855 // syntactic operator.
1856 //
1857 // An operator call to operator-> is always implicit, so just skip it. The
1858 // enclosing MemberExpr will profile the actual member access.
1859 if (S->getOperator() == OO_Arrow)
1860 return Visit(S->getArg(0));
1861
1862 UnaryOperatorKind UnaryOp = UO_Extension;
1863 BinaryOperatorKind BinaryOp = BO_Comma;
1864 Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
1865
1866 ID.AddInteger(SC);
1867 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1868 Visit(S->getArg(I));
1869 if (SC == Stmt::UnaryOperatorClass)
1870 ID.AddInteger(UnaryOp);
1871 else if (SC == Stmt::BinaryOperatorClass ||
1872 SC == Stmt::CompoundAssignOperatorClass)
1873 ID.AddInteger(BinaryOp);
1874 else
1875 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1876
1877 return;
1878 }
1879
1880 VisitCallExpr(S);
1881 ID.AddInteger(S->getOperator());
1882}
1883
1884void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1885 const CXXRewrittenBinaryOperator *S) {
1886 // If a rewritten operator were ever to be type-dependent, we should profile
1887 // it following its syntactic operator.
1888 assert(!S->isTypeDependent() &&
1889 "resolved rewritten operator should never be type-dependent");
1890 ID.AddBoolean(S->isReversed());
1891 VisitExpr(S->getSemanticForm());
1892}
1893
1894#if defined(_MSC_VER) && !defined(__clang__)
1895#if _MSC_VER == 1911
1896#pragma optimize("", on)
1897#endif
1898#endif
1899
1900void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1901 VisitCallExpr(S);
1902}
1903
1904void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1905 VisitCallExpr(S);
1906}
1907
1908void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1909 VisitExpr(S);
1910}
1911
1912void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1913 VisitExplicitCastExpr(S);
1914}
1915
1916void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1917 VisitCXXNamedCastExpr(S);
1918}
1919
1920void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1921 VisitCXXNamedCastExpr(S);
1922}
1923
1924void
1925StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1926 VisitCXXNamedCastExpr(S);
1927}
1928
1929void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1930 VisitCXXNamedCastExpr(S);
1931}
1932
1933void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1934 VisitExpr(S);
1935 VisitType(S->getTypeInfoAsWritten()->getType());
1936}
1937
1938void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1939 VisitCXXNamedCastExpr(S);
1940}
1941
1942void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1943 VisitCallExpr(S);
1944}
1945
1946void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1947 VisitExpr(S);
1948 ID.AddBoolean(S->getValue());
1949}
1950
1951void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1952 VisitExpr(S);
1953}
1954
1955void StmtProfiler::VisitCXXStdInitializerListExpr(
1956 const CXXStdInitializerListExpr *S) {
1957 VisitExpr(S);
1958}
1959
1960void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1961 VisitExpr(S);
1962 if (S->isTypeOperand())
1963 VisitType(S->getTypeOperandSourceInfo()->getType());
1964}
1965
1966void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1967 VisitExpr(S);
1968 if (S->isTypeOperand())
1969 VisitType(S->getTypeOperandSourceInfo()->getType());
1970}
1971
1972void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1973 VisitExpr(S);
1974 VisitDecl(S->getPropertyDecl());
1975}
1976
1977void StmtProfiler::VisitMSPropertySubscriptExpr(
1978 const MSPropertySubscriptExpr *S) {
1979 VisitExpr(S);
1980}
1981
1982void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1983 VisitExpr(S);
1984 ID.AddBoolean(S->isImplicit());
1985}
1986
1987void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1988 VisitExpr(S);
1989}
1990
1991void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1992 VisitExpr(S);
1993 VisitDecl(S->getParam());
1994}
1995
1996void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1997 VisitExpr(S);
1998 VisitDecl(S->getField());
1999}
2000
2001void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
2002 VisitExpr(S);
2003 VisitDecl(
2004 const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
2005}
2006
2007void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
2008 VisitExpr(S);
2009 VisitDecl(S->getConstructor());
2010 ID.AddBoolean(S->isElidable());
2011}
2012
2013void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2014 const CXXInheritedCtorInitExpr *S) {
2015 VisitExpr(S);
2016 VisitDecl(S->getConstructor());
2017}
2018
2019void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
2020 VisitExplicitCastExpr(S);
2021}
2022
2023void
2024StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
2025 VisitCXXConstructExpr(S);
2026}
2027
2028void
2029StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
2030 // Do not recursively visit the children of this expression. Profiling the
2031 // body would result in unnecessary work, and is not safe to do during
2032 // deserialization.
2033 VisitStmtNoChildren(S);
2034
2035 // C++20 [temp.over.link]p5:
2036 // Two lambda-expressions are never considered equivalent.
2037 VisitDecl(S->getLambdaClass());
2038}
2039
2040void
2041StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
2042 VisitExpr(S);
2043}
2044
2045void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
2046 VisitExpr(S);
2047 ID.AddBoolean(S->isGlobalDelete());
2048 ID.AddBoolean(S->isArrayForm());
2049 VisitDecl(S->getOperatorDelete());
2050}
2051
2052void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
2053 VisitExpr(S);
2054 VisitType(S->getAllocatedType());
2055 VisitDecl(S->getOperatorNew());
2056 VisitDecl(S->getOperatorDelete());
2057 ID.AddBoolean(S->isArray());
2058 ID.AddInteger(S->getNumPlacementArgs());
2059 ID.AddBoolean(S->isGlobalNew());
2060 ID.AddBoolean(S->isParenTypeId());
2061 ID.AddInteger(S->getInitializationStyle());
2062}
2063
2064void
2065StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
2066 VisitExpr(S);
2067 ID.AddBoolean(S->isArrow());
2068 VisitNestedNameSpecifier(S->getQualifier());
2069 ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
2070 if (S->getScopeTypeInfo())
2071 VisitType(S->getScopeTypeInfo()->getType());
2072 ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
2073 if (S->getDestroyedTypeInfo())
2074 VisitType(S->getDestroyedType());
2075 else
2076 VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
2077}
2078
2079void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
2080 VisitExpr(S);
2081 VisitNestedNameSpecifier(S->getQualifier());
2082 VisitName(S->getName(), /*TreatAsDecl*/ true);
2083 ID.AddBoolean(S->hasExplicitTemplateArgs());
2084 if (S->hasExplicitTemplateArgs())
2085 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2086}
2087
2088void
2089StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
2090 VisitOverloadExpr(S);
2091}
2092
2093void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2094 VisitExpr(S);
2095 ID.AddInteger(S->getTrait());
2096 ID.AddInteger(S->getNumArgs());
2097 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2098 VisitType(S->getArg(I)->getType());
2099}
2100
2101void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2102 VisitExpr(S);
2103 ID.AddInteger(S->getTrait());
2104 VisitType(S->getQueriedType());
2105}
2106
2107void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2108 VisitExpr(S);
2109 ID.AddInteger(S->getTrait());
2110 VisitExpr(S->getQueriedExpression());
2111}
2112
2113void StmtProfiler::VisitDependentScopeDeclRefExpr(
2114 const DependentScopeDeclRefExpr *S) {
2115 VisitExpr(S);
2116 VisitName(S->getDeclName());
2117 VisitNestedNameSpecifier(S->getQualifier());
2118 ID.AddBoolean(S->hasExplicitTemplateArgs());
2119 if (S->hasExplicitTemplateArgs())
2120 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2121}
2122
2123void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2124 VisitExpr(S);
2125}
2126
2127void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2128 const CXXUnresolvedConstructExpr *S) {
2129 VisitExpr(S);
2130 VisitType(S->getTypeAsWritten());
2131 ID.AddInteger(S->isListInitialization());
2132}
2133
2134void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2135 const CXXDependentScopeMemberExpr *S) {
2136 ID.AddBoolean(S->isImplicitAccess());
2137 if (!S->isImplicitAccess()) {
2138 VisitExpr(S);
2139 ID.AddBoolean(S->isArrow());
2140 }
2141 VisitNestedNameSpecifier(S->getQualifier());
2142 VisitName(S->getMember());
2143 ID.AddBoolean(S->hasExplicitTemplateArgs());
2144 if (S->hasExplicitTemplateArgs())
2145 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2146}
2147
2148void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2149 ID.AddBoolean(S->isImplicitAccess());
2150 if (!S->isImplicitAccess()) {
2151 VisitExpr(S);
2152 ID.AddBoolean(S->isArrow());
2153 }
2154 VisitNestedNameSpecifier(S->getQualifier());
2155 VisitName(S->getMemberName());
2156 ID.AddBoolean(S->hasExplicitTemplateArgs());
2157 if (S->hasExplicitTemplateArgs())
2158 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2159}
2160
2161void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2162 VisitExpr(S);
2163}
2164
2165void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2166 VisitExpr(S);
2167}
2168
2169void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2170 VisitExpr(S);
2171 VisitDecl(S->getPack());
2172 if (S->isPartiallySubstituted()) {
2173 auto Args = S->getPartialArguments();
2174 ID.AddInteger(Args.size());
2175 for (const auto &TA : Args)
2176 VisitTemplateArgument(TA);
2177 } else {
2178 ID.AddInteger(0);
2179 }
2180}
2181
2182void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2184 VisitExpr(S);
2185 VisitDecl(S->getParameterPack());
2186 VisitTemplateArgument(S->getArgumentPack());
2187}
2188
2189void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2191 // Profile exactly as the replacement expression.
2192 Visit(E->getReplacement());
2193}
2194
2195void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2196 VisitExpr(S);
2197 VisitDecl(S->getParameterPack());
2198 ID.AddInteger(S->getNumExpansions());
2199 for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
2200 VisitDecl(*I);
2201}
2202
2203void StmtProfiler::VisitMaterializeTemporaryExpr(
2204 const MaterializeTemporaryExpr *S) {
2205 VisitExpr(S);
2206}
2207
2208void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2209 VisitExpr(S);
2210 ID.AddInteger(S->getOperator());
2211}
2212
2213void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) {
2214 VisitExpr(S);
2215}
2216
2217void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2218 VisitStmt(S);
2219}
2220
2221void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2222 VisitStmt(S);
2223}
2224
2225void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2226 VisitExpr(S);
2227}
2228
2229void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2230 VisitExpr(S);
2231}
2232
2233void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2234 VisitExpr(S);
2235}
2236
2237void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2238 VisitExpr(E);
2239}
2240
2241void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2242 VisitExpr(E);
2243}
2244
2245void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2246 VisitExpr(E);
2247}
2248
2249void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2250
2251void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2252 VisitExpr(S);
2253}
2254
2255void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2256 VisitExpr(E);
2257}
2258
2259void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2260 VisitExpr(E);
2261}
2262
2263void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2264 VisitExpr(E);
2265}
2266
2267void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2268 VisitExpr(S);
2269 VisitType(S->getEncodedType());
2270}
2271
2272void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2273 VisitExpr(S);
2274 VisitName(S->getSelector());
2275}
2276
2277void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2278 VisitExpr(S);
2279 VisitDecl(S->getProtocol());
2280}
2281
2282void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2283 VisitExpr(S);
2284 VisitDecl(S->getDecl());
2285 ID.AddBoolean(S->isArrow());
2286 ID.AddBoolean(S->isFreeIvar());
2287}
2288
2289void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2290 VisitExpr(S);
2291 if (S->isImplicitProperty()) {
2292 VisitDecl(S->getImplicitPropertyGetter());
2293 VisitDecl(S->getImplicitPropertySetter());
2294 } else {
2295 VisitDecl(S->getExplicitProperty());
2296 }
2297 if (S->isSuperReceiver()) {
2298 ID.AddBoolean(S->isSuperReceiver());
2299 VisitType(S->getSuperReceiverType());
2300 }
2301}
2302
2303void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2304 VisitExpr(S);
2305 VisitDecl(S->getAtIndexMethodDecl());
2306 VisitDecl(S->setAtIndexMethodDecl());
2307}
2308
2309void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2310 VisitExpr(S);
2311 VisitName(S->getSelector());
2312 VisitDecl(S->getMethodDecl());
2313}
2314
2315void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2316 VisitExpr(S);
2317 ID.AddBoolean(S->isArrow());
2318}
2319
2320void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2321 VisitExpr(S);
2322 ID.AddBoolean(S->getValue());
2323}
2324
2325void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2326 const ObjCIndirectCopyRestoreExpr *S) {
2327 VisitExpr(S);
2328 ID.AddBoolean(S->shouldCopy());
2329}
2330
2331void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2332 VisitExplicitCastExpr(S);
2333 ID.AddBoolean(S->getBridgeKind());
2334}
2335
2336void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2337 const ObjCAvailabilityCheckExpr *S) {
2338 VisitExpr(S);
2339}
2340
2341void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2342 unsigned NumArgs) {
2343 ID.AddInteger(NumArgs);
2344 for (unsigned I = 0; I != NumArgs; ++I)
2345 VisitTemplateArgument(Args[I].getArgument());
2346}
2347
2348void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2349 // Mostly repetitive with TemplateArgument::Profile!
2350 ID.AddInteger(Arg.getKind());
2351 switch (Arg.getKind()) {
2353 break;
2354
2356 VisitType(Arg.getAsType());
2357 break;
2358
2361 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2362 break;
2363
2365 VisitType(Arg.getParamTypeForDecl());
2366 // FIXME: Do we need to recursively decompose template parameter objects?
2367 VisitDecl(Arg.getAsDecl());
2368 break;
2369
2371 VisitType(Arg.getNullPtrType());
2372 break;
2373
2375 VisitType(Arg.getIntegralType());
2376 Arg.getAsIntegral().Profile(ID);
2377 break;
2378
2380 Visit(Arg.getAsExpr());
2381 break;
2382
2384 for (const auto &P : Arg.pack_elements())
2385 VisitTemplateArgument(P);
2386 break;
2387 }
2388}
2389
2390void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2391 bool Canonical) const {
2392 StmtProfilerWithPointers Profiler(ID, Context, Canonical);
2393 Profiler.Visit(this);
2394}
2395
2396void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2397 class ODRHash &Hash) const {
2398 StmtProfilerWithoutPointers Profiler(ID, Hash);
2399 Profiler.Visit(this);
2400}
Defines the clang::ASTContext interface.
DynTypedNode Node
StringRef P
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
This file defines OpenMP AST classes for clauses.
static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, UnaryOperatorKind &UnaryOp, BinaryOperatorKind &BinaryOp)
static const TemplateArgument & getArgument(const TemplateArgument &A)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2524
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4317
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5531
Represents a loop initializing the elements of an array.
Definition: Expr.h:5478
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2661
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2827
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6086
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6289
Represents an attribute applied to a statement.
Definition: Stmt.h:1896
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4220
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3819
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6025
BreakStmt - This represents a break.
Definition: Stmt.h:2796
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5115
This class is used for builtin types like 'int'.
Definition: Type.h:2647
Kind getKind() const
Definition: Type.h:2685
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3750
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:231
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1470
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:563
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1518
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1249
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1356
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2473
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3629
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2755
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4676
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1787
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1709
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:176
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2199
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4072
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4798
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2592
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2151
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1855
Represents the this expression in C++.
Definition: ExprCXX.h:1148
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1187
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:845
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3503
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1062
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2817
This captures a statement into a function.
Definition: Stmt.h:3573
CaseStmt - Represent a case statement.
Definition: Stmt.h:1617
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3487
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4537
Represents a 'co_await' expression.
Definition: ExprCXX.h:5008
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4067
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3417
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1424
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:41
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4158
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:194
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1044
ContinueStmt - This represents a continue.
Definition: Stmt.h:2766
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4478
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:462
Represents the body of a coroutine.
Definition: StmtCXX.h:320
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5089
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1237
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1315
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:946
Kind getKind() const
Definition: DeclBase.h:435
The name of a declaration.
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5040
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3269
Represents a single C99 designator.
Definition: Expr.h:5102
Represents a C99 designated initializer expression.
Definition: Expr.h:5060
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2541
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3709
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3420
This represents one expression.
Definition: Expr.h:110
An expression trait intrinsic.
Definition: ExprCXX.h:2897
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5965
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2597
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4484
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4518
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3075
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4612
Represents a C11 generic selection.
Definition: Expr.h:5686
AssociationTy< true > ConstAssociation
Definition: Expr.h:5841
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2678
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1954
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1728
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3634
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5567
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2717
Describes an C or C++ initializer list.
Definition: Expr.h:4815
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1847
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1924
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3298
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:929
MS property subscript expression.
Definition: ExprCXX.h:1000
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4564
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2739
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3180
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5387
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1387
void AddDecl(const Decl *D)
Definition: ODRHash.cpp:785
void AddIdentifierInfo(const IdentifierInfo *II)
Definition: ODRHash.cpp:29
void AddDeclarationName(DeclarationName Name, bool TreatAsDecl=false)
Definition: ODRHash.cpp:34
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS)
Definition: ODRHash.cpp:112
void AddTemplateName(TemplateName Name)
Definition: ODRHash.cpp:141
void AddQualType(QualType T)
Definition: ODRHash.cpp:1279
This represents 'acq_rel' clause in the '#pragma omp atomic|flush' directives.
This represents 'acquire' clause in the '#pragma omp atomic|flush' directives.
This represents clause 'affinity' in the '#pragma omp task'-based directives.
This represents the 'align' clause in the '#pragma omp allocate' directive.
Definition: OpenMPClause.h:388
This represents clause 'aligned' in the '#pragma omp ...' directives.
This represents clause 'allocate' in the '#pragma omp ...' directives.
Definition: OpenMPClause.h:432
This represents 'allocator' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:354
OpenMP 5.0 [2.1.5, Array Sections].
Definition: ExprOpenMP.h:56
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:148
This represents 'at' clause in the '#pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2895
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2573
This represents 'bind' clause in the '#pragma omp ...' directives.
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3600
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3542
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
This represents 'capture' clause in the '#pragma omp atomic' directive.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Definition: OpenMPClause.h:233
Class that handles pre-initialization statement for some clauses, like 'shedule', 'firstprivate' etc.
Definition: OpenMPClause.h:195
This represents 'collapse' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:977
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents clause 'copyin' in the '#pragma omp ...' directives.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:2024
This represents 'default' clause in the '#pragma omp ...' directive.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2789
This represents 'destroy' clause in the '#pragma omp depobj' directive or the '#pragma omp interop' d...
This represents 'detach' clause in the '#pragma omp task' directive.
This represents 'device' clause in the '#pragma omp ...' directive.
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5755
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4370
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4492
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4588
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4653
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents '#pragma omp error' directive.
Definition: StmtOpenMP.h:6230
This represents clause 'exclusive' in the '#pragma omp scan' directive.
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
This represents 'filter' clause in the '#pragma omp ...' directive.
This represents 'final' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:630
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2737
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1633
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1723
This represents clause 'from' in the '#pragma omp ...' directives.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
Definition: OpenMPClause.h:879
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:5910
This represents 'grainsize' clause in the '#pragma omp ...' directive.
This represents clause 'has_device_ptr' in the '#pragma omp ...' directives.
This represents 'hint' clause in the '#pragma omp ...' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:527
This represents clause 'in_reduction' in the '#pragma omp task' directives.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
This represents the 'init' clause in '#pragma omp ...' directives.
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5702
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:275
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
This represents clause 'linear' in the '#pragma omp ...' directives.
The base class for all loop-based directives, including loop transformation directives.
Definition: StmtOpenMP.h:683
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Definition: StmtOpenMP.h:1003
The base class for all loop transformation directives.
Definition: StmtOpenMP.h:960
This represents clause 'map' in the '#pragma omp ...' directives.
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:5820
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3875
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4016
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:1976
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3799
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:3951
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents 'message' clause in the '#pragma omp error' directive.
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:5871
This represents 'nocontext' clause in the '#pragma omp ...' directive.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
This represents 'novariants' clause in the '#pragma omp ...' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:676
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:2841
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:612
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:2095
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:2192
This represents '#pragma omp parallel loop' directive.
Definition: StmtOpenMP.h:6103
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2320
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4160
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4305
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2257
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4082
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4238
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:2384
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
Definition: OpenMPClause.h:907
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents clause 'private' in the '#pragma omp ...' directives.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
This represents clause 'reduction' in the '#pragma omp ...' directives.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:721
This represents '#pragma omp scan' directive.
Definition: StmtOpenMP.h:5649
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:1863
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:1786
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:1570
This represents 'simdlen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:756
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1925
This represents the 'sizes' clause in the '#pragma omp tile' directive.
Definition: OpenMPClause.h:788
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:3151
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3097
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3205
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3260
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3314
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3394
This represents '#pragma omp target parallel for simd' directive.
Definition: StmtOpenMP.h:4719
This represents '#pragma omp target parallel loop' directive.
Definition: StmtOpenMP.h:6168
This represents '#pragma omp target simd' directive.
Definition: StmtOpenMP.h:4786
This represents '#pragma omp target teams' directive.
Definition: StmtOpenMP.h:5144
This represents '#pragma omp target teams distribute' combined directive.
Definition: StmtOpenMP.h:5200
This represents '#pragma omp target teams distribute parallel for' combined directive.
Definition: StmtOpenMP.h:5267
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
Definition: StmtOpenMP.h:5365
This represents '#pragma omp target teams distribute simd' combined directive.
Definition: StmtOpenMP.h:5435
This represents '#pragma omp target teams loop' directive.
Definition: StmtOpenMP.h:6037
This represents '#pragma omp target update' directive.
Definition: StmtOpenMP.h:4436
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:2465
This represents '#pragma omp taskloop' directive.
Definition: StmtOpenMP.h:3660
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:3733
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:2670
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:2619
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:2527
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:3489
This represents '#pragma omp teams distribute' directive.
Definition: StmtOpenMP.h:4851
This represents '#pragma omp teams distribute parallel for' composite directive.
Definition: StmtOpenMP.h:5051
This represents '#pragma omp teams distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4985
This represents '#pragma omp teams distribute simd' combined directive.
Definition: StmtOpenMP.h:4917
This represents '#pragma omp teams loop' directive.
Definition: StmtOpenMP.h:5972
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
This represents 'threads' clause in the '#pragma omp ...' directive.
This represents the '#pragma omp tile' loop transformation directive.
Definition: StmtOpenMP.h:5493
This represents clause 'to' in the '#pragma omp ...' directives.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents the '#pragma omp unroll' loop transformation directive.
Definition: StmtOpenMP.h:5575
This represents 'untied' clause in the '#pragma omp ...' directive.
This represents 'update' clause in the '#pragma omp atomic' directive.
This represents the 'use' clause in '#pragma omp ...' directives.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
This represents clause 'uses_allocators' in the '#pragma omp target'-based directives.
This represents 'write' clause in the '#pragma omp atomic' directive.
This represents 'ompx_dyn_cgroup_mem' clause in the '#pragma omp target ...' directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition: ExprObjC.h:191
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:77
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:127
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:302
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:357
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:167
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:393
A runtime availability query.
Definition: ExprObjC.h:1685
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition: ExprObjC.h:1626
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:309
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
Represents Objective-C's collection statement.
Definition: StmtObjC.h:23
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1565
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1481
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:942
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:504
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2462
Helper class for OffsetOfExpr.
Definition: Expr.h:2356
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2420
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1673
@ Array
An index into an array.
Definition: Expr.h:2361
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2365
@ Field
A field.
Definition: Expr.h:2363
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2368
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2410
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1145
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition: ExprCXX.h:2954
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4126
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2128
Represents a parameter to a function.
Definition: Decl.h:1722
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1971
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6157
const Expr *const * const_semantics_iterator
Definition: Expr.h:6222
A (possibly-)qualified type.
Definition: Type.h:736
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:803
void * getAsOpaquePtr() const
Definition: Type.h:783
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:6477
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:480
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:2835
Represents a __leave statement.
Definition: Stmt.h:3534
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4410
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4204
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4696
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4362
Stmt - This represents one statement.
Definition: Stmt.h:72
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
StmtClass
Definition: Stmt.h:74
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1780
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4320
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4405
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2204
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:484
Represents a template argument.
Definition: TemplateBase.h:60
QualType getParamTypeForDecl() const
Definition: TemplateBase.h:299
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:368
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:287
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:331
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:305
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:345
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:294
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:392
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
Definition: TemplateBase.h:73
@ Template
The template argument is a template name that was provided for a template template parameter.
Definition: TemplateBase.h:85
@ Pack
The template argument is actually a parameter pack.
Definition: TemplateBase.h:99
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:89
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:77
@ Type
The template argument is a type.
Definition: TemplateBase.h:69
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:66
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:81
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
Definition: TemplateBase.h:95
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:263
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Definition: TemplateBase.h:318
Represents a C++ template name within the type system.
Definition: TemplateName.h:202
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:198
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2742
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6422
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2565
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2181
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3151
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3889
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition: ExprCXX.h:637
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4646
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2400
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:148
@ OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
@ NUM_OVERLOADED_OPERATORS
Definition: OperatorKinds.h:26
BinaryOperatorKind
@ C
Languages that the frontend can parse and compile.
UnaryOperatorKind
#define false
Definition: stdbool.h:22
Data for list of allocators.
Expr * AllocatorTraits
Allocator traits.