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::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
588
589void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
590
591void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
592
593void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
594
595void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {}
596
597void OMPClauseProfiler::VisitOMPWeakClause(const OMPWeakClause *) {}
598
599void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
600
601void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
602
603void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
604
605void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) {
606 VisitOMPClauseList(C);
607}
608
609void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) {
610 if (C->getInteropVar())
611 Profiler->VisitStmt(C->getInteropVar());
612}
613
614void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) {
615 if (C->getInteropVar())
616 Profiler->VisitStmt(C->getInteropVar());
617}
618
619void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) {
620 VistOMPClauseWithPreInit(C);
621 if (C->getThreadID())
622 Profiler->VisitStmt(C->getThreadID());
623}
624
625template<typename T>
626void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
627 for (auto *E : Node->varlists()) {
628 if (E)
629 Profiler->VisitStmt(E);
630 }
631}
632
633void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
634 VisitOMPClauseList(C);
635 for (auto *E : C->private_copies()) {
636 if (E)
637 Profiler->VisitStmt(E);
638 }
639}
640void
641OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
642 VisitOMPClauseList(C);
643 VistOMPClauseWithPreInit(C);
644 for (auto *E : C->private_copies()) {
645 if (E)
646 Profiler->VisitStmt(E);
647 }
648 for (auto *E : C->inits()) {
649 if (E)
650 Profiler->VisitStmt(E);
651 }
652}
653void
654OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
655 VisitOMPClauseList(C);
656 VistOMPClauseWithPostUpdate(C);
657 for (auto *E : C->source_exprs()) {
658 if (E)
659 Profiler->VisitStmt(E);
660 }
661 for (auto *E : C->destination_exprs()) {
662 if (E)
663 Profiler->VisitStmt(E);
664 }
665 for (auto *E : C->assignment_ops()) {
666 if (E)
667 Profiler->VisitStmt(E);
668 }
669}
670void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
671 VisitOMPClauseList(C);
672}
673void OMPClauseProfiler::VisitOMPReductionClause(
674 const OMPReductionClause *C) {
675 Profiler->VisitNestedNameSpecifier(
676 C->getQualifierLoc().getNestedNameSpecifier());
677 Profiler->VisitName(C->getNameInfo().getName());
678 VisitOMPClauseList(C);
679 VistOMPClauseWithPostUpdate(C);
680 for (auto *E : C->privates()) {
681 if (E)
682 Profiler->VisitStmt(E);
683 }
684 for (auto *E : C->lhs_exprs()) {
685 if (E)
686 Profiler->VisitStmt(E);
687 }
688 for (auto *E : C->rhs_exprs()) {
689 if (E)
690 Profiler->VisitStmt(E);
691 }
692 for (auto *E : C->reduction_ops()) {
693 if (E)
694 Profiler->VisitStmt(E);
695 }
696 if (C->getModifier() == clang::OMPC_REDUCTION_inscan) {
697 for (auto *E : C->copy_ops()) {
698 if (E)
699 Profiler->VisitStmt(E);
700 }
701 for (auto *E : C->copy_array_temps()) {
702 if (E)
703 Profiler->VisitStmt(E);
704 }
705 for (auto *E : C->copy_array_elems()) {
706 if (E)
707 Profiler->VisitStmt(E);
708 }
709 }
710}
711void OMPClauseProfiler::VisitOMPTaskReductionClause(
712 const OMPTaskReductionClause *C) {
713 Profiler->VisitNestedNameSpecifier(
714 C->getQualifierLoc().getNestedNameSpecifier());
715 Profiler->VisitName(C->getNameInfo().getName());
716 VisitOMPClauseList(C);
717 VistOMPClauseWithPostUpdate(C);
718 for (auto *E : C->privates()) {
719 if (E)
720 Profiler->VisitStmt(E);
721 }
722 for (auto *E : C->lhs_exprs()) {
723 if (E)
724 Profiler->VisitStmt(E);
725 }
726 for (auto *E : C->rhs_exprs()) {
727 if (E)
728 Profiler->VisitStmt(E);
729 }
730 for (auto *E : C->reduction_ops()) {
731 if (E)
732 Profiler->VisitStmt(E);
733 }
734}
735void OMPClauseProfiler::VisitOMPInReductionClause(
736 const OMPInReductionClause *C) {
737 Profiler->VisitNestedNameSpecifier(
738 C->getQualifierLoc().getNestedNameSpecifier());
739 Profiler->VisitName(C->getNameInfo().getName());
740 VisitOMPClauseList(C);
741 VistOMPClauseWithPostUpdate(C);
742 for (auto *E : C->privates()) {
743 if (E)
744 Profiler->VisitStmt(E);
745 }
746 for (auto *E : C->lhs_exprs()) {
747 if (E)
748 Profiler->VisitStmt(E);
749 }
750 for (auto *E : C->rhs_exprs()) {
751 if (E)
752 Profiler->VisitStmt(E);
753 }
754 for (auto *E : C->reduction_ops()) {
755 if (E)
756 Profiler->VisitStmt(E);
757 }
758 for (auto *E : C->taskgroup_descriptors()) {
759 if (E)
760 Profiler->VisitStmt(E);
761 }
762}
763void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
764 VisitOMPClauseList(C);
765 VistOMPClauseWithPostUpdate(C);
766 for (auto *E : C->privates()) {
767 if (E)
768 Profiler->VisitStmt(E);
769 }
770 for (auto *E : C->inits()) {
771 if (E)
772 Profiler->VisitStmt(E);
773 }
774 for (auto *E : C->updates()) {
775 if (E)
776 Profiler->VisitStmt(E);
777 }
778 for (auto *E : C->finals()) {
779 if (E)
780 Profiler->VisitStmt(E);
781 }
782 if (C->getStep())
783 Profiler->VisitStmt(C->getStep());
784 if (C->getCalcStep())
785 Profiler->VisitStmt(C->getCalcStep());
786}
787void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
788 VisitOMPClauseList(C);
789 if (C->getAlignment())
790 Profiler->VisitStmt(C->getAlignment());
791}
792void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
793 VisitOMPClauseList(C);
794 for (auto *E : C->source_exprs()) {
795 if (E)
796 Profiler->VisitStmt(E);
797 }
798 for (auto *E : C->destination_exprs()) {
799 if (E)
800 Profiler->VisitStmt(E);
801 }
802 for (auto *E : C->assignment_ops()) {
803 if (E)
804 Profiler->VisitStmt(E);
805 }
806}
807void
808OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
809 VisitOMPClauseList(C);
810 for (auto *E : C->source_exprs()) {
811 if (E)
812 Profiler->VisitStmt(E);
813 }
814 for (auto *E : C->destination_exprs()) {
815 if (E)
816 Profiler->VisitStmt(E);
817 }
818 for (auto *E : C->assignment_ops()) {
819 if (E)
820 Profiler->VisitStmt(E);
821 }
822}
823void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
824 VisitOMPClauseList(C);
825}
826void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) {
827 if (const Expr *Depobj = C->getDepobj())
828 Profiler->VisitStmt(Depobj);
829}
830void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
831 VisitOMPClauseList(C);
832}
833void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
834 if (C->getDevice())
835 Profiler->VisitStmt(C->getDevice());
836}
837void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
838 VisitOMPClauseList(C);
839}
840void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
841 if (Expr *Allocator = C->getAllocator())
842 Profiler->VisitStmt(Allocator);
843 VisitOMPClauseList(C);
844}
845void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
846 VistOMPClauseWithPreInit(C);
847 if (C->getNumTeams())
848 Profiler->VisitStmt(C->getNumTeams());
849}
850void OMPClauseProfiler::VisitOMPThreadLimitClause(
851 const OMPThreadLimitClause *C) {
852 VistOMPClauseWithPreInit(C);
853 if (C->getThreadLimit())
854 Profiler->VisitStmt(C->getThreadLimit());
855}
856void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
857 VistOMPClauseWithPreInit(C);
858 if (C->getPriority())
859 Profiler->VisitStmt(C->getPriority());
860}
861void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
862 VistOMPClauseWithPreInit(C);
863 if (C->getGrainsize())
864 Profiler->VisitStmt(C->getGrainsize());
865}
866void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
867 VistOMPClauseWithPreInit(C);
868 if (C->getNumTasks())
869 Profiler->VisitStmt(C->getNumTasks());
870}
871void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
872 if (C->getHint())
873 Profiler->VisitStmt(C->getHint());
874}
875void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
876 VisitOMPClauseList(C);
877}
878void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
879 VisitOMPClauseList(C);
880}
881void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
882 const OMPUseDevicePtrClause *C) {
883 VisitOMPClauseList(C);
884}
885void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
886 const OMPUseDeviceAddrClause *C) {
887 VisitOMPClauseList(C);
888}
889void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
890 const OMPIsDevicePtrClause *C) {
891 VisitOMPClauseList(C);
892}
893void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
894 const OMPHasDeviceAddrClause *C) {
895 VisitOMPClauseList(C);
896}
897void OMPClauseProfiler::VisitOMPNontemporalClause(
898 const OMPNontemporalClause *C) {
899 VisitOMPClauseList(C);
900 for (auto *E : C->private_refs())
901 Profiler->VisitStmt(E);
902}
903void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
904 VisitOMPClauseList(C);
905}
906void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) {
907 VisitOMPClauseList(C);
908}
909void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
910 const OMPUsesAllocatorsClause *C) {
911 for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
912 OMPUsesAllocatorsClause::Data D = C->getAllocatorData(I);
913 Profiler->VisitStmt(D.Allocator);
914 if (D.AllocatorTraits)
915 Profiler->VisitStmt(D.AllocatorTraits);
916 }
917}
918void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
919 if (const Expr *Modifier = C->getModifier())
920 Profiler->VisitStmt(Modifier);
921 for (const Expr *E : C->varlists())
922 Profiler->VisitStmt(E);
923}
924void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
925void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {}
926void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
927 const OMPXDynCGroupMemClause *C) {
928 VistOMPClauseWithPreInit(C);
929 if (Expr *Size = C->getSize())
930 Profiler->VisitStmt(Size);
931}
932void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) {
933 VisitOMPClauseList(C);
934}
935void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) {
936}
937void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {}
938} // namespace
939
940void
941StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
942 VisitStmt(S);
943 OMPClauseProfiler P(this);
944 ArrayRef<OMPClause *> Clauses = S->clauses();
945 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
946 I != E; ++I)
947 if (*I)
948 P.Visit(*I);
949}
950
951void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) {
952 VisitStmt(L);
953}
954
955void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) {
956 VisitOMPExecutableDirective(S);
957}
958
959void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
960 VisitOMPLoopBasedDirective(S);
961}
962
963void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) {
964 VisitOMPExecutableDirective(S);
965}
966
967void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
968 VisitOMPExecutableDirective(S);
969}
970
971void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
972 VisitOMPLoopDirective(S);
973}
974
975void StmtProfiler::VisitOMPLoopTransformationDirective(
977 VisitOMPLoopBasedDirective(S);
978}
979
980void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) {
981 VisitOMPLoopTransformationDirective(S);
982}
983
984void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) {
985 VisitOMPLoopTransformationDirective(S);
986}
987
988void StmtProfiler::VisitOMPReverseDirective(const OMPReverseDirective *S) {
989 VisitOMPLoopTransformationDirective(S);
990}
991
992void StmtProfiler::VisitOMPInterchangeDirective(
993 const OMPInterchangeDirective *S) {
994 VisitOMPLoopTransformationDirective(S);
995}
996
997void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
998 VisitOMPLoopDirective(S);
999}
1000
1001void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
1002 VisitOMPLoopDirective(S);
1003}
1004
1005void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
1006 VisitOMPExecutableDirective(S);
1007}
1008
1009void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
1010 VisitOMPExecutableDirective(S);
1011}
1012
1013void StmtProfiler::VisitOMPScopeDirective(const OMPScopeDirective *S) {
1014 VisitOMPExecutableDirective(S);
1015}
1016
1017void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
1018 VisitOMPExecutableDirective(S);
1019}
1020
1021void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
1022 VisitOMPExecutableDirective(S);
1023}
1024
1025void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
1026 VisitOMPExecutableDirective(S);
1027 VisitName(S->getDirectiveName().getName());
1028}
1029
1030void
1031StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
1032 VisitOMPLoopDirective(S);
1033}
1034
1035void StmtProfiler::VisitOMPParallelForSimdDirective(
1036 const OMPParallelForSimdDirective *S) {
1037 VisitOMPLoopDirective(S);
1038}
1039
1040void StmtProfiler::VisitOMPParallelMasterDirective(
1041 const OMPParallelMasterDirective *S) {
1042 VisitOMPExecutableDirective(S);
1043}
1044
1045void StmtProfiler::VisitOMPParallelMaskedDirective(
1046 const OMPParallelMaskedDirective *S) {
1047 VisitOMPExecutableDirective(S);
1048}
1049
1050void StmtProfiler::VisitOMPParallelSectionsDirective(
1052 VisitOMPExecutableDirective(S);
1053}
1054
1055void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
1056 VisitOMPExecutableDirective(S);
1057}
1058
1059void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
1060 VisitOMPExecutableDirective(S);
1061}
1062
1063void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
1064 VisitOMPExecutableDirective(S);
1065}
1066
1067void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
1068 VisitOMPExecutableDirective(S);
1069}
1070
1071void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) {
1072 VisitOMPExecutableDirective(S);
1073}
1074void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
1075 VisitOMPExecutableDirective(S);
1076 if (const Expr *E = S->getReductionRef())
1077 VisitStmt(E);
1078}
1079
1080void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
1081 VisitOMPExecutableDirective(S);
1082}
1083
1084void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1085 VisitOMPExecutableDirective(S);
1086}
1087
1088void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1089 VisitOMPExecutableDirective(S);
1090}
1091
1092void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1093 VisitOMPExecutableDirective(S);
1094}
1095
1096void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1097 VisitOMPExecutableDirective(S);
1098}
1099
1100void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1101 VisitOMPExecutableDirective(S);
1102}
1103
1104void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
1105 VisitOMPExecutableDirective(S);
1106}
1107
1108void StmtProfiler::VisitOMPTargetEnterDataDirective(
1109 const OMPTargetEnterDataDirective *S) {
1110 VisitOMPExecutableDirective(S);
1111}
1112
1113void StmtProfiler::VisitOMPTargetExitDataDirective(
1114 const OMPTargetExitDataDirective *S) {
1115 VisitOMPExecutableDirective(S);
1116}
1117
1118void StmtProfiler::VisitOMPTargetParallelDirective(
1119 const OMPTargetParallelDirective *S) {
1120 VisitOMPExecutableDirective(S);
1121}
1122
1123void StmtProfiler::VisitOMPTargetParallelForDirective(
1125 VisitOMPExecutableDirective(S);
1126}
1127
1128void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1129 VisitOMPExecutableDirective(S);
1130}
1131
1132void StmtProfiler::VisitOMPCancellationPointDirective(
1134 VisitOMPExecutableDirective(S);
1135}
1136
1137void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1138 VisitOMPExecutableDirective(S);
1139}
1140
1141void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1142 VisitOMPLoopDirective(S);
1143}
1144
1145void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1146 const OMPTaskLoopSimdDirective *S) {
1147 VisitOMPLoopDirective(S);
1148}
1149
1150void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1151 const OMPMasterTaskLoopDirective *S) {
1152 VisitOMPLoopDirective(S);
1153}
1154
1155void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1156 const OMPMaskedTaskLoopDirective *S) {
1157 VisitOMPLoopDirective(S);
1158}
1159
1160void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1162 VisitOMPLoopDirective(S);
1163}
1164
1165void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1167 VisitOMPLoopDirective(S);
1168}
1169
1170void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1172 VisitOMPLoopDirective(S);
1173}
1174
1175void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1177 VisitOMPLoopDirective(S);
1178}
1179
1180void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1182 VisitOMPLoopDirective(S);
1183}
1184
1185void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1187 VisitOMPLoopDirective(S);
1188}
1189
1190void StmtProfiler::VisitOMPDistributeDirective(
1191 const OMPDistributeDirective *S) {
1192 VisitOMPLoopDirective(S);
1193}
1194
1195void OMPClauseProfiler::VisitOMPDistScheduleClause(
1196 const OMPDistScheduleClause *C) {
1197 VistOMPClauseWithPreInit(C);
1198 if (auto *S = C->getChunkSize())
1199 Profiler->VisitStmt(S);
1200}
1201
1202void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1203
1204void StmtProfiler::VisitOMPTargetUpdateDirective(
1205 const OMPTargetUpdateDirective *S) {
1206 VisitOMPExecutableDirective(S);
1207}
1208
1209void StmtProfiler::VisitOMPDistributeParallelForDirective(
1211 VisitOMPLoopDirective(S);
1212}
1213
1214void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1216 VisitOMPLoopDirective(S);
1217}
1218
1219void StmtProfiler::VisitOMPDistributeSimdDirective(
1220 const OMPDistributeSimdDirective *S) {
1221 VisitOMPLoopDirective(S);
1222}
1223
1224void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1226 VisitOMPLoopDirective(S);
1227}
1228
1229void StmtProfiler::VisitOMPTargetSimdDirective(
1230 const OMPTargetSimdDirective *S) {
1231 VisitOMPLoopDirective(S);
1232}
1233
1234void StmtProfiler::VisitOMPTeamsDistributeDirective(
1235 const OMPTeamsDistributeDirective *S) {
1236 VisitOMPLoopDirective(S);
1237}
1238
1239void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1241 VisitOMPLoopDirective(S);
1242}
1243
1244void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1246 VisitOMPLoopDirective(S);
1247}
1248
1249void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1251 VisitOMPLoopDirective(S);
1252}
1253
1254void StmtProfiler::VisitOMPTargetTeamsDirective(
1255 const OMPTargetTeamsDirective *S) {
1256 VisitOMPExecutableDirective(S);
1257}
1258
1259void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1261 VisitOMPLoopDirective(S);
1262}
1263
1264void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1266 VisitOMPLoopDirective(S);
1267}
1268
1269void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1271 VisitOMPLoopDirective(S);
1272}
1273
1274void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1276 VisitOMPLoopDirective(S);
1277}
1278
1279void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1280 VisitOMPExecutableDirective(S);
1281}
1282
1283void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1284 VisitOMPExecutableDirective(S);
1285}
1286
1287void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1288 VisitOMPExecutableDirective(S);
1289}
1290
1291void StmtProfiler::VisitOMPGenericLoopDirective(
1292 const OMPGenericLoopDirective *S) {
1293 VisitOMPLoopDirective(S);
1294}
1295
1296void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1298 VisitOMPLoopDirective(S);
1299}
1300
1301void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1303 VisitOMPLoopDirective(S);
1304}
1305
1306void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1308 VisitOMPLoopDirective(S);
1309}
1310
1311void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1313 VisitOMPLoopDirective(S);
1314}
1315
1316void StmtProfiler::VisitExpr(const Expr *S) {
1317 VisitStmt(S);
1318}
1319
1320void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1321 VisitExpr(S);
1322}
1323
1324void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1325 VisitExpr(S);
1326 if (!Canonical)
1327 VisitNestedNameSpecifier(S->getQualifier());
1328 VisitDecl(S->getDecl());
1329 if (!Canonical) {
1330 ID.AddBoolean(S->hasExplicitTemplateArgs());
1331 if (S->hasExplicitTemplateArgs())
1332 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1333 }
1334}
1335
1336void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1337 const SYCLUniqueStableNameExpr *S) {
1338 VisitExpr(S);
1339 VisitType(S->getTypeSourceInfo()->getType());
1340}
1341
1342void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1343 VisitExpr(S);
1344 ID.AddInteger(llvm::to_underlying(S->getIdentKind()));
1345}
1346
1347void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1348 VisitExpr(S);
1349 S->getValue().Profile(ID);
1350
1351 QualType T = S->getType();
1352 if (Canonical)
1353 T = T.getCanonicalType();
1354 ID.AddInteger(T->getTypeClass());
1355 if (auto BitIntT = T->getAs<BitIntType>())
1356 BitIntT->Profile(ID);
1357 else
1358 ID.AddInteger(T->castAs<BuiltinType>()->getKind());
1359}
1360
1361void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1362 VisitExpr(S);
1363 S->getValue().Profile(ID);
1364 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1365}
1366
1367void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1368 VisitExpr(S);
1369 ID.AddInteger(llvm::to_underlying(S->getKind()));
1370 ID.AddInteger(S->getValue());
1371}
1372
1373void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1374 VisitExpr(S);
1375 S->getValue().Profile(ID);
1376 ID.AddBoolean(S->isExact());
1377 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1378}
1379
1380void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1381 VisitExpr(S);
1382}
1383
1384void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1385 VisitExpr(S);
1386 ID.AddString(S->getBytes());
1387 ID.AddInteger(llvm::to_underlying(S->getKind()));
1388}
1389
1390void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1391 VisitExpr(S);
1392}
1393
1394void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1395 VisitExpr(S);
1396}
1397
1398void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1399 VisitExpr(S);
1400 ID.AddInteger(S->getOpcode());
1401}
1402
1403void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1404 VisitType(S->getTypeSourceInfo()->getType());
1405 unsigned n = S->getNumComponents();
1406 for (unsigned i = 0; i < n; ++i) {
1407 const OffsetOfNode &ON = S->getComponent(i);
1408 ID.AddInteger(ON.getKind());
1409 switch (ON.getKind()) {
1411 // Expressions handled below.
1412 break;
1413
1415 VisitDecl(ON.getField());
1416 break;
1417
1419 VisitIdentifierInfo(ON.getFieldName());
1420 break;
1421
1422 case OffsetOfNode::Base:
1423 // These nodes are implicit, and therefore don't need profiling.
1424 break;
1425 }
1426 }
1427
1428 VisitExpr(S);
1429}
1430
1431void
1432StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1433 VisitExpr(S);
1434 ID.AddInteger(S->getKind());
1435 if (S->isArgumentType())
1436 VisitType(S->getArgumentType());
1437}
1438
1439void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1440 VisitExpr(S);
1441}
1442
1443void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1444 VisitExpr(S);
1445}
1446
1447void StmtProfiler::VisitArraySectionExpr(const ArraySectionExpr *S) {
1448 VisitExpr(S);
1449}
1450
1451void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1452 VisitExpr(S);
1453}
1454
1455void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1456 VisitExpr(S);
1457 for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1458 VisitDecl(S->getIteratorDecl(I));
1459}
1460
1461void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1462 VisitExpr(S);
1463}
1464
1465void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1466 VisitExpr(S);
1467 VisitDecl(S->getMemberDecl());
1468 if (!Canonical)
1469 VisitNestedNameSpecifier(S->getQualifier());
1470 ID.AddBoolean(S->isArrow());
1471}
1472
1473void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1474 VisitExpr(S);
1475 ID.AddBoolean(S->isFileScope());
1476}
1477
1478void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1479 VisitExpr(S);
1480}
1481
1482void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1483 VisitCastExpr(S);
1484 ID.AddInteger(S->getValueKind());
1485}
1486
1487void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1488 VisitCastExpr(S);
1489 VisitType(S->getTypeAsWritten());
1490}
1491
1492void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1493 VisitExplicitCastExpr(S);
1494}
1495
1496void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1497 VisitExpr(S);
1498 ID.AddInteger(S->getOpcode());
1499}
1500
1501void
1502StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1503 VisitBinaryOperator(S);
1504}
1505
1506void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1507 VisitExpr(S);
1508}
1509
1510void StmtProfiler::VisitBinaryConditionalOperator(
1511 const BinaryConditionalOperator *S) {
1512 VisitExpr(S);
1513}
1514
1515void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1516 VisitExpr(S);
1517 VisitDecl(S->getLabel());
1518}
1519
1520void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1521 VisitExpr(S);
1522}
1523
1524void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1525 VisitExpr(S);
1526}
1527
1528void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1529 VisitExpr(S);
1530}
1531
1532void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1533 VisitExpr(S);
1534}
1535
1536void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1537 VisitExpr(S);
1538}
1539
1540void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1541 VisitExpr(S);
1542}
1543
1544void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1545 if (S->getSyntacticForm()) {
1546 VisitInitListExpr(S->getSyntacticForm());
1547 return;
1548 }
1549
1550 VisitExpr(S);
1551}
1552
1553void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1554 VisitExpr(S);
1555 ID.AddBoolean(S->usesGNUSyntax());
1556 for (const DesignatedInitExpr::Designator &D : S->designators()) {
1557 if (D.isFieldDesignator()) {
1558 ID.AddInteger(0);
1559 VisitName(D.getFieldName());
1560 continue;
1561 }
1562
1563 if (D.isArrayDesignator()) {
1564 ID.AddInteger(1);
1565 } else {
1566 assert(D.isArrayRangeDesignator());
1567 ID.AddInteger(2);
1568 }
1569 ID.AddInteger(D.getArrayIndex());
1570 }
1571}
1572
1573// Seems that if VisitInitListExpr() only works on the syntactic form of an
1574// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1575void StmtProfiler::VisitDesignatedInitUpdateExpr(
1576 const DesignatedInitUpdateExpr *S) {
1577 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1578 "initializer");
1579}
1580
1581void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1582 VisitExpr(S);
1583}
1584
1585void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1586 VisitExpr(S);
1587}
1588
1589void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1590 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1591}
1592
1593void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1594 VisitExpr(S);
1595}
1596
1597void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1598 VisitExpr(S);
1599 VisitName(&S->getAccessor());
1600}
1601
1602void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1603 VisitExpr(S);
1604 VisitDecl(S->getBlockDecl());
1605}
1606
1607void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1608 VisitExpr(S);
1610 S->associations()) {
1611 QualType T = Assoc.getType();
1612 if (T.isNull())
1613 ID.AddPointer(nullptr);
1614 else
1615 VisitType(T);
1616 VisitExpr(Assoc.getAssociationExpr());
1617 }
1618}
1619
1620void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1621 VisitExpr(S);
1623 i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1624 // Normally, we would not profile the source expressions of OVEs.
1625 if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1626 Visit(OVE->getSourceExpr());
1627}
1628
1629void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1630 VisitExpr(S);
1631 ID.AddInteger(S->getOp());
1632}
1633
1634void StmtProfiler::VisitConceptSpecializationExpr(
1635 const ConceptSpecializationExpr *S) {
1636 VisitExpr(S);
1637 VisitDecl(S->getNamedConcept());
1638 for (const TemplateArgument &Arg : S->getTemplateArguments())
1639 VisitTemplateArgument(Arg);
1640}
1641
1642void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1643 VisitExpr(S);
1644 ID.AddInteger(S->getLocalParameters().size());
1645 for (ParmVarDecl *LocalParam : S->getLocalParameters())
1646 VisitDecl(LocalParam);
1647 ID.AddInteger(S->getRequirements().size());
1648 for (concepts::Requirement *Req : S->getRequirements()) {
1649 if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1651 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1652 if (!TypeReq->isSubstitutionFailure())
1653 VisitType(TypeReq->getType()->getType());
1654 } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1656 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1657 if (!ExprReq->isExprSubstitutionFailure())
1658 Visit(ExprReq->getExpr());
1659 // C++2a [expr.prim.req.compound]p1 Example:
1660 // [...] The compound-requirement in C1 requires that x++ is a valid
1661 // expression. It is equivalent to the simple-requirement x++; [...]
1662 // We therefore do not profile isSimple() here.
1663 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1665 ExprReq->getReturnTypeRequirement();
1666 if (RetReq.isEmpty()) {
1667 ID.AddInteger(0);
1668 } else if (RetReq.isTypeConstraint()) {
1669 ID.AddInteger(1);
1671 } else {
1672 assert(RetReq.isSubstitutionFailure());
1673 ID.AddInteger(2);
1674 }
1675 } else {
1677 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1678 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1679 if (!NestedReq->hasInvalidConstraint())
1680 Visit(NestedReq->getConstraintExpr());
1681 }
1682 }
1683}
1684
1686 UnaryOperatorKind &UnaryOp,
1687 BinaryOperatorKind &BinaryOp,
1688 unsigned &NumArgs) {
1689 switch (S->getOperator()) {
1690 case OO_None:
1691 case OO_New:
1692 case OO_Delete:
1693 case OO_Array_New:
1694 case OO_Array_Delete:
1695 case OO_Arrow:
1696 case OO_Conditional:
1698 llvm_unreachable("Invalid operator call kind");
1699
1700 case OO_Plus:
1701 if (NumArgs == 1) {
1702 UnaryOp = UO_Plus;
1703 return Stmt::UnaryOperatorClass;
1704 }
1705
1706 BinaryOp = BO_Add;
1707 return Stmt::BinaryOperatorClass;
1708
1709 case OO_Minus:
1710 if (NumArgs == 1) {
1711 UnaryOp = UO_Minus;
1712 return Stmt::UnaryOperatorClass;
1713 }
1714
1715 BinaryOp = BO_Sub;
1716 return Stmt::BinaryOperatorClass;
1717
1718 case OO_Star:
1719 if (NumArgs == 1) {
1720 UnaryOp = UO_Deref;
1721 return Stmt::UnaryOperatorClass;
1722 }
1723
1724 BinaryOp = BO_Mul;
1725 return Stmt::BinaryOperatorClass;
1726
1727 case OO_Slash:
1728 BinaryOp = BO_Div;
1729 return Stmt::BinaryOperatorClass;
1730
1731 case OO_Percent:
1732 BinaryOp = BO_Rem;
1733 return Stmt::BinaryOperatorClass;
1734
1735 case OO_Caret:
1736 BinaryOp = BO_Xor;
1737 return Stmt::BinaryOperatorClass;
1738
1739 case OO_Amp:
1740 if (NumArgs == 1) {
1741 UnaryOp = UO_AddrOf;
1742 return Stmt::UnaryOperatorClass;
1743 }
1744
1745 BinaryOp = BO_And;
1746 return Stmt::BinaryOperatorClass;
1747
1748 case OO_Pipe:
1749 BinaryOp = BO_Or;
1750 return Stmt::BinaryOperatorClass;
1751
1752 case OO_Tilde:
1753 UnaryOp = UO_Not;
1754 return Stmt::UnaryOperatorClass;
1755
1756 case OO_Exclaim:
1757 UnaryOp = UO_LNot;
1758 return Stmt::UnaryOperatorClass;
1759
1760 case OO_Equal:
1761 BinaryOp = BO_Assign;
1762 return Stmt::BinaryOperatorClass;
1763
1764 case OO_Less:
1765 BinaryOp = BO_LT;
1766 return Stmt::BinaryOperatorClass;
1767
1768 case OO_Greater:
1769 BinaryOp = BO_GT;
1770 return Stmt::BinaryOperatorClass;
1771
1772 case OO_PlusEqual:
1773 BinaryOp = BO_AddAssign;
1774 return Stmt::CompoundAssignOperatorClass;
1775
1776 case OO_MinusEqual:
1777 BinaryOp = BO_SubAssign;
1778 return Stmt::CompoundAssignOperatorClass;
1779
1780 case OO_StarEqual:
1781 BinaryOp = BO_MulAssign;
1782 return Stmt::CompoundAssignOperatorClass;
1783
1784 case OO_SlashEqual:
1785 BinaryOp = BO_DivAssign;
1786 return Stmt::CompoundAssignOperatorClass;
1787
1788 case OO_PercentEqual:
1789 BinaryOp = BO_RemAssign;
1790 return Stmt::CompoundAssignOperatorClass;
1791
1792 case OO_CaretEqual:
1793 BinaryOp = BO_XorAssign;
1794 return Stmt::CompoundAssignOperatorClass;
1795
1796 case OO_AmpEqual:
1797 BinaryOp = BO_AndAssign;
1798 return Stmt::CompoundAssignOperatorClass;
1799
1800 case OO_PipeEqual:
1801 BinaryOp = BO_OrAssign;
1802 return Stmt::CompoundAssignOperatorClass;
1803
1804 case OO_LessLess:
1805 BinaryOp = BO_Shl;
1806 return Stmt::BinaryOperatorClass;
1807
1808 case OO_GreaterGreater:
1809 BinaryOp = BO_Shr;
1810 return Stmt::BinaryOperatorClass;
1811
1812 case OO_LessLessEqual:
1813 BinaryOp = BO_ShlAssign;
1814 return Stmt::CompoundAssignOperatorClass;
1815
1816 case OO_GreaterGreaterEqual:
1817 BinaryOp = BO_ShrAssign;
1818 return Stmt::CompoundAssignOperatorClass;
1819
1820 case OO_EqualEqual:
1821 BinaryOp = BO_EQ;
1822 return Stmt::BinaryOperatorClass;
1823
1824 case OO_ExclaimEqual:
1825 BinaryOp = BO_NE;
1826 return Stmt::BinaryOperatorClass;
1827
1828 case OO_LessEqual:
1829 BinaryOp = BO_LE;
1830 return Stmt::BinaryOperatorClass;
1831
1832 case OO_GreaterEqual:
1833 BinaryOp = BO_GE;
1834 return Stmt::BinaryOperatorClass;
1835
1836 case OO_Spaceship:
1837 BinaryOp = BO_Cmp;
1838 return Stmt::BinaryOperatorClass;
1839
1840 case OO_AmpAmp:
1841 BinaryOp = BO_LAnd;
1842 return Stmt::BinaryOperatorClass;
1843
1844 case OO_PipePipe:
1845 BinaryOp = BO_LOr;
1846 return Stmt::BinaryOperatorClass;
1847
1848 case OO_PlusPlus:
1849 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1850 NumArgs = 1;
1851 return Stmt::UnaryOperatorClass;
1852
1853 case OO_MinusMinus:
1854 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1855 NumArgs = 1;
1856 return Stmt::UnaryOperatorClass;
1857
1858 case OO_Comma:
1859 BinaryOp = BO_Comma;
1860 return Stmt::BinaryOperatorClass;
1861
1862 case OO_ArrowStar:
1863 BinaryOp = BO_PtrMemI;
1864 return Stmt::BinaryOperatorClass;
1865
1866 case OO_Subscript:
1867 return Stmt::ArraySubscriptExprClass;
1868
1869 case OO_Call:
1870 return Stmt::CallExprClass;
1871
1872 case OO_Coawait:
1873 UnaryOp = UO_Coawait;
1874 return Stmt::UnaryOperatorClass;
1875 }
1876
1877 llvm_unreachable("Invalid overloaded operator expression");
1878}
1879
1880#if defined(_MSC_VER) && !defined(__clang__)
1881#if _MSC_VER == 1911
1882// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1883// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1884// will crash in stage 2 of a bootstrap build.
1885#pragma optimize("", off)
1886#endif
1887#endif
1888
1889void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1890 if (S->isTypeDependent()) {
1891 // Type-dependent operator calls are profiled like their underlying
1892 // syntactic operator.
1893 //
1894 // An operator call to operator-> is always implicit, so just skip it. The
1895 // enclosing MemberExpr will profile the actual member access.
1896 if (S->getOperator() == OO_Arrow)
1897 return Visit(S->getArg(0));
1898
1899 UnaryOperatorKind UnaryOp = UO_Extension;
1900 BinaryOperatorKind BinaryOp = BO_Comma;
1901 unsigned NumArgs = S->getNumArgs();
1902 Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp, NumArgs);
1903
1904 ID.AddInteger(SC);
1905 for (unsigned I = 0; I != NumArgs; ++I)
1906 Visit(S->getArg(I));
1907 if (SC == Stmt::UnaryOperatorClass)
1908 ID.AddInteger(UnaryOp);
1909 else if (SC == Stmt::BinaryOperatorClass ||
1910 SC == Stmt::CompoundAssignOperatorClass)
1911 ID.AddInteger(BinaryOp);
1912 else
1913 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1914
1915 return;
1916 }
1917
1918 VisitCallExpr(S);
1919 ID.AddInteger(S->getOperator());
1920}
1921
1922void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1923 const CXXRewrittenBinaryOperator *S) {
1924 // If a rewritten operator were ever to be type-dependent, we should profile
1925 // it following its syntactic operator.
1926 assert(!S->isTypeDependent() &&
1927 "resolved rewritten operator should never be type-dependent");
1928 ID.AddBoolean(S->isReversed());
1929 VisitExpr(S->getSemanticForm());
1930}
1931
1932#if defined(_MSC_VER) && !defined(__clang__)
1933#if _MSC_VER == 1911
1934#pragma optimize("", on)
1935#endif
1936#endif
1937
1938void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1939 VisitCallExpr(S);
1940}
1941
1942void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1943 VisitCallExpr(S);
1944}
1945
1946void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1947 VisitExpr(S);
1948}
1949
1950void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1951 VisitExplicitCastExpr(S);
1952}
1953
1954void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1955 VisitCXXNamedCastExpr(S);
1956}
1957
1958void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1959 VisitCXXNamedCastExpr(S);
1960}
1961
1962void
1963StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1964 VisitCXXNamedCastExpr(S);
1965}
1966
1967void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1968 VisitCXXNamedCastExpr(S);
1969}
1970
1971void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1972 VisitExpr(S);
1973 VisitType(S->getTypeInfoAsWritten()->getType());
1974}
1975
1976void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1977 VisitCXXNamedCastExpr(S);
1978}
1979
1980void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1981 VisitCallExpr(S);
1982}
1983
1984void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1985 VisitExpr(S);
1986 ID.AddBoolean(S->getValue());
1987}
1988
1989void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1990 VisitExpr(S);
1991}
1992
1993void StmtProfiler::VisitCXXStdInitializerListExpr(
1994 const CXXStdInitializerListExpr *S) {
1995 VisitExpr(S);
1996}
1997
1998void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1999 VisitExpr(S);
2000 if (S->isTypeOperand())
2001 VisitType(S->getTypeOperandSourceInfo()->getType());
2002}
2003
2004void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
2005 VisitExpr(S);
2006 if (S->isTypeOperand())
2007 VisitType(S->getTypeOperandSourceInfo()->getType());
2008}
2009
2010void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
2011 VisitExpr(S);
2012 VisitDecl(S->getPropertyDecl());
2013}
2014
2015void StmtProfiler::VisitMSPropertySubscriptExpr(
2016 const MSPropertySubscriptExpr *S) {
2017 VisitExpr(S);
2018}
2019
2020void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
2021 VisitExpr(S);
2022 ID.AddBoolean(S->isImplicit());
2023 ID.AddBoolean(S->isCapturedByCopyInLambdaWithExplicitObjectParameter());
2024}
2025
2026void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
2027 VisitExpr(S);
2028}
2029
2030void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
2031 VisitExpr(S);
2032 VisitDecl(S->getParam());
2033}
2034
2035void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
2036 VisitExpr(S);
2037 VisitDecl(S->getField());
2038}
2039
2040void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
2041 VisitExpr(S);
2042 VisitDecl(
2043 const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
2044}
2045
2046void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
2047 VisitExpr(S);
2048 VisitDecl(S->getConstructor());
2049 ID.AddBoolean(S->isElidable());
2050}
2051
2052void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2053 const CXXInheritedCtorInitExpr *S) {
2054 VisitExpr(S);
2055 VisitDecl(S->getConstructor());
2056}
2057
2058void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
2059 VisitExplicitCastExpr(S);
2060}
2061
2062void
2063StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
2064 VisitCXXConstructExpr(S);
2065}
2066
2067void
2068StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
2069 if (!ProfileLambdaExpr) {
2070 // Do not recursively visit the children of this expression. Profiling the
2071 // body would result in unnecessary work, and is not safe to do during
2072 // deserialization.
2073 VisitStmtNoChildren(S);
2074
2075 // C++20 [temp.over.link]p5:
2076 // Two lambda-expressions are never considered equivalent.
2077 VisitDecl(S->getLambdaClass());
2078
2079 return;
2080 }
2081
2082 CXXRecordDecl *Lambda = S->getLambdaClass();
2083 for (const auto &Capture : Lambda->captures()) {
2084 ID.AddInteger(Capture.getCaptureKind());
2085 if (Capture.capturesVariable())
2086 VisitDecl(Capture.getCapturedVar());
2087 }
2088
2089 // Profiling the body of the lambda may be dangerous during deserialization.
2090 // So we'd like only to profile the signature here.
2091 ODRHash Hasher;
2092 // FIXME: We can't get the operator call easily by
2093 // `CXXRecordDecl::getLambdaCallOperator()` if we're in deserialization.
2094 // So we have to do something raw here.
2095 for (auto *SubDecl : Lambda->decls()) {
2096 FunctionDecl *Call = nullptr;
2097 if (auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2098 Call = FTD->getTemplatedDecl();
2099 else if (auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2100 Call = FD;
2101
2102 if (!Call)
2103 continue;
2104
2105 Hasher.AddFunctionDecl(Call, /*SkipBody=*/true);
2106 }
2107 ID.AddInteger(Hasher.CalculateHash());
2108}
2109
2110void
2111StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
2112 VisitExpr(S);
2113}
2114
2115void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
2116 VisitExpr(S);
2117 ID.AddBoolean(S->isGlobalDelete());
2118 ID.AddBoolean(S->isArrayForm());
2119 VisitDecl(S->getOperatorDelete());
2120}
2121
2122void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
2123 VisitExpr(S);
2124 VisitType(S->getAllocatedType());
2125 VisitDecl(S->getOperatorNew());
2126 VisitDecl(S->getOperatorDelete());
2127 ID.AddBoolean(S->isArray());
2128 ID.AddInteger(S->getNumPlacementArgs());
2129 ID.AddBoolean(S->isGlobalNew());
2130 ID.AddBoolean(S->isParenTypeId());
2131 ID.AddInteger(llvm::to_underlying(S->getInitializationStyle()));
2132}
2133
2134void
2135StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
2136 VisitExpr(S);
2137 ID.AddBoolean(S->isArrow());
2138 VisitNestedNameSpecifier(S->getQualifier());
2139 ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
2140 if (S->getScopeTypeInfo())
2141 VisitType(S->getScopeTypeInfo()->getType());
2142 ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
2143 if (S->getDestroyedTypeInfo())
2144 VisitType(S->getDestroyedType());
2145 else
2146 VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
2147}
2148
2149void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
2150 VisitExpr(S);
2151 VisitNestedNameSpecifier(S->getQualifier());
2152 VisitName(S->getName(), /*TreatAsDecl*/ true);
2153 ID.AddBoolean(S->hasExplicitTemplateArgs());
2154 if (S->hasExplicitTemplateArgs())
2155 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2156}
2157
2158void
2159StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
2160 VisitOverloadExpr(S);
2161}
2162
2163void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2164 VisitExpr(S);
2165 ID.AddInteger(S->getTrait());
2166 ID.AddInteger(S->getNumArgs());
2167 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
2168 VisitType(S->getArg(I)->getType());
2169}
2170
2171void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2172 VisitExpr(S);
2173 ID.AddInteger(S->getTrait());
2174 VisitType(S->getQueriedType());
2175}
2176
2177void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2178 VisitExpr(S);
2179 ID.AddInteger(S->getTrait());
2180 VisitExpr(S->getQueriedExpression());
2181}
2182
2183void StmtProfiler::VisitDependentScopeDeclRefExpr(
2184 const DependentScopeDeclRefExpr *S) {
2185 VisitExpr(S);
2186 VisitName(S->getDeclName());
2187 VisitNestedNameSpecifier(S->getQualifier());
2188 ID.AddBoolean(S->hasExplicitTemplateArgs());
2189 if (S->hasExplicitTemplateArgs())
2190 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2191}
2192
2193void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2194 VisitExpr(S);
2195}
2196
2197void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2198 const CXXUnresolvedConstructExpr *S) {
2199 VisitExpr(S);
2200 VisitType(S->getTypeAsWritten());
2201 ID.AddInteger(S->isListInitialization());
2202}
2203
2204void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2205 const CXXDependentScopeMemberExpr *S) {
2206 ID.AddBoolean(S->isImplicitAccess());
2207 if (!S->isImplicitAccess()) {
2208 VisitExpr(S);
2209 ID.AddBoolean(S->isArrow());
2210 }
2211 VisitNestedNameSpecifier(S->getQualifier());
2212 VisitName(S->getMember());
2213 ID.AddBoolean(S->hasExplicitTemplateArgs());
2214 if (S->hasExplicitTemplateArgs())
2215 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2216}
2217
2218void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2219 ID.AddBoolean(S->isImplicitAccess());
2220 if (!S->isImplicitAccess()) {
2221 VisitExpr(S);
2222 ID.AddBoolean(S->isArrow());
2223 }
2224 VisitNestedNameSpecifier(S->getQualifier());
2225 VisitName(S->getMemberName());
2226 ID.AddBoolean(S->hasExplicitTemplateArgs());
2227 if (S->hasExplicitTemplateArgs())
2228 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2229}
2230
2231void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2232 VisitExpr(S);
2233}
2234
2235void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2236 VisitExpr(S);
2237}
2238
2239void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2240 VisitExpr(S);
2241 VisitDecl(S->getPack());
2242 if (S->isPartiallySubstituted()) {
2243 auto Args = S->getPartialArguments();
2244 ID.AddInteger(Args.size());
2245 for (const auto &TA : Args)
2246 VisitTemplateArgument(TA);
2247 } else {
2248 ID.AddInteger(0);
2249 }
2250}
2251
2252void StmtProfiler::VisitPackIndexingExpr(const PackIndexingExpr *E) {
2253 VisitExpr(E);
2254 VisitExpr(E->getPackIdExpression());
2255 VisitExpr(E->getIndexExpr());
2256}
2257
2258void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2260 VisitExpr(S);
2261 VisitDecl(S->getParameterPack());
2262 VisitTemplateArgument(S->getArgumentPack());
2263}
2264
2265void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2267 // Profile exactly as the replacement expression.
2268 Visit(E->getReplacement());
2269}
2270
2271void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2272 VisitExpr(S);
2273 VisitDecl(S->getParameterPack());
2274 ID.AddInteger(S->getNumExpansions());
2275 for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
2276 VisitDecl(*I);
2277}
2278
2279void StmtProfiler::VisitMaterializeTemporaryExpr(
2280 const MaterializeTemporaryExpr *S) {
2281 VisitExpr(S);
2282}
2283
2284void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2285 VisitExpr(S);
2286 ID.AddInteger(S->getOperator());
2287}
2288
2289void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) {
2290 VisitExpr(S);
2291}
2292
2293void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2294 VisitStmt(S);
2295}
2296
2297void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2298 VisitStmt(S);
2299}
2300
2301void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2302 VisitExpr(S);
2303}
2304
2305void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2306 VisitExpr(S);
2307}
2308
2309void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2310 VisitExpr(S);
2311}
2312
2313void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2314 VisitExpr(E);
2315}
2316
2317void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2318 VisitExpr(E);
2319}
2320
2321void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2322 VisitExpr(E);
2323}
2324
2325void StmtProfiler::VisitEmbedExpr(const EmbedExpr *E) { VisitExpr(E); }
2326
2327void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2328
2329void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2330 VisitExpr(S);
2331}
2332
2333void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2334 VisitExpr(E);
2335}
2336
2337void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2338 VisitExpr(E);
2339}
2340
2341void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2342 VisitExpr(E);
2343}
2344
2345void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2346 VisitExpr(S);
2347 VisitType(S->getEncodedType());
2348}
2349
2350void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2351 VisitExpr(S);
2352 VisitName(S->getSelector());
2353}
2354
2355void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2356 VisitExpr(S);
2357 VisitDecl(S->getProtocol());
2358}
2359
2360void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2361 VisitExpr(S);
2362 VisitDecl(S->getDecl());
2363 ID.AddBoolean(S->isArrow());
2364 ID.AddBoolean(S->isFreeIvar());
2365}
2366
2367void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2368 VisitExpr(S);
2369 if (S->isImplicitProperty()) {
2370 VisitDecl(S->getImplicitPropertyGetter());
2371 VisitDecl(S->getImplicitPropertySetter());
2372 } else {
2373 VisitDecl(S->getExplicitProperty());
2374 }
2375 if (S->isSuperReceiver()) {
2376 ID.AddBoolean(S->isSuperReceiver());
2377 VisitType(S->getSuperReceiverType());
2378 }
2379}
2380
2381void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2382 VisitExpr(S);
2383 VisitDecl(S->getAtIndexMethodDecl());
2384 VisitDecl(S->setAtIndexMethodDecl());
2385}
2386
2387void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2388 VisitExpr(S);
2389 VisitName(S->getSelector());
2390 VisitDecl(S->getMethodDecl());
2391}
2392
2393void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2394 VisitExpr(S);
2395 ID.AddBoolean(S->isArrow());
2396}
2397
2398void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2399 VisitExpr(S);
2400 ID.AddBoolean(S->getValue());
2401}
2402
2403void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2404 const ObjCIndirectCopyRestoreExpr *S) {
2405 VisitExpr(S);
2406 ID.AddBoolean(S->shouldCopy());
2407}
2408
2409void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2410 VisitExplicitCastExpr(S);
2411 ID.AddBoolean(S->getBridgeKind());
2412}
2413
2414void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2415 const ObjCAvailabilityCheckExpr *S) {
2416 VisitExpr(S);
2417}
2418
2419void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2420 unsigned NumArgs) {
2421 ID.AddInteger(NumArgs);
2422 for (unsigned I = 0; I != NumArgs; ++I)
2423 VisitTemplateArgument(Args[I].getArgument());
2424}
2425
2426void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2427 // Mostly repetitive with TemplateArgument::Profile!
2428 ID.AddInteger(Arg.getKind());
2429 switch (Arg.getKind()) {
2431 break;
2432
2434 VisitType(Arg.getAsType());
2435 break;
2436
2439 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2440 break;
2441
2443 VisitType(Arg.getParamTypeForDecl());
2444 // FIXME: Do we need to recursively decompose template parameter objects?
2445 VisitDecl(Arg.getAsDecl());
2446 break;
2447
2449 VisitType(Arg.getNullPtrType());
2450 break;
2451
2453 VisitType(Arg.getIntegralType());
2454 Arg.getAsIntegral().Profile(ID);
2455 break;
2456
2458 VisitType(Arg.getStructuralValueType());
2459 // FIXME: Do we need to recursively decompose this ourselves?
2460 Arg.getAsStructuralValue().Profile(ID);
2461 break;
2462
2464 Visit(Arg.getAsExpr());
2465 break;
2466
2468 for (const auto &P : Arg.pack_elements())
2469 VisitTemplateArgument(P);
2470 break;
2471 }
2472}
2473
2474namespace {
2475class OpenACCClauseProfiler
2476 : public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2477 StmtProfiler &Profiler;
2478
2479public:
2480 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2481
2482 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2483 for (const OpenACCClause *Clause : Clauses) {
2484 // TODO OpenACC: When we have clauses with expressions, we should
2485 // profile them too.
2486 Visit(Clause);
2487 }
2488 }
2489
2490#define VISIT_CLAUSE(CLAUSE_NAME) \
2491 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2492
2493#include "clang/Basic/OpenACCClauses.def"
2494};
2495
2496/// Nothing to do here, there are no sub-statements.
2497void OpenACCClauseProfiler::VisitDefaultClause(
2498 const OpenACCDefaultClause &Clause) {}
2499
2500void OpenACCClauseProfiler::VisitIfClause(const OpenACCIfClause &Clause) {
2501 assert(Clause.hasConditionExpr() &&
2502 "if clause requires a valid condition expr");
2503 Profiler.VisitStmt(Clause.getConditionExpr());
2504}
2505
2506void OpenACCClauseProfiler::VisitCopyClause(const OpenACCCopyClause &Clause) {
2507 for (auto *E : Clause.getVarList())
2508 Profiler.VisitStmt(E);
2509}
2510void OpenACCClauseProfiler::VisitCopyInClause(
2511 const OpenACCCopyInClause &Clause) {
2512 for (auto *E : Clause.getVarList())
2513 Profiler.VisitStmt(E);
2514}
2515
2516void OpenACCClauseProfiler::VisitCopyOutClause(
2517 const OpenACCCopyOutClause &Clause) {
2518 for (auto *E : Clause.getVarList())
2519 Profiler.VisitStmt(E);
2520}
2521
2522void OpenACCClauseProfiler::VisitCreateClause(
2523 const OpenACCCreateClause &Clause) {
2524 for (auto *E : Clause.getVarList())
2525 Profiler.VisitStmt(E);
2526}
2527
2528void OpenACCClauseProfiler::VisitSelfClause(const OpenACCSelfClause &Clause) {
2529 if (Clause.hasConditionExpr())
2530 Profiler.VisitStmt(Clause.getConditionExpr());
2531}
2532
2533void OpenACCClauseProfiler::VisitNumGangsClause(
2534 const OpenACCNumGangsClause &Clause) {
2535 for (auto *E : Clause.getIntExprs())
2536 Profiler.VisitStmt(E);
2537}
2538
2539void OpenACCClauseProfiler::VisitNumWorkersClause(
2540 const OpenACCNumWorkersClause &Clause) {
2541 assert(Clause.hasIntExpr() && "num_workers clause requires a valid int expr");
2542 Profiler.VisitStmt(Clause.getIntExpr());
2543}
2544
2545void OpenACCClauseProfiler::VisitPrivateClause(
2546 const OpenACCPrivateClause &Clause) {
2547 for (auto *E : Clause.getVarList())
2548 Profiler.VisitStmt(E);
2549}
2550
2551void OpenACCClauseProfiler::VisitFirstPrivateClause(
2552 const OpenACCFirstPrivateClause &Clause) {
2553 for (auto *E : Clause.getVarList())
2554 Profiler.VisitStmt(E);
2555}
2556
2557void OpenACCClauseProfiler::VisitAttachClause(
2558 const OpenACCAttachClause &Clause) {
2559 for (auto *E : Clause.getVarList())
2560 Profiler.VisitStmt(E);
2561}
2562
2563void OpenACCClauseProfiler::VisitDevicePtrClause(
2564 const OpenACCDevicePtrClause &Clause) {
2565 for (auto *E : Clause.getVarList())
2566 Profiler.VisitStmt(E);
2567}
2568
2569void OpenACCClauseProfiler::VisitNoCreateClause(
2570 const OpenACCNoCreateClause &Clause) {
2571 for (auto *E : Clause.getVarList())
2572 Profiler.VisitStmt(E);
2573}
2574
2575void OpenACCClauseProfiler::VisitPresentClause(
2576 const OpenACCPresentClause &Clause) {
2577 for (auto *E : Clause.getVarList())
2578 Profiler.VisitStmt(E);
2579}
2580
2581void OpenACCClauseProfiler::VisitVectorLengthClause(
2582 const OpenACCVectorLengthClause &Clause) {
2583 assert(Clause.hasIntExpr() &&
2584 "vector_length clause requires a valid int expr");
2585 Profiler.VisitStmt(Clause.getIntExpr());
2586}
2587
2588void OpenACCClauseProfiler::VisitAsyncClause(const OpenACCAsyncClause &Clause) {
2589 if (Clause.hasIntExpr())
2590 Profiler.VisitStmt(Clause.getIntExpr());
2591}
2592
2593void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) {
2594 if (Clause.hasDevNumExpr())
2595 Profiler.VisitStmt(Clause.getDevNumExpr());
2596 for (auto *E : Clause.getQueueIdExprs())
2597 Profiler.VisitStmt(E);
2598}
2599/// Nothing to do here, there are no sub-statements.
2600void OpenACCClauseProfiler::VisitDeviceTypeClause(
2601 const OpenACCDeviceTypeClause &Clause) {}
2602
2603void OpenACCClauseProfiler::VisitAutoClause(const OpenACCAutoClause &Clause) {}
2604
2605void OpenACCClauseProfiler::VisitIndependentClause(
2606 const OpenACCIndependentClause &Clause) {}
2607
2608void OpenACCClauseProfiler::VisitSeqClause(const OpenACCSeqClause &Clause) {}
2609
2610void OpenACCClauseProfiler::VisitReductionClause(
2611 const OpenACCReductionClause &Clause) {
2612 for (auto *E : Clause.getVarList())
2613 Profiler.VisitStmt(E);
2614}
2615} // namespace
2616
2617void StmtProfiler::VisitOpenACCComputeConstruct(
2618 const OpenACCComputeConstruct *S) {
2619 // VisitStmt handles children, so the AssociatedStmt is handled.
2620 VisitStmt(S);
2621
2622 OpenACCClauseProfiler P{*this};
2623 P.VisitOpenACCClauseList(S->clauses());
2624}
2625
2626void StmtProfiler::VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S) {
2627 // VisitStmt handles children, so the Loop is handled.
2628 VisitStmt(S);
2629
2630 OpenACCClauseProfiler P{*this};
2631 P.VisitOpenACCClauseList(S->clauses());
2632}
2633
2634void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2635 bool Canonical, bool ProfileLambdaExpr) const {
2636 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
2637 Profiler.Visit(this);
2638}
2639
2640void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2641 class ODRHash &Hash) const {
2642 StmtProfilerWithoutPointers Profiler(ID, Hash);
2643 Profiler.Visit(this);
2644}
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:186
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:2625
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:4362
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5746
Represents a loop initializing the elements of an array.
Definition: Expr.h:5693
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
Definition: Expr.h:6916
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:2852
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:6416
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Definition: Expr.h:6619
Represents an attribute applied to a statement.
Definition: Stmt.h:2085
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4265
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:7626
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:6355
BreakStmt - This represents a break.
Definition: Stmt.h:2985
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:5290
This class is used for builtin types like 'int'.
Definition: Type.h:3000
Kind getKind() const
Definition: Type.h:3045
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:2497
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3681
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2799
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:4838
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:2240
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:4124
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:4952
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2616
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
capture_const_range captures() const
Definition: DeclCXX.h:1101
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:523
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:283
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
Definition: ExprCXX.h:2181
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:3555
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:3762
CaseStmt - Represent a case statement.
Definition: Stmt.h:1806
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:4582
Represents a 'co_await' expression.
Definition: ExprCXX.h:5183
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:4112
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3428
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1606
Represents the specialization of a concept - evaluates to a prvalue of type bool.
Definition: ExprConcepts.h:42
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:4203
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:2955
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4523
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:5264
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
Definition: DeclBase.h:2339
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:1497
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:957
Kind getKind() const
Definition: DeclBase.h:448
The name of a declaration.
Represents a 'co_await' expression while the type of the promise is dependent.
Definition: ExprCXX.h:5215
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3321
Represents a single C99 designator.
Definition: Expr.h:5317
Represents a C99 designated initializer expression.
Definition: Expr.h:5274
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:2730
Represents a reference to #emded data.
Definition: Expr.h:4857
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:3472
This represents one expression.
Definition: Expr.h:110
An expression trait intrinsic.
Definition: ExprCXX.h:2923
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:6295
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:2786
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:4646
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4680
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:3264
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4657
Represents a C11 generic selection.
Definition: Expr.h:5907
AssociationTy< true > ConstAssociation
Definition: Expr.h:6139
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2867
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
Definition: Stmt.h:2143
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:5782
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2906
Describes an C or C++ initializer list.
Definition: Expr.h:5029
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:2036
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:3487
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:4726
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:5602
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1569
void AddDecl(const Decl *D)
Definition: ODRHash.cpp:806
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:660
void AddTemplateName(TemplateName Name)
Definition: ODRHash.cpp:141
void AddQualType(QualType T)
Definition: ODRHash.cpp:1261
unsigned CalculateHash()
Definition: ODRHash.cpp:225
This represents 'acq_rel' clause in the '#pragma omp atomic|flush' directives.
This represents 'acquire' clause in the '#pragma omp atomic|flush' directives.
This represents clause 'affinity' in the '#pragma omp task'-based directives.
This represents the 'align' clause in the '#pragma omp allocate' directive.
Definition: OpenMPClause.h:388
This represents clause 'aligned' in the '#pragma omp ...' directives.
This represents clause 'allocate' in the '#pragma omp ...' directives.
Definition: OpenMPClause.h:432
This represents 'allocator' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:354
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 'shedule', 'firstprivate' etc.
Definition: OpenMPClause.h:195
This represents 'collapse' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:977
This represents 'compare' clause in the '#pragma omp atomic' directive.
This represents clause 'copyin' in the '#pragma omp ...' directives.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h: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:630
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h: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:879
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 'if' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:527
This represents clause 'in_reduction' in the '#pragma omp task' directives.
This represents clause 'inclusive' in the '#pragma omp scan' directive.
This represents the 'init' clause in '#pragma omp ...' directives.
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 'nocontext' clause in the '#pragma omp ...' directive.
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents clause 'nontemporal' in the '#pragma omp ...' directives.
This represents 'novariants' clause in the '#pragma omp ...' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:676
This represents 'order' clause in the '#pragma omp ...' directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h: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:907
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents clause 'private' in the '#pragma omp ...' directives.
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
This represents clause 'reduction' in the '#pragma omp ...' directives.
This represents 'relaxed' clause in the '#pragma omp atomic' directives.
This represents 'release' clause in the '#pragma omp atomic|flush' directives.
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:721
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:756
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1977
This represents the 'sizes' clause in the '#pragma omp tile' directive.
Definition: OpenMPClause.h:788
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h: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:2982
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4178
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:6487
const Expr *const * const_semantics_iterator
Definition: Expr.h:6552
A (possibly-)qualified type.
Definition: Type.h:941
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:7091
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:3024
Represents a __leave statement.
Definition: Stmt.h:3723
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4455
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4256
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Definition: Expr.h:4751
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4407
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:4482
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4567
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:2393
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:243
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2767
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:8583
TypeClass getTypeClass() const
Definition: Type.h:2316
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8516
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6767
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:3202
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3941
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:4691
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:2589
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.