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 | //===----------------------------------------------------------------------===// |
13 | #include "clang/AST/ASTContext.h" |
14 | #include "clang/AST/DeclCXX.h" |
15 | #include "clang/AST/DeclObjC.h" |
16 | #include "clang/AST/DeclTemplate.h" |
17 | #include "clang/AST/Expr.h" |
18 | #include "clang/AST/ExprCXX.h" |
19 | #include "clang/AST/ExprObjC.h" |
20 | #include "clang/AST/ExprOpenMP.h" |
21 | #include "clang/AST/ODRHash.h" |
22 | #include "clang/AST/OpenMPClause.h" |
23 | #include "clang/AST/StmtVisitor.h" |
24 | #include "llvm/ADT/FoldingSet.h" |
25 | using namespace clang; |
26 | |
27 | namespace { |
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(SC: 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(I: SC); |
95 | } |
96 | |
97 | void VisitDecl(const Decl *D) override { |
98 | ID.AddInteger(I: D ? D->getKind() : 0); |
99 | |
100 | if (Canonical && D) { |
101 | if (const NonTypeTemplateParmDecl *NTTP = |
102 | dyn_cast<NonTypeTemplateParmDecl>(Val: D)) { |
103 | ID.AddInteger(I: NTTP->getDepth()); |
104 | ID.AddInteger(I: NTTP->getIndex()); |
105 | ID.AddBoolean(B: 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(T: Context.getUnconstrainedType(T: NTTP->getType())); |
115 | return; |
116 | } |
117 | |
118 | if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(Val: 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(T: Parm->getType()); |
130 | ID.AddInteger(I: Parm->getFunctionScopeDepth()); |
131 | ID.AddInteger(I: Parm->getFunctionScopeIndex()); |
132 | return; |
133 | } |
134 | |
135 | if (const TemplateTypeParmDecl *TTP = |
136 | dyn_cast<TemplateTypeParmDecl>(Val: D)) { |
137 | ID.AddInteger(I: TTP->getDepth()); |
138 | ID.AddInteger(I: TTP->getIndex()); |
139 | ID.AddBoolean(B: TTP->isParameterPack()); |
140 | return; |
141 | } |
142 | |
143 | if (const TemplateTemplateParmDecl *TTP = |
144 | dyn_cast<TemplateTemplateParmDecl>(Val: D)) { |
145 | ID.AddInteger(I: TTP->getDepth()); |
146 | ID.AddInteger(I: TTP->getIndex()); |
147 | ID.AddBoolean(B: TTP->isParameterPack()); |
148 | return; |
149 | } |
150 | } |
151 | |
152 | ID.AddPointer(Ptr: 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(Ptr: T.getAsOpaquePtr()); |
160 | } |
161 | |
162 | void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override { |
163 | ID.AddPointer(Ptr: Name.getAsOpaquePtr()); |
164 | } |
165 | |
166 | void VisitIdentifierInfo(const IdentifierInfo *II) override { |
167 | ID.AddPointer(Ptr: II); |
168 | } |
169 | |
170 | void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { |
171 | if (Canonical) |
172 | NNS = Context.getCanonicalNestedNameSpecifier(NNS); |
173 | ID.AddPointer(Ptr: 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(I: Stmt::DeclRefExprClass); |
197 | } else { |
198 | ID.AddInteger(I: 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(B: true); |
211 | } |
212 | Hash.AddDeclarationName(Name, TreatAsDecl); |
213 | } |
214 | void VisitIdentifierInfo(const IdentifierInfo *II) override { |
215 | ID.AddBoolean(B: II); |
216 | if (II) { |
217 | Hash.AddIdentifierInfo(II); |
218 | } |
219 | } |
220 | void VisitDecl(const Decl *D) override { |
221 | ID.AddBoolean(B: 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(B: NNS); |
231 | if (NNS) { |
232 | Hash.AddNestedNameSpecifier(NNS); |
233 | } |
234 | } |
235 | }; |
236 | } |
237 | |
238 | void 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(S: SubStmt); |
246 | else |
247 | ID.AddInteger(I: 0); |
248 | } |
249 | } |
250 | |
251 | void StmtProfiler::VisitDeclStmt(const DeclStmt *S) { |
252 | VisitStmt(S); |
253 | for (const auto *D : S->decls()) |
254 | VisitDecl(D); |
255 | } |
256 | |
257 | void StmtProfiler::VisitNullStmt(const NullStmt *S) { |
258 | VisitStmt(S); |
259 | } |
260 | |
261 | void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) { |
262 | VisitStmt(S); |
263 | } |
264 | |
265 | void StmtProfiler::VisitCaseStmt(const CaseStmt *S) { |
266 | VisitStmt(S); |
267 | } |
268 | |
269 | void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) { |
270 | VisitStmt(S); |
271 | } |
272 | |
273 | void StmtProfiler::VisitLabelStmt(const LabelStmt *S) { |
274 | VisitStmt(S); |
275 | VisitDecl(D: S->getDecl()); |
276 | } |
277 | |
278 | void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) { |
279 | VisitStmt(S); |
280 | // TODO: maybe visit attributes? |
281 | } |
282 | |
283 | void StmtProfiler::VisitIfStmt(const IfStmt *S) { |
284 | VisitStmt(S); |
285 | VisitDecl(D: S->getConditionVariable()); |
286 | } |
287 | |
288 | void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) { |
289 | VisitStmt(S); |
290 | VisitDecl(D: S->getConditionVariable()); |
291 | } |
292 | |
293 | void StmtProfiler::VisitWhileStmt(const WhileStmt *S) { |
294 | VisitStmt(S); |
295 | VisitDecl(D: S->getConditionVariable()); |
296 | } |
297 | |
298 | void StmtProfiler::VisitDoStmt(const DoStmt *S) { |
299 | VisitStmt(S); |
300 | } |
301 | |
302 | void StmtProfiler::VisitForStmt(const ForStmt *S) { |
303 | VisitStmt(S); |
304 | } |
305 | |
306 | void StmtProfiler::VisitGotoStmt(const GotoStmt *S) { |
307 | VisitStmt(S); |
308 | VisitDecl(D: S->getLabel()); |
309 | } |
310 | |
311 | void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) { |
312 | VisitStmt(S); |
313 | } |
314 | |
315 | void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) { |
316 | VisitStmt(S); |
317 | } |
318 | |
319 | void StmtProfiler::VisitBreakStmt(const BreakStmt *S) { |
320 | VisitStmt(S); |
321 | } |
322 | |
323 | void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) { |
324 | VisitStmt(S); |
325 | } |
326 | |
327 | void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) { |
328 | VisitStmt(S); |
329 | ID.AddBoolean(B: S->isVolatile()); |
330 | ID.AddBoolean(B: S->isSimple()); |
331 | VisitStringLiteral(S: S->getAsmString()); |
332 | ID.AddInteger(I: S->getNumOutputs()); |
333 | for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) { |
334 | ID.AddString(String: S->getOutputName(i: I)); |
335 | VisitStringLiteral(S: S->getOutputConstraintLiteral(i: I)); |
336 | } |
337 | ID.AddInteger(I: S->getNumInputs()); |
338 | for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) { |
339 | ID.AddString(String: S->getInputName(i: I)); |
340 | VisitStringLiteral(S: S->getInputConstraintLiteral(i: I)); |
341 | } |
342 | ID.AddInteger(I: S->getNumClobbers()); |
343 | for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) |
344 | VisitStringLiteral(S: S->getClobberStringLiteral(i: I)); |
345 | ID.AddInteger(I: S->getNumLabels()); |
346 | for (auto *L : S->labels()) |
347 | VisitDecl(D: L->getLabel()); |
348 | } |
349 | |
350 | void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) { |
351 | // FIXME: Implement MS style inline asm statement profiler. |
352 | VisitStmt(S); |
353 | } |
354 | |
355 | void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) { |
356 | VisitStmt(S); |
357 | VisitType(T: S->getCaughtType()); |
358 | } |
359 | |
360 | void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) { |
361 | VisitStmt(S); |
362 | } |
363 | |
364 | void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) { |
365 | VisitStmt(S); |
366 | } |
367 | |
368 | void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) { |
369 | VisitStmt(S); |
370 | ID.AddBoolean(B: S->isIfExists()); |
371 | VisitNestedNameSpecifier(NNS: S->getQualifierLoc().getNestedNameSpecifier()); |
372 | VisitName(Name: S->getNameInfo().getName()); |
373 | } |
374 | |
375 | void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) { |
376 | VisitStmt(S); |
377 | } |
378 | |
379 | void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) { |
380 | VisitStmt(S); |
381 | } |
382 | |
383 | void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) { |
384 | VisitStmt(S); |
385 | } |
386 | |
387 | void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) { |
388 | VisitStmt(S); |
389 | } |
390 | |
391 | void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) { |
392 | VisitStmt(S); |
393 | } |
394 | |
395 | void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) { |
396 | VisitStmt(S); |
397 | } |
398 | |
399 | void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) { |
400 | VisitStmt(S); |
401 | ID.AddBoolean(B: S->hasEllipsis()); |
402 | if (S->getCatchParamDecl()) |
403 | VisitType(T: S->getCatchParamDecl()->getType()); |
404 | } |
405 | |
406 | void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) { |
407 | VisitStmt(S); |
408 | } |
409 | |
410 | void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) { |
411 | VisitStmt(S); |
412 | } |
413 | |
414 | void |
415 | StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) { |
416 | VisitStmt(S); |
417 | } |
418 | |
419 | void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) { |
420 | VisitStmt(S); |
421 | } |
422 | |
423 | void |
424 | StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) { |
425 | VisitStmt(S); |
426 | } |
427 | |
428 | namespace { |
429 | class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> { |
430 | StmtProfiler *Profiler; |
431 | /// Process clauses with list of variables. |
432 | template <typename T> |
433 | void VisitOMPClauseList(T *Node); |
434 | |
435 | public: |
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 | |
444 | void OMPClauseProfiler::VistOMPClauseWithPreInit( |
445 | const OMPClauseWithPreInit *C) { |
446 | if (auto *S = C->getPreInitStmt()) |
447 | Profiler->VisitStmt(S); |
448 | } |
449 | |
450 | void OMPClauseProfiler::VistOMPClauseWithPostUpdate( |
451 | const OMPClauseWithPostUpdate *C) { |
452 | VistOMPClauseWithPreInit(C); |
453 | if (auto *E = C->getPostUpdateExpr()) |
454 | Profiler->VisitStmt(S: E); |
455 | } |
456 | |
457 | void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) { |
458 | VistOMPClauseWithPreInit(C); |
459 | if (C->getCondition()) |
460 | Profiler->VisitStmt(S: C->getCondition()); |
461 | } |
462 | |
463 | void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) { |
464 | VistOMPClauseWithPreInit(C); |
465 | if (C->getCondition()) |
466 | Profiler->VisitStmt(S: C->getCondition()); |
467 | } |
468 | |
469 | void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) { |
470 | VistOMPClauseWithPreInit(C); |
471 | if (C->getNumThreads()) |
472 | Profiler->VisitStmt(S: C->getNumThreads()); |
473 | } |
474 | |
475 | void OMPClauseProfiler::VisitOMPAlignClause(const OMPAlignClause *C) { |
476 | if (C->getAlignment()) |
477 | Profiler->VisitStmt(S: C->getAlignment()); |
478 | } |
479 | |
480 | void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) { |
481 | if (C->getSafelen()) |
482 | Profiler->VisitStmt(S: C->getSafelen()); |
483 | } |
484 | |
485 | void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) { |
486 | if (C->getSimdlen()) |
487 | Profiler->VisitStmt(S: C->getSimdlen()); |
488 | } |
489 | |
490 | void OMPClauseProfiler::VisitOMPSizesClause(const OMPSizesClause *C) { |
491 | for (auto *E : C->getSizesRefs()) |
492 | if (E) |
493 | Profiler->VisitExpr(S: E); |
494 | } |
495 | |
496 | void OMPClauseProfiler::VisitOMPFullClause(const OMPFullClause *C) {} |
497 | |
498 | void OMPClauseProfiler::VisitOMPPartialClause(const OMPPartialClause *C) { |
499 | if (const Expr *Factor = C->getFactor()) |
500 | Profiler->VisitExpr(S: Factor); |
501 | } |
502 | |
503 | void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) { |
504 | if (C->getAllocator()) |
505 | Profiler->VisitStmt(S: C->getAllocator()); |
506 | } |
507 | |
508 | void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) { |
509 | if (C->getNumForLoops()) |
510 | Profiler->VisitStmt(S: C->getNumForLoops()); |
511 | } |
512 | |
513 | void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) { |
514 | if (Expr *Evt = C->getEventHandler()) |
515 | Profiler->VisitStmt(S: Evt); |
516 | } |
517 | |
518 | void OMPClauseProfiler::VisitOMPNovariantsClause(const OMPNovariantsClause *C) { |
519 | VistOMPClauseWithPreInit(C); |
520 | if (C->getCondition()) |
521 | Profiler->VisitStmt(S: C->getCondition()); |
522 | } |
523 | |
524 | void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) { |
525 | VistOMPClauseWithPreInit(C); |
526 | if (C->getCondition()) |
527 | Profiler->VisitStmt(S: C->getCondition()); |
528 | } |
529 | |
530 | void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { } |
531 | |
532 | void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { } |
533 | |
534 | void OMPClauseProfiler::VisitOMPUnifiedAddressClause( |
535 | const OMPUnifiedAddressClause *C) {} |
536 | |
537 | void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause( |
538 | const OMPUnifiedSharedMemoryClause *C) {} |
539 | |
540 | void OMPClauseProfiler::VisitOMPReverseOffloadClause( |
541 | const OMPReverseOffloadClause *C) {} |
542 | |
543 | void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause( |
544 | const OMPDynamicAllocatorsClause *C) {} |
545 | |
546 | void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause( |
547 | const OMPAtomicDefaultMemOrderClause *C) {} |
548 | |
549 | void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {} |
550 | |
551 | void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {} |
552 | |
553 | void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) { |
554 | if (C->getMessageString()) |
555 | Profiler->VisitStmt(S: C->getMessageString()); |
556 | } |
557 | |
558 | void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) { |
559 | VistOMPClauseWithPreInit(C); |
560 | if (auto *S = C->getChunkSize()) |
561 | Profiler->VisitStmt(S); |
562 | } |
563 | |
564 | void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) { |
565 | if (auto *Num = C->getNumForLoops()) |
566 | Profiler->VisitStmt(S: Num); |
567 | } |
568 | |
569 | void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {} |
570 | |
571 | void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {} |
572 | |
573 | void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {} |
574 | |
575 | void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {} |
576 | |
577 | void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {} |
578 | |
579 | void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {} |
580 | |
581 | void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {} |
582 | |
583 | void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {} |
584 | |
585 | void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {} |
586 | |
587 | void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} |
588 | |
589 | void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {} |
590 | |
591 | void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {} |
592 | |
593 | void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {} |
594 | |
595 | void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {} |
596 | |
597 | void OMPClauseProfiler::VisitOMPWeakClause(const OMPWeakClause *) {} |
598 | |
599 | void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {} |
600 | |
601 | void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {} |
602 | |
603 | void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {} |
604 | |
605 | void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) { |
606 | VisitOMPClauseList(Node: C); |
607 | } |
608 | |
609 | void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) { |
610 | if (C->getInteropVar()) |
611 | Profiler->VisitStmt(S: C->getInteropVar()); |
612 | } |
613 | |
614 | void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) { |
615 | if (C->getInteropVar()) |
616 | Profiler->VisitStmt(S: C->getInteropVar()); |
617 | } |
618 | |
619 | void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) { |
620 | VistOMPClauseWithPreInit(C); |
621 | if (C->getThreadID()) |
622 | Profiler->VisitStmt(S: C->getThreadID()); |
623 | } |
624 | |
625 | template<typename T> |
626 | void OMPClauseProfiler::VisitOMPClauseList(T *Node) { |
627 | for (auto *E : Node->varlists()) { |
628 | if (E) |
629 | Profiler->VisitStmt(S: E); |
630 | } |
631 | } |
632 | |
633 | void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) { |
634 | VisitOMPClauseList(Node: C); |
635 | for (auto *E : C->private_copies()) { |
636 | if (E) |
637 | Profiler->VisitStmt(S: E); |
638 | } |
639 | } |
640 | void |
641 | OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) { |
642 | VisitOMPClauseList(Node: C); |
643 | VistOMPClauseWithPreInit(C); |
644 | for (auto *E : C->private_copies()) { |
645 | if (E) |
646 | Profiler->VisitStmt(S: E); |
647 | } |
648 | for (auto *E : C->inits()) { |
649 | if (E) |
650 | Profiler->VisitStmt(S: E); |
651 | } |
652 | } |
653 | void |
654 | OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) { |
655 | VisitOMPClauseList(Node: C); |
656 | VistOMPClauseWithPostUpdate(C); |
657 | for (auto *E : C->source_exprs()) { |
658 | if (E) |
659 | Profiler->VisitStmt(S: E); |
660 | } |
661 | for (auto *E : C->destination_exprs()) { |
662 | if (E) |
663 | Profiler->VisitStmt(S: E); |
664 | } |
665 | for (auto *E : C->assignment_ops()) { |
666 | if (E) |
667 | Profiler->VisitStmt(S: E); |
668 | } |
669 | } |
670 | void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) { |
671 | VisitOMPClauseList(Node: C); |
672 | } |
673 | void OMPClauseProfiler::VisitOMPReductionClause( |
674 | const OMPReductionClause *C) { |
675 | Profiler->VisitNestedNameSpecifier( |
676 | NNS: C->getQualifierLoc().getNestedNameSpecifier()); |
677 | Profiler->VisitName(Name: C->getNameInfo().getName()); |
678 | VisitOMPClauseList(Node: C); |
679 | VistOMPClauseWithPostUpdate(C); |
680 | for (auto *E : C->privates()) { |
681 | if (E) |
682 | Profiler->VisitStmt(S: E); |
683 | } |
684 | for (auto *E : C->lhs_exprs()) { |
685 | if (E) |
686 | Profiler->VisitStmt(S: E); |
687 | } |
688 | for (auto *E : C->rhs_exprs()) { |
689 | if (E) |
690 | Profiler->VisitStmt(S: E); |
691 | } |
692 | for (auto *E : C->reduction_ops()) { |
693 | if (E) |
694 | Profiler->VisitStmt(S: E); |
695 | } |
696 | if (C->getModifier() == clang::OMPC_REDUCTION_inscan) { |
697 | for (auto *E : C->copy_ops()) { |
698 | if (E) |
699 | Profiler->VisitStmt(S: E); |
700 | } |
701 | for (auto *E : C->copy_array_temps()) { |
702 | if (E) |
703 | Profiler->VisitStmt(S: E); |
704 | } |
705 | for (auto *E : C->copy_array_elems()) { |
706 | if (E) |
707 | Profiler->VisitStmt(S: E); |
708 | } |
709 | } |
710 | } |
711 | void OMPClauseProfiler::VisitOMPTaskReductionClause( |
712 | const OMPTaskReductionClause *C) { |
713 | Profiler->VisitNestedNameSpecifier( |
714 | NNS: C->getQualifierLoc().getNestedNameSpecifier()); |
715 | Profiler->VisitName(Name: C->getNameInfo().getName()); |
716 | VisitOMPClauseList(Node: C); |
717 | VistOMPClauseWithPostUpdate(C); |
718 | for (auto *E : C->privates()) { |
719 | if (E) |
720 | Profiler->VisitStmt(S: E); |
721 | } |
722 | for (auto *E : C->lhs_exprs()) { |
723 | if (E) |
724 | Profiler->VisitStmt(S: E); |
725 | } |
726 | for (auto *E : C->rhs_exprs()) { |
727 | if (E) |
728 | Profiler->VisitStmt(S: E); |
729 | } |
730 | for (auto *E : C->reduction_ops()) { |
731 | if (E) |
732 | Profiler->VisitStmt(S: E); |
733 | } |
734 | } |
735 | void OMPClauseProfiler::VisitOMPInReductionClause( |
736 | const OMPInReductionClause *C) { |
737 | Profiler->VisitNestedNameSpecifier( |
738 | NNS: C->getQualifierLoc().getNestedNameSpecifier()); |
739 | Profiler->VisitName(Name: C->getNameInfo().getName()); |
740 | VisitOMPClauseList(Node: C); |
741 | VistOMPClauseWithPostUpdate(C); |
742 | for (auto *E : C->privates()) { |
743 | if (E) |
744 | Profiler->VisitStmt(S: E); |
745 | } |
746 | for (auto *E : C->lhs_exprs()) { |
747 | if (E) |
748 | Profiler->VisitStmt(S: E); |
749 | } |
750 | for (auto *E : C->rhs_exprs()) { |
751 | if (E) |
752 | Profiler->VisitStmt(S: E); |
753 | } |
754 | for (auto *E : C->reduction_ops()) { |
755 | if (E) |
756 | Profiler->VisitStmt(S: E); |
757 | } |
758 | for (auto *E : C->taskgroup_descriptors()) { |
759 | if (E) |
760 | Profiler->VisitStmt(S: E); |
761 | } |
762 | } |
763 | void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) { |
764 | VisitOMPClauseList(Node: C); |
765 | VistOMPClauseWithPostUpdate(C); |
766 | for (auto *E : C->privates()) { |
767 | if (E) |
768 | Profiler->VisitStmt(S: E); |
769 | } |
770 | for (auto *E : C->inits()) { |
771 | if (E) |
772 | Profiler->VisitStmt(S: E); |
773 | } |
774 | for (auto *E : C->updates()) { |
775 | if (E) |
776 | Profiler->VisitStmt(S: E); |
777 | } |
778 | for (auto *E : C->finals()) { |
779 | if (E) |
780 | Profiler->VisitStmt(S: E); |
781 | } |
782 | if (C->getStep()) |
783 | Profiler->VisitStmt(S: C->getStep()); |
784 | if (C->getCalcStep()) |
785 | Profiler->VisitStmt(S: C->getCalcStep()); |
786 | } |
787 | void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) { |
788 | VisitOMPClauseList(Node: C); |
789 | if (C->getAlignment()) |
790 | Profiler->VisitStmt(S: C->getAlignment()); |
791 | } |
792 | void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) { |
793 | VisitOMPClauseList(Node: C); |
794 | for (auto *E : C->source_exprs()) { |
795 | if (E) |
796 | Profiler->VisitStmt(S: E); |
797 | } |
798 | for (auto *E : C->destination_exprs()) { |
799 | if (E) |
800 | Profiler->VisitStmt(S: E); |
801 | } |
802 | for (auto *E : C->assignment_ops()) { |
803 | if (E) |
804 | Profiler->VisitStmt(S: E); |
805 | } |
806 | } |
807 | void |
808 | OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) { |
809 | VisitOMPClauseList(Node: C); |
810 | for (auto *E : C->source_exprs()) { |
811 | if (E) |
812 | Profiler->VisitStmt(S: E); |
813 | } |
814 | for (auto *E : C->destination_exprs()) { |
815 | if (E) |
816 | Profiler->VisitStmt(S: E); |
817 | } |
818 | for (auto *E : C->assignment_ops()) { |
819 | if (E) |
820 | Profiler->VisitStmt(S: E); |
821 | } |
822 | } |
823 | void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) { |
824 | VisitOMPClauseList(Node: C); |
825 | } |
826 | void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) { |
827 | if (const Expr *Depobj = C->getDepobj()) |
828 | Profiler->VisitStmt(S: Depobj); |
829 | } |
830 | void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) { |
831 | VisitOMPClauseList(Node: C); |
832 | } |
833 | void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) { |
834 | if (C->getDevice()) |
835 | Profiler->VisitStmt(S: C->getDevice()); |
836 | } |
837 | void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) { |
838 | VisitOMPClauseList(Node: C); |
839 | } |
840 | void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) { |
841 | if (Expr *Allocator = C->getAllocator()) |
842 | Profiler->VisitStmt(S: Allocator); |
843 | VisitOMPClauseList(Node: C); |
844 | } |
845 | void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) { |
846 | VistOMPClauseWithPreInit(C); |
847 | if (C->getNumTeams()) |
848 | Profiler->VisitStmt(S: C->getNumTeams()); |
849 | } |
850 | void OMPClauseProfiler::VisitOMPThreadLimitClause( |
851 | const OMPThreadLimitClause *C) { |
852 | VistOMPClauseWithPreInit(C); |
853 | if (C->getThreadLimit()) |
854 | Profiler->VisitStmt(S: C->getThreadLimit()); |
855 | } |
856 | void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) { |
857 | VistOMPClauseWithPreInit(C); |
858 | if (C->getPriority()) |
859 | Profiler->VisitStmt(S: C->getPriority()); |
860 | } |
861 | void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) { |
862 | VistOMPClauseWithPreInit(C); |
863 | if (C->getGrainsize()) |
864 | Profiler->VisitStmt(S: C->getGrainsize()); |
865 | } |
866 | void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) { |
867 | VistOMPClauseWithPreInit(C); |
868 | if (C->getNumTasks()) |
869 | Profiler->VisitStmt(S: C->getNumTasks()); |
870 | } |
871 | void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) { |
872 | if (C->getHint()) |
873 | Profiler->VisitStmt(S: C->getHint()); |
874 | } |
875 | void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) { |
876 | VisitOMPClauseList(Node: C); |
877 | } |
878 | void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) { |
879 | VisitOMPClauseList(Node: C); |
880 | } |
881 | void OMPClauseProfiler::VisitOMPUseDevicePtrClause( |
882 | const OMPUseDevicePtrClause *C) { |
883 | VisitOMPClauseList(Node: C); |
884 | } |
885 | void OMPClauseProfiler::VisitOMPUseDeviceAddrClause( |
886 | const OMPUseDeviceAddrClause *C) { |
887 | VisitOMPClauseList(Node: C); |
888 | } |
889 | void OMPClauseProfiler::VisitOMPIsDevicePtrClause( |
890 | const OMPIsDevicePtrClause *C) { |
891 | VisitOMPClauseList(Node: C); |
892 | } |
893 | void OMPClauseProfiler::VisitOMPHasDeviceAddrClause( |
894 | const OMPHasDeviceAddrClause *C) { |
895 | VisitOMPClauseList(Node: C); |
896 | } |
897 | void OMPClauseProfiler::VisitOMPNontemporalClause( |
898 | const OMPNontemporalClause *C) { |
899 | VisitOMPClauseList(Node: C); |
900 | for (auto *E : C->private_refs()) |
901 | Profiler->VisitStmt(S: E); |
902 | } |
903 | void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) { |
904 | VisitOMPClauseList(Node: C); |
905 | } |
906 | void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) { |
907 | VisitOMPClauseList(Node: C); |
908 | } |
909 | void 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(S: D.Allocator); |
914 | if (D.AllocatorTraits) |
915 | Profiler->VisitStmt(S: D.AllocatorTraits); |
916 | } |
917 | } |
918 | void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) { |
919 | if (const Expr *Modifier = C->getModifier()) |
920 | Profiler->VisitStmt(S: Modifier); |
921 | for (const Expr *E : C->varlists()) |
922 | Profiler->VisitStmt(S: E); |
923 | } |
924 | void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {} |
925 | void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {} |
926 | void OMPClauseProfiler::VisitOMPXDynCGroupMemClause( |
927 | const OMPXDynCGroupMemClause *C) { |
928 | VistOMPClauseWithPreInit(C); |
929 | if (Expr *Size = C->getSize()) |
930 | Profiler->VisitStmt(S: Size); |
931 | } |
932 | void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) { |
933 | VisitOMPClauseList(Node: C); |
934 | } |
935 | void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) { |
936 | } |
937 | void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {} |
938 | } // namespace |
939 | |
940 | void |
941 | StmtProfiler::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(S: *I); |
949 | } |
950 | |
951 | void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) { |
952 | VisitStmt(S: L); |
953 | } |
954 | |
955 | void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) { |
956 | VisitOMPExecutableDirective(S); |
957 | } |
958 | |
959 | void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) { |
960 | VisitOMPLoopBasedDirective(S); |
961 | } |
962 | |
963 | void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) { |
964 | VisitOMPExecutableDirective(S); |
965 | } |
966 | |
967 | void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) { |
968 | VisitOMPExecutableDirective(S); |
969 | } |
970 | |
971 | void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) { |
972 | VisitOMPLoopDirective(S); |
973 | } |
974 | |
975 | void StmtProfiler::VisitOMPLoopTransformationDirective( |
976 | const OMPLoopTransformationDirective *S) { |
977 | VisitOMPLoopBasedDirective(S); |
978 | } |
979 | |
980 | void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) { |
981 | VisitOMPLoopTransformationDirective(S); |
982 | } |
983 | |
984 | void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) { |
985 | VisitOMPLoopTransformationDirective(S); |
986 | } |
987 | |
988 | void StmtProfiler::VisitOMPReverseDirective(const OMPReverseDirective *S) { |
989 | VisitOMPLoopTransformationDirective(S); |
990 | } |
991 | |
992 | void StmtProfiler::VisitOMPInterchangeDirective( |
993 | const OMPInterchangeDirective *S) { |
994 | VisitOMPLoopTransformationDirective(S); |
995 | } |
996 | |
997 | void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) { |
998 | VisitOMPLoopDirective(S); |
999 | } |
1000 | |
1001 | void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) { |
1002 | VisitOMPLoopDirective(S); |
1003 | } |
1004 | |
1005 | void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) { |
1006 | VisitOMPExecutableDirective(S); |
1007 | } |
1008 | |
1009 | void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) { |
1010 | VisitOMPExecutableDirective(S); |
1011 | } |
1012 | |
1013 | void StmtProfiler::VisitOMPScopeDirective(const OMPScopeDirective *S) { |
1014 | VisitOMPExecutableDirective(S); |
1015 | } |
1016 | |
1017 | void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) { |
1018 | VisitOMPExecutableDirective(S); |
1019 | } |
1020 | |
1021 | void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) { |
1022 | VisitOMPExecutableDirective(S); |
1023 | } |
1024 | |
1025 | void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) { |
1026 | VisitOMPExecutableDirective(S); |
1027 | VisitName(Name: S->getDirectiveName().getName()); |
1028 | } |
1029 | |
1030 | void |
1031 | StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) { |
1032 | VisitOMPLoopDirective(S); |
1033 | } |
1034 | |
1035 | void StmtProfiler::VisitOMPParallelForSimdDirective( |
1036 | const OMPParallelForSimdDirective *S) { |
1037 | VisitOMPLoopDirective(S); |
1038 | } |
1039 | |
1040 | void StmtProfiler::VisitOMPParallelMasterDirective( |
1041 | const OMPParallelMasterDirective *S) { |
1042 | VisitOMPExecutableDirective(S); |
1043 | } |
1044 | |
1045 | void StmtProfiler::VisitOMPParallelMaskedDirective( |
1046 | const OMPParallelMaskedDirective *S) { |
1047 | VisitOMPExecutableDirective(S); |
1048 | } |
1049 | |
1050 | void StmtProfiler::VisitOMPParallelSectionsDirective( |
1051 | const OMPParallelSectionsDirective *S) { |
1052 | VisitOMPExecutableDirective(S); |
1053 | } |
1054 | |
1055 | void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) { |
1056 | VisitOMPExecutableDirective(S); |
1057 | } |
1058 | |
1059 | void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) { |
1060 | VisitOMPExecutableDirective(S); |
1061 | } |
1062 | |
1063 | void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) { |
1064 | VisitOMPExecutableDirective(S); |
1065 | } |
1066 | |
1067 | void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) { |
1068 | VisitOMPExecutableDirective(S); |
1069 | } |
1070 | |
1071 | void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) { |
1072 | VisitOMPExecutableDirective(S); |
1073 | } |
1074 | void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) { |
1075 | VisitOMPExecutableDirective(S); |
1076 | if (const Expr *E = S->getReductionRef()) |
1077 | VisitStmt(S: E); |
1078 | } |
1079 | |
1080 | void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) { |
1081 | VisitOMPExecutableDirective(S); |
1082 | } |
1083 | |
1084 | void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) { |
1085 | VisitOMPExecutableDirective(S); |
1086 | } |
1087 | |
1088 | void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) { |
1089 | VisitOMPExecutableDirective(S); |
1090 | } |
1091 | |
1092 | void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) { |
1093 | VisitOMPExecutableDirective(S); |
1094 | } |
1095 | |
1096 | void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) { |
1097 | VisitOMPExecutableDirective(S); |
1098 | } |
1099 | |
1100 | void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) { |
1101 | VisitOMPExecutableDirective(S); |
1102 | } |
1103 | |
1104 | void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) { |
1105 | VisitOMPExecutableDirective(S); |
1106 | } |
1107 | |
1108 | void StmtProfiler::VisitOMPTargetEnterDataDirective( |
1109 | const OMPTargetEnterDataDirective *S) { |
1110 | VisitOMPExecutableDirective(S); |
1111 | } |
1112 | |
1113 | void StmtProfiler::VisitOMPTargetExitDataDirective( |
1114 | const OMPTargetExitDataDirective *S) { |
1115 | VisitOMPExecutableDirective(S); |
1116 | } |
1117 | |
1118 | void StmtProfiler::VisitOMPTargetParallelDirective( |
1119 | const OMPTargetParallelDirective *S) { |
1120 | VisitOMPExecutableDirective(S); |
1121 | } |
1122 | |
1123 | void StmtProfiler::VisitOMPTargetParallelForDirective( |
1124 | const OMPTargetParallelForDirective *S) { |
1125 | VisitOMPExecutableDirective(S); |
1126 | } |
1127 | |
1128 | void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) { |
1129 | VisitOMPExecutableDirective(S); |
1130 | } |
1131 | |
1132 | void StmtProfiler::VisitOMPCancellationPointDirective( |
1133 | const OMPCancellationPointDirective *S) { |
1134 | VisitOMPExecutableDirective(S); |
1135 | } |
1136 | |
1137 | void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) { |
1138 | VisitOMPExecutableDirective(S); |
1139 | } |
1140 | |
1141 | void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) { |
1142 | VisitOMPLoopDirective(S); |
1143 | } |
1144 | |
1145 | void StmtProfiler::VisitOMPTaskLoopSimdDirective( |
1146 | const OMPTaskLoopSimdDirective *S) { |
1147 | VisitOMPLoopDirective(S); |
1148 | } |
1149 | |
1150 | void StmtProfiler::VisitOMPMasterTaskLoopDirective( |
1151 | const OMPMasterTaskLoopDirective *S) { |
1152 | VisitOMPLoopDirective(S); |
1153 | } |
1154 | |
1155 | void StmtProfiler::VisitOMPMaskedTaskLoopDirective( |
1156 | const OMPMaskedTaskLoopDirective *S) { |
1157 | VisitOMPLoopDirective(S); |
1158 | } |
1159 | |
1160 | void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective( |
1161 | const OMPMasterTaskLoopSimdDirective *S) { |
1162 | VisitOMPLoopDirective(S); |
1163 | } |
1164 | |
1165 | void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective( |
1166 | const OMPMaskedTaskLoopSimdDirective *S) { |
1167 | VisitOMPLoopDirective(S); |
1168 | } |
1169 | |
1170 | void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective( |
1171 | const OMPParallelMasterTaskLoopDirective *S) { |
1172 | VisitOMPLoopDirective(S); |
1173 | } |
1174 | |
1175 | void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective( |
1176 | const OMPParallelMaskedTaskLoopDirective *S) { |
1177 | VisitOMPLoopDirective(S); |
1178 | } |
1179 | |
1180 | void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective( |
1181 | const OMPParallelMasterTaskLoopSimdDirective *S) { |
1182 | VisitOMPLoopDirective(S); |
1183 | } |
1184 | |
1185 | void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective( |
1186 | const OMPParallelMaskedTaskLoopSimdDirective *S) { |
1187 | VisitOMPLoopDirective(S); |
1188 | } |
1189 | |
1190 | void StmtProfiler::VisitOMPDistributeDirective( |
1191 | const OMPDistributeDirective *S) { |
1192 | VisitOMPLoopDirective(S); |
1193 | } |
1194 | |
1195 | void OMPClauseProfiler::VisitOMPDistScheduleClause( |
1196 | const OMPDistScheduleClause *C) { |
1197 | VistOMPClauseWithPreInit(C); |
1198 | if (auto *S = C->getChunkSize()) |
1199 | Profiler->VisitStmt(S); |
1200 | } |
1201 | |
1202 | void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {} |
1203 | |
1204 | void StmtProfiler::VisitOMPTargetUpdateDirective( |
1205 | const OMPTargetUpdateDirective *S) { |
1206 | VisitOMPExecutableDirective(S); |
1207 | } |
1208 | |
1209 | void StmtProfiler::VisitOMPDistributeParallelForDirective( |
1210 | const OMPDistributeParallelForDirective *S) { |
1211 | VisitOMPLoopDirective(S); |
1212 | } |
1213 | |
1214 | void StmtProfiler::VisitOMPDistributeParallelForSimdDirective( |
1215 | const OMPDistributeParallelForSimdDirective *S) { |
1216 | VisitOMPLoopDirective(S); |
1217 | } |
1218 | |
1219 | void StmtProfiler::VisitOMPDistributeSimdDirective( |
1220 | const OMPDistributeSimdDirective *S) { |
1221 | VisitOMPLoopDirective(S); |
1222 | } |
1223 | |
1224 | void StmtProfiler::VisitOMPTargetParallelForSimdDirective( |
1225 | const OMPTargetParallelForSimdDirective *S) { |
1226 | VisitOMPLoopDirective(S); |
1227 | } |
1228 | |
1229 | void StmtProfiler::VisitOMPTargetSimdDirective( |
1230 | const OMPTargetSimdDirective *S) { |
1231 | VisitOMPLoopDirective(S); |
1232 | } |
1233 | |
1234 | void StmtProfiler::VisitOMPTeamsDistributeDirective( |
1235 | const OMPTeamsDistributeDirective *S) { |
1236 | VisitOMPLoopDirective(S); |
1237 | } |
1238 | |
1239 | void StmtProfiler::VisitOMPTeamsDistributeSimdDirective( |
1240 | const OMPTeamsDistributeSimdDirective *S) { |
1241 | VisitOMPLoopDirective(S); |
1242 | } |
1243 | |
1244 | void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective( |
1245 | const OMPTeamsDistributeParallelForSimdDirective *S) { |
1246 | VisitOMPLoopDirective(S); |
1247 | } |
1248 | |
1249 | void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective( |
1250 | const OMPTeamsDistributeParallelForDirective *S) { |
1251 | VisitOMPLoopDirective(S); |
1252 | } |
1253 | |
1254 | void StmtProfiler::VisitOMPTargetTeamsDirective( |
1255 | const OMPTargetTeamsDirective *S) { |
1256 | VisitOMPExecutableDirective(S); |
1257 | } |
1258 | |
1259 | void StmtProfiler::VisitOMPTargetTeamsDistributeDirective( |
1260 | const OMPTargetTeamsDistributeDirective *S) { |
1261 | VisitOMPLoopDirective(S); |
1262 | } |
1263 | |
1264 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective( |
1265 | const OMPTargetTeamsDistributeParallelForDirective *S) { |
1266 | VisitOMPLoopDirective(S); |
1267 | } |
1268 | |
1269 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
1270 | const OMPTargetTeamsDistributeParallelForSimdDirective *S) { |
1271 | VisitOMPLoopDirective(S); |
1272 | } |
1273 | |
1274 | void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective( |
1275 | const OMPTargetTeamsDistributeSimdDirective *S) { |
1276 | VisitOMPLoopDirective(S); |
1277 | } |
1278 | |
1279 | void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) { |
1280 | VisitOMPExecutableDirective(S); |
1281 | } |
1282 | |
1283 | void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) { |
1284 | VisitOMPExecutableDirective(S); |
1285 | } |
1286 | |
1287 | void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) { |
1288 | VisitOMPExecutableDirective(S); |
1289 | } |
1290 | |
1291 | void StmtProfiler::VisitOMPGenericLoopDirective( |
1292 | const OMPGenericLoopDirective *S) { |
1293 | VisitOMPLoopDirective(S); |
1294 | } |
1295 | |
1296 | void StmtProfiler::VisitOMPTeamsGenericLoopDirective( |
1297 | const OMPTeamsGenericLoopDirective *S) { |
1298 | VisitOMPLoopDirective(S); |
1299 | } |
1300 | |
1301 | void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective( |
1302 | const OMPTargetTeamsGenericLoopDirective *S) { |
1303 | VisitOMPLoopDirective(S); |
1304 | } |
1305 | |
1306 | void StmtProfiler::VisitOMPParallelGenericLoopDirective( |
1307 | const OMPParallelGenericLoopDirective *S) { |
1308 | VisitOMPLoopDirective(S); |
1309 | } |
1310 | |
1311 | void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective( |
1312 | const OMPTargetParallelGenericLoopDirective *S) { |
1313 | VisitOMPLoopDirective(S); |
1314 | } |
1315 | |
1316 | void StmtProfiler::VisitExpr(const Expr *S) { |
1317 | VisitStmt(S); |
1318 | } |
1319 | |
1320 | void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) { |
1321 | VisitExpr(S); |
1322 | } |
1323 | |
1324 | void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) { |
1325 | VisitExpr(S); |
1326 | if (!Canonical) |
1327 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
1328 | VisitDecl(D: S->getDecl()); |
1329 | if (!Canonical) { |
1330 | ID.AddBoolean(B: S->hasExplicitTemplateArgs()); |
1331 | if (S->hasExplicitTemplateArgs()) |
1332 | VisitTemplateArguments(Args: S->getTemplateArgs(), NumArgs: S->getNumTemplateArgs()); |
1333 | } |
1334 | } |
1335 | |
1336 | void StmtProfiler::VisitSYCLUniqueStableNameExpr( |
1337 | const SYCLUniqueStableNameExpr *S) { |
1338 | VisitExpr(S); |
1339 | VisitType(T: S->getTypeSourceInfo()->getType()); |
1340 | } |
1341 | |
1342 | void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) { |
1343 | VisitExpr(S); |
1344 | ID.AddInteger(I: llvm::to_underlying(E: S->getIdentKind())); |
1345 | } |
1346 | |
1347 | void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) { |
1348 | VisitExpr(S); |
1349 | S->getValue().Profile(id&: ID); |
1350 | |
1351 | QualType T = S->getType(); |
1352 | if (Canonical) |
1353 | T = T.getCanonicalType(); |
1354 | ID.AddInteger(I: T->getTypeClass()); |
1355 | if (auto BitIntT = T->getAs<BitIntType>()) |
1356 | BitIntT->Profile(ID); |
1357 | else |
1358 | ID.AddInteger(I: T->castAs<BuiltinType>()->getKind()); |
1359 | } |
1360 | |
1361 | void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) { |
1362 | VisitExpr(S); |
1363 | S->getValue().Profile(id&: ID); |
1364 | ID.AddInteger(I: S->getType()->castAs<BuiltinType>()->getKind()); |
1365 | } |
1366 | |
1367 | void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) { |
1368 | VisitExpr(S); |
1369 | ID.AddInteger(I: llvm::to_underlying(E: S->getKind())); |
1370 | ID.AddInteger(I: S->getValue()); |
1371 | } |
1372 | |
1373 | void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) { |
1374 | VisitExpr(S); |
1375 | S->getValue().Profile(NID&: ID); |
1376 | ID.AddBoolean(B: S->isExact()); |
1377 | ID.AddInteger(I: S->getType()->castAs<BuiltinType>()->getKind()); |
1378 | } |
1379 | |
1380 | void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) { |
1381 | VisitExpr(S); |
1382 | } |
1383 | |
1384 | void StmtProfiler::VisitStringLiteral(const StringLiteral *S) { |
1385 | VisitExpr(S); |
1386 | ID.AddString(String: S->getBytes()); |
1387 | ID.AddInteger(I: llvm::to_underlying(E: S->getKind())); |
1388 | } |
1389 | |
1390 | void StmtProfiler::VisitParenExpr(const ParenExpr *S) { |
1391 | VisitExpr(S); |
1392 | } |
1393 | |
1394 | void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) { |
1395 | VisitExpr(S); |
1396 | } |
1397 | |
1398 | void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) { |
1399 | VisitExpr(S); |
1400 | ID.AddInteger(I: S->getOpcode()); |
1401 | } |
1402 | |
1403 | void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) { |
1404 | VisitType(T: S->getTypeSourceInfo()->getType()); |
1405 | unsigned n = S->getNumComponents(); |
1406 | for (unsigned i = 0; i < n; ++i) { |
1407 | const OffsetOfNode &ON = S->getComponent(Idx: i); |
1408 | ID.AddInteger(I: ON.getKind()); |
1409 | switch (ON.getKind()) { |
1410 | case OffsetOfNode::Array: |
1411 | // Expressions handled below. |
1412 | break; |
1413 | |
1414 | case OffsetOfNode::Field: |
1415 | VisitDecl(D: ON.getField()); |
1416 | break; |
1417 | |
1418 | case OffsetOfNode::Identifier: |
1419 | VisitIdentifierInfo(II: 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 | |
1431 | void |
1432 | StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) { |
1433 | VisitExpr(S); |
1434 | ID.AddInteger(I: S->getKind()); |
1435 | if (S->isArgumentType()) |
1436 | VisitType(T: S->getArgumentType()); |
1437 | } |
1438 | |
1439 | void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) { |
1440 | VisitExpr(S); |
1441 | } |
1442 | |
1443 | void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) { |
1444 | VisitExpr(S); |
1445 | } |
1446 | |
1447 | void StmtProfiler::VisitArraySectionExpr(const ArraySectionExpr *S) { |
1448 | VisitExpr(S); |
1449 | } |
1450 | |
1451 | void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) { |
1452 | VisitExpr(S); |
1453 | } |
1454 | |
1455 | void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) { |
1456 | VisitExpr(S); |
1457 | for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I) |
1458 | VisitDecl(D: S->getIteratorDecl(I)); |
1459 | } |
1460 | |
1461 | void StmtProfiler::VisitCallExpr(const CallExpr *S) { |
1462 | VisitExpr(S); |
1463 | } |
1464 | |
1465 | void StmtProfiler::VisitMemberExpr(const MemberExpr *S) { |
1466 | VisitExpr(S); |
1467 | VisitDecl(D: S->getMemberDecl()); |
1468 | if (!Canonical) |
1469 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
1470 | ID.AddBoolean(B: S->isArrow()); |
1471 | } |
1472 | |
1473 | void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) { |
1474 | VisitExpr(S); |
1475 | ID.AddBoolean(B: S->isFileScope()); |
1476 | } |
1477 | |
1478 | void StmtProfiler::VisitCastExpr(const CastExpr *S) { |
1479 | VisitExpr(S); |
1480 | } |
1481 | |
1482 | void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) { |
1483 | VisitCastExpr(S); |
1484 | ID.AddInteger(I: S->getValueKind()); |
1485 | } |
1486 | |
1487 | void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) { |
1488 | VisitCastExpr(S); |
1489 | VisitType(T: S->getTypeAsWritten()); |
1490 | } |
1491 | |
1492 | void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) { |
1493 | VisitExplicitCastExpr(S); |
1494 | } |
1495 | |
1496 | void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) { |
1497 | VisitExpr(S); |
1498 | ID.AddInteger(I: S->getOpcode()); |
1499 | } |
1500 | |
1501 | void |
1502 | StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) { |
1503 | VisitBinaryOperator(S); |
1504 | } |
1505 | |
1506 | void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) { |
1507 | VisitExpr(S); |
1508 | } |
1509 | |
1510 | void StmtProfiler::VisitBinaryConditionalOperator( |
1511 | const BinaryConditionalOperator *S) { |
1512 | VisitExpr(S); |
1513 | } |
1514 | |
1515 | void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) { |
1516 | VisitExpr(S); |
1517 | VisitDecl(D: S->getLabel()); |
1518 | } |
1519 | |
1520 | void StmtProfiler::VisitStmtExpr(const StmtExpr *S) { |
1521 | VisitExpr(S); |
1522 | } |
1523 | |
1524 | void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) { |
1525 | VisitExpr(S); |
1526 | } |
1527 | |
1528 | void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) { |
1529 | VisitExpr(S); |
1530 | } |
1531 | |
1532 | void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) { |
1533 | VisitExpr(S); |
1534 | } |
1535 | |
1536 | void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) { |
1537 | VisitExpr(S); |
1538 | } |
1539 | |
1540 | void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) { |
1541 | VisitExpr(S); |
1542 | } |
1543 | |
1544 | void StmtProfiler::VisitInitListExpr(const InitListExpr *S) { |
1545 | if (S->getSyntacticForm()) { |
1546 | VisitInitListExpr(S: S->getSyntacticForm()); |
1547 | return; |
1548 | } |
1549 | |
1550 | VisitExpr(S); |
1551 | } |
1552 | |
1553 | void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) { |
1554 | VisitExpr(S); |
1555 | ID.AddBoolean(B: S->usesGNUSyntax()); |
1556 | for (const DesignatedInitExpr::Designator &D : S->designators()) { |
1557 | if (D.isFieldDesignator()) { |
1558 | ID.AddInteger(I: 0); |
1559 | VisitName(Name: D.getFieldName()); |
1560 | continue; |
1561 | } |
1562 | |
1563 | if (D.isArrayDesignator()) { |
1564 | ID.AddInteger(I: 1); |
1565 | } else { |
1566 | assert(D.isArrayRangeDesignator()); |
1567 | ID.AddInteger(I: 2); |
1568 | } |
1569 | ID.AddInteger(I: 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. |
1575 | void StmtProfiler::VisitDesignatedInitUpdateExpr( |
1576 | const DesignatedInitUpdateExpr *S) { |
1577 | llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of " |
1578 | "initializer" ); |
1579 | } |
1580 | |
1581 | void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) { |
1582 | VisitExpr(S); |
1583 | } |
1584 | |
1585 | void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) { |
1586 | VisitExpr(S); |
1587 | } |
1588 | |
1589 | void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) { |
1590 | llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer" ); |
1591 | } |
1592 | |
1593 | void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) { |
1594 | VisitExpr(S); |
1595 | } |
1596 | |
1597 | void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) { |
1598 | VisitExpr(S); |
1599 | VisitName(Name: &S->getAccessor()); |
1600 | } |
1601 | |
1602 | void StmtProfiler::VisitBlockExpr(const BlockExpr *S) { |
1603 | VisitExpr(S); |
1604 | VisitDecl(D: S->getBlockDecl()); |
1605 | } |
1606 | |
1607 | void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) { |
1608 | VisitExpr(S); |
1609 | for (const GenericSelectionExpr::ConstAssociation Assoc : |
1610 | S->associations()) { |
1611 | QualType T = Assoc.getType(); |
1612 | if (T.isNull()) |
1613 | ID.AddPointer(Ptr: nullptr); |
1614 | else |
1615 | VisitType(T); |
1616 | VisitExpr(S: Assoc.getAssociationExpr()); |
1617 | } |
1618 | } |
1619 | |
1620 | void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) { |
1621 | VisitExpr(S); |
1622 | for (PseudoObjectExpr::const_semantics_iterator |
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>(Val: *i)) |
1626 | Visit(S: OVE->getSourceExpr()); |
1627 | } |
1628 | |
1629 | void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) { |
1630 | VisitExpr(S); |
1631 | ID.AddInteger(I: S->getOp()); |
1632 | } |
1633 | |
1634 | void StmtProfiler::VisitConceptSpecializationExpr( |
1635 | const ConceptSpecializationExpr *S) { |
1636 | VisitExpr(S); |
1637 | VisitDecl(D: S->getNamedConcept()); |
1638 | for (const TemplateArgument &Arg : S->getTemplateArguments()) |
1639 | VisitTemplateArgument(Arg); |
1640 | } |
1641 | |
1642 | void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) { |
1643 | VisitExpr(S); |
1644 | ID.AddInteger(I: S->getLocalParameters().size()); |
1645 | for (ParmVarDecl *LocalParam : S->getLocalParameters()) |
1646 | VisitDecl(D: LocalParam); |
1647 | ID.AddInteger(I: S->getRequirements().size()); |
1648 | for (concepts::Requirement *Req : S->getRequirements()) { |
1649 | if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Val: Req)) { |
1650 | ID.AddInteger(I: concepts::Requirement::RK_Type); |
1651 | ID.AddBoolean(B: TypeReq->isSubstitutionFailure()); |
1652 | if (!TypeReq->isSubstitutionFailure()) |
1653 | VisitType(T: TypeReq->getType()->getType()); |
1654 | } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Val: Req)) { |
1655 | ID.AddInteger(I: concepts::Requirement::RK_Compound); |
1656 | ID.AddBoolean(B: ExprReq->isExprSubstitutionFailure()); |
1657 | if (!ExprReq->isExprSubstitutionFailure()) |
1658 | Visit(S: 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(B: ExprReq->getNoexceptLoc().isValid()); |
1664 | const concepts::ExprRequirement::ReturnTypeRequirement &RetReq = |
1665 | ExprReq->getReturnTypeRequirement(); |
1666 | if (RetReq.isEmpty()) { |
1667 | ID.AddInteger(I: 0); |
1668 | } else if (RetReq.isTypeConstraint()) { |
1669 | ID.AddInteger(I: 1); |
1670 | Visit(S: RetReq.getTypeConstraint()->getImmediatelyDeclaredConstraint()); |
1671 | } else { |
1672 | assert(RetReq.isSubstitutionFailure()); |
1673 | ID.AddInteger(I: 2); |
1674 | } |
1675 | } else { |
1676 | ID.AddInteger(I: concepts::Requirement::RK_Nested); |
1677 | auto *NestedReq = cast<concepts::NestedRequirement>(Val: Req); |
1678 | ID.AddBoolean(B: NestedReq->hasInvalidConstraint()); |
1679 | if (!NestedReq->hasInvalidConstraint()) |
1680 | Visit(S: NestedReq->getConstraintExpr()); |
1681 | } |
1682 | } |
1683 | } |
1684 | |
1685 | static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, |
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: |
1697 | case NUM_OVERLOADED_OPERATORS: |
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 | |
1889 | void 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: S->getArg(Arg: 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(I: SC); |
1905 | for (unsigned I = 0; I != NumArgs; ++I) |
1906 | Visit(S: S->getArg(Arg: I)); |
1907 | if (SC == Stmt::UnaryOperatorClass) |
1908 | ID.AddInteger(I: UnaryOp); |
1909 | else if (SC == Stmt::BinaryOperatorClass || |
1910 | SC == Stmt::CompoundAssignOperatorClass) |
1911 | ID.AddInteger(I: BinaryOp); |
1912 | else |
1913 | assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass); |
1914 | |
1915 | return; |
1916 | } |
1917 | |
1918 | VisitCallExpr(S); |
1919 | ID.AddInteger(I: S->getOperator()); |
1920 | } |
1921 | |
1922 | void 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(B: S->isReversed()); |
1929 | VisitExpr(S: 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 | |
1938 | void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { |
1939 | VisitCallExpr(S); |
1940 | } |
1941 | |
1942 | void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) { |
1943 | VisitCallExpr(S); |
1944 | } |
1945 | |
1946 | void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) { |
1947 | VisitExpr(S); |
1948 | } |
1949 | |
1950 | void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) { |
1951 | VisitExplicitCastExpr(S); |
1952 | } |
1953 | |
1954 | void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) { |
1955 | VisitCXXNamedCastExpr(S); |
1956 | } |
1957 | |
1958 | void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) { |
1959 | VisitCXXNamedCastExpr(S); |
1960 | } |
1961 | |
1962 | void |
1963 | StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) { |
1964 | VisitCXXNamedCastExpr(S); |
1965 | } |
1966 | |
1967 | void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) { |
1968 | VisitCXXNamedCastExpr(S); |
1969 | } |
1970 | |
1971 | void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) { |
1972 | VisitExpr(S); |
1973 | VisitType(T: S->getTypeInfoAsWritten()->getType()); |
1974 | } |
1975 | |
1976 | void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) { |
1977 | VisitCXXNamedCastExpr(S); |
1978 | } |
1979 | |
1980 | void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) { |
1981 | VisitCallExpr(S); |
1982 | } |
1983 | |
1984 | void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { |
1985 | VisitExpr(S); |
1986 | ID.AddBoolean(B: S->getValue()); |
1987 | } |
1988 | |
1989 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) { |
1990 | VisitExpr(S); |
1991 | } |
1992 | |
1993 | void StmtProfiler::VisitCXXStdInitializerListExpr( |
1994 | const CXXStdInitializerListExpr *S) { |
1995 | VisitExpr(S); |
1996 | } |
1997 | |
1998 | void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) { |
1999 | VisitExpr(S); |
2000 | if (S->isTypeOperand()) |
2001 | VisitType(T: S->getTypeOperandSourceInfo()->getType()); |
2002 | } |
2003 | |
2004 | void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) { |
2005 | VisitExpr(S); |
2006 | if (S->isTypeOperand()) |
2007 | VisitType(T: S->getTypeOperandSourceInfo()->getType()); |
2008 | } |
2009 | |
2010 | void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) { |
2011 | VisitExpr(S); |
2012 | VisitDecl(D: S->getPropertyDecl()); |
2013 | } |
2014 | |
2015 | void StmtProfiler::VisitMSPropertySubscriptExpr( |
2016 | const MSPropertySubscriptExpr *S) { |
2017 | VisitExpr(S); |
2018 | } |
2019 | |
2020 | void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { |
2021 | VisitExpr(S); |
2022 | ID.AddBoolean(B: S->isImplicit()); |
2023 | ID.AddBoolean(B: S->isCapturedByCopyInLambdaWithExplicitObjectParameter()); |
2024 | } |
2025 | |
2026 | void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) { |
2027 | VisitExpr(S); |
2028 | } |
2029 | |
2030 | void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) { |
2031 | VisitExpr(S); |
2032 | VisitDecl(D: S->getParam()); |
2033 | } |
2034 | |
2035 | void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) { |
2036 | VisitExpr(S); |
2037 | VisitDecl(D: S->getField()); |
2038 | } |
2039 | |
2040 | void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { |
2041 | VisitExpr(S); |
2042 | VisitDecl( |
2043 | D: const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
2044 | } |
2045 | |
2046 | void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) { |
2047 | VisitExpr(S); |
2048 | VisitDecl(D: S->getConstructor()); |
2049 | ID.AddBoolean(B: S->isElidable()); |
2050 | } |
2051 | |
2052 | void StmtProfiler::VisitCXXInheritedCtorInitExpr( |
2053 | const CXXInheritedCtorInitExpr *S) { |
2054 | VisitExpr(S); |
2055 | VisitDecl(D: S->getConstructor()); |
2056 | } |
2057 | |
2058 | void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { |
2059 | VisitExplicitCastExpr(S); |
2060 | } |
2061 | |
2062 | void |
2063 | StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { |
2064 | VisitCXXConstructExpr(S); |
2065 | } |
2066 | |
2067 | void |
2068 | StmtProfiler::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(D: S->getLambdaClass()); |
2078 | |
2079 | return; |
2080 | } |
2081 | |
2082 | CXXRecordDecl *Lambda = S->getLambdaClass(); |
2083 | for (const auto &Capture : Lambda->captures()) { |
2084 | ID.AddInteger(I: Capture.getCaptureKind()); |
2085 | if (Capture.capturesVariable()) |
2086 | VisitDecl(D: 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>(Val: SubDecl)) |
2098 | Call = FTD->getTemplatedDecl(); |
2099 | else if (auto *FD = dyn_cast<FunctionDecl>(Val: SubDecl)) |
2100 | Call = FD; |
2101 | |
2102 | if (!Call) |
2103 | continue; |
2104 | |
2105 | Hasher.AddFunctionDecl(Function: Call, /*SkipBody=*/true); |
2106 | } |
2107 | ID.AddInteger(I: Hasher.CalculateHash()); |
2108 | } |
2109 | |
2110 | void |
2111 | StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) { |
2112 | VisitExpr(S); |
2113 | } |
2114 | |
2115 | void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) { |
2116 | VisitExpr(S); |
2117 | ID.AddBoolean(B: S->isGlobalDelete()); |
2118 | ID.AddBoolean(B: S->isArrayForm()); |
2119 | VisitDecl(D: S->getOperatorDelete()); |
2120 | } |
2121 | |
2122 | void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) { |
2123 | VisitExpr(S); |
2124 | VisitType(T: S->getAllocatedType()); |
2125 | VisitDecl(D: S->getOperatorNew()); |
2126 | VisitDecl(D: S->getOperatorDelete()); |
2127 | ID.AddBoolean(B: S->isArray()); |
2128 | ID.AddInteger(I: S->getNumPlacementArgs()); |
2129 | ID.AddBoolean(B: S->isGlobalNew()); |
2130 | ID.AddBoolean(B: S->isParenTypeId()); |
2131 | ID.AddInteger(I: llvm::to_underlying(E: S->getInitializationStyle())); |
2132 | } |
2133 | |
2134 | void |
2135 | StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { |
2136 | VisitExpr(S); |
2137 | ID.AddBoolean(B: S->isArrow()); |
2138 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
2139 | ID.AddBoolean(B: S->getScopeTypeInfo() != nullptr); |
2140 | if (S->getScopeTypeInfo()) |
2141 | VisitType(T: S->getScopeTypeInfo()->getType()); |
2142 | ID.AddBoolean(B: S->getDestroyedTypeInfo() != nullptr); |
2143 | if (S->getDestroyedTypeInfo()) |
2144 | VisitType(T: S->getDestroyedType()); |
2145 | else |
2146 | VisitIdentifierInfo(II: S->getDestroyedTypeIdentifier()); |
2147 | } |
2148 | |
2149 | void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { |
2150 | VisitExpr(S); |
2151 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
2152 | VisitName(Name: S->getName(), /*TreatAsDecl*/ true); |
2153 | ID.AddBoolean(B: S->hasExplicitTemplateArgs()); |
2154 | if (S->hasExplicitTemplateArgs()) |
2155 | VisitTemplateArguments(Args: S->getTemplateArgs(), NumArgs: S->getNumTemplateArgs()); |
2156 | } |
2157 | |
2158 | void |
2159 | StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) { |
2160 | VisitOverloadExpr(S); |
2161 | } |
2162 | |
2163 | void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) { |
2164 | VisitExpr(S); |
2165 | ID.AddInteger(I: S->getTrait()); |
2166 | ID.AddInteger(I: S->getNumArgs()); |
2167 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
2168 | VisitType(T: S->getArg(I)->getType()); |
2169 | } |
2170 | |
2171 | void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) { |
2172 | VisitExpr(S); |
2173 | ID.AddInteger(I: S->getTrait()); |
2174 | VisitType(T: S->getQueriedType()); |
2175 | } |
2176 | |
2177 | void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) { |
2178 | VisitExpr(S); |
2179 | ID.AddInteger(I: S->getTrait()); |
2180 | VisitExpr(S: S->getQueriedExpression()); |
2181 | } |
2182 | |
2183 | void StmtProfiler::VisitDependentScopeDeclRefExpr( |
2184 | const DependentScopeDeclRefExpr *S) { |
2185 | VisitExpr(S); |
2186 | VisitName(Name: S->getDeclName()); |
2187 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
2188 | ID.AddBoolean(B: S->hasExplicitTemplateArgs()); |
2189 | if (S->hasExplicitTemplateArgs()) |
2190 | VisitTemplateArguments(Args: S->getTemplateArgs(), NumArgs: S->getNumTemplateArgs()); |
2191 | } |
2192 | |
2193 | void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) { |
2194 | VisitExpr(S); |
2195 | } |
2196 | |
2197 | void StmtProfiler::VisitCXXUnresolvedConstructExpr( |
2198 | const CXXUnresolvedConstructExpr *S) { |
2199 | VisitExpr(S); |
2200 | VisitType(T: S->getTypeAsWritten()); |
2201 | ID.AddInteger(I: S->isListInitialization()); |
2202 | } |
2203 | |
2204 | void StmtProfiler::VisitCXXDependentScopeMemberExpr( |
2205 | const CXXDependentScopeMemberExpr *S) { |
2206 | ID.AddBoolean(B: S->isImplicitAccess()); |
2207 | if (!S->isImplicitAccess()) { |
2208 | VisitExpr(S); |
2209 | ID.AddBoolean(B: S->isArrow()); |
2210 | } |
2211 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
2212 | VisitName(Name: S->getMember()); |
2213 | ID.AddBoolean(B: S->hasExplicitTemplateArgs()); |
2214 | if (S->hasExplicitTemplateArgs()) |
2215 | VisitTemplateArguments(Args: S->getTemplateArgs(), NumArgs: S->getNumTemplateArgs()); |
2216 | } |
2217 | |
2218 | void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) { |
2219 | ID.AddBoolean(B: S->isImplicitAccess()); |
2220 | if (!S->isImplicitAccess()) { |
2221 | VisitExpr(S); |
2222 | ID.AddBoolean(B: S->isArrow()); |
2223 | } |
2224 | VisitNestedNameSpecifier(NNS: S->getQualifier()); |
2225 | VisitName(Name: S->getMemberName()); |
2226 | ID.AddBoolean(B: S->hasExplicitTemplateArgs()); |
2227 | if (S->hasExplicitTemplateArgs()) |
2228 | VisitTemplateArguments(Args: S->getTemplateArgs(), NumArgs: S->getNumTemplateArgs()); |
2229 | } |
2230 | |
2231 | void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) { |
2232 | VisitExpr(S); |
2233 | } |
2234 | |
2235 | void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) { |
2236 | VisitExpr(S); |
2237 | } |
2238 | |
2239 | void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) { |
2240 | VisitExpr(S); |
2241 | VisitDecl(D: S->getPack()); |
2242 | if (S->isPartiallySubstituted()) { |
2243 | auto Args = S->getPartialArguments(); |
2244 | ID.AddInteger(I: Args.size()); |
2245 | for (const auto &TA : Args) |
2246 | VisitTemplateArgument(Arg: TA); |
2247 | } else { |
2248 | ID.AddInteger(I: 0); |
2249 | } |
2250 | } |
2251 | |
2252 | void StmtProfiler::VisitPackIndexingExpr(const PackIndexingExpr *E) { |
2253 | VisitExpr(S: E); |
2254 | VisitExpr(S: E->getPackIdExpression()); |
2255 | VisitExpr(S: E->getIndexExpr()); |
2256 | } |
2257 | |
2258 | void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr( |
2259 | const SubstNonTypeTemplateParmPackExpr *S) { |
2260 | VisitExpr(S); |
2261 | VisitDecl(D: S->getParameterPack()); |
2262 | VisitTemplateArgument(Arg: S->getArgumentPack()); |
2263 | } |
2264 | |
2265 | void StmtProfiler::VisitSubstNonTypeTemplateParmExpr( |
2266 | const SubstNonTypeTemplateParmExpr *E) { |
2267 | // Profile exactly as the replacement expression. |
2268 | Visit(S: E->getReplacement()); |
2269 | } |
2270 | |
2271 | void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) { |
2272 | VisitExpr(S); |
2273 | VisitDecl(D: S->getParameterPack()); |
2274 | ID.AddInteger(I: S->getNumExpansions()); |
2275 | for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I) |
2276 | VisitDecl(D: *I); |
2277 | } |
2278 | |
2279 | void StmtProfiler::VisitMaterializeTemporaryExpr( |
2280 | const MaterializeTemporaryExpr *S) { |
2281 | VisitExpr(S); |
2282 | } |
2283 | |
2284 | void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) { |
2285 | VisitExpr(S); |
2286 | ID.AddInteger(I: S->getOperator()); |
2287 | } |
2288 | |
2289 | void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) { |
2290 | VisitExpr(S); |
2291 | } |
2292 | |
2293 | void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) { |
2294 | VisitStmt(S); |
2295 | } |
2296 | |
2297 | void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) { |
2298 | VisitStmt(S); |
2299 | } |
2300 | |
2301 | void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) { |
2302 | VisitExpr(S); |
2303 | } |
2304 | |
2305 | void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) { |
2306 | VisitExpr(S); |
2307 | } |
2308 | |
2309 | void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) { |
2310 | VisitExpr(S); |
2311 | } |
2312 | |
2313 | void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { |
2314 | VisitExpr(S: E); |
2315 | } |
2316 | |
2317 | void StmtProfiler::VisitTypoExpr(const TypoExpr *E) { |
2318 | VisitExpr(S: E); |
2319 | } |
2320 | |
2321 | void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) { |
2322 | VisitExpr(S: E); |
2323 | } |
2324 | |
2325 | void StmtProfiler::VisitEmbedExpr(const EmbedExpr *E) { VisitExpr(S: E); } |
2326 | |
2327 | void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(S: E); } |
2328 | |
2329 | void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) { |
2330 | VisitExpr(S); |
2331 | } |
2332 | |
2333 | void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { |
2334 | VisitExpr(S: E); |
2335 | } |
2336 | |
2337 | void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) { |
2338 | VisitExpr(S: E); |
2339 | } |
2340 | |
2341 | void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) { |
2342 | VisitExpr(S: E); |
2343 | } |
2344 | |
2345 | void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) { |
2346 | VisitExpr(S); |
2347 | VisitType(T: S->getEncodedType()); |
2348 | } |
2349 | |
2350 | void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) { |
2351 | VisitExpr(S); |
2352 | VisitName(Name: S->getSelector()); |
2353 | } |
2354 | |
2355 | void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) { |
2356 | VisitExpr(S); |
2357 | VisitDecl(D: S->getProtocol()); |
2358 | } |
2359 | |
2360 | void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) { |
2361 | VisitExpr(S); |
2362 | VisitDecl(D: S->getDecl()); |
2363 | ID.AddBoolean(B: S->isArrow()); |
2364 | ID.AddBoolean(B: S->isFreeIvar()); |
2365 | } |
2366 | |
2367 | void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) { |
2368 | VisitExpr(S); |
2369 | if (S->isImplicitProperty()) { |
2370 | VisitDecl(D: S->getImplicitPropertyGetter()); |
2371 | VisitDecl(D: S->getImplicitPropertySetter()); |
2372 | } else { |
2373 | VisitDecl(D: S->getExplicitProperty()); |
2374 | } |
2375 | if (S->isSuperReceiver()) { |
2376 | ID.AddBoolean(B: S->isSuperReceiver()); |
2377 | VisitType(T: S->getSuperReceiverType()); |
2378 | } |
2379 | } |
2380 | |
2381 | void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) { |
2382 | VisitExpr(S); |
2383 | VisitDecl(D: S->getAtIndexMethodDecl()); |
2384 | VisitDecl(D: S->setAtIndexMethodDecl()); |
2385 | } |
2386 | |
2387 | void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) { |
2388 | VisitExpr(S); |
2389 | VisitName(Name: S->getSelector()); |
2390 | VisitDecl(D: S->getMethodDecl()); |
2391 | } |
2392 | |
2393 | void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) { |
2394 | VisitExpr(S); |
2395 | ID.AddBoolean(B: S->isArrow()); |
2396 | } |
2397 | |
2398 | void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) { |
2399 | VisitExpr(S); |
2400 | ID.AddBoolean(B: S->getValue()); |
2401 | } |
2402 | |
2403 | void StmtProfiler::VisitObjCIndirectCopyRestoreExpr( |
2404 | const ObjCIndirectCopyRestoreExpr *S) { |
2405 | VisitExpr(S); |
2406 | ID.AddBoolean(B: S->shouldCopy()); |
2407 | } |
2408 | |
2409 | void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) { |
2410 | VisitExplicitCastExpr(S); |
2411 | ID.AddBoolean(B: S->getBridgeKind()); |
2412 | } |
2413 | |
2414 | void StmtProfiler::VisitObjCAvailabilityCheckExpr( |
2415 | const ObjCAvailabilityCheckExpr *S) { |
2416 | VisitExpr(S); |
2417 | } |
2418 | |
2419 | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
2420 | unsigned NumArgs) { |
2421 | ID.AddInteger(I: NumArgs); |
2422 | for (unsigned I = 0; I != NumArgs; ++I) |
2423 | VisitTemplateArgument(Arg: Args[I].getArgument()); |
2424 | } |
2425 | |
2426 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
2427 | // Mostly repetitive with TemplateArgument::Profile! |
2428 | ID.AddInteger(I: Arg.getKind()); |
2429 | switch (Arg.getKind()) { |
2430 | case TemplateArgument::Null: |
2431 | break; |
2432 | |
2433 | case TemplateArgument::Type: |
2434 | VisitType(T: Arg.getAsType()); |
2435 | break; |
2436 | |
2437 | case TemplateArgument::Template: |
2438 | case TemplateArgument::TemplateExpansion: |
2439 | VisitTemplateName(Name: Arg.getAsTemplateOrTemplatePattern()); |
2440 | break; |
2441 | |
2442 | case TemplateArgument::Declaration: |
2443 | VisitType(T: Arg.getParamTypeForDecl()); |
2444 | // FIXME: Do we need to recursively decompose template parameter objects? |
2445 | VisitDecl(D: Arg.getAsDecl()); |
2446 | break; |
2447 | |
2448 | case TemplateArgument::NullPtr: |
2449 | VisitType(T: Arg.getNullPtrType()); |
2450 | break; |
2451 | |
2452 | case TemplateArgument::Integral: |
2453 | VisitType(T: Arg.getIntegralType()); |
2454 | Arg.getAsIntegral().Profile(ID); |
2455 | break; |
2456 | |
2457 | case TemplateArgument::StructuralValue: |
2458 | VisitType(T: Arg.getStructuralValueType()); |
2459 | // FIXME: Do we need to recursively decompose this ourselves? |
2460 | Arg.getAsStructuralValue().Profile(ID); |
2461 | break; |
2462 | |
2463 | case TemplateArgument::Expression: |
2464 | Visit(S: Arg.getAsExpr()); |
2465 | break; |
2466 | |
2467 | case TemplateArgument::Pack: |
2468 | for (const auto &P : Arg.pack_elements()) |
2469 | VisitTemplateArgument(Arg: P); |
2470 | break; |
2471 | } |
2472 | } |
2473 | |
2474 | namespace { |
2475 | class OpenACCClauseProfiler |
2476 | : public OpenACCClauseVisitor<OpenACCClauseProfiler> { |
2477 | StmtProfiler &Profiler; |
2478 | |
2479 | public: |
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(C: 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. |
2497 | void OpenACCClauseProfiler::VisitDefaultClause( |
2498 | const OpenACCDefaultClause &Clause) {} |
2499 | |
2500 | void OpenACCClauseProfiler::VisitIfClause(const OpenACCIfClause &Clause) { |
2501 | assert(Clause.hasConditionExpr() && |
2502 | "if clause requires a valid condition expr" ); |
2503 | Profiler.VisitStmt(S: Clause.getConditionExpr()); |
2504 | } |
2505 | |
2506 | void OpenACCClauseProfiler::VisitCopyClause(const OpenACCCopyClause &Clause) { |
2507 | for (auto *E : Clause.getVarList()) |
2508 | Profiler.VisitStmt(S: E); |
2509 | } |
2510 | void OpenACCClauseProfiler::VisitCopyInClause( |
2511 | const OpenACCCopyInClause &Clause) { |
2512 | for (auto *E : Clause.getVarList()) |
2513 | Profiler.VisitStmt(S: E); |
2514 | } |
2515 | |
2516 | void OpenACCClauseProfiler::VisitCopyOutClause( |
2517 | const OpenACCCopyOutClause &Clause) { |
2518 | for (auto *E : Clause.getVarList()) |
2519 | Profiler.VisitStmt(S: E); |
2520 | } |
2521 | |
2522 | void OpenACCClauseProfiler::VisitCreateClause( |
2523 | const OpenACCCreateClause &Clause) { |
2524 | for (auto *E : Clause.getVarList()) |
2525 | Profiler.VisitStmt(S: E); |
2526 | } |
2527 | |
2528 | void OpenACCClauseProfiler::VisitSelfClause(const OpenACCSelfClause &Clause) { |
2529 | if (Clause.hasConditionExpr()) |
2530 | Profiler.VisitStmt(S: Clause.getConditionExpr()); |
2531 | } |
2532 | |
2533 | void OpenACCClauseProfiler::VisitNumGangsClause( |
2534 | const OpenACCNumGangsClause &Clause) { |
2535 | for (auto *E : Clause.getIntExprs()) |
2536 | Profiler.VisitStmt(S: E); |
2537 | } |
2538 | |
2539 | void OpenACCClauseProfiler::VisitNumWorkersClause( |
2540 | const OpenACCNumWorkersClause &Clause) { |
2541 | assert(Clause.hasIntExpr() && "num_workers clause requires a valid int expr" ); |
2542 | Profiler.VisitStmt(S: Clause.getIntExpr()); |
2543 | } |
2544 | |
2545 | void OpenACCClauseProfiler::VisitPrivateClause( |
2546 | const OpenACCPrivateClause &Clause) { |
2547 | for (auto *E : Clause.getVarList()) |
2548 | Profiler.VisitStmt(S: E); |
2549 | } |
2550 | |
2551 | void OpenACCClauseProfiler::VisitFirstPrivateClause( |
2552 | const OpenACCFirstPrivateClause &Clause) { |
2553 | for (auto *E : Clause.getVarList()) |
2554 | Profiler.VisitStmt(S: E); |
2555 | } |
2556 | |
2557 | void OpenACCClauseProfiler::VisitAttachClause( |
2558 | const OpenACCAttachClause &Clause) { |
2559 | for (auto *E : Clause.getVarList()) |
2560 | Profiler.VisitStmt(S: E); |
2561 | } |
2562 | |
2563 | void OpenACCClauseProfiler::VisitDevicePtrClause( |
2564 | const OpenACCDevicePtrClause &Clause) { |
2565 | for (auto *E : Clause.getVarList()) |
2566 | Profiler.VisitStmt(S: E); |
2567 | } |
2568 | |
2569 | void OpenACCClauseProfiler::VisitNoCreateClause( |
2570 | const OpenACCNoCreateClause &Clause) { |
2571 | for (auto *E : Clause.getVarList()) |
2572 | Profiler.VisitStmt(S: E); |
2573 | } |
2574 | |
2575 | void OpenACCClauseProfiler::VisitPresentClause( |
2576 | const OpenACCPresentClause &Clause) { |
2577 | for (auto *E : Clause.getVarList()) |
2578 | Profiler.VisitStmt(S: E); |
2579 | } |
2580 | |
2581 | void OpenACCClauseProfiler::VisitVectorLengthClause( |
2582 | const OpenACCVectorLengthClause &Clause) { |
2583 | assert(Clause.hasIntExpr() && |
2584 | "vector_length clause requires a valid int expr" ); |
2585 | Profiler.VisitStmt(S: Clause.getIntExpr()); |
2586 | } |
2587 | |
2588 | void OpenACCClauseProfiler::VisitAsyncClause(const OpenACCAsyncClause &Clause) { |
2589 | if (Clause.hasIntExpr()) |
2590 | Profiler.VisitStmt(S: Clause.getIntExpr()); |
2591 | } |
2592 | |
2593 | void OpenACCClauseProfiler::VisitWaitClause(const OpenACCWaitClause &Clause) { |
2594 | if (Clause.hasDevNumExpr()) |
2595 | Profiler.VisitStmt(S: Clause.getDevNumExpr()); |
2596 | for (auto *E : Clause.getQueueIdExprs()) |
2597 | Profiler.VisitStmt(S: E); |
2598 | } |
2599 | /// Nothing to do here, there are no sub-statements. |
2600 | void OpenACCClauseProfiler::VisitDeviceTypeClause( |
2601 | const OpenACCDeviceTypeClause &Clause) {} |
2602 | |
2603 | void OpenACCClauseProfiler::VisitAutoClause(const OpenACCAutoClause &Clause) {} |
2604 | |
2605 | void OpenACCClauseProfiler::VisitIndependentClause( |
2606 | const OpenACCIndependentClause &Clause) {} |
2607 | |
2608 | void OpenACCClauseProfiler::VisitSeqClause(const OpenACCSeqClause &Clause) {} |
2609 | |
2610 | void OpenACCClauseProfiler::VisitReductionClause( |
2611 | const OpenACCReductionClause &Clause) { |
2612 | for (auto *E : Clause.getVarList()) |
2613 | Profiler.VisitStmt(S: E); |
2614 | } |
2615 | } // namespace |
2616 | |
2617 | void 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(Clauses: S->clauses()); |
2624 | } |
2625 | |
2626 | void 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(Clauses: S->clauses()); |
2632 | } |
2633 | |
2634 | void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
2635 | bool Canonical, bool ProfileLambdaExpr) const { |
2636 | StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr); |
2637 | Profiler.Visit(S: this); |
2638 | } |
2639 | |
2640 | void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID, |
2641 | class ODRHash &Hash) const { |
2642 | StmtProfilerWithoutPointers Profiler(ID, Hash); |
2643 | Profiler.Visit(S: this); |
2644 | } |
2645 | |