clang: lib/AST/StmtProfile.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
24#include "llvm/ADT/FoldingSet.h"
25using namespace clang;
26
27namespace {
29 protected:
30 llvm::FoldingSetNodeID &ID;
31 bool Canonical;
32 bool ProfileLambdaExpr;
33
34 public:
35 StmtProfiler(llvm::FoldingSetNodeID &ID, bool Canonical,
36 bool ProfileLambdaExpr)
37 : ID(ID), Canonical(Canonical), ProfileLambdaExpr(ProfileLambdaExpr) {}
38
39 virtual ~StmtProfiler() {}
40
41 void VisitStmt(const Stmt *S);
42
43 void VisitStmtNoChildren(const Stmt *S) {
44 HandleStmtClass(S->getStmtClass());
45 }
46
48
49#define STMT(Node, Base) void Visit##Node(const Node *S);
50#include "clang/AST/StmtNodes.inc"
51
52
53
54 virtual void VisitDecl(const Decl *D) = 0;
55
56
57
58 virtual void VisitType(QualType T) = 0;
59
60
61 virtual void VisitName(DeclarationName Name, bool TreatAsDecl = false) = 0;
62
63
64 virtual void VisitIdentifierInfo(const IdentifierInfo *II) = 0;
65
66
67
69
70
71
72 virtual void VisitTemplateName(TemplateName Name) = 0;
73
74
75
77 unsigned NumArgs);
78
79
81 };
82
83 class StmtProfilerWithPointers : public StmtProfiler {
85
86 public:
87 StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
88 const ASTContext &Context, bool Canonical,
89 bool ProfileLambdaExpr)
90 : StmtProfiler(ID, Canonical, ProfileLambdaExpr), Context(Context) {}
91
92 private:
94 ID.AddInteger(SC);
95 }
96
97 void VisitDecl(const Decl *D) override {
99
100 if (Canonical && D) {
102 dyn_cast(D)) {
103 ID.AddInteger(NTTP->getDepth());
104 ID.AddInteger(NTTP->getIndex());
105 ID.AddBoolean(NTTP->isParameterPack());
106
107
108
109
110
111
112
113
115 return;
116 }
117
118 if (const ParmVarDecl *Parm = dyn_cast(D)) {
119
120
121
122
123
124
125
126
127
128
129 VisitType(Parm->getType());
130 ID.AddInteger(Parm->getFunctionScopeDepth());
131 ID.AddInteger(Parm->getFunctionScopeIndex());
132 return;
133 }
134
136 dyn_cast(D)) {
137 ID.AddInteger(TTP->getDepth());
138 ID.AddInteger(TTP->getIndex());
139 ID.AddBoolean(TTP->isParameterPack());
140 return;
141 }
142
144 dyn_cast(D)) {
145 ID.AddInteger(TTP->getDepth());
146 ID.AddInteger(TTP->getIndex());
147 ID.AddBoolean(TTP->isParameterPack());
148 return;
149 }
150 }
151
153 }
154
155 void VisitType(QualType T) override {
156 if (Canonical && .isNull())
158
159 ID.AddPointer(T.getAsOpaquePtr());
160 }
161
162 void VisitName(DeclarationName Name, bool ) override {
163 ID.AddPointer(Name.getAsOpaquePtr());
164 }
165
166 void VisitIdentifierInfo(const IdentifierInfo *II) override {
167 ID.AddPointer(II);
168 }
169
171 if (Canonical)
173 ID.AddPointer(NNS);
174 }
175
176 void VisitTemplateName(TemplateName Name) override {
177 if (Canonical)
179
180 Name.Profile(ID);
181 }
182 };
183
184 class StmtProfilerWithoutPointers : public StmtProfiler {
186 public:
187 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
188 : StmtProfiler(ID, false, false),
189 Hash(Hash) {}
190
191 private:
193 if (SC == Stmt::UnresolvedLookupExprClass) {
194
195
196 ID.AddInteger(Stmt::DeclRefExprClass);
197 } else {
198 ID.AddInteger(SC);
199 }
200 }
201
202 void VisitType(QualType T) override {
204 }
205
206 void VisitName(DeclarationName Name, bool TreatAsDecl) override {
207 if (TreatAsDecl) {
208
209
210 ID.AddBoolean(true);
211 }
213 }
214 void VisitIdentifierInfo(const IdentifierInfo *II) override {
215 ID.AddBoolean(II);
216 if (II) {
218 }
219 }
220 void VisitDecl(const Decl *D) override {
222 if (D) {
224 }
225 }
226 void VisitTemplateName(TemplateName Name) override {
228 }
230 ID.AddBoolean(NNS);
231 if (NNS) {
233 }
234 }
235 };
236}
237
238void StmtProfiler::VisitStmt(const Stmt *S) {
239 assert(S && "Requires non-null Stmt pointer");
240
241 VisitStmtNoChildren(S);
242
243 for (const Stmt *SubStmt : S->children()) {
244 if (SubStmt)
245 Visit(SubStmt);
246 else
247 ID.AddInteger(0);
248 }
249}
250
251void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
252 VisitStmt(S);
253 for (const auto *D : S->decls())
254 VisitDecl(D);
255}
256
257void StmtProfiler::VisitNullStmt(const NullStmt *S) {
258 VisitStmt(S);
259}
260
261void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
262 VisitStmt(S);
263}
264
265void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
266 VisitStmt(S);
267}
268
269void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
270 VisitStmt(S);
271}
272
273void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
274 VisitStmt(S);
275 VisitDecl(S->getDecl());
276}
277
278void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
279 VisitStmt(S);
280
281}
282
283void StmtProfiler::VisitIfStmt(const IfStmt *S) {
284 VisitStmt(S);
285 VisitDecl(S->getConditionVariable());
286}
287
288void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
289 VisitStmt(S);
290 VisitDecl(S->getConditionVariable());
291}
292
293void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
294 VisitStmt(S);
295 VisitDecl(S->getConditionVariable());
296}
297
298void StmtProfiler::VisitDoStmt(const DoStmt *S) {
299 VisitStmt(S);
300}
301
302void StmtProfiler::VisitForStmt(const ForStmt *S) {
303 VisitStmt(S);
304}
305
306void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
307 VisitStmt(S);
308 VisitDecl(S->getLabel());
309}
310
311void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
312 VisitStmt(S);
313}
314
315void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
316 VisitStmt(S);
317}
318
319void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
320 VisitStmt(S);
321}
322
323void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
324 VisitStmt(S);
325}
326
327void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
328 VisitStmt(S);
329 ID.AddBoolean(S->isVolatile());
330 ID.AddBoolean(S->isSimple());
331 VisitStringLiteral(S->getAsmString());
332 ID.AddInteger(S->getNumOutputs());
333 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
334 ID.AddString(S->getOutputName(I));
335 VisitStringLiteral(S->getOutputConstraintLiteral(I));
336 }
337 ID.AddInteger(S->getNumInputs());
338 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
339 ID.AddString(S->getInputName(I));
340 VisitStringLiteral(S->getInputConstraintLiteral(I));
341 }
342 ID.AddInteger(S->getNumClobbers());
343 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
344 VisitStringLiteral(S->getClobberStringLiteral(I));
345 ID.AddInteger(S->getNumLabels());
346 for (auto *L : S->labels())
347 VisitDecl(L->getLabel());
348}
349
350void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
351
352 VisitStmt(S);
353}
354
355void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
356 VisitStmt(S);
357 VisitType(S->getCaughtType());
358}
359
360void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
361 VisitStmt(S);
362}
363
364void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
365 VisitStmt(S);
366}
367
369 VisitStmt(S);
370 ID.AddBoolean(S->isIfExists());
371 VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
372 VisitName(S->getNameInfo().getName());
373}
374
375void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
376 VisitStmt(S);
377}
378
379void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
380 VisitStmt(S);
381}
382
383void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
384 VisitStmt(S);
385}
386
387void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
388 VisitStmt(S);
389}
390
391void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
392 VisitStmt(S);
393}
394
396 VisitStmt(S);
397}
398
399void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
400 VisitStmt(S);
401 ID.AddBoolean(S->hasEllipsis());
402 if (S->getCatchParamDecl())
403 VisitType(S->getCatchParamDecl()->getType());
404}
405
406void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
407 VisitStmt(S);
408}
409
410void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
411 VisitStmt(S);
412}
413
414void
416 VisitStmt(S);
417}
418
419void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
420 VisitStmt(S);
421}
422
423void
425 VisitStmt(S);
426}
427
428namespace {
430 StmtProfiler *Profiler;
431
432 template
433 void VisitOMPClauseList(T *Node);
434
435public:
436 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
437#define GEN_CLANG_CLAUSE_CLASS
438#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
439#include "llvm/Frontend/OpenMP/OMP.inc"
442};
443
444void OMPClauseProfiler::VistOMPClauseWithPreInit(
446 if (auto *S = C->getPreInitStmt())
447 Profiler->VisitStmt(S);
448}
449
450void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
452 VistOMPClauseWithPreInit(C);
453 if (auto *E = C->getPostUpdateExpr())
454 Profiler->VisitStmt(E);
455}
456
457void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
458 VistOMPClauseWithPreInit(C);
459 if (C->getCondition())
460 Profiler->VisitStmt(C->getCondition());
461}
462
463void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
464 VistOMPClauseWithPreInit(C);
465 if (C->getCondition())
466 Profiler->VisitStmt(C->getCondition());
467}
468
469void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
470 VistOMPClauseWithPreInit(C);
471 if (C->getNumThreads())
472 Profiler->VisitStmt(C->getNumThreads());
473}
474
475void OMPClauseProfiler::VisitOMPAlignClause(const OMPAlignClause *C) {
476 if (C->getAlignment())
477 Profiler->VisitStmt(C->getAlignment());
478}
479
480void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
481 if (C->getSafelen())
482 Profiler->VisitStmt(C->getSafelen());
483}
484
485void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) {
486 if (C->getSimdlen())
487 Profiler->VisitStmt(C->getSimdlen());
488}
489
490void OMPClauseProfiler::VisitOMPSizesClause(const OMPSizesClause *C) {
491 for (auto *E : C->getSizesRefs())
492 if (E)
493 Profiler->VisitExpr(E);
494}
495
496void OMPClauseProfiler::VisitOMPPermutationClause(
498 for (Expr *E : C->getArgsRefs())
499 if (E)
500 Profiler->VisitExpr(E);
501}
502
503void OMPClauseProfiler::VisitOMPFullClause(const OMPFullClause *C) {}
504
505void OMPClauseProfiler::VisitOMPPartialClause(const OMPPartialClause *C) {
506 if (const Expr *Factor = C->getFactor())
507 Profiler->VisitExpr(Factor);
508}
509
510void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) {
511 if (C->getAllocator())
512 Profiler->VisitStmt(C->getAllocator());
513}
514
515void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
516 if (C->getNumForLoops())
517 Profiler->VisitStmt(C->getNumForLoops());
518}
519
520void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) {
521 if (Expr *Evt = C->getEventHandler())
522 Profiler->VisitStmt(Evt);
523}
524
525void OMPClauseProfiler::VisitOMPNovariantsClause(const OMPNovariantsClause *C) {
526 VistOMPClauseWithPreInit(C);
527 if (C->getCondition())
528 Profiler->VisitStmt(C->getCondition());
529}
530
531void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) {
532 VistOMPClauseWithPreInit(C);
533 if (C->getCondition())
534 Profiler->VisitStmt(C->getCondition());
535}
536
537void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
538
539void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
540
541void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
543
544void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
546
547void OMPClauseProfiler::VisitOMPReverseOffloadClause(
549
550void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
552
553void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
555
556void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {}
557
558void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {}
559
560void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) {
561 if (C->getMessageString())
562 Profiler->VisitStmt(C->getMessageString());
563}
564
565void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
566 VistOMPClauseWithPreInit(C);
567 if (auto *S = C->getChunkSize())
568 Profiler->VisitStmt(S);
569}
570
571void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
572 if (auto *Num = C->getNumForLoops())
573 Profiler->VisitStmt(Num);
574}
575
576void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
577
578void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
579
580void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
581
582void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
583
584void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
585
586void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
587
588void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
589
590void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
591
592void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {}
593
594void OMPClauseProfiler::VisitOMPAbsentClause(const OMPAbsentClause *) {}
595
596void OMPClauseProfiler::VisitOMPHoldsClause(const OMPHoldsClause *) {}
597
598void OMPClauseProfiler::VisitOMPContainsClause(const OMPContainsClause *) {}
599
600void OMPClauseProfiler::VisitOMPNoOpenMPClause(const OMPNoOpenMPClause *) {}
601
602void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
604
605void OMPClauseProfiler::VisitOMPNoParallelismClause(
607
608void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
609
610void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
611
612void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
613
614void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
615
616void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {}
617
618void OMPClauseProfiler::VisitOMPWeakClause(const OMPWeakClause *) {}
619
620void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
621
622void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
623
624void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
625
626void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) {
627 VisitOMPClauseList(C);
628}
629
630void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) {
631 if (C->getInteropVar())
632 Profiler->VisitStmt(C->getInteropVar());
633}
634
635void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) {
636 if (C->getInteropVar())
637 Profiler->VisitStmt(C->getInteropVar());
638}
639
640void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) {
641 VistOMPClauseWithPreInit(C);
642 if (C->getThreadID())
643 Profiler->VisitStmt(C->getThreadID());
644}
645
646template
647void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
648 for (auto *E : Node->varlist()) {
649 if (E)
650 Profiler->VisitStmt(E);
651 }
652}
653
654void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
655 VisitOMPClauseList(C);
656 for (auto *E : C->private_copies()) {
657 if (E)
658 Profiler->VisitStmt(E);
659 }
660}
661void
663 VisitOMPClauseList(C);
664 VistOMPClauseWithPreInit(C);
665 for (auto *E : C->private_copies()) {
666 if (E)
667 Profiler->VisitStmt(E);
668 }
669 for (auto *E : C->inits()) {
670 if (E)
671 Profiler->VisitStmt(E);
672 }
673}
674void
676 VisitOMPClauseList(C);
677 VistOMPClauseWithPostUpdate(C);
678 for (auto *E : C->source_exprs()) {
679 if (E)
680 Profiler->VisitStmt(E);
681 }
682 for (auto *E : C->destination_exprs()) {
683 if (E)
684 Profiler->VisitStmt(E);
685 }
686 for (auto *E : C->assignment_ops()) {
687 if (E)
688 Profiler->VisitStmt(E);
689 }
690}
691void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
692 VisitOMPClauseList(C);
693}
694void OMPClauseProfiler::VisitOMPReductionClause(
696 Profiler->VisitNestedNameSpecifier(
697 C->getQualifierLoc().getNestedNameSpecifier());
698 Profiler->VisitName(C->getNameInfo().getName());
699 VisitOMPClauseList(C);
700 VistOMPClauseWithPostUpdate(C);
701 for (auto *E : C->privates()) {
702 if (E)
703 Profiler->VisitStmt(E);
704 }
705 for (auto *E : C->lhs_exprs()) {
706 if (E)
707 Profiler->VisitStmt(E);
708 }
709 for (auto *E : C->rhs_exprs()) {
710 if (E)
711 Profiler->VisitStmt(E);
712 }
713 for (auto *E : C->reduction_ops()) {
714 if (E)
715 Profiler->VisitStmt(E);
716 }
717 if (C->getModifier() == clang::OMPC_REDUCTION_inscan) {
718 for (auto *E : C->copy_ops()) {
719 if (E)
720 Profiler->VisitStmt(E);
721 }
722 for (auto *E : C->copy_array_temps()) {
723 if (E)
724 Profiler->VisitStmt(E);
725 }
726 for (auto *E : C->copy_array_elems()) {
727 if (E)
728 Profiler->VisitStmt(E);
729 }
730 }
731}
732void OMPClauseProfiler::VisitOMPTaskReductionClause(
734 Profiler->VisitNestedNameSpecifier(
735 C->getQualifierLoc().getNestedNameSpecifier());
736 Profiler->VisitName(C->getNameInfo().getName());
737 VisitOMPClauseList(C);
738 VistOMPClauseWithPostUpdate(C);
739 for (auto *E : C->privates()) {
740 if (E)
741 Profiler->VisitStmt(E);
742 }
743 for (auto *E : C->lhs_exprs()) {
744 if (E)
745 Profiler->VisitStmt(E);
746 }
747 for (auto *E : C->rhs_exprs()) {
748 if (E)
749 Profiler->VisitStmt(E);
750 }
751 for (auto *E : C->reduction_ops()) {
752 if (E)
753 Profiler->VisitStmt(E);
754 }
755}
756void OMPClauseProfiler::VisitOMPInReductionClause(
758 Profiler->VisitNestedNameSpecifier(
759 C->getQualifierLoc().getNestedNameSpecifier());
760 Profiler->VisitName(C->getNameInfo().getName());
761 VisitOMPClauseList(C);
762 VistOMPClauseWithPostUpdate(C);
763 for (auto *E : C->privates()) {
764 if (E)
765 Profiler->VisitStmt(E);
766 }
767 for (auto *E : C->lhs_exprs()) {
768 if (E)
769 Profiler->VisitStmt(E);
770 }
771 for (auto *E : C->rhs_exprs()) {
772 if (E)
773 Profiler->VisitStmt(E);
774 }
775 for (auto *E : C->reduction_ops()) {
776 if (E)
777 Profiler->VisitStmt(E);
778 }
779 for (auto *E : C->taskgroup_descriptors()) {
780 if (E)
781 Profiler->VisitStmt(E);
782 }
783}
784void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
785 VisitOMPClauseList(C);
786 VistOMPClauseWithPostUpdate(C);
787 for (auto *E : C->privates()) {
788 if (E)
789 Profiler->VisitStmt(E);
790 }
791 for (auto *E : C->inits()) {
792 if (E)
793 Profiler->VisitStmt(E);
794 }
795 for (auto *E : C->updates()) {
796 if (E)
797 Profiler->VisitStmt(E);
798 }
799 for (auto *E : C->finals()) {
800 if (E)
801 Profiler->VisitStmt(E);
802 }
803 if (C->getStep())
804 Profiler->VisitStmt(C->getStep());
805 if (C->getCalcStep())
806 Profiler->VisitStmt(C->getCalcStep());
807}
808void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
809 VisitOMPClauseList(C);
810 if (C->getAlignment())
811 Profiler->VisitStmt(C->getAlignment());
812}
813void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
814 VisitOMPClauseList(C);
815 for (auto *E : C->source_exprs()) {
816 if (E)
817 Profiler->VisitStmt(E);
818 }
819 for (auto *E : C->destination_exprs()) {
820 if (E)
821 Profiler->VisitStmt(E);
822 }
823 for (auto *E : C->assignment_ops()) {
824 if (E)
825 Profiler->VisitStmt(E);
826 }
827}
828void
830 VisitOMPClauseList(C);
831 for (auto *E : C->source_exprs()) {
832 if (E)
833 Profiler->VisitStmt(E);
834 }
835 for (auto *E : C->destination_exprs()) {
836 if (E)
837 Profiler->VisitStmt(E);
838 }
839 for (auto *E : C->assignment_ops()) {
840 if (E)
841 Profiler->VisitStmt(E);
842 }
843}
844void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
845 VisitOMPClauseList(C);
846}
847void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) {
848 if (const Expr *Depobj = C->getDepobj())
849 Profiler->VisitStmt(Depobj);
850}
851void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
852 VisitOMPClauseList(C);
853}
854void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
855 if (C->getDevice())
856 Profiler->VisitStmt(C->getDevice());
857}
858void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
859 VisitOMPClauseList(C);
860}
861void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
862 if (Expr *Allocator = C->getAllocator())
863 Profiler->VisitStmt(Allocator);
864 VisitOMPClauseList(C);
865}
866void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
867 VisitOMPClauseList(C);
868 VistOMPClauseWithPreInit(C);
869}
870void OMPClauseProfiler::VisitOMPThreadLimitClause(
872 VisitOMPClauseList(C);
873 VistOMPClauseWithPreInit(C);
874}
875void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
876 VistOMPClauseWithPreInit(C);
877 if (C->getPriority())
878 Profiler->VisitStmt(C->getPriority());
879}
880void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
881 VistOMPClauseWithPreInit(C);
882 if (C->getGrainsize())
883 Profiler->VisitStmt(C->getGrainsize());
884}
885void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
886 VistOMPClauseWithPreInit(C);
887 if (C->getNumTasks())
888 Profiler->VisitStmt(C->getNumTasks());
889}
890void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
891 if (C->getHint())
892 Profiler->VisitStmt(C->getHint());
893}
894void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
895 VisitOMPClauseList(C);
896}
897void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
898 VisitOMPClauseList(C);
899}
900void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
902 VisitOMPClauseList(C);
903}
904void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
906 VisitOMPClauseList(C);
907}
908void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
910 VisitOMPClauseList(C);
911}
912void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
914 VisitOMPClauseList(C);
915}
916void OMPClauseProfiler::VisitOMPNontemporalClause(
918 VisitOMPClauseList(C);
919 for (auto *E : C->private_refs())
920 Profiler->VisitStmt(E);
921}
922void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
923 VisitOMPClauseList(C);
924}
925void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) {
926 VisitOMPClauseList(C);
927}
928void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
930 for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
932 Profiler->VisitStmt(D.Allocator);
933 if (D.AllocatorTraits)
934 Profiler->VisitStmt(D.AllocatorTraits);
935 }
936}
937void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
938 if (const Expr *Modifier = C->getModifier())
939 Profiler->VisitStmt(Modifier);
940 for (const Expr *E : C->varlist())
941 Profiler->VisitStmt(E);
942}
943void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
944void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {}
945void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
947 VistOMPClauseWithPreInit(C);
948 if (Expr *Size = C->getSize())
949 Profiler->VisitStmt(Size);
950}
951void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) {
952 VisitOMPClauseList(C);
953}
954void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) {
955}
956void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {}
957}
958
959void
961 VisitStmt(S);
962 OMPClauseProfiler P(this);
965 I != E; ++I)
966 if (*I)
967 P.Visit(*I);
968}
969
970void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) {
971 VisitStmt(L);
972}
973
975 VisitOMPExecutableDirective(S);
976}
977
978void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
979 VisitOMPLoopBasedDirective(S);
980}
981
982void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) {
983 VisitOMPExecutableDirective(S);
984}
985
987 VisitOMPExecutableDirective(S);
988}
989
990void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
991 VisitOMPLoopDirective(S);
992}
993
994void StmtProfiler::VisitOMPLoopTransformationDirective(
996 VisitOMPLoopBasedDirective(S);
997}
998
999void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) {
1000 VisitOMPLoopTransformationDirective(S);
1001}
1002
1003void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) {
1004 VisitOMPLoopTransformationDirective(S);
1005}
1006
1007void StmtProfiler::VisitOMPReverseDirective(const OMPReverseDirective *S) {
1008 VisitOMPLoopTransformationDirective(S);
1009}
1010
1011void StmtProfiler::VisitOMPInterchangeDirective(
1013 VisitOMPLoopTransformationDirective(S);
1014}
1015
1016void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
1017 VisitOMPLoopDirective(S);
1018}
1019
1020void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
1021 VisitOMPLoopDirective(S);
1022}
1023
1024void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
1025 VisitOMPExecutableDirective(S);
1026}
1027
1028void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
1029 VisitOMPExecutableDirective(S);
1030}
1031
1032void StmtProfiler::VisitOMPScopeDirective(const OMPScopeDirective *S) {
1033 VisitOMPExecutableDirective(S);
1034}
1035
1036void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
1037 VisitOMPExecutableDirective(S);
1038}
1039
1040void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
1041 VisitOMPExecutableDirective(S);
1042}
1043
1044void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
1045 VisitOMPExecutableDirective(S);
1046 VisitName(S->getDirectiveName().getName());
1047}
1048
1049void
1051 VisitOMPLoopDirective(S);
1052}
1053
1054void StmtProfiler::VisitOMPParallelForSimdDirective(
1056 VisitOMPLoopDirective(S);
1057}
1058
1059void StmtProfiler::VisitOMPParallelMasterDirective(
1061 VisitOMPExecutableDirective(S);
1062}
1063
1064void StmtProfiler::VisitOMPParallelMaskedDirective(
1066 VisitOMPExecutableDirective(S);
1067}
1068
1069void StmtProfiler::VisitOMPParallelSectionsDirective(
1071 VisitOMPExecutableDirective(S);
1072}
1073
1074void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
1075 VisitOMPExecutableDirective(S);
1076}
1077
1079 VisitOMPExecutableDirective(S);
1080}
1081
1082void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
1083 VisitOMPExecutableDirective(S);
1084}
1085
1086void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
1087 VisitOMPExecutableDirective(S);
1088}
1089
1090void StmtProfiler::VisitOMPAssumeDirective(const OMPAssumeDirective *S) {
1091 VisitOMPExecutableDirective(S);
1092}
1093
1094void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) {
1095 VisitOMPExecutableDirective(S);
1096}
1098 VisitOMPExecutableDirective(S);
1099 if (const Expr *E = S->getReductionRef())
1100 VisitStmt(E);
1101}
1102
1103void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
1104 VisitOMPExecutableDirective(S);
1105}
1106
1107void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1108 VisitOMPExecutableDirective(S);
1109}
1110
1111void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1112 VisitOMPExecutableDirective(S);
1113}
1114
1115void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1116 VisitOMPExecutableDirective(S);
1117}
1118
1119void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1120 VisitOMPExecutableDirective(S);
1121}
1122
1123void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1124 VisitOMPExecutableDirective(S);
1125}
1126
1128 VisitOMPExecutableDirective(S);
1129}
1130
1131void StmtProfiler::VisitOMPTargetEnterDataDirective(
1133 VisitOMPExecutableDirective(S);
1134}
1135
1136void StmtProfiler::VisitOMPTargetExitDataDirective(
1138 VisitOMPExecutableDirective(S);
1139}
1140
1141void StmtProfiler::VisitOMPTargetParallelDirective(
1143 VisitOMPExecutableDirective(S);
1144}
1145
1146void StmtProfiler::VisitOMPTargetParallelForDirective(
1148 VisitOMPExecutableDirective(S);
1149}
1150
1151void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1152 VisitOMPExecutableDirective(S);
1153}
1154
1155void StmtProfiler::VisitOMPCancellationPointDirective(
1157 VisitOMPExecutableDirective(S);
1158}
1159
1160void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1161 VisitOMPExecutableDirective(S);
1162}
1163
1164void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1165 VisitOMPLoopDirective(S);
1166}
1167
1168void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1170 VisitOMPLoopDirective(S);
1171}
1172
1173void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1175 VisitOMPLoopDirective(S);
1176}
1177
1178void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1180 VisitOMPLoopDirective(S);
1181}
1182
1183void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1185 VisitOMPLoopDirective(S);
1186}
1187
1188void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1190 VisitOMPLoopDirective(S);
1191}
1192
1193void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1195 VisitOMPLoopDirective(S);
1196}
1197
1198void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1200 VisitOMPLoopDirective(S);
1201}
1202
1203void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1205 VisitOMPLoopDirective(S);
1206}
1207
1208void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1210 VisitOMPLoopDirective(S);
1211}
1212
1213void StmtProfiler::VisitOMPDistributeDirective(
1215 VisitOMPLoopDirective(S);
1216}
1217
1218void OMPClauseProfiler::VisitOMPDistScheduleClause(
1220 VistOMPClauseWithPreInit(C);
1221 if (auto *S = C->getChunkSize())
1222 Profiler->VisitStmt(S);
1223}
1224
1225void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1226
1227void StmtProfiler::VisitOMPTargetUpdateDirective(
1229 VisitOMPExecutableDirective(S);
1230}
1231
1232void StmtProfiler::VisitOMPDistributeParallelForDirective(
1234 VisitOMPLoopDirective(S);
1235}
1236
1237void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1239 VisitOMPLoopDirective(S);
1240}
1241
1242void StmtProfiler::VisitOMPDistributeSimdDirective(
1244 VisitOMPLoopDirective(S);
1245}
1246
1247void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1249 VisitOMPLoopDirective(S);
1250}
1251
1252void StmtProfiler::VisitOMPTargetSimdDirective(
1254 VisitOMPLoopDirective(S);
1255}
1256
1257void StmtProfiler::VisitOMPTeamsDistributeDirective(
1259 VisitOMPLoopDirective(S);
1260}
1261
1262void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1264 VisitOMPLoopDirective(S);
1265}
1266
1267void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1269 VisitOMPLoopDirective(S);
1270}
1271
1272void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1274 VisitOMPLoopDirective(S);
1275}
1276
1277void StmtProfiler::VisitOMPTargetTeamsDirective(
1279 VisitOMPExecutableDirective(S);
1280}
1281
1282void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1284 VisitOMPLoopDirective(S);
1285}
1286
1287void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1289 VisitOMPLoopDirective(S);
1290}
1291
1292void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1294 VisitOMPLoopDirective(S);
1295}
1296
1297void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1299 VisitOMPLoopDirective(S);
1300}
1301
1302void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1303 VisitOMPExecutableDirective(S);
1304}
1305
1306void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1307 VisitOMPExecutableDirective(S);
1308}
1309
1310void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1311 VisitOMPExecutableDirective(S);
1312}
1313
1314void StmtProfiler::VisitOMPGenericLoopDirective(
1316 VisitOMPLoopDirective(S);
1317}
1318
1319void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1321 VisitOMPLoopDirective(S);
1322}
1323
1324void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1326 VisitOMPLoopDirective(S);
1327}
1328
1329void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1331 VisitOMPLoopDirective(S);
1332}
1333
1334void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1336 VisitOMPLoopDirective(S);
1337}
1338
1339void StmtProfiler::VisitExpr(const Expr *S) {
1340 VisitStmt(S);
1341}
1342
1343void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1344 VisitExpr(S);
1345}
1346
1347void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1348 VisitExpr(S);
1349 if (!Canonical)
1350 VisitNestedNameSpecifier(S->getQualifier());
1351 VisitDecl(S->getDecl());
1352 if (!Canonical) {
1353 ID.AddBoolean(S->hasExplicitTemplateArgs());
1354 if (S->hasExplicitTemplateArgs())
1355 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1356 }
1357}
1358
1359void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1361 VisitExpr(S);
1362 VisitType(S->getTypeSourceInfo()->getType());
1363}
1364
1365void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1366 VisitExpr(S);
1367 ID.AddInteger(llvm::to_underlying(S->getIdentKind()));
1368}
1369
1370void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1372 VisitExpr(S);
1373}
1374
1375void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1376 VisitExpr(S);
1377 S->getValue().Profile(ID);
1378
1380 if (Canonical)
1381 T = T.getCanonicalType();
1384 BitIntT->Profile(ID);
1385 else
1387}
1388
1389void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1390 VisitExpr(S);
1391 S->getValue().Profile(ID);
1393}
1394
1395void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1396 VisitExpr(S);
1397 ID.AddInteger(llvm::to_underlying(S->getKind()));
1398 ID.AddInteger(S->getValue());
1399}
1400
1401void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1402 VisitExpr(S);
1403 S->getValue().Profile(ID);
1404 ID.AddBoolean(S->isExact());
1406}
1407
1408void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1409 VisitExpr(S);
1410}
1411
1412void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1413 VisitExpr(S);
1414 ID.AddString(S->getBytes());
1415 ID.AddInteger(llvm::to_underlying(S->getKind()));
1416}
1417
1418void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1419 VisitExpr(S);
1420}
1421
1422void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1423 VisitExpr(S);
1424}
1425
1426void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1427 VisitExpr(S);
1428 ID.AddInteger(S->getOpcode());
1429}
1430
1431void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1432 VisitType(S->getTypeSourceInfo()->getType());
1433 unsigned n = S->getNumComponents();
1434 for (unsigned i = 0; i < n; ++i) {
1435 const OffsetOfNode &ON = S->getComponent(i);
1439
1440 break;
1441
1444 break;
1445
1448 break;
1449
1451
1452 break;
1453 }
1454 }
1455
1456 VisitExpr(S);
1457}
1458
1459void
1461 VisitExpr(S);
1462 ID.AddInteger(S->getKind());
1463 if (S->isArgumentType())
1464 VisitType(S->getArgumentType());
1465}
1466
1467void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1468 VisitExpr(S);
1469}
1470
1471void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1472 VisitExpr(S);
1473}
1474
1475void StmtProfiler::VisitArraySectionExpr(const ArraySectionExpr *S) {
1476 VisitExpr(S);
1477}
1478
1479void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1480 VisitExpr(S);
1481}
1482
1483void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1484 VisitExpr(S);
1485 for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1486 VisitDecl(S->getIteratorDecl(I));
1487}
1488
1489void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1490 VisitExpr(S);
1491}
1492
1493void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1494 VisitExpr(S);
1495 VisitDecl(S->getMemberDecl());
1496 if (!Canonical)
1497 VisitNestedNameSpecifier(S->getQualifier());
1498 ID.AddBoolean(S->isArrow());
1499}
1500
1501void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1502 VisitExpr(S);
1503 ID.AddBoolean(S->isFileScope());
1504}
1505
1506void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1507 VisitExpr(S);
1508}
1509
1510void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1511 VisitCastExpr(S);
1512 ID.AddInteger(S->getValueKind());
1513}
1514
1515void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1516 VisitCastExpr(S);
1517 VisitType(S->getTypeAsWritten());
1518}
1519
1520void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1521 VisitExplicitCastExpr(S);
1522}
1523
1524void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1525 VisitExpr(S);
1526 ID.AddInteger(S->getOpcode());
1527}
1528
1529void
1531 VisitBinaryOperator(S);
1532}
1533
1534void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1535 VisitExpr(S);
1536}
1537
1538void StmtProfiler::VisitBinaryConditionalOperator(
1540 VisitExpr(S);
1541}
1542
1543void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1544 VisitExpr(S);
1545 VisitDecl(S->getLabel());
1546}
1547
1548void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1549 VisitExpr(S);
1550}
1551
1552void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1553 VisitExpr(S);
1554}
1555
1556void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1557 VisitExpr(S);
1558}
1559
1560void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1561 VisitExpr(S);
1562}
1563
1564void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1565 VisitExpr(S);
1566}
1567
1568void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1569 VisitExpr(S);
1570}
1571
1572void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1573 if (S->getSyntacticForm()) {
1574 VisitInitListExpr(S->getSyntacticForm());
1575 return;
1576 }
1577
1578 VisitExpr(S);
1579}
1580
1581void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1582 VisitExpr(S);
1583 ID.AddBoolean(S->usesGNUSyntax());
1585 if (D.isFieldDesignator()) {
1586 ID.AddInteger(0);
1587 VisitName(D.getFieldName());
1588 continue;
1589 }
1590
1591 if (D.isArrayDesignator()) {
1592 ID.AddInteger(1);
1593 } else {
1594 assert(D.isArrayRangeDesignator());
1595 ID.AddInteger(2);
1596 }
1597 ID.AddInteger(D.getArrayIndex());
1598 }
1599}
1600
1601
1602
1603void StmtProfiler::VisitDesignatedInitUpdateExpr(
1605 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1606 "initializer");
1607}
1608
1609void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1610 VisitExpr(S);
1611}
1612
1613void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1614 VisitExpr(S);
1615}
1616
1617void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1618 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1619}
1620
1622 VisitExpr(S);
1623}
1624
1625void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1626 VisitExpr(S);
1627 VisitName(&S->getAccessor());
1628}
1629
1630void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1631 VisitExpr(S);
1632 VisitDecl(S->getBlockDecl());
1633}
1634
1635void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1636 VisitExpr(S);
1638 S->associations()) {
1640 if (T.isNull())
1641 ID.AddPointer(nullptr);
1642 else
1643 VisitType(T);
1644 VisitExpr(Assoc.getAssociationExpr());
1645 }
1646}
1647
1648void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1649 VisitExpr(S);
1651 i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1652
1653 if (const OpaqueValueExpr *OVE = dyn_cast(*i))
1654 Visit(OVE->getSourceExpr());
1655}
1656
1657void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1658 VisitExpr(S);
1659 ID.AddInteger(S->getOp());
1660}
1661
1662void StmtProfiler::VisitConceptSpecializationExpr(
1664 VisitExpr(S);
1665 VisitDecl(S->getNamedConcept());
1666 for (const TemplateArgument &Arg : S->getTemplateArguments())
1667 VisitTemplateArgument(Arg);
1668}
1669
1670void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1671 VisitExpr(S);
1672 ID.AddInteger(S->getLocalParameters().size());
1673 for (ParmVarDecl *LocalParam : S->getLocalParameters())
1674 VisitDecl(LocalParam);
1675 ID.AddInteger(S->getRequirements().size());
1677 if (auto *TypeReq = dyn_castconcepts::TypeRequirement(Req)) {
1679 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1680 if (!TypeReq->isSubstitutionFailure())
1681 VisitType(TypeReq->getType()->getType());
1682 } else if (auto *ExprReq = dyn_castconcepts::ExprRequirement(Req)) {
1684 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1685 if (!ExprReq->isExprSubstitutionFailure())
1686 Visit(ExprReq->getExpr());
1687
1688
1689
1690
1691 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1693 ExprReq->getReturnTypeRequirement();
1695 ID.AddInteger(0);
1697 ID.AddInteger(1);
1699 } else {
1701 ID.AddInteger(2);
1702 }
1703 } else {
1705 auto *NestedReq = castconcepts::NestedRequirement(Req);
1706 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1707 if (!NestedReq->hasInvalidConstraint())
1708 Visit(NestedReq->getConstraintExpr());
1709 }
1710 }
1711}
1712
1716 unsigned &NumArgs) {
1717 switch (S->getOperator()) {
1719 case OO_New:
1720 case OO_Delete:
1721 case OO_Array_New:
1722 case OO_Array_Delete:
1723 case OO_Arrow:
1724 case OO_Conditional:
1726 llvm_unreachable("Invalid operator call kind");
1727
1728 case OO_Plus:
1729 if (NumArgs == 1) {
1730 UnaryOp = UO_Plus;
1731 return Stmt::UnaryOperatorClass;
1732 }
1733
1734 BinaryOp = BO_Add;
1735 return Stmt::BinaryOperatorClass;
1736
1737 case OO_Minus:
1738 if (NumArgs == 1) {
1739 UnaryOp = UO_Minus;
1740 return Stmt::UnaryOperatorClass;
1741 }
1742
1743 BinaryOp = BO_Sub;
1744 return Stmt::BinaryOperatorClass;
1745
1746 case OO_Star:
1747 if (NumArgs == 1) {
1748 UnaryOp = UO_Deref;
1749 return Stmt::UnaryOperatorClass;
1750 }
1751
1752 BinaryOp = BO_Mul;
1753 return Stmt::BinaryOperatorClass;
1754
1755 case OO_Slash:
1756 BinaryOp = BO_Div;
1757 return Stmt::BinaryOperatorClass;
1758
1759 case OO_Percent:
1760 BinaryOp = BO_Rem;
1761 return Stmt::BinaryOperatorClass;
1762
1763 case OO_Caret:
1764 BinaryOp = BO_Xor;
1765 return Stmt::BinaryOperatorClass;
1766
1767 case OO_Amp:
1768 if (NumArgs == 1) {
1769 UnaryOp = UO_AddrOf;
1770 return Stmt::UnaryOperatorClass;
1771 }
1772
1773 BinaryOp = BO_And;
1774 return Stmt::BinaryOperatorClass;
1775
1776 case OO_Pipe:
1777 BinaryOp = BO_Or;
1778 return Stmt::BinaryOperatorClass;
1779
1780 case OO_Tilde:
1781 UnaryOp = UO_Not;
1782 return Stmt::UnaryOperatorClass;
1783
1784 case OO_Exclaim:
1785 UnaryOp = UO_LNot;
1786 return Stmt::UnaryOperatorClass;
1787
1788 case OO_Equal:
1789 BinaryOp = BO_Assign;
1790 return Stmt::BinaryOperatorClass;
1791
1792 case OO_Less:
1793 BinaryOp = BO_LT;
1794 return Stmt::BinaryOperatorClass;
1795
1796 case OO_Greater:
1797 BinaryOp = BO_GT;
1798 return Stmt::BinaryOperatorClass;
1799
1800 case OO_PlusEqual:
1801 BinaryOp = BO_AddAssign;
1802 return Stmt::CompoundAssignOperatorClass;
1803
1804 case OO_MinusEqual:
1805 BinaryOp = BO_SubAssign;
1806 return Stmt::CompoundAssignOperatorClass;
1807
1808 case OO_StarEqual:
1809 BinaryOp = BO_MulAssign;
1810 return Stmt::CompoundAssignOperatorClass;
1811
1812 case OO_SlashEqual:
1813 BinaryOp = BO_DivAssign;
1814 return Stmt::CompoundAssignOperatorClass;
1815
1816 case OO_PercentEqual:
1817 BinaryOp = BO_RemAssign;
1818 return Stmt::CompoundAssignOperatorClass;
1819
1820 case OO_CaretEqual:
1821 BinaryOp = BO_XorAssign;
1822 return Stmt::CompoundAssignOperatorClass;
1823
1824 case OO_AmpEqual:
1825 BinaryOp = BO_AndAssign;
1826 return Stmt::CompoundAssignOperatorClass;
1827
1828 case OO_PipeEqual:
1829 BinaryOp = BO_OrAssign;
1830 return Stmt::CompoundAssignOperatorClass;
1831
1832 case OO_LessLess:
1833 BinaryOp = BO_Shl;
1834 return Stmt::BinaryOperatorClass;
1835
1836 case OO_GreaterGreater:
1837 BinaryOp = BO_Shr;
1838 return Stmt::BinaryOperatorClass;
1839
1840 case OO_LessLessEqual:
1841 BinaryOp = BO_ShlAssign;
1842 return Stmt::CompoundAssignOperatorClass;
1843
1844 case OO_GreaterGreaterEqual:
1845 BinaryOp = BO_ShrAssign;
1846 return Stmt::CompoundAssignOperatorClass;
1847
1848 case OO_EqualEqual:
1849 BinaryOp = BO_EQ;
1850 return Stmt::BinaryOperatorClass;
1851
1852 case OO_ExclaimEqual:
1853 BinaryOp = BO_NE;
1854 return Stmt::BinaryOperatorClass;
1855
1856 case OO_LessEqual:
1857 BinaryOp = BO_LE;
1858 return Stmt::BinaryOperatorClass;
1859
1860 case OO_GreaterEqual:
1861 BinaryOp = BO_GE;
1862 return Stmt::BinaryOperatorClass;
1863
1864 case OO_Spaceship:
1865 BinaryOp = BO_Cmp;
1866 return Stmt::BinaryOperatorClass;
1867
1868 case OO_AmpAmp:
1869 BinaryOp = BO_LAnd;
1870 return Stmt::BinaryOperatorClass;
1871
1872 case OO_PipePipe:
1873 BinaryOp = BO_LOr;
1874 return Stmt::BinaryOperatorClass;
1875
1876 case OO_PlusPlus:
1877 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1878 NumArgs = 1;
1879 return Stmt::UnaryOperatorClass;
1880
1881 case OO_MinusMinus:
1882 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1883 NumArgs = 1;
1884 return Stmt::UnaryOperatorClass;
1885
1886 case OO_Comma:
1887 BinaryOp = BO_Comma;
1888 return Stmt::BinaryOperatorClass;
1889
1890 case OO_ArrowStar:
1891 BinaryOp = BO_PtrMemI;
1892 return Stmt::BinaryOperatorClass;
1893
1894 case OO_Subscript:
1895 return Stmt::ArraySubscriptExprClass;
1896
1897 case OO_Call:
1898 return Stmt::CallExprClass;
1899
1900 case OO_Coawait:
1901 UnaryOp = UO_Coawait;
1902 return Stmt::UnaryOperatorClass;
1903 }
1904
1905 llvm_unreachable("Invalid overloaded operator expression");
1906}
1907
1908#if defined(_MSC_VER) && !defined(__clang__)
1909#if _MSC_VER == 1911
1910
1911
1912
1913#pragma optimize("", off)
1914#endif
1915#endif
1916
1917void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1918 if (S->isTypeDependent()) {
1919
1920
1921
1922
1923
1924 if (S->getOperator() == OO_Arrow)
1925 return Visit(S->getArg(0));
1926
1929 unsigned NumArgs = S->getNumArgs();
1931
1932 ID.AddInteger(SC);
1933 for (unsigned I = 0; I != NumArgs; ++I)
1934 Visit(S->getArg(I));
1935 if (SC == Stmt::UnaryOperatorClass)
1936 ID.AddInteger(UnaryOp);
1937 else if (SC == Stmt::BinaryOperatorClass ||
1938 SC == Stmt::CompoundAssignOperatorClass)
1939 ID.AddInteger(BinaryOp);
1940 else
1941 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1942
1943 return;
1944 }
1945
1946 VisitCallExpr(S);
1947 ID.AddInteger(S->getOperator());
1948}
1949
1950void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1952
1953
1954 assert(!S->isTypeDependent() &&
1955 "resolved rewritten operator should never be type-dependent");
1956 ID.AddBoolean(S->isReversed());
1957 VisitExpr(S->getSemanticForm());
1958}
1959
1960#if defined(_MSC_VER) && !defined(__clang__)
1961#if _MSC_VER == 1911
1962#pragma optimize("", on)
1963#endif
1964#endif
1965
1966void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1967 VisitCallExpr(S);
1968}
1969
1970void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1971 VisitCallExpr(S);
1972}
1973
1974void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1975 VisitExpr(S);
1976}
1977
1978void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1979 VisitExplicitCastExpr(S);
1980}
1981
1982void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1983 VisitCXXNamedCastExpr(S);
1984}
1985
1986void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1987 VisitCXXNamedCastExpr(S);
1988}
1989
1990void
1992 VisitCXXNamedCastExpr(S);
1993}
1994
1995void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1996 VisitCXXNamedCastExpr(S);
1997}
1998
1999void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
2000 VisitExpr(S);
2001 VisitType(S->getTypeInfoAsWritten()->getType());
2002}
2003
2004void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
2005 VisitCXXNamedCastExpr(S);
2006}
2007
2008void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
2009 VisitCallExpr(S);
2010}
2011
2012void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
2013 VisitExpr(S);
2014 ID.AddBoolean(S->getValue());
2015}
2016
2018 VisitExpr(S);
2019}
2020
2021void StmtProfiler::VisitCXXStdInitializerListExpr(
2023 VisitExpr(S);
2024}
2025
2026void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
2027 VisitExpr(S);
2028 if (S->isTypeOperand())
2029 VisitType(S->getTypeOperandSourceInfo()->getType());
2030}
2031
2032void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
2033 VisitExpr(S);
2034 if (S->isTypeOperand())
2035 VisitType(S->getTypeOperandSourceInfo()->getType());
2036}
2037
2038void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
2039 VisitExpr(S);
2040 VisitDecl(S->getPropertyDecl());
2041}
2042
2043void StmtProfiler::VisitMSPropertySubscriptExpr(
2045 VisitExpr(S);
2046}
2047
2048void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
2049 VisitExpr(S);
2050 ID.AddBoolean(S->isImplicit());
2051 ID.AddBoolean(S->isCapturedByCopyInLambdaWithExplicitObjectParameter());
2052}
2053
2054void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
2055 VisitExpr(S);
2056}
2057
2058void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
2059 VisitExpr(S);
2060 VisitDecl(S->getParam());
2061}
2062
2063void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
2064 VisitExpr(S);
2065 VisitDecl(S->getField());
2066}
2067
2068void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
2069 VisitExpr(S);
2070 VisitDecl(
2071 const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
2072}
2073
2074void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
2075 VisitExpr(S);
2076 VisitDecl(S->getConstructor());
2077 ID.AddBoolean(S->isElidable());
2078}
2079
2080void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2082 VisitExpr(S);
2083 VisitDecl(S->getConstructor());
2084}
2085
2087 VisitExplicitCastExpr(S);
2088}
2089
2090void
2092 VisitCXXConstructExpr(S);
2093}
2094
2095void
2096StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
2097 if (!ProfileLambdaExpr) {
2098
2099
2100
2101 VisitStmtNoChildren(S);
2102
2103
2104
2105 VisitDecl(S->getLambdaClass());
2106
2107 return;
2108 }
2109
2112 ID.AddInteger(Capture.getCaptureKind());
2113 if (Capture.capturesVariable())
2114 VisitDecl(Capture.getCapturedVar());
2115 }
2116
2117
2118
2120
2121
2122
2123 for (auto *SubDecl : Lambda->decls()) {
2125 if (auto *FTD = dyn_cast(SubDecl))
2126 Call = FTD->getTemplatedDecl();
2127 else if (auto *FD = dyn_cast(SubDecl))
2129
2131 continue;
2132
2134 }
2136}
2137
2138void
2140 VisitExpr(S);
2141}
2142
2143void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
2144 VisitExpr(S);
2145 ID.AddBoolean(S->isGlobalDelete());
2146 ID.AddBoolean(S->isArrayForm());
2147 VisitDecl(S->getOperatorDelete());
2148}
2149
2150void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
2151 VisitExpr(S);
2152 VisitType(S->getAllocatedType());
2153 VisitDecl(S->getOperatorNew());
2154 VisitDecl(S->getOperatorDelete());
2155 ID.AddBoolean(S->isArray());
2156 ID.AddInteger(S->getNumPlacementArgs());
2157 ID.AddBoolean(S->isGlobalNew());
2158 ID.AddBoolean(S->isParenTypeId());
2159 ID.AddInteger(llvm::to_underlying(S->getInitializationStyle()));
2160}
2161
2162void
2164 VisitExpr(S);
2165 ID.AddBoolean(S->isArrow());
2166 VisitNestedNameSpecifier(S->getQualifier());
2167 ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
2168 if (S->getScopeTypeInfo())
2169 VisitType(S->getScopeTypeInfo()->getType());
2170 ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
2171 if (S->getDestroyedTypeInfo())
2172 VisitType(S->getDestroyedType());
2173 else
2174 VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
2175}
2176
2177void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
2178 VisitExpr(S);
2179 VisitNestedNameSpecifier(S->getQualifier());
2180 VisitName(S->getName(), true);
2181 ID.AddBoolean(S->hasExplicitTemplateArgs());
2182 if (S->hasExplicitTemplateArgs())
2183 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2184}
2185
2186void
2188 VisitOverloadExpr(S);
2189}
2190
2191void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2192 VisitExpr(S);
2193 ID.AddInteger(S->getTrait());
2194 ID.AddInteger(S->getNumArgs());
2195 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2196 VisitType(S->getArg(I)->getType());
2197}
2198
2199void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2200 VisitExpr(S);
2201 ID.AddInteger(S->getTrait());
2202 VisitType(S->getQueriedType());
2203}
2204
2205void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2206 VisitExpr(S);
2207 ID.AddInteger(S->getTrait());
2208 VisitExpr(S->getQueriedExpression());
2209}
2210
2211void StmtProfiler::VisitDependentScopeDeclRefExpr(
2213 VisitExpr(S);
2214 VisitName(S->getDeclName());
2215 VisitNestedNameSpecifier(S->getQualifier());
2216 ID.AddBoolean(S->hasExplicitTemplateArgs());
2217 if (S->hasExplicitTemplateArgs())
2218 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2219}
2220
2221void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2222 VisitExpr(S);
2223}
2224
2225void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2227 VisitExpr(S);
2228 VisitType(S->getTypeAsWritten());
2229 ID.AddInteger(S->isListInitialization());
2230}
2231
2232void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2234 ID.AddBoolean(S->isImplicitAccess());
2235 if (!S->isImplicitAccess()) {
2236 VisitExpr(S);
2237 ID.AddBoolean(S->isArrow());
2238 }
2239 VisitNestedNameSpecifier(S->getQualifier());
2240 VisitName(S->getMember());
2241 ID.AddBoolean(S->hasExplicitTemplateArgs());
2242 if (S->hasExplicitTemplateArgs())
2243 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2244}
2245
2246void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2247 ID.AddBoolean(S->isImplicitAccess());
2248 if (!S->isImplicitAccess()) {
2249 VisitExpr(S);
2250 ID.AddBoolean(S->isArrow());
2251 }
2252 VisitNestedNameSpecifier(S->getQualifier());
2253 VisitName(S->getMemberName());
2254 ID.AddBoolean(S->hasExplicitTemplateArgs());
2255 if (S->hasExplicitTemplateArgs())
2256 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2257}
2258
2259void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2260 VisitExpr(S);
2261}
2262
2263void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2264 VisitExpr(S);
2265}
2266
2267void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2268 VisitExpr(S);
2269 VisitDecl(S->getPack());
2270 if (S->isPartiallySubstituted()) {
2271 auto Args = S->getPartialArguments();
2272 ID.AddInteger(Args.size());
2273 for (const auto &TA : Args)
2274 VisitTemplateArgument(TA);
2275 } else {
2276 ID.AddInteger(0);
2277 }
2278}
2279
2280void StmtProfiler::VisitPackIndexingExpr(const PackIndexingExpr *E) {
2281 VisitExpr(E);
2282 VisitExpr(E->getPackIdExpression());
2283 VisitExpr(E->getIndexExpr());
2284}
2285
2286void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2288 VisitExpr(S);
2289 VisitDecl(S->getParameterPack());
2290 VisitTemplateArgument(S->getArgumentPack());
2291}
2292
2293void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2295
2296 Visit(E->getReplacement());
2297}
2298
2299void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2300 VisitExpr(S);
2301 VisitDecl(S->getParameterPack());
2302 ID.AddInteger(S->getNumExpansions());
2304 VisitDecl(*I);
2305}
2306
2307void StmtProfiler::VisitMaterializeTemporaryExpr(
2309 VisitExpr(S);
2310}
2311
2312void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2313 VisitExpr(S);
2314 ID.AddInteger(S->getOperator());
2315}
2316
2317void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) {
2318 VisitExpr(S);
2319}
2320
2321void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2322 VisitStmt(S);
2323}
2324
2325void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2326 VisitStmt(S);
2327}
2328
2329void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2330 VisitExpr(S);
2331}
2332
2333void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2334 VisitExpr(S);
2335}
2336
2337void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2338 VisitExpr(S);
2339}
2340
2341void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2342 VisitExpr(E);
2343}
2344
2345void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2346 VisitExpr(E);
2347}
2348
2349void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2350 VisitExpr(E);
2351}
2352
2353void StmtProfiler::VisitEmbedExpr(const EmbedExpr *E) { VisitExpr(E); }
2354
2355void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2356
2357void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2358 VisitExpr(S);
2359}
2360
2361void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2362 VisitExpr(E);
2363}
2364
2365void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2366 VisitExpr(E);
2367}
2368
2370 VisitExpr(E);
2371}
2372
2373void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2374 VisitExpr(S);
2375 VisitType(S->getEncodedType());
2376}
2377
2378void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2379 VisitExpr(S);
2380 VisitName(S->getSelector());
2381}
2382
2383void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2384 VisitExpr(S);
2385 VisitDecl(S->getProtocol());
2386}
2387
2388void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2389 VisitExpr(S);
2390 VisitDecl(S->getDecl());
2391 ID.AddBoolean(S->isArrow());
2392 ID.AddBoolean(S->isFreeIvar());
2393}
2394
2395void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2396 VisitExpr(S);
2397 if (S->isImplicitProperty()) {
2398 VisitDecl(S->getImplicitPropertyGetter());
2399 VisitDecl(S->getImplicitPropertySetter());
2400 } else {
2401 VisitDecl(S->getExplicitProperty());
2402 }
2403 if (S->isSuperReceiver()) {
2404 ID.AddBoolean(S->isSuperReceiver());
2405 VisitType(S->getSuperReceiverType());
2406 }
2407}
2408
2409void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2410 VisitExpr(S);
2411 VisitDecl(S->getAtIndexMethodDecl());
2412 VisitDecl(S->setAtIndexMethodDecl());
2413}
2414
2415void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2416 VisitExpr(S);
2417 VisitName(S->getSelector());
2418 VisitDecl(S->getMethodDecl());
2419}
2420
2421void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2422 VisitExpr(S);
2423 ID.AddBoolean(S->isArrow());
2424}
2425
2426void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2427 VisitExpr(S);
2428 ID.AddBoolean(S->getValue());
2429}
2430
2431void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2433 VisitExpr(S);
2434 ID.AddBoolean(S->shouldCopy());
2435}
2436
2437void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2438 VisitExplicitCastExpr(S);
2439 ID.AddBoolean(S->getBridgeKind());
2440}
2441
2442void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2444 VisitExpr(S);
2445}
2446
2447void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2448 unsigned NumArgs) {
2449 ID.AddInteger(NumArgs);
2450 for (unsigned I = 0; I != NumArgs; ++I)
2451 VisitTemplateArgument(Args[I].getArgument());
2452}
2453
2454void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2455
2457 switch (Arg.getKind()) {
2459 break;
2460
2463 break;
2464
2468 break;
2469
2472
2474 break;
2475
2478 break;
2479
2483 break;
2484
2487
2489 break;
2490
2493 break;
2494
2497 VisitTemplateArgument(P);
2498 break;
2499 }
2500}
2501
2502namespace {
2503class OpenACCClauseProfiler
2505 StmtProfiler &Profiler;
2506
2507public:
2508 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2509
2512
2513
2515 }
2516 }
2517
2520 Profiler.VisitStmt(E);
2521 }
2522
2523#define VISIT_CLAUSE(CLAUSE_NAME) \
2524 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2525
2526#include "clang/Basic/OpenACCClauses.def"
2527};
2528
2529
2530void OpenACCClauseProfiler::VisitDefaultClause(
2532
2533void OpenACCClauseProfiler::VisitIfClause(const OpenACCIfClause &Clause) {
2535 "if clause requires a valid condition expr");
2537}
2538
2539void OpenACCClauseProfiler::VisitCopyClause(const OpenACCCopyClause &Clause) {
2540 VisitClauseWithVarList(Clause);
2541}
2542void OpenACCClauseProfiler::VisitCopyInClause(
2544 VisitClauseWithVarList(Clause);
2545}
2546
2547void OpenACCClauseProfiler::VisitCopyOutClause(
2549 VisitClauseWithVarList(Clause);
2550}
2551
2552void OpenACCClauseProfiler::VisitCreateClause(
2554 VisitClauseWithVarList(Clause);
2555}
2556
2557void OpenACCClauseProfiler::VisitHostClause(const OpenACCHostClause &Clause) {
2558 VisitClauseWithVarList(Clause);
2559}
2560
2561void OpenACCClauseProfiler::VisitDeviceClause(
2563 VisitClauseWithVarList(Clause);
2564}
2565
2566void OpenACCClauseProfiler::VisitSelfClause(const OpenACCSelfClause &Clause) {
2570 } else {
2572 Profiler.VisitStmt(E);
2573 }
2574}
2575
2576void OpenACCClauseProfiler::VisitFinalizeClause(
2578
2579void OpenACCClauseProfiler::VisitIfPresentClause(
2581
2582void OpenACCClauseProfiler::VisitNumGangsClause(
2585 Profiler.VisitStmt(E);
2586}
2587
2588void OpenACCClauseProfiler::VisitTileClause(const OpenACCTileClause &Clause) {
2590 Profiler.VisitStmt(E);
2591}
2592
2593void OpenACCClauseProfiler::VisitNumWorkersClause(
2595 assert(Clause.hasIntExpr() && "num_workers clause requires a valid int expr");
2596 Profiler.VisitStmt(Clause.getIntExpr());
2597}
2598
2599void OpenACCClauseProfiler::VisitCollapseClause(
2601 assert(Clause.getLoopCount() && "collapse clause requires a valid int expr");
2603}
2604
2605void OpenACCClauseProfiler::VisitPrivateClause(
2607 VisitClauseWithVarList(Clause);
2608}
2609
2610void OpenACCClauseProfiler::VisitFirstPrivateClause(
2612 VisitClauseWithVarList(Clause);
2613}
2614
2615void OpenACCClauseProfiler::VisitAttachClause(
2617 VisitClauseWithVarList(Clause);
2618}
2619
2620void OpenACCClauseProfiler::VisitDetachClause(
2622 VisitClauseWithVarList(Clause);
2623}
2624
2625void OpenACCClauseProfiler::VisitDeleteClause(
2627 VisitClauseWithVarList(Clause);
2628}
2629
2630void OpenACCClauseProfiler::VisitDevicePtrClause(
2632 VisitClauseWithVarList(Clause);
2633}
2634
2635void OpenACCClauseProfiler::VisitNoCreateClause(
2637 VisitClauseWithVarList(Clause);
2638}
2639
2640void OpenACCClauseProfiler::VisitPresentClause(
2642 VisitClauseWithVarList(Clause);
2643}
2644
2645void OpenACCClauseProfiler::VisitUseDeviceClause(
2647 VisitClauseWithVarList(Clause);
2648}
2649
2650void OpenACCClauseProfiler::VisitVectorLengthClause(
2653 "vector_length clause requires a valid int expr");
2654 Profiler.VisitStmt(Clause.getIntExpr());
2655}
2656
2657void OpenACCClauseProfiler::VisitAsyncClause(const OpenACCAsyncClause &Clause) {
2659 Profiler.VisitStmt(Clause.getIntExpr());
2660}
2661
2662void OpenACCClauseProfiler::VisitDeviceNumClause(
2664 Profiler.VisitStmt(Clause.getIntExpr());
2665}
2666
2667void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2669 Profiler.VisitStmt(Clause.getIntExpr());
2670}
2671
2672void OpenACCClauseProfiler::VisitWorkerClause(
2675 Profiler.VisitStmt(Clause.getIntExpr());
2676}
2677
2678void OpenACCClauseProfiler::VisitVectorClause(
2681 Profiler.VisitStmt(Clause.getIntExpr());
2682}
2683
2684void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) {
2688 Profiler.VisitStmt(E);
2689}
2690
2691void OpenACCClauseProfiler::VisitDeviceTypeClause(
2693
2694void OpenACCClauseProfiler::VisitAutoClause(const OpenACCAutoClause &Clause) {}
2695
2696void OpenACCClauseProfiler::VisitIndependentClause(
2698
2699void OpenACCClauseProfiler::VisitSeqClause(const OpenACCSeqClause &Clause) {}
2700
2701void OpenACCClauseProfiler::VisitGangClause(const OpenACCGangClause &Clause) {
2702 for (unsigned I = 0; I < Clause.getNumExprs(); ++I) {
2703 Profiler.VisitStmt(Clause.getExpr(I).second);
2704 }
2705}
2706
2707void OpenACCClauseProfiler::VisitReductionClause(
2709 VisitClauseWithVarList(Clause);
2710}
2711}
2712
2713void StmtProfiler::VisitOpenACCComputeConstruct(
2715
2716 VisitStmt(S);
2717
2718 OpenACCClauseProfiler P{*this};
2719 P.VisitOpenACCClauseList(S->clauses());
2720}
2721
2722void StmtProfiler::VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S) {
2723
2724 VisitStmt(S);
2725
2726 OpenACCClauseProfiler P{*this};
2727 P.VisitOpenACCClauseList(S->clauses());
2728}
2729
2730void StmtProfiler::VisitOpenACCCombinedConstruct(
2732
2733 VisitStmt(S);
2734
2735 OpenACCClauseProfiler P{*this};
2736 P.VisitOpenACCClauseList(S->clauses());
2737}
2738
2739void StmtProfiler::VisitOpenACCDataConstruct(const OpenACCDataConstruct *S) {
2740 VisitStmt(S);
2741
2742 OpenACCClauseProfiler P{*this};
2743 P.VisitOpenACCClauseList(S->clauses());
2744}
2745
2746void StmtProfiler::VisitOpenACCEnterDataConstruct(
2748 VisitStmt(S);
2749
2750 OpenACCClauseProfiler P{*this};
2751 P.VisitOpenACCClauseList(S->clauses());
2752}
2753
2754void StmtProfiler::VisitOpenACCExitDataConstruct(
2756 VisitStmt(S);
2757
2758 OpenACCClauseProfiler P{*this};
2759 P.VisitOpenACCClauseList(S->clauses());
2760}
2761
2762void StmtProfiler::VisitOpenACCHostDataConstruct(
2764 VisitStmt(S);
2765
2766 OpenACCClauseProfiler P{*this};
2767 P.VisitOpenACCClauseList(S->clauses());
2768}
2769
2770void StmtProfiler::VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *S) {
2771
2772 VisitStmt(S);
2773
2774 OpenACCClauseProfiler P{*this};
2775 P.VisitOpenACCClauseList(S->clauses());
2776}
2777
2778void StmtProfiler::VisitOpenACCInitConstruct(const OpenACCInitConstruct *S) {
2779 VisitStmt(S);
2780 OpenACCClauseProfiler P{*this};
2781 P.VisitOpenACCClauseList(S->clauses());
2782}
2783
2784void StmtProfiler::VisitOpenACCShutdownConstruct(
2786 VisitStmt(S);
2787 OpenACCClauseProfiler P{*this};
2788 P.VisitOpenACCClauseList(S->clauses());
2789}
2790
2791void StmtProfiler::VisitOpenACCSetConstruct(const OpenACCSetConstruct *S) {
2792 VisitStmt(S);
2793 OpenACCClauseProfiler P{*this};
2794 P.VisitOpenACCClauseList(S->clauses());
2795}
2796
2797void StmtProfiler::VisitOpenACCUpdateConstruct(
2799 VisitStmt(S);
2800 OpenACCClauseProfiler P{*this};
2801 P.VisitOpenACCClauseList(S->clauses());
2802}
2803
2804void StmtProfiler::VisitHLSLOutArgExpr(const HLSLOutArgExpr *S) {
2805 VisitStmt(S);
2806}
2807
2809 bool Canonical, bool ProfileLambdaExpr) const {
2810 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
2811 Profiler.Visit(this);
2812}
2813
2815 class ODRHash &Hash) const {
2816 StmtProfilerWithoutPointers Profiler(ID, Hash);
2817 Profiler.Visit(this);
2818}
Defines the clang::ASTContext interface.
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, unsigned &NumArgs)
static const TemplateArgument & getArgument(const TemplateArgument &A)
void Profile(llvm::FoldingSetNodeID &ID) const
profile this value.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
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.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
A fixed int type of a specified bitwidth.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
This class is used for builtin types like 'int'.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
capture_const_range captures() const
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
A C++ static_cast expression (C++ [expr.static.cast]).
Implicit construction of a std::initializer_list object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
This captures a statement into a function.
CaseStmt - Represent a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
ConditionalOperator - The ?: ternary operator.
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a 'co_yield' expression.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
Represents a 'co_await' expression while the type of the promise is dependent.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
Represents a reference to #emded data.
ExplicitCastExpr - An explicit cast written in the source code.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
An expression trait intrinsic.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< true > ConstAssociation
GotoStmt - This represents a direct goto.
This class represents temporary values used to represent inout and out arguments in HLSL.
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
LabelStmt - Represents a label, which has a substatement.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
A member reference to an MSPropertyDecl.
MS property subscript expression.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Represents a C++ nested name specifier, such as "\::std::vector::".
Represents a place-holder for an object not to be initialized by anything.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
void AddDecl(const Decl *D)
void AddIdentifierInfo(const IdentifierInfo *II)
void AddDeclarationName(DeclarationName Name, bool TreatAsDecl=false)
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS)
void AddFunctionDecl(const FunctionDecl *Function, bool SkipBody=false)
void AddTemplateName(TemplateName Name)
void AddQualType(QualType T)
This represents the 'absent' clause in the '#pragma omp assume' directive.
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.
This represents clause 'aligned' in the '#pragma omp ...' directives.
This represents clause 'allocate' in the '#pragma omp ...' directives.
This represents 'allocator' clause in the '#pragma omp ...' directive.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
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.
This represents '#pragma omp barrier' directive.
This represents 'bind' clause in the '#pragma omp ...' directives.
This represents '#pragma omp cancel' directive.
This represents '#pragma omp cancellation point' directive.
Representation of an OpenMP canonical loop.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents the 'contains' clause in the '#pragma omp assume' 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.
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.
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.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp distribute' directive.
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
This represents '#pragma omp distribute simd' composite directive.
This represents the 'doacross' clause for the '#pragma omp ordered' directive.
This represents 'dynamic_allocators' clause in the '#pragma omp requires' directive.
This represents '#pragma omp error' directive.
This represents clause 'exclusive' in the '#pragma omp scan' directive.
This is a basic class for representing single OpenMP executable directive.
This represents 'fail' clause in the '#pragma omp atomic' directive.
This represents 'filter' clause in the '#pragma omp ...' directive.
This represents 'final' clause in the '#pragma omp ...' directive.
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.
This represents '#pragma omp for' directive.
This represents '#pragma omp for simd' directive.
This represents clause 'from' in the '#pragma omp ...' directives.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
This represents '#pragma omp loop' directive.
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 the 'holds' clause in the '#pragma omp assume' directive.
This represents 'if' clause in the '#pragma omp ...' directive.
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.
Represents the '#pragma omp interchange' loop transformation directive.
This represents '#pragma omp interop' directive.
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...
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.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
The base class for all loop transformation directives.
This represents clause 'map' in the '#pragma omp ...' directives.
This represents '#pragma omp masked' directive.
This represents '#pragma omp masked taskloop' directive.
This represents '#pragma omp masked taskloop simd' directive.
This represents '#pragma omp master' directive.
This represents '#pragma omp master taskloop' directive.
This represents '#pragma omp master taskloop simd' directive.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents 'message' clause in the '#pragma omp error' directive.
This represents the 'no_openmp' clause in the '#pragma omp assume' directive.
This represents the 'no_openmp_routines' clause in the '#pragma omp assume' directive.
This represents the 'no_parallelism' clause in the '#pragma omp assume' directive.
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.
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
This represents '#pragma omp ordered' directive.
This represents '#pragma omp parallel' directive.
This represents '#pragma omp parallel for' directive.
This represents '#pragma omp parallel for simd' directive.
This represents '#pragma omp parallel loop' directive.
This represents '#pragma omp parallel masked' directive.
This represents '#pragma omp parallel masked taskloop' directive.
This represents '#pragma omp parallel masked taskloop simd' directive.
This represents '#pragma omp parallel master' directive.
This represents '#pragma omp parallel master taskloop' directive.
This represents '#pragma omp parallel master taskloop simd' directive.
This represents '#pragma omp parallel sections' directive.
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
This class represents the 'permutation' clause in the '#pragma omp interchange' directive.
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.
Represents the '#pragma omp reverse' loop transformation directive.
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.
This represents '#pragma omp scan' directive.
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp scope' directive.
This represents '#pragma omp section' directive.
This represents '#pragma omp sections' directive.
This represents 'seq_cst' clause in the '#pragma omp atomic|flush' directives.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents '#pragma omp simd' directive.
This represents 'simdlen' clause in the '#pragma omp ...' directive.
This represents '#pragma omp single' directive.
This represents the 'sizes' clause in the '#pragma omp tile' directive.
This represents '#pragma omp target data' directive.
This represents '#pragma omp target' directive.
This represents '#pragma omp target enter data' directive.
This represents '#pragma omp target exit data' directive.
This represents '#pragma omp target parallel' directive.
This represents '#pragma omp target parallel for' directive.
This represents '#pragma omp target parallel for simd' directive.
This represents '#pragma omp target parallel loop' directive.
This represents '#pragma omp target simd' directive.
This represents '#pragma omp target teams' directive.
This represents '#pragma omp target teams distribute' combined directive.
This represents '#pragma omp target teams distribute parallel for' combined directive.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
This represents '#pragma omp target teams distribute simd' combined directive.
This represents '#pragma omp target teams loop' directive.
This represents '#pragma omp target update' directive.
This represents '#pragma omp task' directive.
This represents '#pragma omp taskloop' directive.
This represents '#pragma omp taskloop simd' directive.
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
This represents '#pragma omp taskgroup' directive.
This represents '#pragma omp taskwait' directive.
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp teams' directive.
This represents '#pragma omp teams distribute' directive.
This represents '#pragma omp teams distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
This represents '#pragma omp teams distribute simd' combined directive.
This represents '#pragma omp teams loop' directive.
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.
This represents clause 'to' in the '#pragma omp ...' directives.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents the '#pragma omp unroll' loop transformation directive.
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 'weak' clause in the '#pragma omp atomic' directives.
This represents 'write' clause in the '#pragma omp atomic' directive.
This represents 'ompx_attribute' clause in a directive that might generate an outlined function.
This represents 'ompx_bare' clause in the '#pragma omp target teams ...' 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,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Helper class for OffsetOfExpr.
FieldDecl * getField() const
For a field offsetof node, returns the field.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Kind getKind() const
Determine what kind of offsetof node this is.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
This expression type represents an asterisk in an OpenACC Size-Expr, used in the 'tile' and 'gang' cl...
void Visit(const OpenACCClause *C)
bool hasConditionExpr() const
const Expr * getConditionExpr() const
const Expr * getIntExpr() const
Represents a clause with one or more 'var' objects, represented as an expr, as its arguments.
ArrayRef< Expr * > getVarList()
This is the base type for all OpenACC Clauses.
Represents a 'collapse' clause on a 'loop' construct.
const Expr * getLoopCount() const
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
A 'default' clause, has the optional 'none' or 'present' argument.
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
unsigned getNumExprs() const
std::pair< OpenACCGangKind, const Expr * > getExpr(unsigned I) const
An 'if' clause, which has a required condition expression.
This class represents a 'loop' construct.
llvm::ArrayRef< Expr * > getIntExprs()
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
const Expr * getConditionExpr() const
bool isConditionExprClause() const
ArrayRef< Expr * > getVarList()
bool hasConditionExpr() const
llvm::ArrayRef< Expr * > getSizeExprs()
Expr * getDevNumExpr() const
llvm::ArrayRef< Expr * > getQueueIdExprs()
bool hasDevNumExpr() const
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Represents a C++11 pack expansion that produces a sequence of expressions.
ParenExpr - This represents a parenthesized expression, e.g.
Represents a parameter to a function.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
const Expr *const * const_semantics_iterator
A (possibly-)qualified type.
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Represents a __leave statement.
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
SwitchStmt - This represents a 'switch' stmt.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
Represents a C++ template name within the type system.
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,...
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
const T * castAs() const
Member-template castAs.
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs'.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Represents a call to the builtin function __builtin_va_arg.
WhileStmt - This represents a 'while' stmt.
bool isTypeConstraint() const
const TypeConstraint * getTypeConstraint() const
bool isSubstitutionFailure() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
The JSON file list parser is used to communicate input to InstallAPI.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
const FunctionProtoType * T
Data for list of allocators.