clang 20.0.0git
StmtProfile.cpp
Go to the documentation of this file.
1//===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the Stmt::Profile method, which builds a unique bit
10// representation that identifies a statement/expression.
11//
12//===----------------------------------------------------------------------===//
14#include "clang/AST/DeclCXX.h"
15#include "clang/AST/DeclObjC.h"
17#include "clang/AST/Expr.h"
18#include "clang/AST/ExprCXX.h"
19#include "clang/AST/ExprObjC.h"
21#include "clang/AST/ODRHash.h"
24#include "llvm/ADT/FoldingSet.h"
25using namespace clang;
26
27namespace {
28 class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
29 protected:
30 llvm::FoldingSetNodeID &ID;
31 bool Canonical;
32 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
47 virtual void HandleStmtClass(Stmt::StmtClass SC) = 0;
48
49#define STMT(Node, Base) void Visit##Node(const Node *S);
50#include "clang/AST/StmtNodes.inc"
51
52 /// Visit a declaration that is referenced within an expression
53 /// or statement.
54 virtual void VisitDecl(const Decl *D) = 0;
55
56 /// Visit a type that is referenced within an expression or
57 /// statement.
58 virtual void VisitType(QualType T) = 0;
59
60 /// Visit a name that occurs within an expression or statement.
61 virtual void VisitName(DeclarationName Name, bool TreatAsDecl = false) = 0;
62
63 /// Visit identifiers that are not in Decl's or Type's.
64 virtual void VisitIdentifierInfo(const IdentifierInfo *II) = 0;
65
66 /// Visit a nested-name-specifier that occurs within an expression
67 /// or statement.
68 virtual void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) = 0;
69
70 /// Visit a template name that occurs within an expression or
71 /// statement.
72 virtual void VisitTemplateName(TemplateName Name) = 0;
73
74 /// Visit template arguments that occur within an expression or
75 /// statement.
76 void VisitTemplateArguments(const TemplateArgumentLoc *Args,
77 unsigned NumArgs);
78
79 /// Visit a single template argument.
80 void VisitTemplateArgument(const TemplateArgument &Arg);
81 };
82
83 class StmtProfilerWithPointers : public StmtProfiler {
84 const ASTContext &Context;
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:
93 void HandleStmtClass(Stmt::StmtClass SC) override {
94 ID.AddInteger(SC);
95 }
96
97 void VisitDecl(const Decl *D) override {
98 ID.AddInteger(D ? D->getKind() : 0);
99
100 if (Canonical && D) {
101 if (const NonTypeTemplateParmDecl *NTTP =
102 dyn_cast<NonTypeTemplateParmDecl>(D)) {
103 ID.AddInteger(NTTP->getDepth());
104 ID.AddInteger(NTTP->getIndex());
105 ID.AddBoolean(NTTP->isParameterPack());
106 // C++20 [temp.over.link]p6:
107 // Two template-parameters are equivalent under the following
108 // conditions: [...] if they declare non-type template parameters,
109 // they have equivalent types ignoring the use of type-constraints
110 // for placeholder types
111 //
112 // TODO: Why do we need to include the type in the profile? It's not
113 // part of the mangling.
114 VisitType(Context.getUnconstrainedType(NTTP->getType()));
115 return;
116 }
117
118 if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
119 // The Itanium C++ ABI uses the type, scope depth, and scope
120 // index of a parameter when mangling expressions that involve
121 // function parameters, so we will use the parameter's type for
122 // establishing function parameter identity. That way, our
123 // definition of "equivalent" (per C++ [temp.over.link]) is at
124 // least as strong as the definition of "equivalent" used for
125 // name mangling.
126 //
127 // TODO: The Itanium C++ ABI only uses the top-level cv-qualifiers,
128 // not the entirety of the type.
129 VisitType(Parm->getType());
130 ID.AddInteger(Parm->getFunctionScopeDepth());
131 ID.AddInteger(Parm->getFunctionScopeIndex());
132 return;
133 }
134
135 if (const TemplateTypeParmDecl *TTP =
136 dyn_cast<TemplateTypeParmDecl>(D)) {
137 ID.AddInteger(TTP->getDepth());
138 ID.AddInteger(TTP->getIndex());
139 ID.AddBoolean(TTP->isParameterPack());
140 return;
141 }
142
143 if (const TemplateTemplateParmDecl *TTP =
144 dyn_cast<TemplateTemplateParmDecl>(D)) {
145 ID.AddInteger(TTP->getDepth());
146 ID.AddInteger(TTP->getIndex());
147 ID.AddBoolean(TTP->isParameterPack());
148 return;
149 }
150 }
151
152 ID.AddPointer(D ? D->getCanonicalDecl() : nullptr);
153 }
154
155 void VisitType(QualType T) override {
156 if (Canonical && !T.isNull())
157 T = Context.getCanonicalType(T);
158
159 ID.AddPointer(T.getAsOpaquePtr());
160 }
161
162 void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override {
163 ID.AddPointer(Name.getAsOpaquePtr());
164 }
165
166 void VisitIdentifierInfo(const IdentifierInfo *II) override {
167 ID.AddPointer(II);
168 }
169
170 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
171 if (Canonical)
172 NNS = Context.getCanonicalNestedNameSpecifier(NNS);
173 ID.AddPointer(NNS);
174 }
175
176 void VisitTemplateName(TemplateName Name) override {
177 if (Canonical)
178 Name = Context.getCanonicalTemplateName(Name);
179
180 Name.Profile(ID);
181 }
182 };
183
184 class StmtProfilerWithoutPointers : public StmtProfiler {
185 ODRHash &Hash;
186 public:
187 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
188 : StmtProfiler(ID, /*Canonical=*/false, /*ProfileLambdaExpr=*/false),
189 Hash(Hash) {}
190
191 private:
192 void HandleStmtClass(Stmt::StmtClass SC) override {
193 if (SC == Stmt::UnresolvedLookupExprClass) {
194 // Pretend that the name looked up is a Decl due to how templates
195 // handle some Decl lookups.
196 ID.AddInteger(Stmt::DeclRefExprClass);
197 } else {
198 ID.AddInteger(SC);
199 }
200 }
201
202 void VisitType(QualType T) override {
203 Hash.AddQualType(T);
204 }
205
206 void VisitName(DeclarationName Name, bool TreatAsDecl) override {
207 if (TreatAsDecl) {
208 // A Decl can be null, so each Decl is preceded by a boolean to
209 // store its nullness. Add a boolean here to match.
210 ID.AddBoolean(true);
211 }
212 Hash.AddDeclarationName(Name, TreatAsDecl);
213 }
214 void VisitIdentifierInfo(const IdentifierInfo *II) override {
215 ID.AddBoolean(II);
216 if (II) {
217 Hash.AddIdentifierInfo(II);
218 }
219 }
220 void VisitDecl(const Decl *D) override {
221 ID.AddBoolean(D);
222 if (D) {
223 Hash.AddDecl(D);
224 }
225 }
226 void VisitTemplateName(TemplateName Name) override {
227 Hash.AddTemplateName(Name);
228 }
229 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
230 ID.AddBoolean(NNS);
231 if (NNS) {
232 Hash.AddNestedNameSpecifier(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 // TODO: maybe visit attributes?
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 // FIXME: Implement MS style inline asm statement profiler.
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
368void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
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
395void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
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
415StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
416 VisitStmt(S);
417}
418
419void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
420 VisitStmt(S);
421}
422
423void
424StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
425 VisitStmt(S);
426}
427
428namespace {
429class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
430 StmtProfiler *Profiler;
431 /// Process clauses with list of variables.
432 template <typename T>
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"
440 void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
441 void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
442};
443
444void OMPClauseProfiler::VistOMPClauseWithPreInit(
445 const OMPClauseWithPreInit *C) {
446 if (auto *S = C->getPreInitStmt())
447 Profiler->VisitStmt(S);
448}
449
450void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
451 const OMPClauseWithPostUpdate *C) {
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::VisitOMPFullClause(const OMPFullClause *C) {}
497
498void OMPClauseProfiler::VisitOMPPartialClause(const OMPPartialClause *C) {
499 if (const Expr *Factor = C->getFactor())
500 Profiler->VisitExpr(Factor);
501}
502
503void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) {
504 if (C->getAllocator())
505 Profiler->VisitStmt(C->getAllocator());
506}
507
508void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
509 if (C->getNumForLoops())
510 Profiler->VisitStmt(C->getNumForLoops());
511}
512
513void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) {
514 if (Expr *Evt = C->getEventHandler())
515 Profiler->VisitStmt(Evt);
516}
517
518void OMPClauseProfiler::VisitOMPNovariantsClause(const OMPNovariantsClause *C) {
519 VistOMPClauseWithPreInit(C);
520 if (C->getCondition())
521 Profiler->VisitStmt(C->getCondition());
522}
523
524void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) {
525 VistOMPClauseWithPreInit(C);
526 if (C->getCondition())
527 Profiler->VisitStmt(C->getCondition());
528}
529
530void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
531
532void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
533
534void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
535 const OMPUnifiedAddressClause *C) {}
536
537void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
539
540void OMPClauseProfiler::VisitOMPReverseOffloadClause(
541 const OMPReverseOffloadClause *C) {}
542
543void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
545
546void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
548
549void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {}
550
551void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {}
552
553void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) {
554 if (C->getMessageString())
555 Profiler->VisitStmt(C->getMessageString());
556}
557
558void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
559 VistOMPClauseWithPreInit(C);
560 if (auto *S = C->getChunkSize())
561 Profiler->VisitStmt(S);
562}
563
564void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
565 if (auto *Num = C->getNumForLoops())
566 Profiler->VisitStmt(Num);
567}
568
569void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
570
571void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
572
573void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
574
575void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
576
577void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
578
579void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
580
581void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
582
583void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
584
585void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {}
586
587void OMPClauseProfiler::VisitOMPAbsentClause(const OMPAbsentClause *) {}
588
589void OMPClauseProfiler::VisitOMPHoldsClause(const OMPHoldsClause *) {}
590
591void OMPClauseProfiler::VisitOMPContainsClause(const OMPContainsClause *) {}
592
593void OMPClauseProfiler::VisitOMPNoOpenMPClause(const OMPNoOpenMPClause *) {}
594
595void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
596 const OMPNoOpenMPRoutinesClause *) {}
597
598void OMPClauseProfiler::VisitOMPNoParallelismClause(
599 const OMPNoParallelismClause *) {}
600
601void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
602
603void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
604
605void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
606
607void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
608
609void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {}
610
611void OMPClauseProfiler::VisitOMPWeakClause(const OMPWeakClause *) {}
612
613void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
614
615void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
616
617void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
618
619void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) {
620 VisitOMPClauseList(C);
621}
622
623void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) {
624 if (C->getInteropVar())
625 Profiler->VisitStmt(C->getInteropVar());
626}
627
628void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) {
629 if (C->getInteropVar())
630 Profiler->VisitStmt(C->getInteropVar());
631}
632
633void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) {
634 VistOMPClauseWithPreInit(C);
635 if (C->getThreadID())
636 Profiler->VisitStmt(C->getThreadID());
637}
638
639template<typename T>
640void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
641 for (auto *E : Node->varlist()) {
642 if (E)
643 Profiler->VisitStmt(E);
644 }
645}
646
647void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
648 VisitOMPClauseList(C);
649 for (auto *E : C->private_copies()) {
650 if (E)
651 Profiler->VisitStmt(E);
652 }
653}
654void
655OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
656 VisitOMPClauseList(C);
657 VistOMPClauseWithPreInit(C);
658 for (auto *E : C->private_copies()) {
659 if (E)
660 Profiler->VisitStmt(E);
661 }
662 for (auto *E : C->inits()) {
663 if (E)
664 Profiler->VisitStmt(E);
665 }
666}
667void
668OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
669 VisitOMPClauseList(C);
670 VistOMPClauseWithPostUpdate(C);
671 for (auto *E : C->source_exprs()) {
672 if (E)
673 Profiler->VisitStmt(E);
674 }
675 for (auto *E : C->destination_exprs()) {
676 if (E)
677 Profiler->VisitStmt(E);
678 }
679 for (auto *E : C->assignment_ops()) {
680 if (E)
681 Profiler->VisitStmt(E);
682 }
683}
684void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
685 VisitOMPClauseList(C);
686}
687void OMPClauseProfiler::VisitOMPReductionClause(
688 const OMPReductionClause *C) {
689 Profiler->VisitNestedNameSpecifier(
690 C->getQualifierLoc().getNestedNameSpecifier());
691 Profiler->VisitName(C->getNameInfo().getName());
692 VisitOMPClauseList(C);
693 VistOMPClauseWithPostUpdate(C);
694 for (auto *E : C->privates()) {
695 if (E)
696 Profiler->VisitStmt(E);
697 }
698 for (auto *E : C->lhs_exprs()) {
699 if (E)
700 Profiler->VisitStmt(E);
701 }
702 for (auto *E : C->rhs_exprs()) {
703 if (E)
704 Profiler->VisitStmt(E);
705 }
706 for (auto *E : C->reduction_ops()) {
707 if (E)
708 Profiler->VisitStmt(E);
709 }
710 if (C->getModifier() == clang::OMPC_REDUCTION_inscan) {
711 for (auto *E : C->copy_ops()) {
712 if (E)
713 Profiler->VisitStmt(E);
714 }
715 for (auto *E : C->copy_array_temps()) {
716 if (E)
717 Profiler->VisitStmt(E);
718 }
719 for (auto *E : C->copy_array_elems()) {
720 if (E)
721 Profiler->VisitStmt(E);
722 }
723 }
724}
725void OMPClauseProfiler::VisitOMPTaskReductionClause(
726 const OMPTaskReductionClause *C) {
727 Profiler->VisitNestedNameSpecifier(
728 C->getQualifierLoc().getNestedNameSpecifier());
729 Profiler->VisitName(C->getNameInfo().getName());
730 VisitOMPClauseList(C);
731 VistOMPClauseWithPostUpdate(C);
732 for (auto *E : C->privates()) {
733 if (E)
734 Profiler->VisitStmt(E);
735 }
736 for (auto *E : C->lhs_exprs()) {
737 if (E)
738 Profiler->VisitStmt(E);
739 }
740 for (auto *E : C->rhs_exprs()) {
741 if (E)
742 Profiler->VisitStmt(E);
743 }
744 for (auto *E : C->reduction_ops()) {
745 if (E)
746 Profiler->VisitStmt(E);
747 }
748}
749void OMPClauseProfiler::VisitOMPInReductionClause(
750 const OMPInReductionClause *C) {
751 Profiler->VisitNestedNameSpecifier(
752 C->getQualifierLoc().getNestedNameSpecifier());
753 Profiler->VisitName(C->getNameInfo().getName());
754 VisitOMPClauseList(C);
755 VistOMPClauseWithPostUpdate(C);
756 for (auto *E : C->privates()) {
757 if (E)
758 Profiler->VisitStmt(E);
759 }
760 for (auto *E : C->lhs_exprs()) {
761 if (E)
762 Profiler->VisitStmt(E);
763 }
764 for (auto *E : C->rhs_exprs()) {
765 if (E)
766 Profiler->VisitStmt(E);
767 }
768 for (auto *E : C->reduction_ops()) {
769 if (E)
770 Profiler->VisitStmt(E);
771 }
772 for (auto *E : C->taskgroup_descriptors()) {
773 if (E)
774 Profiler->VisitStmt(E);
775 }
776}
777void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
778 VisitOMPClauseList(C);
779 VistOMPClauseWithPostUpdate(C);
780 for (auto *E : C->privates()) {
781 if (E)
782 Profiler->VisitStmt(E);
783 }
784 for (auto *E : C->inits()) {
785 if (E)
786 Profiler->VisitStmt(E);
787 }
788 for (auto *E : C->updates()) {
789 if (E)
790 Profiler->VisitStmt(E);
791 }
792 for (auto *E : C->finals()) {
793 if (E)
794 Profiler->VisitStmt(E);
795 }
796 if (C->getStep())
797 Profiler->VisitStmt(C->getStep());
798 if (C->getCalcStep())
799 Profiler->VisitStmt(C->getCalcStep());
800}
801void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
802 VisitOMPClauseList(C);
803 if (C->getAlignment())
804 Profiler->VisitStmt(C->getAlignment());
805}
806void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
807 VisitOMPClauseList(C);
808 for (auto *E : C->source_exprs()) {
809 if (E)
810 Profiler->VisitStmt(E);
811 }
812 for (auto *E : C->destination_exprs()) {
813 if (E)
814 Profiler->VisitStmt(E);
815 }
816 for (auto *E : C->assignment_ops()) {
817 if (E)
818 Profiler->VisitStmt(E);
819 }
820}
821void
822OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
823 VisitOMPClauseList(C);
824 for (auto *E : C->source_exprs()) {
825 if (E)
826 Profiler->VisitStmt(E);
827 }
828 for (auto *E : C->destination_exprs()) {
829 if (E)
830 Profiler->VisitStmt(E);
831 }
832 for (auto *E : C->assignment_ops()) {
833 if (E)
834 Profiler->VisitStmt(E);
835 }
836}
837void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
838 VisitOMPClauseList(C);
839}
840void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) {
841 if (const Expr *Depobj = C->getDepobj())
842 Profiler->VisitStmt(Depobj);
843}
844void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
845 VisitOMPClauseList(C);
846}
847void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
848 if (C->getDevice())
849 Profiler->VisitStmt(C->getDevice());
850}
851void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
852 VisitOMPClauseList(C);
853}
854void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
855 if (Expr *Allocator = C->getAllocator())
856 Profiler->VisitStmt(Allocator);
857 VisitOMPClauseList(C);
858}
859void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
860 VisitOMPClauseList(C);
861 VistOMPClauseWithPreInit(C);
862}
863void OMPClauseProfiler::VisitOMPThreadLimitClause(
864 const OMPThreadLimitClause *C) {
865 VisitOMPClauseList(C);
866 VistOMPClauseWithPreInit(C);
867}
868void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
869 VistOMPClauseWithPreInit(C);
870 if (C->getPriority())
871 Profiler->VisitStmt(C->getPriority());
872}
873void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
874 VistOMPClauseWithPreInit(C);
875 if (C->getGrainsize())
876 Profiler->VisitStmt(C->getGrainsize());
877}
878void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
879 VistOMPClauseWithPreInit(C);
880 if (C->getNumTasks())
881 Profiler->VisitStmt(C->getNumTasks());
882}
883void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
884 if (C->getHint())
885 Profiler->VisitStmt(C->getHint());
886}
887void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
888 VisitOMPClauseList(C);
889}
890void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
891 VisitOMPClauseList(C);
892}
893void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
894 const OMPUseDevicePtrClause *C) {
895 VisitOMPClauseList(C);
896}
897void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
898 const OMPUseDeviceAddrClause *C) {
899 VisitOMPClauseList(C);
900}
901void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
902 const OMPIsDevicePtrClause *C) {
903 VisitOMPClauseList(C);
904}
905void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
906 const OMPHasDeviceAddrClause *C) {
907 VisitOMPClauseList(C);
908}
909void OMPClauseProfiler::VisitOMPNontemporalClause(
910 const OMPNontemporalClause *C) {
911 VisitOMPClauseList(C);
912 for (auto *E : C->private_refs())
913 Profiler->VisitStmt(E);
914}
915void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
916 VisitOMPClauseList(C);
917}
918void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) {
919 VisitOMPClauseList(C);
920}
921void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
922 const OMPUsesAllocatorsClause *C) {
923 for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
924 OMPUsesAllocatorsClause::Data D = C->getAllocatorData(I);
925 Profiler->VisitStmt(D.Allocator);
926 if (D.AllocatorTraits)
927 Profiler->VisitStmt(D.AllocatorTraits);
928 }
929}
930void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
931 if (const Expr *Modifier = C->getModifier())
932 Profiler->VisitStmt(Modifier);
933 for (const Expr *E : C->varlist())
934 Profiler->VisitStmt(E);
935}
936void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
937void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {}
938void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
939 const OMPXDynCGroupMemClause *C) {
940 VistOMPClauseWithPreInit(C);
941 if (Expr *Size = C->getSize())
942 Profiler->VisitStmt(Size);
943}
944void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) {
945 VisitOMPClauseList(C);
946}
947void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) {
948}
949void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {}
950} // namespace
951
952void
953StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
954 VisitStmt(S);
955 OMPClauseProfiler P(this);
956 ArrayRef<OMPClause *> Clauses = S->clauses();
957 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
958 I != E; ++I)
959 if (*I)
960 P.Visit(*I);
961}
962
963void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) {
964 VisitStmt(L);
965}
966
967void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) {
968 VisitOMPExecutableDirective(S);
969}
970
971void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
972 VisitOMPLoopBasedDirective(S);
973}
974
975void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) {
976 VisitOMPExecutableDirective(S);
977}
978
979void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
980 VisitOMPExecutableDirective(S);
981}
982
983void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
984 VisitOMPLoopDirective(S);
985}
986
987void StmtProfiler::VisitOMPLoopTransformationDirective(
989 VisitOMPLoopBasedDirective(S);
990}
991
992void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) {
993 VisitOMPLoopTransformationDirective(S);
994}
995
996void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) {
997 VisitOMPLoopTransformationDirective(S);
998}
999
1000void StmtProfiler::VisitOMPReverseDirective(const OMPReverseDirective *S) {
1001 VisitOMPLoopTransformationDirective(S);
1002}
1003
1004void StmtProfiler::VisitOMPInterchangeDirective(
1005 const OMPInterchangeDirective *S) {
1006 VisitOMPLoopTransformationDirective(S);
1007}
1008
1009void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
1010 VisitOMPLoopDirective(S);
1011}
1012
1013void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
1014 VisitOMPLoopDirective(S);
1015}
1016
1017void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
1018 VisitOMPExecutableDirective(S);
1019}
1020
1021void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
1022 VisitOMPExecutableDirective(S);
1023}
1024
1025void StmtProfiler::VisitOMPScopeDirective(const OMPScopeDirective *S) {
1026 VisitOMPExecutableDirective(S);
1027}
1028
1029void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
1030 VisitOMPExecutableDirective(S);
1031}
1032
1033void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
1034 VisitOMPExecutableDirective(S);
1035}
1036
1037void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
1038 VisitOMPExecutableDirective(S);
1039 VisitName(S->getDirectiveName().getName());
1040}
1041
1042void
1043StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
1044 VisitOMPLoopDirective(S);
1045}
1046
1047void StmtProfiler::VisitOMPParallelForSimdDirective(
1048 const OMPParallelForSimdDirective *S) {
1049 VisitOMPLoopDirective(S);
1050}
1051
1052void StmtProfiler::VisitOMPParallelMasterDirective(
1053 const OMPParallelMasterDirective *S) {
1054 VisitOMPExecutableDirective(S);
1055}
1056
1057void StmtProfiler::VisitOMPParallelMaskedDirective(
1058 const OMPParallelMaskedDirective *S) {
1059 VisitOMPExecutableDirective(S);
1060}
1061
1062void StmtProfiler::VisitOMPParallelSectionsDirective(
1064 VisitOMPExecutableDirective(S);
1065}
1066
1067void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
1068 VisitOMPExecutableDirective(S);
1069}
1070
1071void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
1072 VisitOMPExecutableDirective(S);
1073}
1074
1075void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
1076 VisitOMPExecutableDirective(S);
1077}
1078
1079void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
1080 VisitOMPExecutableDirective(S);
1081}
1082
1083void StmtProfiler::VisitOMPAssumeDirective(const OMPAssumeDirective *S) {
1084 VisitOMPExecutableDirective(S);
1085}
1086
1087void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) {
1088 VisitOMPExecutableDirective(S);
1089}
1090void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
1091 VisitOMPExecutableDirective(S);
1092 if (const Expr *E = S->getReductionRef())
1093 VisitStmt(E);
1094}
1095
1096void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
1097 VisitOMPExecutableDirective(S);
1098}
1099
1100void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1101 VisitOMPExecutableDirective(S);
1102}
1103
1104void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1105 VisitOMPExecutableDirective(S);
1106}
1107
1108void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1109 VisitOMPExecutableDirective(S);
1110}
1111
1112void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1113 VisitOMPExecutableDirective(S);
1114}
1115
1116void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1117 VisitOMPExecutableDirective(S);
1118}
1119
1120void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
1121 VisitOMPExecutableDirective(S);
1122}
1123
1124void StmtProfiler::VisitOMPTargetEnterDataDirective(
1125 const OMPTargetEnterDataDirective *S) {
1126 VisitOMPExecutableDirective(S);
1127}
1128
1129void StmtProfiler::VisitOMPTargetExitDataDirective(
1130 const OMPTargetExitDataDirective *S) {
1131 VisitOMPExecutableDirective(S);
1132}
1133
1134void StmtProfiler::VisitOMPTargetParallelDirective(
1135 const OMPTargetParallelDirective *S) {
1136 VisitOMPExecutableDirective(S);
1137}
1138
1139void StmtProfiler::VisitOMPTargetParallelForDirective(
1141 VisitOMPExecutableDirective(S);
1142}
1143
1144void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1145 VisitOMPExecutableDirective(S);
1146}
1147
1148void StmtProfiler::VisitOMPCancellationPointDirective(
1150 VisitOMPExecutableDirective(S);
1151}
1152
1153void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1154 VisitOMPExecutableDirective(S);
1155}
1156
1157void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1158 VisitOMPLoopDirective(S);
1159}
1160
1161void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1162 const OMPTaskLoopSimdDirective *S) {
1163 VisitOMPLoopDirective(S);
1164}
1165
1166void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1167 const OMPMasterTaskLoopDirective *S) {
1168 VisitOMPLoopDirective(S);
1169}
1170
1171void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1172 const OMPMaskedTaskLoopDirective *S) {
1173 VisitOMPLoopDirective(S);
1174}
1175
1176void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1178 VisitOMPLoopDirective(S);
1179}
1180
1181void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1183 VisitOMPLoopDirective(S);
1184}
1185
1186void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1188 VisitOMPLoopDirective(S);
1189}
1190
1191void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1193 VisitOMPLoopDirective(S);
1194}
1195
1196void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1198 VisitOMPLoopDirective(S);
1199}
1200
1201void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1203 VisitOMPLoopDirective(S);
1204}
1205
1206void StmtProfiler::VisitOMPDistributeDirective(
1207 const OMPDistributeDirective *S) {
1208 VisitOMPLoopDirective(S);
1209}
1210
1211void OMPClauseProfiler::VisitOMPDistScheduleClause(
1212 const OMPDistScheduleClause *C) {
1213 VistOMPClauseWithPreInit(C);
1214 if (auto *S = C->getChunkSize())
1215 Profiler->VisitStmt(S);
1216}
1217
1218void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1219
1220void StmtProfiler::VisitOMPTargetUpdateDirective(
1221 const OMPTargetUpdateDirective *S) {
1222 VisitOMPExecutableDirective(S);
1223}
1224
1225void StmtProfiler::VisitOMPDistributeParallelForDirective(
1227 VisitOMPLoopDirective(S);
1228}
1229
1230void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1232 VisitOMPLoopDirective(S);
1233}
1234
1235void StmtProfiler::VisitOMPDistributeSimdDirective(
1236 const OMPDistributeSimdDirective *S) {
1237 VisitOMPLoopDirective(S);
1238}
1239
1240void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1242 VisitOMPLoopDirective(S);
1243}
1244
1245void StmtProfiler::VisitOMPTargetSimdDirective(
1246 const OMPTargetSimdDirective *S) {
1247 VisitOMPLoopDirective(S);
1248}
1249
1250void StmtProfiler::VisitOMPTeamsDistributeDirective(
1251 const OMPTeamsDistributeDirective *S) {
1252 VisitOMPLoopDirective(S);
1253}
1254
1255void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1257 VisitOMPLoopDirective(S);
1258}
1259
1260void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1262 VisitOMPLoopDirective(S);
1263}
1264
1265void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1267 VisitOMPLoopDirective(S);
1268}
1269
1270void StmtProfiler::VisitOMPTargetTeamsDirective(
1271 const OMPTargetTeamsDirective *S) {
1272 VisitOMPExecutableDirective(S);
1273}
1274
1275void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1277 VisitOMPLoopDirective(S);
1278}
1279
1280void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1282 VisitOMPLoopDirective(S);
1283}
1284
1285void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1287 VisitOMPLoopDirective(S);
1288}
1289
1290void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1292 VisitOMPLoopDirective(S);
1293}
1294
1295void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1296 VisitOMPExecutableDirective(S);
1297}
1298
1299void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1300 VisitOMPExecutableDirective(S);
1301}
1302
1303void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1304 VisitOMPExecutableDirective(S);
1305}
1306
1307void StmtProfiler::VisitOMPGenericLoopDirective(
1308 const OMPGenericLoopDirective *S) {
1309 VisitOMPLoopDirective(S);
1310}
1311
1312void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1314 VisitOMPLoopDirective(S);
1315}
1316
1317void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1319 VisitOMPLoopDirective(S);
1320}
1321
1322void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1324 VisitOMPLoopDirective(S);
1325}
1326
1327void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1329 VisitOMPLoopDirective(S);
1330}
1331
1332void StmtProfiler::VisitExpr(const Expr *S) {
1333 VisitStmt(S);
1334}
1335
1336void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1337 VisitExpr(S);
1338}
1339
1340void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1341 VisitExpr(S);
1342 if (!Canonical)
1343 VisitNestedNameSpecifier(S->getQualifier());
1344 VisitDecl(S->getDecl());
1345 if (!Canonical) {
1346 ID.AddBoolean(S->hasExplicitTemplateArgs());
1347 if (S->hasExplicitTemplateArgs())
1348 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1349 }
1350}
1351
1352void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1353 const SYCLUniqueStableNameExpr *S) {
1354 VisitExpr(S);
1355 VisitType(S->getTypeSourceInfo()->getType());
1356}
1357
1358void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1359 VisitExpr(S);
1360 ID.AddInteger(llvm::to_underlying(S->getIdentKind()));
1361}
1362
1363void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1364 VisitExpr(S);
1365 S->getValue().Profile(ID);
1366
1367 QualType T = S->getType();
1368 if (Canonical)
1369 T = T.getCanonicalType();
1370 ID.AddInteger(T->getTypeClass());
1371 if (auto BitIntT = T->getAs<BitIntType>())
1372 BitIntT->Profile(ID);
1373 else
1374 ID.AddInteger(T->castAs<BuiltinType>()->getKind());
1375}
1376
1377void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1378 VisitExpr(S);
1379 S->getValue().Profile(ID);
1380 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1381}
1382
1383void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1384 VisitExpr(S);
1385 ID.AddInteger(llvm::to_underlying(S->getKind()));
1386 ID.AddInteger(S->getValue());
1387}
1388
1389void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1390 VisitExpr(S);
1391 S->getValue().Profile(ID);
1392 ID.AddBoolean(S->isExact());
1393 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1394}
1395
1396void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1397 VisitExpr(S);
1398}
1399
1400void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1401 VisitExpr(S);
1402 ID.AddString(S->getBytes());
1403 ID.AddInteger(llvm::to_underlying(S->getKind()));
1404}
1405
1406void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1407 VisitExpr(S);
1408}
1409
1410void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1411 VisitExpr(S);
1412}
1413
1414void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1415 VisitExpr(S);
1416 ID.AddInteger(S->getOpcode());
1417}
1418
1419void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1420 VisitType(S->getTypeSourceInfo()->getType());
1421 unsigned n = S->getNumComponents();
1422 for (unsigned i = 0; i < n; ++i) {
1423 const OffsetOfNode &ON = S->getComponent(i);
1424 ID.AddInteger(ON.getKind());
1425 switch (ON.getKind()) {
1427 // Expressions handled below.
1428 break;
1429
1431 VisitDecl(ON.getField());
1432 break;
1433
1435 VisitIdentifierInfo(ON.getFieldName());
1436 break;
1437
1438 case OffsetOfNode::Base:
1439 // These nodes are implicit, and therefore don't need profiling.
1440 break;
1441 }
1442 }
1443
1444 VisitExpr(S);
1445}
1446
1447void
1448StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1449 VisitExpr(S);
1450 ID.AddInteger(S->getKind());
1451 if (S->isArgumentType())
1452 VisitType(S->getArgumentType());
1453}
1454
1455void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1456 VisitExpr(S);
1457}
1458
1459void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1460 VisitExpr(S);
1461}
1462
1463void StmtProfiler::VisitArraySectionExpr(const ArraySectionExpr *S) {
1464 VisitExpr(S);
1465}
1466
1467void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1468 VisitExpr(S);
1469}
1470
1471void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1472 VisitExpr(S);
1473 for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1474 VisitDecl(S->getIteratorDecl(I));
1475}
1476
1477void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1478 VisitExpr(S);
1479}
1480
1481void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1482 VisitExpr(S);
1483 VisitDecl(S->getMemberDecl());
1484 if (!Canonical)
1485 VisitNestedNameSpecifier(S->getQualifier());
1486 ID.AddBoolean(S->isArrow());
1487}
1488
1489void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1490 VisitExpr(S);
1491 ID.AddBoolean(S->isFileScope());
1492}
1493
1494void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1495 VisitExpr(S);
1496}
1497
1498void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1499 VisitCastExpr(S);
1500 ID.AddInteger(S->getValueKind());
1501}
1502
1503void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1504 VisitCastExpr(S);
1505 VisitType(S->getTypeAsWritten());
1506}
1507
1508void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1509 VisitExplicitCastExpr(S);
1510}
1511
1512void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1513 VisitExpr(S);
1514 ID.AddInteger(S->getOpcode());
1515}
1516
1517void
1518StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1519 VisitBinaryOperator(S);
1520}
1521
1522void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1523 VisitExpr(S);
1524}
1525
1526void StmtProfiler::VisitBinaryConditionalOperator(
1527 const BinaryConditionalOperator *S) {
1528 VisitExpr(S);
1529}
1530
1531void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1532 VisitExpr(S);
1533 VisitDecl(S->getLabel());
1534}
1535
1536void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1537 VisitExpr(S);
1538}
1539
1540void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1541 VisitExpr(S);
1542}
1543
1544void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1545 VisitExpr(S);
1546}
1547
1548void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1549 VisitExpr(S);
1550}
1551
1552void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1553 VisitExpr(S);
1554}
1555
1556void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1557 VisitExpr(S);
1558}
1559
1560void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1561 if (S->getSyntacticForm()) {
1562 VisitInitListExpr(S->getSyntacticForm());
1563 return;
1564 }
1565
1566 VisitExpr(S);
1567}
1568
1569void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1570 VisitExpr(S);
1571 ID.AddBoolean(S->usesGNUSyntax());
1572 for (const DesignatedInitExpr::Designator &D : S->designators()) {
1573 if (D.isFieldDesignator()) {
1574 ID.AddInteger(0);
1575 VisitName(D.getFieldName());
1576 continue;
1577 }
1578
1579 if (D.isArrayDesignator()) {
1580 ID.AddInteger(1);
1581 } else {
1582 assert(D.isArrayRangeDesignator());
1583 ID.AddInteger(2);
1584 }
1585 ID.AddInteger(D.getArrayIndex());
1586 }
1587}
1588
1589// Seems that if VisitInitListExpr() only works on the syntactic form of an
1590// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1591void StmtProfiler::VisitDesignatedInitUpdateExpr(
1592 const DesignatedInitUpdateExpr *S) {
1593 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1594 "initializer");
1595}
1596
1597void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1598 VisitExpr(S);
1599}
1600
1601void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1602 VisitExpr(S);
1603}
1604
1605void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1606 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1607}
1608
1609void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1610 VisitExpr(S);
1611}
1612
1613void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1614 VisitExpr(S);
1615 VisitName(&S->getAccessor());
1616}
1617
1618void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1619 VisitExpr(S);
1620 VisitDecl(S->getBlockDecl());
1621}
1622
1623void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1624 VisitExpr(S);
1626 S->associations()) {
1627 QualType T = Assoc.getType();
1628 if (T.isNull())
1629 ID.AddPointer(nullptr);
1630 else
1631 VisitType(T);
1632 VisitExpr(Assoc.getAssociationExpr());
1633 }
1634}
1635
1636void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1637 VisitExpr(S);
1639 i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1640 // Normally, we would not profile the source expressions of OVEs.
1641 if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1642 Visit(OVE->getSourceExpr());
1643}
1644
1645void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1646 VisitExpr(S);
1647 ID.AddInteger(S->getOp());
1648}
1649
1650void StmtProfiler::VisitConceptSpecializationExpr(
1651 const ConceptSpecializationExpr *S) {
1652 VisitExpr(S);
1653 VisitDecl(S->getNamedConcept());
1654 for (const TemplateArgument &Arg : S->getTemplateArguments())
1655 VisitTemplateArgument(Arg);
1656}
1657
1658void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1659 VisitExpr(S);
1660 ID.AddInteger(S->getLocalParameters().size());
1661 for (ParmVarDecl *LocalParam : S->getLocalParameters())
1662 VisitDecl(LocalParam);
1663 ID.AddInteger(S->getRequirements().size());
1664 for (concepts::Requirement *Req : S->getRequirements()) {
1665 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1667 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1668 if (!TypeReq->isSubstitutionFailure())
1669 VisitType(TypeReq->getType()->getType());
1670 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1672 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1673 if (!ExprReq->isExprSubstitutionFailure())
1674 Visit(ExprReq->getExpr());
1675 // C++2a [expr.prim.req.compound]p1 Example:
1676 // [...] The compound-requirement in C1 requires that x++ is a valid
1677 // expression. It is equivalent to the simple-requirement x++; [...]
1678 // We therefore do not profile isSimple() here.
1679 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1681 ExprReq->getReturnTypeRequirement();
1682 if (RetReq.isEmpty()) {
1683 ID.AddInteger(0);
1684 } else if (RetReq.isTypeConstraint()) {
1685 ID.AddInteger(1);
1687 } else {
1688 assert(RetReq.isSubstitutionFailure());
1689 ID.AddInteger(2);
1690 }
1691 } else {
1693 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1694 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1695 if (!NestedReq->hasInvalidConstraint())
1696 Visit(NestedReq->getConstraintExpr());
1697 }
1698 }
1699}
1700
1702 UnaryOperatorKind &UnaryOp,
1703 BinaryOperatorKind &BinaryOp,
1704 unsigned &NumArgs) {
1705 switch (S->getOperator()) {
1706 case OO_None:
1707 case OO_New:
1708 case OO_Delete:
1709 case OO_Array_New:
1710 case OO_Array_Delete:
1711 case OO_Arrow:
1712 case OO_Conditional:
1714 llvm_unreachable("Invalid operator call kind");
1715
1716 case OO_Plus:
1717 if (NumArgs == 1) {
1718 UnaryOp = UO_Plus;
1719 return Stmt::UnaryOperatorClass;
1720 }
1721
1722 BinaryOp = BO_Add;
1723 return Stmt::BinaryOperatorClass;
1724
1725 case OO_Minus:
1726 if (NumArgs == 1) {
1727 UnaryOp = UO_Minus;
1728 return Stmt::UnaryOperatorClass;
1729 }
1730
1731 BinaryOp = BO_Sub;
1732 return Stmt::BinaryOperatorClass;
1733
1734 case OO_Star:
1735 if (NumArgs == 1) {
1736 UnaryOp = UO_Deref;
1737 return Stmt::UnaryOperatorClass;
1738 }
1739
1740 BinaryOp = BO_Mul;
1741 return Stmt::BinaryOperatorClass;
1742
1743 case OO_Slash:
1744 BinaryOp = BO_Div;
1745 return Stmt::BinaryOperatorClass;
1746
1747 case OO_Percent:
1748 BinaryOp = BO_Rem;
1749 return Stmt::BinaryOperatorClass;
1750
1751 case OO_Caret:
1752 BinaryOp = BO_Xor;
1753 return Stmt::BinaryOperatorClass;
1754
1755 case OO_Amp:
1756 if (NumArgs == 1) {
1757 UnaryOp = UO_AddrOf;
1758 return Stmt::UnaryOperatorClass;
1759 }
1760
1761 BinaryOp = BO_And;
1762 return Stmt::BinaryOperatorClass;
1763
1764 case OO_Pipe:
1765 BinaryOp = BO_Or;
1766 return Stmt::BinaryOperatorClass;
1767
1768 case OO_Tilde:
1769 UnaryOp = UO_Not;
1770 return Stmt::UnaryOperatorClass;
1771
1772 case OO_Exclaim:
1773 UnaryOp = UO_LNot;
1774 return Stmt::UnaryOperatorClass;
1775
1776 case OO_Equal:
1777 BinaryOp = BO_Assign;
1778 return Stmt::BinaryOperatorClass;
1779
1780 case OO_Less:
1781 BinaryOp = BO_LT;
1782 return Stmt::BinaryOperatorClass;
1783
1784 case OO_Greater:
1785 BinaryOp = BO_GT;
1786 return Stmt::BinaryOperatorClass;
1787
1788 case OO_PlusEqual:
1789 BinaryOp = BO_AddAssign;
1790 return Stmt::CompoundAssignOperatorClass;
1791
1792 case OO_MinusEqual:
1793 BinaryOp = BO_SubAssign;
1794 return Stmt::CompoundAssignOperatorClass;
1795
1796 case OO_StarEqual:
1797 BinaryOp = BO_MulAssign;
1798 return Stmt::CompoundAssignOperatorClass;
1799
1800 case OO_SlashEqual:
1801 BinaryOp = BO_DivAssign;
1802 return Stmt::CompoundAssignOperatorClass;
1803
1804 case OO_PercentEqual:
1805 BinaryOp = BO_RemAssign;
1806 return Stmt::CompoundAssignOperatorClass;
1807
1808 case OO_CaretEqual:
1809 BinaryOp = BO_XorAssign;
1810 return Stmt::CompoundAssignOperatorClass;
1811
1812 case OO_AmpEqual:
1813 BinaryOp = BO_AndAssign;
1814 return Stmt::CompoundAssignOperatorClass;
1815
1816 case OO_PipeEqual:
1817 BinaryOp = BO_OrAssign;
1818 return Stmt::CompoundAssignOperatorClass;
1819
1820 case OO_LessLess:
1821 BinaryOp = BO_Shl;
1822 return Stmt::BinaryOperatorClass;
1823
1824 case OO_GreaterGreater:
1825 BinaryOp = BO_Shr;
1826 return Stmt::BinaryOperatorClass;
1827
1828 case OO_LessLessEqual:
1829 BinaryOp = BO_ShlAssign;
1830 return Stmt::CompoundAssignOperatorClass;
1831
1832 case OO_GreaterGreaterEqual:
1833 BinaryOp = BO_ShrAssign;
1834 return Stmt::CompoundAssignOperatorClass;
1835
1836 case OO_EqualEqual:
1837 BinaryOp = BO_EQ;
1838 return Stmt::BinaryOperatorClass;
1839
1840 case OO_ExclaimEqual:
1841 BinaryOp = BO_NE;
1842 return Stmt::BinaryOperatorClass;
1843
1844 case OO_LessEqual:
1845 BinaryOp = BO_LE;
1846 return Stmt::BinaryOperatorClass;
1847
1848 case OO_GreaterEqual:
1849 BinaryOp = BO_GE;
1850 return Stmt::BinaryOperatorClass;
1851
1852 case OO_Spaceship:
1853 BinaryOp = BO_Cmp;
1854 return Stmt::BinaryOperatorClass;
1855
1856 case OO_AmpAmp:
1857 BinaryOp = BO_LAnd;
1858 return Stmt::BinaryOperatorClass;
1859
1860 case OO_PipePipe:
1861 BinaryOp = BO_LOr;
1862 return Stmt::BinaryOperatorClass;
1863
1864 case OO_PlusPlus:
1865 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1866 NumArgs = 1;
1867 return Stmt::UnaryOperatorClass;
1868
1869 case OO_MinusMinus:
1870 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1871 NumArgs = 1;
1872 return Stmt::UnaryOperatorClass;
1873
1874 case OO_Comma:
1875 BinaryOp = BO_Comma;
1876 return Stmt::BinaryOperatorClass;
1877
1878 case OO_ArrowStar:
1879 BinaryOp = BO_PtrMemI;
1880 return Stmt::BinaryOperatorClass;
1881
1882 case OO_Subscript:
1883 return Stmt::ArraySubscriptExprClass;
1884
1885 case OO_Call:
1886 return Stmt::CallExprClass;
1887
1888 case OO_Coawait:
1889 UnaryOp = UO_Coawait;
1890 return Stmt::UnaryOperatorClass;
1891 }
1892
1893 llvm_unreachable("Invalid overloaded operator expression");
1894}
1895
1896#if defined(_MSC_VER) && !defined(__clang__)
1897#if _MSC_VER == 1911
1898// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1899// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1900// will crash in stage 2 of a bootstrap build.
1901#pragma optimize("", off)
1902#endif
1903#endif
1904
1905void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1906 if (S->isTypeDependent()) {
1907 // Type-dependent operator calls are profiled like their underlying
1908 // syntactic operator.
1909 //
1910 // An operator call to operator-> is always implicit, so just skip it. The
1911 // enclosing MemberExpr will profile the actual member access.
1912 if (S->getOperator() == OO_Arrow)
1913 return Visit(S->getArg(0));
1914
1915 UnaryOperatorKind UnaryOp = UO_Extension;
1916 BinaryOperatorKind BinaryOp = BO_Comma;
1917 unsigned NumArgs = S->getNumArgs();
1918 Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp, NumArgs);
1919
1920 ID.AddInteger(SC);
1921 for (unsigned I = 0; I != NumArgs; ++I)
1922 Visit(S->getArg(I));
1923 if (SC == Stmt::UnaryOperatorClass)
1924 ID.AddInteger(UnaryOp);
1925 else if (SC == Stmt::BinaryOperatorClass ||
1926 SC == Stmt::CompoundAssignOperatorClass)
1927 ID.AddInteger(BinaryOp);
1928 else
1929 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1930
1931 return;
1932 }
1933
1934 VisitCallExpr(S);
1935 ID.AddInteger(S->getOperator());
1936}
1937
1938void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1939 const CXXRewrittenBinaryOperator *S) {
1940 // If a rewritten operator were ever to be type-dependent, we should profile
1941 // it following its syntactic operator.
1942 assert(!S->isTypeDependent() &&
1943 "resolved rewritten operator should never be type-dependent");
1944 ID.AddBoolean(S->isReversed());
1945 VisitExpr(S->getSemanticForm());
1946}
1947
1948#if defined(_MSC_VER) && !defined(__clang__)
1949#if _MSC_VER == 1911
1950#pragma optimize("", on)
1951#endif
1952#endif
1953
1954void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1955 VisitCallExpr(S);
1956}
1957
1958void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1959 VisitCallExpr(S);
1960}
1961
1962void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1963 VisitExpr(S);
1964}
1965
1966void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1967 VisitExplicitCastExpr(S);
1968}
1969
1970void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1971 VisitCXXNamedCastExpr(S);
1972}
1973
1974void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1975 VisitCXXNamedCastExpr(S);
1976}
1977
1978void
1979StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1980 VisitCXXNamedCastExpr(S);
1981}
1982
1983void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1984 VisitCXXNamedCastExpr(S);
1985}
1986
1987void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1988 VisitExpr(S);
1989 VisitType(S->getTypeInfoAsWritten()->getType());
1990}
1991
1992void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1993 VisitCXXNamedCastExpr(S);
1994}
1995
1996void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1997 VisitCallExpr(S);
1998}
1999
2000void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
2001 VisitExpr(S);
2002 ID.AddBoolean(S->getValue());
2003}
2004
2005void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
2006 VisitExpr(S);
2007}
2008
2009void StmtProfiler::VisitCXXStdInitializerListExpr(
2010 const CXXStdInitializerListExpr *S) {
2011 VisitExpr(S);
2012}
2013
2014void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
2015 VisitExpr(S);
2016 if (S->isTypeOperand())
2017 VisitType(S->getTypeOperandSourceInfo()->getType());
2018}
2019
2020void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
2021 VisitExpr(S);
2022 if (S->isTypeOperand())
2023 VisitType(S->getTypeOperandSourceInfo()->getType());
2024}
2025
2026void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
2027 VisitExpr(S);
2028 VisitDecl(S->getPropertyDecl());
2029}
2030
2031void StmtProfiler::VisitMSPropertySubscriptExpr(
2032 const MSPropertySubscriptExpr *S) {
2033 VisitExpr(S);
2034}
2035
2036void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
2037 VisitExpr(S);
2038 ID.AddBoolean(S->isImplicit());
2039 ID.AddBoolean(S->isCapturedByCopyInLambdaWithExplicitObjectParameter());
2040}
2041
2042void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
2043 VisitExpr(S);
2044}
2045
2046void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
2047 VisitExpr(S);
2048 VisitDecl(S->getParam());
2049}
2050
2051void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
2052 VisitExpr(S);
2053 VisitDecl(S->getField());
2054}
2055
2056void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
2057 VisitExpr(S);
2058 VisitDecl(
2059 const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
2060}
2061
2062void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
2063 VisitExpr(S);
2064 VisitDecl(S->getConstructor());
2065 ID.AddBoolean(S->isElidable());
2066}
2067
2068void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2069 const CXXInheritedCtorInitExpr *S) {
2070 VisitExpr(S);
2071 VisitDecl(S->getConstructor());
2072}
2073
2074void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
2075 VisitExplicitCastExpr(S);
2076}
2077
2078void
2079StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
2080 VisitCXXConstructExpr(S);
2081}
2082
2083void
2084StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
2085 if (!ProfileLambdaExpr) {
2086 // Do not recursively visit the children of this expression. Profiling the
2087 // body would result in unnecessary work, and is not safe to do during
2088 // deserialization.
2089 VisitStmtNoChildren(S);
2090
2091 // C++20 [temp.over.link]p5:
2092 // Two lambda-expressions are never considered equivalent.
2093 VisitDecl(S->getLambdaClass());
2094
2095 return;
2096 }
2097
2098 CXXRecordDecl *Lambda = S->getLambdaClass();
2099 for (const auto &Capture : Lambda->captures()) {
2100 ID.AddInteger(Capture.getCaptureKind());
2101 if (Capture.capturesVariable())
2102 VisitDecl(Capture.getCapturedVar());
2103 }
2104
2105 // Profiling the body of the lambda may be dangerous during deserialization.
2106 // So we'd like only to profile the signature here.
2107 ODRHash Hasher;
2108 // FIXME: We can't get the operator call easily by
2109 // `CXXRecordDecl::getLambdaCallOperator()` if we're in deserialization.
2110 // So we have to do something raw here.
2111 for (auto *SubDecl : Lambda->decls()) {
2112 FunctionDecl *Call = nullptr;
2113 if (auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2114 Call = FTD->getTemplatedDecl();
2115 else if (auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2116 Call = FD;
2117
2118 if (!Call)
2119 continue;
2120
2121 Hasher.AddFunctionDecl(Call, /*SkipBody=*/true);
2122 }
2123 ID.AddInteger(Hasher.CalculateHash());
2124}
2125
2126void
2127StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
2128 VisitExpr(S);
2129}
2130
2131void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
2132 VisitExpr(S);
2133 ID.AddBoolean(S->isGlobalDelete());
2134 ID.AddBoolean(S->isArrayForm());
2135 VisitDecl(S->getOperatorDelete());
2136}
2137
2138void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
2139 VisitExpr(S);
2140 VisitType(S->getAllocatedType());
2141 VisitDecl(S->getOperatorNew());
2142 VisitDecl(S->getOperatorDelete());
2143 ID.AddBoolean(S->isArray());
2144 ID.AddInteger(S->getNumPlacementArgs());
2145 ID.AddBoolean(S->isGlobalNew());
2146 ID.AddBoolean(S->isParenTypeId());
2147 ID.AddInteger(llvm::to_underlying(S->getInitializationStyle()));
2148}
2149
2150void
2151StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
2152 VisitExpr(S);
2153 ID.AddBoolean(S->isArrow());
2154 VisitNestedNameSpecifier(S->getQualifier());
2155 ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
2156 if (S->getScopeTypeInfo())
2157 VisitType(S->getScopeTypeInfo()->getType());
2158 ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
2159 if (S->getDestroyedTypeInfo())
2160 VisitType(S->getDestroyedType());
2161 else
2162 VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
2163}
2164
2165void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
2166 VisitExpr(S);
2167 VisitNestedNameSpecifier(S->getQualifier());
2168 VisitName(S->getName(), /*TreatAsDecl*/ true);
2169 ID.AddBoolean(S->hasExplicitTemplateArgs());
2170 if (S->hasExplicitTemplateArgs())
2171 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2172}
2173
2174void
2175StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
2176 VisitOverloadExpr(S);
2177}
2178
2179void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2180 VisitExpr(S);
2181 ID.AddInteger(S->getTrait());
2182 ID.AddInteger(S->getNumArgs());
2183 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2184 VisitType(S->getArg(I)->getType());
2185}
2186
2187void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2188 VisitExpr(S);
2189 ID.AddInteger(S->getTrait());
2190 VisitType(S->getQueriedType());
2191}
2192
2193void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2194 VisitExpr(S);
2195 ID.AddInteger(S->getTrait());
2196 VisitExpr(S->getQueriedExpression());
2197}
2198
2199void StmtProfiler::VisitDependentScopeDeclRefExpr(
2200 const DependentScopeDeclRefExpr *S) {
2201 VisitExpr(S);
2202 VisitName(S->getDeclName());
2203 VisitNestedNameSpecifier(S->getQualifier());
2204 ID.AddBoolean(S->hasExplicitTemplateArgs());
2205 if (S->hasExplicitTemplateArgs())
2206 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2207}
2208
2209void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2210 VisitExpr(S);
2211}
2212
2213void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2214 const CXXUnresolvedConstructExpr *S) {
2215 VisitExpr(S);
2216 VisitType(S->getTypeAsWritten());
2217 ID.AddInteger(S->isListInitialization());
2218}
2219
2220void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2221 const CXXDependentScopeMemberExpr *S) {
2222 ID.AddBoolean(S->isImplicitAccess());
2223 if (!S->isImplicitAccess()) {
2224 VisitExpr(S);
2225 ID.AddBoolean(S->isArrow());
2226 }
2227 VisitNestedNameSpecifier(S->getQualifier());
2228 VisitName(S->getMember());
2229 ID.AddBoolean(S->hasExplicitTemplateArgs());
2230 if (S->hasExplicitTemplateArgs())
2231 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2232}
2233
2234void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2235 ID.AddBoolean(S->isImplicitAccess());
2236 if (!S->isImplicitAccess()) {
2237 VisitExpr(S);
2238 ID.AddBoolean(S->isArrow());
2239 }
2240 VisitNestedNameSpecifier(S->getQualifier());
2241 VisitName(S->getMemberName());
2242 ID.AddBoolean(S->hasExplicitTemplateArgs());
2243 if (S->hasExplicitTemplateArgs())
2244 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2245}
2246
2247void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2248 VisitExpr(S);
2249}
2250
2251void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2252 VisitExpr(S);
2253}
2254
2255void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2256 VisitExpr(S);
2257 VisitDecl(S->getPack());
2258 if (S->isPartiallySubstituted()) {
2259 auto Args = S->getPartialArguments();
2260 ID.AddInteger(Args.size());
2261 for (const auto &TA : Args)
2262 VisitTemplateArgument(TA);
2263 } else {
2264 ID.AddInteger(0);
2265 }
2266}
2267
2268void StmtProfiler::VisitPackIndexingExpr(const PackIndexingExpr *E) {
2269 VisitExpr(E);
2270 VisitExpr(E->getPackIdExpression());
2271 VisitExpr(E->getIndexExpr());
2272}
2273
2274void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2276 VisitExpr(S);
2277 VisitDecl(S->getParameterPack());
2278 VisitTemplateArgument(S->getArgumentPack());
2279}
2280
2281void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2283 // Profile exactly as the replacement expression.
2284 Visit(E->getReplacement());
2285}
2286
2287void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2288 VisitExpr(S);
2289 VisitDecl(S->getParameterPack());
2290 ID.AddInteger(S->getNumExpansions());
2291 for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
2292 VisitDecl(*I);
2293}
2294
2295void StmtProfiler::VisitMaterializeTemporaryExpr(
2296 const MaterializeTemporaryExpr *S) {
2297 VisitExpr(S);
2298}
2299
2300void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2301 VisitExpr(S);
2302 ID.AddInteger(S->getOperator());
2303}
2304
2305void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) {
2306 VisitExpr(S);
2307}
2308
2309void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2310 VisitStmt(S);
2311}
2312
2313void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2314 VisitStmt(S);
2315}
2316
2317void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2318 VisitExpr(S);
2319}
2320
2321void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2322 VisitExpr(S);
2323}
2324
2325void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2326 VisitExpr(S);
2327}
2328
2329void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2330 VisitExpr(E);
2331}
2332
2333void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2334 VisitExpr(E);
2335}
2336
2337void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2338 VisitExpr(E);
2339}
2340
2341void StmtProfiler::VisitEmbedExpr(const EmbedExpr *E) { VisitExpr(E); }
2342
2343void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2344
2345void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2346 VisitExpr(S);
2347}
2348
2349void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2350 VisitExpr(E);
2351}
2352
2353void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2354 VisitExpr(E);
2355}
2356
2357void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2358 VisitExpr(E);
2359}
2360
2361void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2362 VisitExpr(S);
2363 VisitType(S->getEncodedType());
2364}
2365
2366void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2367 VisitExpr(S);
2368 VisitName(S->getSelector());
2369}
2370
2371void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2372 VisitExpr(S);
2373 VisitDecl(S->getProtocol());
2374}
2375
2376void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2377 VisitExpr(S);
2378 VisitDecl(S->getDecl());
2379 ID.AddBoolean(S->isArrow());
2380 ID.AddBoolean(S->isFreeIvar());
2381}
2382
2383void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2384 VisitExpr(S);
2385 if (S->isImplicitProperty()) {
2386 VisitDecl(S->getImplicitPropertyGetter());
2387 VisitDecl(S->getImplicitPropertySetter());
2388 } else {
2389 VisitDecl(S->getExplicitProperty());
2390 }
2391 if (S->isSuperReceiver()) {
2392 ID.AddBoolean(S->isSuperReceiver());
2393 VisitType(S->getSuperReceiverType());
2394 }
2395}
2396
2397void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2398 VisitExpr(S);
2399 VisitDecl(S->getAtIndexMethodDecl());
2400 VisitDecl(S->setAtIndexMethodDecl());
2401}
2402
2403void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2404 VisitExpr(S);
2405 VisitName(S->getSelector());
2406 VisitDecl(S->getMethodDecl());
2407}
2408
2409void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2410 VisitExpr(S);
2411 ID.AddBoolean(S->isArrow());
2412}
2413
2414void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2415 VisitExpr(S);
2416 ID.AddBoolean(S->getValue());
2417}
2418
2419void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2420 const ObjCIndirectCopyRestoreExpr *S) {
2421 VisitExpr(S);
2422 ID.AddBoolean(S->shouldCopy());
2423}
2424
2425void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2426 VisitExplicitCastExpr(S);
2427 ID.AddBoolean(S->getBridgeKind());
2428}
2429
2430void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2431 const ObjCAvailabilityCheckExpr *S) {
2432 VisitExpr(S);
2433}
2434
2435void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2436 unsigned NumArgs) {
2437 ID.AddInteger(NumArgs);
2438 for (unsigned I = 0; I != NumArgs; ++I)
2439 VisitTemplateArgument(Args[I].getArgument());
2440}
2441
2442void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2443 // Mostly repetitive with TemplateArgument::Profile!
2444 ID.AddInteger(Arg.getKind());
2445 switch (Arg.getKind()) {
2447 break;
2448
2450 VisitType(Arg.getAsType());
2451 break;
2452
2455 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2456 break;
2457
2459 VisitType(Arg.getParamTypeForDecl());
2460 // FIXME: Do we need to recursively decompose template parameter objects?
2461 VisitDecl(Arg.getAsDecl());
2462 break;
2463
2465 VisitType(Arg.getNullPtrType());
2466 break;
2467
2469 VisitType(Arg.getIntegralType());
2470 Arg.getAsIntegral().Profile(ID);
2471 break;
2472
2474 VisitType(Arg.getStructuralValueType());
2475 // FIXME: Do we need to recursively decompose this ourselves?
2476 Arg.getAsStructuralValue().Profile(ID);
2477 break;
2478
2480 Visit(Arg.getAsExpr());
2481 break;
2482
2484 for (const auto &P : Arg.pack_elements())
2485 VisitTemplateArgument(P);
2486 break;
2487 }
2488}
2489
2490namespace {
2491class OpenACCClauseProfiler
2492 : public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2493 StmtProfiler &Profiler;
2494
2495public:
2496 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2497
2498 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2499 for (const OpenACCClause *Clause : Clauses) {
2500 // TODO OpenACC: When we have clauses with expressions, we should
2501 // profile them too.
2502 Visit(Clause);
2503 }
2504 }
2505
2506#define VISIT_CLAUSE(CLAUSE_NAME) \
2507 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2508
2509#include "clang/Basic/OpenACCClauses.def"
2510};
2511
2512/// Nothing to do here, there are no sub-statements.
2513void OpenACCClauseProfiler::VisitDefaultClause(
2514 const OpenACCDefaultClause &Clause) {}
2515
2516void OpenACCClauseProfiler::VisitIfClause(const OpenACCIfClause &Clause) {
2517 assert(Clause.hasConditionExpr() &&
2518 "if clause requires a valid condition expr");
2519 Profiler.VisitStmt(Clause.getConditionExpr());
2520}
2521
2522void OpenACCClauseProfiler::VisitCopyClause(const OpenACCCopyClause &Clause) {
2523 for (auto *E : Clause.getVarList())
2524 Profiler.VisitStmt(E);
2525}
2526void OpenACCClauseProfiler::VisitCopyInClause(
2527 const OpenACCCopyInClause &Clause) {
2528 for (auto *E : Clause.getVarList())
2529 Profiler.VisitStmt(E);
2530}
2531
2532void OpenACCClauseProfiler::VisitCopyOutClause(
2533 const OpenACCCopyOutClause &Clause) {
2534 for (auto *E : Clause.getVarList())
2535 Profiler.VisitStmt(E);
2536}
2537
2538void OpenACCClauseProfiler::VisitCreateClause(
2539 const OpenACCCreateClause &Clause) {
2540 for (auto *E : Clause.getVarList())
2541 Profiler.VisitStmt(E);
2542}
2543
2544void OpenACCClauseProfiler::VisitSelfClause(const OpenACCSelfClause &Clause) {
2545 if (Clause.hasConditionExpr())
2546 Profiler.VisitStmt(Clause.getConditionExpr());
2547}
2548
2549void OpenACCClauseProfiler::VisitNumGangsClause(
2550 const OpenACCNumGangsClause &Clause) {
2551 for (auto *E : Clause.getIntExprs())
2552 Profiler.VisitStmt(E);
2553}
2554
2555void OpenACCClauseProfiler::VisitNumWorkersClause(
2556 const OpenACCNumWorkersClause &Clause) {
2557 assert(Clause.hasIntExpr() && "num_workers clause requires a valid int expr");
2558 Profiler.VisitStmt(Clause.getIntExpr());
2559}
2560
2561void OpenACCClauseProfiler::VisitPrivateClause(
2562 const OpenACCPrivateClause &Clause) {
2563 for (auto *E : Clause.getVarList())
2564 Profiler.VisitStmt(E);
2565}
2566
2567void OpenACCClauseProfiler::VisitFirstPrivateClause(
2568 const OpenACCFirstPrivateClause &Clause) {
2569 for (auto *E : Clause.getVarList())
2570 Profiler.VisitStmt(E);
2571}
2572
2573void OpenACCClauseProfiler::VisitAttachClause(
2574 const OpenACCAttachClause &Clause) {
2575 for (auto *E : Clause.getVarList())
2576 Profiler.VisitStmt(E);
2577}
2578
2579void OpenACCClauseProfiler::VisitDevicePtrClause(
2580 const OpenACCDevicePtrClause &Clause) {
2581 for (auto *E : Clause.getVarList())
2582 Profiler.VisitStmt(E);
2583}
2584
2585void OpenACCClauseProfiler::VisitNoCreateClause(
2586 const OpenACCNoCreateClause &Clause) {
2587 for (auto *E : Clause.getVarList())
2588 Profiler.VisitStmt(E);
2589}
2590
2591void OpenACCClauseProfiler::VisitPresentClause(
2592 const OpenACCPresentClause &Clause) {
2593 for (auto *E : Clause.getVarList())
2594 Profiler.VisitStmt(E);
2595}
2596
2597void OpenACCClauseProfiler::VisitVectorLengthClause(
2598 const OpenACCVectorLengthClause &Clause) {
2599 assert(Clause.hasIntExpr() &&
2600 "vector_length clause requires a valid int expr");
2601 Profiler.VisitStmt(Clause.getIntExpr());
2602}
2603
2604void OpenACCClauseProfiler::VisitAsyncClause(const OpenACCAsyncClause &Clause) {
2605 if (Clause.hasIntExpr())
2606 Profiler.VisitStmt(Clause.getIntExpr());
2607}
2608
2609void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) {
2610 if (Clause.hasDevNumExpr())
2611 Profiler.VisitStmt(Clause.getDevNumExpr());
2612 for (auto *E : Clause.getQueueIdExprs())
2613 Profiler.VisitStmt(E);
2614}
2615/// Nothing to do here, there are no sub-statements.
2616void OpenACCClauseProfiler::VisitDeviceTypeClause(
2617 const OpenACCDeviceTypeClause &Clause) {}
2618
2619void OpenACCClauseProfiler::VisitAutoClause(const OpenACCAutoClause &Clause) {}
2620
2621void OpenACCClauseProfiler::VisitIndependentClause(
2622 const OpenACCIndependentClause &Clause) {}
2623
2624void OpenACCClauseProfiler::VisitSeqClause(const OpenACCSeqClause &Clause) {}
2625
2626void OpenACCClauseProfiler::VisitReductionClause(
2627 const OpenACCReductionClause &Clause) {
2628 for (auto *E : Clause.getVarList())
2629 Profiler.VisitStmt(E);
2630}
2631} // namespace
2632
2633void StmtProfiler::VisitOpenACCComputeConstruct(
2634 const OpenACCComputeConstruct *S) {
2635 // VisitStmt handles children, so the AssociatedStmt is handled.
2636 VisitStmt(S);
2637
2638 OpenACCClauseProfiler P{*this};
2639 P.VisitOpenACCClauseList(S->clauses());
2640}
2641
2642void StmtProfiler::VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S) {
2643 // VisitStmt handles children, so the Loop is handled.
2644 VisitStmt(S);
2645
2646 OpenACCClauseProfiler P{*this};
2647 P.VisitOpenACCClauseList(S->clauses());
2648}
2649
2650void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2651 bool Canonical, bool ProfileLambdaExpr) const {
2652 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
2653 Profiler.Visit(this);
2654}
2655
2656void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2657 class ODRHash &Hash) const {
2658 StmtProfilerWithoutPointers Profiler(ID, Hash);
2659 Profiler.Visit(this);
2660}
Defines the clang::ASTContext interface.
DynTypedNode Node
StringRef P
const Decl * D
Expr * E
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.
Definition: APValue.cpp:479
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:187
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2628
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4372
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5756
Represents a loop initializing the elements of an array.
Definition: Expr.h:5703
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6926
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2674
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
Definition: ExprCXX.h:2853
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6426
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6629
Represents an attribute applied to a statement.
Definition: Stmt.h:2090
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4275
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3860
A fixed int type of a specified bitwidth.
Definition: Type.h:7638
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6365
BreakStmt - This represents a break.
Definition: Stmt.h:2990
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5292
This class is used for builtin types like 'int'.
Definition: Type.h:3028
Kind getKind() const
Definition: Type.h:3076
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Definition: Expr.h:3791
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:231
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:601
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1491
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:720
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:563
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1546
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1268
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1375
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2498
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3683
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2803
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:478
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4840
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Definition: ExprCXX.h:1817
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1737
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:176
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:372
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2241
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4126
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:765
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:81
Represents a list-initialization with parenthesis.
Definition: ExprCXX.h:4954
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2617
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
capture_const_range captures() const
Definition: DeclCXX.h:1102
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates an rvalue of a non-class type T.
Definition: ExprCXX.h:2182
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:433
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:797
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1885
Represents the this expression in C++.
Definition: ExprCXX.h:1152
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1206
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:845
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3557
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1066
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2830
This captures a statement into a function.
Definition: Stmt.h:3767
CaseStmt - Represent a case statement.
Definition: Stmt.h:1811
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3498
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4592
Represents a 'co_await' expression.
Definition: ExprCXX.h:5185
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4122
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3428
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1611
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4213
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:195
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:1077
ContinueStmt - This represents a continue.
Definition: Stmt.h:2960
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4533
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:473
Represents the body of a coroutine.
Definition: StmtCXX.h:320
Represents a 'co_yield' expression.
Definition: ExprCXX.h:5266
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition: DeclBase.h:2350
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1265
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1502
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:968
Kind getKind() const
Definition: DeclBase.h:449
The name of a declaration.
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5217
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3323
Represents a single C99 designator.
Definition: Expr.h:5327
Represents a C99 designated initializer expression.
Definition: Expr.h:5284
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2735
Represents a reference to #emded data.
Definition: Expr.h:4867
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3750
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:3474
This represents one expression.
Definition: Expr.h:110
An expression trait intrinsic.
Definition: ExprCXX.h:2924
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6305
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2791
Represents a function declaration or definition.
Definition: Decl.h:1932
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4648
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4682
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3269
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4667
Represents a C11 generic selection.
Definition: Expr.h:5917
AssociationTy< true > ConstAssociation
Definition: Expr.h:6149
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2872
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2148
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
Definition: Expr.h:1717
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3675
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5792
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2911
Describes an C or C++ initializer list.
Definition: Expr.h:5039
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2041
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1954
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3492
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:933
MS property subscript expression.
Definition: ExprCXX.h:1004
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4728
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2752
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3187
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5612
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1574
void AddDecl(const Decl *D)
Definition: ODRHash.cpp:807
void AddIdentifierInfo(const IdentifierInfo *II)
Definition: ODRHash.cpp:29
void AddDeclarationName(DeclarationName Name, bool TreatAsDecl=false)
Definition: ODRHash.cpp:34
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS)
Definition: ODRHash.cpp:112
void AddFunctionDecl(const FunctionDecl *Function, bool SkipBody=false)
Definition: ODRHash.cpp:661
void AddTemplateName(TemplateName Name)
Definition: ODRHash.cpp:141
void AddQualType(QualType T)
Definition: ODRHash.cpp:1262
unsigned CalculateHash()
Definition: ODRHash.cpp:225
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.
Definition: OpenMPClause.h:448
This represents clause 'aligned' in the '#pragma omp ...' directives.
This represents clause 'allocate' in the '#pragma omp ...' directives.
Definition: OpenMPClause.h:492
This represents 'allocator' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:414
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
Definition: ExprOpenMP.h:24
This represents 'at' clause in the '#pragma omp error' directive.
This represents 'atomic_default_mem_order' clause in the '#pragma omp requires' directive.
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:2947
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:2625
This represents 'bind' clause in the '#pragma omp ...' directives.
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:3655
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:3597
Representation of an OpenMP canonical loop.
Definition: StmtOpenMP.h:142
This represents 'capture' clause in the '#pragma omp atomic' directive.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Definition: OpenMPClause.h:233
Class that handles pre-initialization statement for some clauses, like 'schedule',...
Definition: OpenMPClause.h:195
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.
Definition: StmtOpenMP.h:2076
This represents 'default' clause in the '#pragma omp ...' directive.
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
This represents implicit clause 'depobj' for the '#pragma omp depobj' directive.
This represents '#pragma omp depobj' directive.
Definition: StmtOpenMP.h:2841
This represents 'destroy' clause in the '#pragma omp depobj' directive or the '#pragma omp interop' d...
This represents 'detach' clause in the '#pragma omp task' directive.
This represents 'device' clause in the '#pragma omp ...' directive.
This represents '#pragma omp dispatch' directive.
Definition: StmtOpenMP.h:5948
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:4425
This represents '#pragma omp distribute parallel for' composite directive.
Definition: StmtOpenMP.h:4547
This represents '#pragma omp distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:4643
This represents '#pragma omp distribute simd' composite directive.
Definition: StmtOpenMP.h:4708
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.
Definition: StmtOpenMP.h:6432
This represents clause 'exclusive' in the '#pragma omp scan' directive.
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:266
This represents '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.
Definition: OpenMPClause.h:690
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:2789
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:1634
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:1724
This represents clause 'from' in the '#pragma omp ...' directives.
Representation of the 'full' clause of the '#pragma omp unroll' directive.
Definition: OpenMPClause.h:939
This represents '#pragma omp loop' directive.
Definition: StmtOpenMP.h:6103
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.
Definition: OpenMPClause.h:587
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.
Definition: StmtOpenMP.h:5769
This represents '#pragma omp interop' directive.
Definition: StmtOpenMP.h:5895
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:151
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
This represents clause 'linear' in the '#pragma omp ...' directives.
The base class for all loop-based directives, including loop transformation directives.
Definition: StmtOpenMP.h:683
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
Definition: StmtOpenMP.h:1004
The base class for all loop transformation directives.
Definition: StmtOpenMP.h:960
This represents clause 'map' in the '#pragma omp ...' directives.
This represents '#pragma omp masked' directive.
Definition: StmtOpenMP.h:6013
This represents '#pragma omp masked taskloop' directive.
Definition: StmtOpenMP.h:3930
This represents '#pragma omp masked taskloop simd' directive.
Definition: StmtOpenMP.h:4071
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:2028
This represents '#pragma omp master taskloop' directive.
Definition: StmtOpenMP.h:3854
This represents '#pragma omp master taskloop simd' directive.
Definition: StmtOpenMP.h:4006
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents 'message' clause in the '#pragma omp error' directive.
This represents '#pragma omp metadirective' directive.
Definition: StmtOpenMP.h:6064
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.
Definition: OpenMPClause.h:736
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:2893
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:612
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:2147
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:2244
This represents '#pragma omp parallel loop' directive.
Definition: StmtOpenMP.h:6305
This represents '#pragma omp parallel masked' directive.
Definition: StmtOpenMP.h:2372
This represents '#pragma omp parallel masked taskloop' directive.
Definition: StmtOpenMP.h:4215
This represents '#pragma omp parallel masked taskloop simd' directive.
Definition: StmtOpenMP.h:4360
This represents '#pragma omp parallel master' directive.
Definition: StmtOpenMP.h:2309
This represents '#pragma omp parallel master taskloop' directive.
Definition: StmtOpenMP.h:4137
This represents '#pragma omp parallel master taskloop simd' directive.
Definition: StmtOpenMP.h:4293
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:2436
Representation of the 'partial' clause of the '#pragma omp unroll' directive.
Definition: OpenMPClause.h:967
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.
Definition: StmtOpenMP.h:5704
This represents 'reverse_offload' clause in the '#pragma omp requires' directive.
This represents 'simd' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:781
This represents '#pragma omp scan' directive.
Definition: StmtOpenMP.h:5842
This represents 'schedule' clause in the '#pragma omp ...' directive.
This represents '#pragma omp scope' directive.
Definition: StmtOpenMP.h:1925
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:1864
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:1787
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'severity' clause in the '#pragma omp error' directive.
This represents clause 'shared' in the '#pragma omp ...' directives.
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:1571
This represents 'simdlen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:816
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1977
This represents the 'sizes' clause in the '#pragma omp tile' directive.
Definition: OpenMPClause.h:848
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:3206
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:3152
This represents '#pragma omp target enter data' directive.
Definition: StmtOpenMP.h:3260
This represents '#pragma omp target exit data' directive.
Definition: StmtOpenMP.h:3315
This represents '#pragma omp target parallel' directive.
Definition: StmtOpenMP.h:3369
This represents '#pragma omp target parallel for' directive.
Definition: StmtOpenMP.h:3449
This represents '#pragma omp target parallel for simd' directive.
Definition: StmtOpenMP.h:4774
This represents '#pragma omp target parallel loop' directive.
Definition: StmtOpenMP.h:6370
This represents '#pragma omp target simd' directive.
Definition: StmtOpenMP.h:4841
This represents '#pragma omp target teams' directive.
Definition: StmtOpenMP.h:5199
This represents '#pragma omp target teams distribute' combined directive.
Definition: StmtOpenMP.h:5255
This represents '#pragma omp target teams distribute parallel for' combined directive.
Definition: StmtOpenMP.h:5322
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
Definition: StmtOpenMP.h:5420
This represents '#pragma omp target teams distribute simd' combined directive.
Definition: StmtOpenMP.h:5490
This represents '#pragma omp target teams loop' directive.
Definition: StmtOpenMP.h:6230
This represents '#pragma omp target update' directive.
Definition: StmtOpenMP.h:4491
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:2517
This represents '#pragma omp taskloop' directive.
Definition: StmtOpenMP.h:3715
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:3788
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:2722
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:2671
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:2579
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:3544
This represents '#pragma omp teams distribute' directive.
Definition: StmtOpenMP.h:4906
This represents '#pragma omp teams distribute parallel for' composite directive.
Definition: StmtOpenMP.h:5106
This represents '#pragma omp teams distribute parallel for simd' composite directive.
Definition: StmtOpenMP.h:5040
This represents '#pragma omp teams distribute simd' combined directive.
Definition: StmtOpenMP.h:4972
This represents '#pragma omp teams loop' directive.
Definition: StmtOpenMP.h:6165
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
This represents 'threads' clause in the '#pragma omp ...' directive.
This represents the '#pragma omp tile' loop transformation directive.
Definition: StmtOpenMP.h:5548
This represents clause 'to' in the '#pragma omp ...' directives.
This represents 'unified_address' clause in the '#pragma omp requires' directive.
This represents 'unified_shared_memory' clause in the '#pragma omp requires' directive.
This represents the '#pragma omp unroll' loop transformation directive.
Definition: StmtOpenMP.h:5630
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,...
Definition: ExprObjC.h:191
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:77
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:127
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:303
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:358
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:167
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:394
A runtime availability query.
Definition: ExprObjC.h:1696
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:87
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:127
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
Definition: ExprObjC.h:1636
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:309
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:410
Represents Objective-C's collection statement.
Definition: StmtObjC.h:23
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1575
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1491
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:549
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:945
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:617
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:505
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:455
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:844
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Definition: Expr.h:2475
Helper class for OffsetOfExpr.
Definition: Expr.h:2369
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2433
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1692
@ Array
An index into an array.
Definition: Expr.h:2374
@ Identifier
A field in a dependent type, known only by its name.
Definition: Expr.h:2378
@ Field
A field.
Definition: Expr.h:2376
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Definition: Expr.h:2381
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2423
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Definition: Expr.h:1173
void Visit(const OpenACCClause *C)
const Expr * getConditionExpr() const
ArrayRef< Expr * > getVarList()
This is the base type for all OpenACC Clauses.
Definition: OpenACCClause.h:24
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Definition: StmtOpenACC.h:132
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.
An 'if' clause, which has a required condition expression.
This class represents a 'loop' construct.
Definition: StmtOpenACC.h:200
llvm::ArrayRef< Expr * > getIntExprs()
A 'self' clause, which has an optional condition expression.
Expr * getDevNumExpr() const
llvm::ArrayRef< Expr * > getQueueIdExprs()
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition: ExprCXX.h:2983
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4180
ParenExpr - This represents a parenthesized expression, e.g.
Definition: Expr.h:2135
Represents a parameter to a function.
Definition: Decl.h:1722
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1991
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6497
const Expr *const * const_semantics_iterator
Definition: Expr.h:6562
A (possibly-)qualified type.
Definition: Type.h:941
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:7101
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3029
Represents a __leave statement.
Definition: Stmt.h:3728
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4465
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4258
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4761
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4417
Stmt - This represents one statement.
Definition: Stmt.h:84
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
StmtClass
Definition: Stmt.h:86
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.
Definition: Expr.h:1778
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4484
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4569
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2398
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
Represents a template argument.
Definition: TemplateBase.h:61
QualType getStructuralValueType() const
Get the type of a StructuralValue.
Definition: TemplateBase.h:399
QualType getParamTypeForDecl() const
Definition: TemplateBase.h:331
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:408
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:319
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:363
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:337
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:377
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:326
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:432
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
Definition: TemplateBase.h:74
@ Template
The template argument is a template name that was provided for a template template parameter.
Definition: TemplateBase.h:93
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
Definition: TemplateBase.h:89
@ Pack
The template argument is actually a parameter pack.
Definition: TemplateBase.h:107
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:97
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:78
@ Type
The template argument is a type.
Definition: TemplateBase.h:70
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:67
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:82
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
Definition: TemplateBase.h:103
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:295
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Definition: TemplateBase.h:350
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
Definition: TemplateBase.h:396
Represents a C++ template name within the type system.
Definition: TemplateName.h:203
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:242
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2768
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:8612
TypeClass getTypeClass() const
Definition: Type.h:2339
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8545
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6777
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
Definition: Expr.h:2578
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Definition: Expr.h:2188
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3203
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3943
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
Definition: ExprCXX.h:637
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4701
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2594
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:168
The JSON file list parser is used to communicate input to InstallAPI.
@ OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
@ NUM_OVERLOADED_OPERATORS
Definition: OperatorKinds.h:26
BinaryOperatorKind
UnaryOperatorKind
const FunctionProtoType * T
#define false
Definition: stdbool.h:26
Data for list of allocators.