/src/llvm-project/clang/lib/AST/StmtProfile.cpp
Line | Count | Source (jump to first uncovered line) |
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 | 51 | : ID(ID), Canonical(Canonical), ProfileLambdaExpr(ProfileLambdaExpr) {} |
38 | | |
39 | 51 | virtual ~StmtProfiler() {} |
40 | | |
41 | | void VisitStmt(const Stmt *S); |
42 | | |
43 | 76 | void VisitStmtNoChildren(const Stmt *S) { |
44 | 76 | HandleStmtClass(S->getStmtClass()); |
45 | 76 | } |
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(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 | 51 | : StmtProfiler(ID, Canonical, ProfileLambdaExpr), Context(Context) {} |
91 | | |
92 | | private: |
93 | 76 | void HandleStmtClass(Stmt::StmtClass SC) override { |
94 | 76 | ID.AddInteger(SC); |
95 | 76 | } |
96 | | |
97 | 1 | void VisitDecl(const Decl *D) override { |
98 | 1 | ID.AddInteger(D ? D->getKind() : 0); |
99 | | |
100 | 1 | if (Canonical && D) { |
101 | 1 | if (const NonTypeTemplateParmDecl *NTTP = |
102 | 1 | dyn_cast<NonTypeTemplateParmDecl>(D)) { |
103 | 0 | ID.AddInteger(NTTP->getDepth()); |
104 | 0 | ID.AddInteger(NTTP->getIndex()); |
105 | 0 | ID.AddBoolean(NTTP->isParameterPack()); |
106 | | // C++20 [temp.over.link]p6: |
107 | | // Two template-parameters are equivalent under the following |
108 | | // conditions: [...] if they declare non-type template parameters, |
109 | | // they have equivalent types ignoring the use of type-constraints |
110 | | // for placeholder types |
111 | | // |
112 | | // TODO: Why do we need to include the type in the profile? It's not |
113 | | // part of the mangling. |
114 | 0 | VisitType(Context.getUnconstrainedType(NTTP->getType())); |
115 | 0 | return; |
116 | 0 | } |
117 | | |
118 | 1 | if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { |
119 | | // The Itanium C++ ABI uses the type, scope depth, and scope |
120 | | // index of a parameter when mangling expressions that involve |
121 | | // function parameters, so we will use the parameter's type for |
122 | | // establishing function parameter identity. That way, our |
123 | | // definition of "equivalent" (per C++ [temp.over.link]) is at |
124 | | // least as strong as the definition of "equivalent" used for |
125 | | // name mangling. |
126 | | // |
127 | | // TODO: The Itanium C++ ABI only uses the top-level cv-qualifiers, |
128 | | // not the entirety of the type. |
129 | 0 | VisitType(Parm->getType()); |
130 | 0 | ID.AddInteger(Parm->getFunctionScopeDepth()); |
131 | 0 | ID.AddInteger(Parm->getFunctionScopeIndex()); |
132 | 0 | return; |
133 | 0 | } |
134 | | |
135 | 1 | if (const TemplateTypeParmDecl *TTP = |
136 | 1 | dyn_cast<TemplateTypeParmDecl>(D)) { |
137 | 0 | ID.AddInteger(TTP->getDepth()); |
138 | 0 | ID.AddInteger(TTP->getIndex()); |
139 | 0 | ID.AddBoolean(TTP->isParameterPack()); |
140 | 0 | return; |
141 | 0 | } |
142 | | |
143 | 1 | if (const TemplateTemplateParmDecl *TTP = |
144 | 1 | dyn_cast<TemplateTemplateParmDecl>(D)) { |
145 | 0 | ID.AddInteger(TTP->getDepth()); |
146 | 0 | ID.AddInteger(TTP->getIndex()); |
147 | 0 | ID.AddBoolean(TTP->isParameterPack()); |
148 | 0 | return; |
149 | 0 | } |
150 | 1 | } |
151 | | |
152 | 1 | ID.AddPointer(D ? D->getCanonicalDecl() : nullptr); |
153 | 1 | } |
154 | | |
155 | 0 | void VisitType(QualType T) override { |
156 | 0 | if (Canonical && !T.isNull()) |
157 | 0 | T = Context.getCanonicalType(T); |
158 | |
|
159 | 0 | ID.AddPointer(T.getAsOpaquePtr()); |
160 | 0 | } |
161 | | |
162 | 1 | void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override { |
163 | 1 | ID.AddPointer(Name.getAsOpaquePtr()); |
164 | 1 | } |
165 | | |
166 | 0 | void VisitIdentifierInfo(IdentifierInfo *II) override { |
167 | 0 | ID.AddPointer(II); |
168 | 0 | } |
169 | | |
170 | 1 | void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { |
171 | 1 | if (Canonical) |
172 | 1 | NNS = Context.getCanonicalNestedNameSpecifier(NNS); |
173 | 1 | ID.AddPointer(NNS); |
174 | 1 | } |
175 | | |
176 | 0 | void VisitTemplateName(TemplateName Name) override { |
177 | 0 | if (Canonical) |
178 | 0 | Name = Context.getCanonicalTemplateName(Name); |
179 | |
|
180 | 0 | Name.Profile(ID); |
181 | 0 | } |
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 | 0 | Hash(Hash) {} |
190 | | |
191 | | private: |
192 | 0 | void HandleStmtClass(Stmt::StmtClass SC) override { |
193 | 0 | if (SC == Stmt::UnresolvedLookupExprClass) { |
194 | | // Pretend that the name looked up is a Decl due to how templates |
195 | | // handle some Decl lookups. |
196 | 0 | ID.AddInteger(Stmt::DeclRefExprClass); |
197 | 0 | } else { |
198 | 0 | ID.AddInteger(SC); |
199 | 0 | } |
200 | 0 | } |
201 | | |
202 | 0 | void VisitType(QualType T) override { |
203 | 0 | Hash.AddQualType(T); |
204 | 0 | } |
205 | | |
206 | 0 | void VisitName(DeclarationName Name, bool TreatAsDecl) override { |
207 | 0 | 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 | 0 | ID.AddBoolean(true); |
211 | 0 | } |
212 | 0 | Hash.AddDeclarationName(Name, TreatAsDecl); |
213 | 0 | } |
214 | 0 | void VisitIdentifierInfo(IdentifierInfo *II) override { |
215 | 0 | ID.AddBoolean(II); |
216 | 0 | if (II) { |
217 | 0 | Hash.AddIdentifierInfo(II); |
218 | 0 | } |
219 | 0 | } |
220 | 0 | void VisitDecl(const Decl *D) override { |
221 | 0 | ID.AddBoolean(D); |
222 | 0 | if (D) { |
223 | 0 | Hash.AddDecl(D); |
224 | 0 | } |
225 | 0 | } |
226 | 0 | void VisitTemplateName(TemplateName Name) override { |
227 | 0 | Hash.AddTemplateName(Name); |
228 | 0 | } |
229 | 0 | void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { |
230 | 0 | ID.AddBoolean(NNS); |
231 | 0 | if (NNS) { |
232 | 0 | Hash.AddNestedNameSpecifier(NNS); |
233 | 0 | } |
234 | 0 | } |
235 | | }; |
236 | | } |
237 | | |
238 | 76 | void StmtProfiler::VisitStmt(const Stmt *S) { |
239 | 76 | assert(S && "Requires non-null Stmt pointer"); |
240 | | |
241 | 0 | VisitStmtNoChildren(S); |
242 | | |
243 | 76 | for (const Stmt *SubStmt : S->children()) { |
244 | 25 | if (SubStmt) |
245 | 25 | Visit(SubStmt); |
246 | 0 | else |
247 | 0 | ID.AddInteger(0); |
248 | 25 | } |
249 | 76 | } |
250 | | |
251 | 0 | void StmtProfiler::VisitDeclStmt(const DeclStmt *S) { |
252 | 0 | VisitStmt(S); |
253 | 0 | for (const auto *D : S->decls()) |
254 | 0 | VisitDecl(D); |
255 | 0 | } |
256 | | |
257 | 0 | void StmtProfiler::VisitNullStmt(const NullStmt *S) { |
258 | 0 | VisitStmt(S); |
259 | 0 | } |
260 | | |
261 | 0 | void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) { |
262 | 0 | VisitStmt(S); |
263 | 0 | } |
264 | | |
265 | 0 | void StmtProfiler::VisitCaseStmt(const CaseStmt *S) { |
266 | 0 | VisitStmt(S); |
267 | 0 | } |
268 | | |
269 | 0 | void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) { |
270 | 0 | VisitStmt(S); |
271 | 0 | } |
272 | | |
273 | 0 | void StmtProfiler::VisitLabelStmt(const LabelStmt *S) { |
274 | 0 | VisitStmt(S); |
275 | 0 | VisitDecl(S->getDecl()); |
276 | 0 | } |
277 | | |
278 | 0 | void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) { |
279 | 0 | VisitStmt(S); |
280 | | // TODO: maybe visit attributes? |
281 | 0 | } |
282 | | |
283 | 0 | void StmtProfiler::VisitIfStmt(const IfStmt *S) { |
284 | 0 | VisitStmt(S); |
285 | 0 | VisitDecl(S->getConditionVariable()); |
286 | 0 | } |
287 | | |
288 | 0 | void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) { |
289 | 0 | VisitStmt(S); |
290 | 0 | VisitDecl(S->getConditionVariable()); |
291 | 0 | } |
292 | | |
293 | 0 | void StmtProfiler::VisitWhileStmt(const WhileStmt *S) { |
294 | 0 | VisitStmt(S); |
295 | 0 | VisitDecl(S->getConditionVariable()); |
296 | 0 | } |
297 | | |
298 | 0 | void StmtProfiler::VisitDoStmt(const DoStmt *S) { |
299 | 0 | VisitStmt(S); |
300 | 0 | } |
301 | | |
302 | 0 | void StmtProfiler::VisitForStmt(const ForStmt *S) { |
303 | 0 | VisitStmt(S); |
304 | 0 | } |
305 | | |
306 | 0 | void StmtProfiler::VisitGotoStmt(const GotoStmt *S) { |
307 | 0 | VisitStmt(S); |
308 | 0 | VisitDecl(S->getLabel()); |
309 | 0 | } |
310 | | |
311 | 0 | void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) { |
312 | 0 | VisitStmt(S); |
313 | 0 | } |
314 | | |
315 | 0 | void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) { |
316 | 0 | VisitStmt(S); |
317 | 0 | } |
318 | | |
319 | 0 | void StmtProfiler::VisitBreakStmt(const BreakStmt *S) { |
320 | 0 | VisitStmt(S); |
321 | 0 | } |
322 | | |
323 | 0 | void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) { |
324 | 0 | VisitStmt(S); |
325 | 0 | } |
326 | | |
327 | 0 | void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) { |
328 | 0 | VisitStmt(S); |
329 | 0 | ID.AddBoolean(S->isVolatile()); |
330 | 0 | ID.AddBoolean(S->isSimple()); |
331 | 0 | VisitStringLiteral(S->getAsmString()); |
332 | 0 | ID.AddInteger(S->getNumOutputs()); |
333 | 0 | for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) { |
334 | 0 | ID.AddString(S->getOutputName(I)); |
335 | 0 | VisitStringLiteral(S->getOutputConstraintLiteral(I)); |
336 | 0 | } |
337 | 0 | ID.AddInteger(S->getNumInputs()); |
338 | 0 | for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) { |
339 | 0 | ID.AddString(S->getInputName(I)); |
340 | 0 | VisitStringLiteral(S->getInputConstraintLiteral(I)); |
341 | 0 | } |
342 | 0 | ID.AddInteger(S->getNumClobbers()); |
343 | 0 | for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) |
344 | 0 | VisitStringLiteral(S->getClobberStringLiteral(I)); |
345 | 0 | ID.AddInteger(S->getNumLabels()); |
346 | 0 | for (auto *L : S->labels()) |
347 | 0 | VisitDecl(L->getLabel()); |
348 | 0 | } |
349 | | |
350 | 0 | void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) { |
351 | | // FIXME: Implement MS style inline asm statement profiler. |
352 | 0 | VisitStmt(S); |
353 | 0 | } |
354 | | |
355 | 0 | void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) { |
356 | 0 | VisitStmt(S); |
357 | 0 | VisitType(S->getCaughtType()); |
358 | 0 | } |
359 | | |
360 | 0 | void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) { |
361 | 0 | VisitStmt(S); |
362 | 0 | } |
363 | | |
364 | 0 | void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) { |
365 | 0 | VisitStmt(S); |
366 | 0 | } |
367 | | |
368 | 0 | void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) { |
369 | 0 | VisitStmt(S); |
370 | 0 | ID.AddBoolean(S->isIfExists()); |
371 | 0 | VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier()); |
372 | 0 | VisitName(S->getNameInfo().getName()); |
373 | 0 | } |
374 | | |
375 | 0 | void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) { |
376 | 0 | VisitStmt(S); |
377 | 0 | } |
378 | | |
379 | 0 | void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) { |
380 | 0 | VisitStmt(S); |
381 | 0 | } |
382 | | |
383 | 0 | void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) { |
384 | 0 | VisitStmt(S); |
385 | 0 | } |
386 | | |
387 | 0 | void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) { |
388 | 0 | VisitStmt(S); |
389 | 0 | } |
390 | | |
391 | 0 | void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) { |
392 | 0 | VisitStmt(S); |
393 | 0 | } |
394 | | |
395 | 0 | void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) { |
396 | 0 | VisitStmt(S); |
397 | 0 | } |
398 | | |
399 | 0 | void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) { |
400 | 0 | VisitStmt(S); |
401 | 0 | ID.AddBoolean(S->hasEllipsis()); |
402 | 0 | if (S->getCatchParamDecl()) |
403 | 0 | VisitType(S->getCatchParamDecl()->getType()); |
404 | 0 | } |
405 | | |
406 | 0 | void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) { |
407 | 0 | VisitStmt(S); |
408 | 0 | } |
409 | | |
410 | 0 | void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) { |
411 | 0 | VisitStmt(S); |
412 | 0 | } |
413 | | |
414 | | void |
415 | 0 | StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) { |
416 | 0 | VisitStmt(S); |
417 | 0 | } |
418 | | |
419 | 0 | void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) { |
420 | 0 | VisitStmt(S); |
421 | 0 | } |
422 | | |
423 | | void |
424 | 0 | StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) { |
425 | 0 | VisitStmt(S); |
426 | 0 | } |
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 | 0 | 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 | 0 | const OMPClauseWithPreInit *C) { |
446 | 0 | if (auto *S = C->getPreInitStmt()) |
447 | 0 | Profiler->VisitStmt(S); |
448 | 0 | } |
449 | | |
450 | | void OMPClauseProfiler::VistOMPClauseWithPostUpdate( |
451 | 0 | const OMPClauseWithPostUpdate *C) { |
452 | 0 | VistOMPClauseWithPreInit(C); |
453 | 0 | if (auto *E = C->getPostUpdateExpr()) |
454 | 0 | Profiler->VisitStmt(E); |
455 | 0 | } |
456 | | |
457 | 0 | void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) { |
458 | 0 | VistOMPClauseWithPreInit(C); |
459 | 0 | if (C->getCondition()) |
460 | 0 | Profiler->VisitStmt(C->getCondition()); |
461 | 0 | } |
462 | | |
463 | 0 | void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) { |
464 | 0 | VistOMPClauseWithPreInit(C); |
465 | 0 | if (C->getCondition()) |
466 | 0 | Profiler->VisitStmt(C->getCondition()); |
467 | 0 | } |
468 | | |
469 | 0 | void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) { |
470 | 0 | VistOMPClauseWithPreInit(C); |
471 | 0 | if (C->getNumThreads()) |
472 | 0 | Profiler->VisitStmt(C->getNumThreads()); |
473 | 0 | } |
474 | | |
475 | 0 | void OMPClauseProfiler::VisitOMPAlignClause(const OMPAlignClause *C) { |
476 | 0 | if (C->getAlignment()) |
477 | 0 | Profiler->VisitStmt(C->getAlignment()); |
478 | 0 | } |
479 | | |
480 | 0 | void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) { |
481 | 0 | if (C->getSafelen()) |
482 | 0 | Profiler->VisitStmt(C->getSafelen()); |
483 | 0 | } |
484 | | |
485 | 0 | void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) { |
486 | 0 | if (C->getSimdlen()) |
487 | 0 | Profiler->VisitStmt(C->getSimdlen()); |
488 | 0 | } |
489 | | |
490 | 0 | void OMPClauseProfiler::VisitOMPSizesClause(const OMPSizesClause *C) { |
491 | 0 | for (auto *E : C->getSizesRefs()) |
492 | 0 | if (E) |
493 | 0 | Profiler->VisitExpr(E); |
494 | 0 | } |
495 | | |
496 | 0 | void OMPClauseProfiler::VisitOMPFullClause(const OMPFullClause *C) {} |
497 | | |
498 | 0 | void OMPClauseProfiler::VisitOMPPartialClause(const OMPPartialClause *C) { |
499 | 0 | if (const Expr *Factor = C->getFactor()) |
500 | 0 | Profiler->VisitExpr(Factor); |
501 | 0 | } |
502 | | |
503 | 0 | void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) { |
504 | 0 | if (C->getAllocator()) |
505 | 0 | Profiler->VisitStmt(C->getAllocator()); |
506 | 0 | } |
507 | | |
508 | 0 | void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) { |
509 | 0 | if (C->getNumForLoops()) |
510 | 0 | Profiler->VisitStmt(C->getNumForLoops()); |
511 | 0 | } |
512 | | |
513 | 0 | void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) { |
514 | 0 | if (Expr *Evt = C->getEventHandler()) |
515 | 0 | Profiler->VisitStmt(Evt); |
516 | 0 | } |
517 | | |
518 | 0 | void OMPClauseProfiler::VisitOMPNovariantsClause(const OMPNovariantsClause *C) { |
519 | 0 | VistOMPClauseWithPreInit(C); |
520 | 0 | if (C->getCondition()) |
521 | 0 | Profiler->VisitStmt(C->getCondition()); |
522 | 0 | } |
523 | | |
524 | 0 | void OMPClauseProfiler::VisitOMPNocontextClause(const OMPNocontextClause *C) { |
525 | 0 | VistOMPClauseWithPreInit(C); |
526 | 0 | if (C->getCondition()) |
527 | 0 | Profiler->VisitStmt(C->getCondition()); |
528 | 0 | } |
529 | | |
530 | 0 | void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { } |
531 | | |
532 | 0 | void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { } |
533 | | |
534 | | void OMPClauseProfiler::VisitOMPUnifiedAddressClause( |
535 | 0 | const OMPUnifiedAddressClause *C) {} |
536 | | |
537 | | void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause( |
538 | 0 | const OMPUnifiedSharedMemoryClause *C) {} |
539 | | |
540 | | void OMPClauseProfiler::VisitOMPReverseOffloadClause( |
541 | 0 | const OMPReverseOffloadClause *C) {} |
542 | | |
543 | | void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause( |
544 | 0 | const OMPDynamicAllocatorsClause *C) {} |
545 | | |
546 | | void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause( |
547 | 0 | const OMPAtomicDefaultMemOrderClause *C) {} |
548 | | |
549 | 0 | void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {} |
550 | | |
551 | 0 | void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {} |
552 | | |
553 | 0 | void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) { |
554 | 0 | if (C->getMessageString()) |
555 | 0 | Profiler->VisitStmt(C->getMessageString()); |
556 | 0 | } |
557 | | |
558 | 0 | void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) { |
559 | 0 | VistOMPClauseWithPreInit(C); |
560 | 0 | if (auto *S = C->getChunkSize()) |
561 | 0 | Profiler->VisitStmt(S); |
562 | 0 | } |
563 | | |
564 | 0 | void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) { |
565 | 0 | if (auto *Num = C->getNumForLoops()) |
566 | 0 | Profiler->VisitStmt(Num); |
567 | 0 | } |
568 | | |
569 | 0 | void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {} |
570 | | |
571 | 0 | void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {} |
572 | | |
573 | 0 | void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {} |
574 | | |
575 | 0 | void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {} |
576 | | |
577 | 0 | void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {} |
578 | | |
579 | 0 | void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {} |
580 | | |
581 | 0 | void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {} |
582 | | |
583 | 0 | void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {} |
584 | | |
585 | 0 | void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {} |
586 | | |
587 | 0 | void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} |
588 | | |
589 | 0 | void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {} |
590 | | |
591 | 0 | void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {} |
592 | | |
593 | 0 | void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {} |
594 | | |
595 | 0 | void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {} |
596 | | |
597 | 0 | void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {} |
598 | | |
599 | 0 | void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {} |
600 | | |
601 | 0 | void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {} |
602 | | |
603 | 0 | void OMPClauseProfiler::VisitOMPInitClause(const OMPInitClause *C) { |
604 | 0 | VisitOMPClauseList(C); |
605 | 0 | } |
606 | | |
607 | 0 | void OMPClauseProfiler::VisitOMPUseClause(const OMPUseClause *C) { |
608 | 0 | if (C->getInteropVar()) |
609 | 0 | Profiler->VisitStmt(C->getInteropVar()); |
610 | 0 | } |
611 | | |
612 | 0 | void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *C) { |
613 | 0 | if (C->getInteropVar()) |
614 | 0 | Profiler->VisitStmt(C->getInteropVar()); |
615 | 0 | } |
616 | | |
617 | 0 | void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) { |
618 | 0 | VistOMPClauseWithPreInit(C); |
619 | 0 | if (C->getThreadID()) |
620 | 0 | Profiler->VisitStmt(C->getThreadID()); |
621 | 0 | } |
622 | | |
623 | | template<typename T> |
624 | 0 | void OMPClauseProfiler::VisitOMPClauseList(T *Node) { |
625 | 0 | for (auto *E : Node->varlists()) { |
626 | 0 | if (E) |
627 | 0 | Profiler->VisitStmt(E); |
628 | 0 | } |
629 | 0 | } Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPAlignedClause const>(clang::OMPAlignedClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPAllocateClause const>(clang::OMPAllocateClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPCopyprivateClause const>(clang::OMPCopyprivateClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPCopyinClause const>(clang::OMPCopyinClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPDependClause const>(clang::OMPDependClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPDoacrossClause const>(clang::OMPDoacrossClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPExclusiveClause const>(clang::OMPExclusiveClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPFirstprivateClause const>(clang::OMPFirstprivateClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPFlushClause const>(clang::OMPFlushClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPFromClause const>(clang::OMPFromClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPHasDeviceAddrClause const>(clang::OMPHasDeviceAddrClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPInReductionClause const>(clang::OMPInReductionClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPInclusiveClause const>(clang::OMPInclusiveClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPInitClause const>(clang::OMPInitClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPIsDevicePtrClause const>(clang::OMPIsDevicePtrClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPLastprivateClause const>(clang::OMPLastprivateClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPLinearClause const>(clang::OMPLinearClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPMapClause const>(clang::OMPMapClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPNontemporalClause const>(clang::OMPNontemporalClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPPrivateClause const>(clang::OMPPrivateClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPReductionClause const>(clang::OMPReductionClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPSharedClause const>(clang::OMPSharedClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPTaskReductionClause const>(clang::OMPTaskReductionClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPToClause const>(clang::OMPToClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPUseDeviceAddrClause const>(clang::OMPUseDeviceAddrClause const*) Unexecuted instantiation: StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPUseDevicePtrClause const>(clang::OMPUseDevicePtrClause const*) |
630 | | |
631 | 0 | void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) { |
632 | 0 | VisitOMPClauseList(C); |
633 | 0 | for (auto *E : C->private_copies()) { |
634 | 0 | if (E) |
635 | 0 | Profiler->VisitStmt(E); |
636 | 0 | } |
637 | 0 | } |
638 | | void |
639 | 0 | OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) { |
640 | 0 | VisitOMPClauseList(C); |
641 | 0 | VistOMPClauseWithPreInit(C); |
642 | 0 | for (auto *E : C->private_copies()) { |
643 | 0 | if (E) |
644 | 0 | Profiler->VisitStmt(E); |
645 | 0 | } |
646 | 0 | for (auto *E : C->inits()) { |
647 | 0 | if (E) |
648 | 0 | Profiler->VisitStmt(E); |
649 | 0 | } |
650 | 0 | } |
651 | | void |
652 | 0 | OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) { |
653 | 0 | VisitOMPClauseList(C); |
654 | 0 | VistOMPClauseWithPostUpdate(C); |
655 | 0 | for (auto *E : C->source_exprs()) { |
656 | 0 | if (E) |
657 | 0 | Profiler->VisitStmt(E); |
658 | 0 | } |
659 | 0 | for (auto *E : C->destination_exprs()) { |
660 | 0 | if (E) |
661 | 0 | Profiler->VisitStmt(E); |
662 | 0 | } |
663 | 0 | for (auto *E : C->assignment_ops()) { |
664 | 0 | if (E) |
665 | 0 | Profiler->VisitStmt(E); |
666 | 0 | } |
667 | 0 | } |
668 | 0 | void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) { |
669 | 0 | VisitOMPClauseList(C); |
670 | 0 | } |
671 | | void OMPClauseProfiler::VisitOMPReductionClause( |
672 | 0 | const OMPReductionClause *C) { |
673 | 0 | Profiler->VisitNestedNameSpecifier( |
674 | 0 | C->getQualifierLoc().getNestedNameSpecifier()); |
675 | 0 | Profiler->VisitName(C->getNameInfo().getName()); |
676 | 0 | VisitOMPClauseList(C); |
677 | 0 | VistOMPClauseWithPostUpdate(C); |
678 | 0 | for (auto *E : C->privates()) { |
679 | 0 | if (E) |
680 | 0 | Profiler->VisitStmt(E); |
681 | 0 | } |
682 | 0 | for (auto *E : C->lhs_exprs()) { |
683 | 0 | if (E) |
684 | 0 | Profiler->VisitStmt(E); |
685 | 0 | } |
686 | 0 | for (auto *E : C->rhs_exprs()) { |
687 | 0 | if (E) |
688 | 0 | Profiler->VisitStmt(E); |
689 | 0 | } |
690 | 0 | for (auto *E : C->reduction_ops()) { |
691 | 0 | if (E) |
692 | 0 | Profiler->VisitStmt(E); |
693 | 0 | } |
694 | 0 | if (C->getModifier() == clang::OMPC_REDUCTION_inscan) { |
695 | 0 | for (auto *E : C->copy_ops()) { |
696 | 0 | if (E) |
697 | 0 | Profiler->VisitStmt(E); |
698 | 0 | } |
699 | 0 | for (auto *E : C->copy_array_temps()) { |
700 | 0 | if (E) |
701 | 0 | Profiler->VisitStmt(E); |
702 | 0 | } |
703 | 0 | for (auto *E : C->copy_array_elems()) { |
704 | 0 | if (E) |
705 | 0 | Profiler->VisitStmt(E); |
706 | 0 | } |
707 | 0 | } |
708 | 0 | } |
709 | | void OMPClauseProfiler::VisitOMPTaskReductionClause( |
710 | 0 | const OMPTaskReductionClause *C) { |
711 | 0 | Profiler->VisitNestedNameSpecifier( |
712 | 0 | C->getQualifierLoc().getNestedNameSpecifier()); |
713 | 0 | Profiler->VisitName(C->getNameInfo().getName()); |
714 | 0 | VisitOMPClauseList(C); |
715 | 0 | VistOMPClauseWithPostUpdate(C); |
716 | 0 | for (auto *E : C->privates()) { |
717 | 0 | if (E) |
718 | 0 | Profiler->VisitStmt(E); |
719 | 0 | } |
720 | 0 | for (auto *E : C->lhs_exprs()) { |
721 | 0 | if (E) |
722 | 0 | Profiler->VisitStmt(E); |
723 | 0 | } |
724 | 0 | for (auto *E : C->rhs_exprs()) { |
725 | 0 | if (E) |
726 | 0 | Profiler->VisitStmt(E); |
727 | 0 | } |
728 | 0 | for (auto *E : C->reduction_ops()) { |
729 | 0 | if (E) |
730 | 0 | Profiler->VisitStmt(E); |
731 | 0 | } |
732 | 0 | } |
733 | | void OMPClauseProfiler::VisitOMPInReductionClause( |
734 | 0 | const OMPInReductionClause *C) { |
735 | 0 | Profiler->VisitNestedNameSpecifier( |
736 | 0 | C->getQualifierLoc().getNestedNameSpecifier()); |
737 | 0 | Profiler->VisitName(C->getNameInfo().getName()); |
738 | 0 | VisitOMPClauseList(C); |
739 | 0 | VistOMPClauseWithPostUpdate(C); |
740 | 0 | for (auto *E : C->privates()) { |
741 | 0 | if (E) |
742 | 0 | Profiler->VisitStmt(E); |
743 | 0 | } |
744 | 0 | for (auto *E : C->lhs_exprs()) { |
745 | 0 | if (E) |
746 | 0 | Profiler->VisitStmt(E); |
747 | 0 | } |
748 | 0 | for (auto *E : C->rhs_exprs()) { |
749 | 0 | if (E) |
750 | 0 | Profiler->VisitStmt(E); |
751 | 0 | } |
752 | 0 | for (auto *E : C->reduction_ops()) { |
753 | 0 | if (E) |
754 | 0 | Profiler->VisitStmt(E); |
755 | 0 | } |
756 | 0 | for (auto *E : C->taskgroup_descriptors()) { |
757 | 0 | if (E) |
758 | 0 | Profiler->VisitStmt(E); |
759 | 0 | } |
760 | 0 | } |
761 | 0 | void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) { |
762 | 0 | VisitOMPClauseList(C); |
763 | 0 | VistOMPClauseWithPostUpdate(C); |
764 | 0 | for (auto *E : C->privates()) { |
765 | 0 | if (E) |
766 | 0 | Profiler->VisitStmt(E); |
767 | 0 | } |
768 | 0 | for (auto *E : C->inits()) { |
769 | 0 | if (E) |
770 | 0 | Profiler->VisitStmt(E); |
771 | 0 | } |
772 | 0 | for (auto *E : C->updates()) { |
773 | 0 | if (E) |
774 | 0 | Profiler->VisitStmt(E); |
775 | 0 | } |
776 | 0 | for (auto *E : C->finals()) { |
777 | 0 | if (E) |
778 | 0 | Profiler->VisitStmt(E); |
779 | 0 | } |
780 | 0 | if (C->getStep()) |
781 | 0 | Profiler->VisitStmt(C->getStep()); |
782 | 0 | if (C->getCalcStep()) |
783 | 0 | Profiler->VisitStmt(C->getCalcStep()); |
784 | 0 | } |
785 | 0 | void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) { |
786 | 0 | VisitOMPClauseList(C); |
787 | 0 | if (C->getAlignment()) |
788 | 0 | Profiler->VisitStmt(C->getAlignment()); |
789 | 0 | } |
790 | 0 | void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) { |
791 | 0 | VisitOMPClauseList(C); |
792 | 0 | for (auto *E : C->source_exprs()) { |
793 | 0 | if (E) |
794 | 0 | Profiler->VisitStmt(E); |
795 | 0 | } |
796 | 0 | for (auto *E : C->destination_exprs()) { |
797 | 0 | if (E) |
798 | 0 | Profiler->VisitStmt(E); |
799 | 0 | } |
800 | 0 | for (auto *E : C->assignment_ops()) { |
801 | 0 | if (E) |
802 | 0 | Profiler->VisitStmt(E); |
803 | 0 | } |
804 | 0 | } |
805 | | void |
806 | 0 | OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) { |
807 | 0 | VisitOMPClauseList(C); |
808 | 0 | for (auto *E : C->source_exprs()) { |
809 | 0 | if (E) |
810 | 0 | Profiler->VisitStmt(E); |
811 | 0 | } |
812 | 0 | for (auto *E : C->destination_exprs()) { |
813 | 0 | if (E) |
814 | 0 | Profiler->VisitStmt(E); |
815 | 0 | } |
816 | 0 | for (auto *E : C->assignment_ops()) { |
817 | 0 | if (E) |
818 | 0 | Profiler->VisitStmt(E); |
819 | 0 | } |
820 | 0 | } |
821 | 0 | void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) { |
822 | 0 | VisitOMPClauseList(C); |
823 | 0 | } |
824 | 0 | void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) { |
825 | 0 | if (const Expr *Depobj = C->getDepobj()) |
826 | 0 | Profiler->VisitStmt(Depobj); |
827 | 0 | } |
828 | 0 | void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) { |
829 | 0 | VisitOMPClauseList(C); |
830 | 0 | } |
831 | 0 | void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) { |
832 | 0 | if (C->getDevice()) |
833 | 0 | Profiler->VisitStmt(C->getDevice()); |
834 | 0 | } |
835 | 0 | void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) { |
836 | 0 | VisitOMPClauseList(C); |
837 | 0 | } |
838 | 0 | void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) { |
839 | 0 | if (Expr *Allocator = C->getAllocator()) |
840 | 0 | Profiler->VisitStmt(Allocator); |
841 | 0 | VisitOMPClauseList(C); |
842 | 0 | } |
843 | 0 | void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) { |
844 | 0 | VistOMPClauseWithPreInit(C); |
845 | 0 | if (C->getNumTeams()) |
846 | 0 | Profiler->VisitStmt(C->getNumTeams()); |
847 | 0 | } |
848 | | void OMPClauseProfiler::VisitOMPThreadLimitClause( |
849 | 0 | const OMPThreadLimitClause *C) { |
850 | 0 | VistOMPClauseWithPreInit(C); |
851 | 0 | if (C->getThreadLimit()) |
852 | 0 | Profiler->VisitStmt(C->getThreadLimit()); |
853 | 0 | } |
854 | 0 | void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) { |
855 | 0 | VistOMPClauseWithPreInit(C); |
856 | 0 | if (C->getPriority()) |
857 | 0 | Profiler->VisitStmt(C->getPriority()); |
858 | 0 | } |
859 | 0 | void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) { |
860 | 0 | VistOMPClauseWithPreInit(C); |
861 | 0 | if (C->getGrainsize()) |
862 | 0 | Profiler->VisitStmt(C->getGrainsize()); |
863 | 0 | } |
864 | 0 | void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) { |
865 | 0 | VistOMPClauseWithPreInit(C); |
866 | 0 | if (C->getNumTasks()) |
867 | 0 | Profiler->VisitStmt(C->getNumTasks()); |
868 | 0 | } |
869 | 0 | void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) { |
870 | 0 | if (C->getHint()) |
871 | 0 | Profiler->VisitStmt(C->getHint()); |
872 | 0 | } |
873 | 0 | void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) { |
874 | 0 | VisitOMPClauseList(C); |
875 | 0 | } |
876 | 0 | void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) { |
877 | 0 | VisitOMPClauseList(C); |
878 | 0 | } |
879 | | void OMPClauseProfiler::VisitOMPUseDevicePtrClause( |
880 | 0 | const OMPUseDevicePtrClause *C) { |
881 | 0 | VisitOMPClauseList(C); |
882 | 0 | } |
883 | | void OMPClauseProfiler::VisitOMPUseDeviceAddrClause( |
884 | 0 | const OMPUseDeviceAddrClause *C) { |
885 | 0 | VisitOMPClauseList(C); |
886 | 0 | } |
887 | | void OMPClauseProfiler::VisitOMPIsDevicePtrClause( |
888 | 0 | const OMPIsDevicePtrClause *C) { |
889 | 0 | VisitOMPClauseList(C); |
890 | 0 | } |
891 | | void OMPClauseProfiler::VisitOMPHasDeviceAddrClause( |
892 | 0 | const OMPHasDeviceAddrClause *C) { |
893 | 0 | VisitOMPClauseList(C); |
894 | 0 | } |
895 | | void OMPClauseProfiler::VisitOMPNontemporalClause( |
896 | 0 | const OMPNontemporalClause *C) { |
897 | 0 | VisitOMPClauseList(C); |
898 | 0 | for (auto *E : C->private_refs()) |
899 | 0 | Profiler->VisitStmt(E); |
900 | 0 | } |
901 | 0 | void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) { |
902 | 0 | VisitOMPClauseList(C); |
903 | 0 | } |
904 | 0 | void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) { |
905 | 0 | VisitOMPClauseList(C); |
906 | 0 | } |
907 | | void OMPClauseProfiler::VisitOMPUsesAllocatorsClause( |
908 | 0 | const OMPUsesAllocatorsClause *C) { |
909 | 0 | for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) { |
910 | 0 | OMPUsesAllocatorsClause::Data D = C->getAllocatorData(I); |
911 | 0 | Profiler->VisitStmt(D.Allocator); |
912 | 0 | if (D.AllocatorTraits) |
913 | 0 | Profiler->VisitStmt(D.AllocatorTraits); |
914 | 0 | } |
915 | 0 | } |
916 | 0 | void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) { |
917 | 0 | if (const Expr *Modifier = C->getModifier()) |
918 | 0 | Profiler->VisitStmt(Modifier); |
919 | 0 | for (const Expr *E : C->varlists()) |
920 | 0 | Profiler->VisitStmt(E); |
921 | 0 | } |
922 | 0 | void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {} |
923 | 0 | void OMPClauseProfiler::VisitOMPBindClause(const OMPBindClause *C) {} |
924 | | void OMPClauseProfiler::VisitOMPXDynCGroupMemClause( |
925 | 0 | const OMPXDynCGroupMemClause *C) { |
926 | 0 | VistOMPClauseWithPreInit(C); |
927 | 0 | if (Expr *Size = C->getSize()) |
928 | 0 | Profiler->VisitStmt(Size); |
929 | 0 | } |
930 | 0 | void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) { |
931 | 0 | VisitOMPClauseList(C); |
932 | 0 | } |
933 | 0 | void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) { |
934 | 0 | } |
935 | 0 | void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {} |
936 | | } // namespace |
937 | | |
938 | | void |
939 | 0 | StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) { |
940 | 0 | VisitStmt(S); |
941 | 0 | OMPClauseProfiler P(this); |
942 | 0 | ArrayRef<OMPClause *> Clauses = S->clauses(); |
943 | 0 | for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end(); |
944 | 0 | I != E; ++I) |
945 | 0 | if (*I) |
946 | 0 | P.Visit(*I); |
947 | 0 | } |
948 | | |
949 | 0 | void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) { |
950 | 0 | VisitStmt(L); |
951 | 0 | } |
952 | | |
953 | 0 | void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) { |
954 | 0 | VisitOMPExecutableDirective(S); |
955 | 0 | } |
956 | | |
957 | 0 | void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) { |
958 | 0 | VisitOMPLoopBasedDirective(S); |
959 | 0 | } |
960 | | |
961 | 0 | void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) { |
962 | 0 | VisitOMPExecutableDirective(S); |
963 | 0 | } |
964 | | |
965 | 0 | void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) { |
966 | 0 | VisitOMPExecutableDirective(S); |
967 | 0 | } |
968 | | |
969 | 0 | void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) { |
970 | 0 | VisitOMPLoopDirective(S); |
971 | 0 | } |
972 | | |
973 | | void StmtProfiler::VisitOMPLoopTransformationDirective( |
974 | 0 | const OMPLoopTransformationDirective *S) { |
975 | 0 | VisitOMPLoopBasedDirective(S); |
976 | 0 | } |
977 | | |
978 | 0 | void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) { |
979 | 0 | VisitOMPLoopTransformationDirective(S); |
980 | 0 | } |
981 | | |
982 | 0 | void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) { |
983 | 0 | VisitOMPLoopTransformationDirective(S); |
984 | 0 | } |
985 | | |
986 | 0 | void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) { |
987 | 0 | VisitOMPLoopDirective(S); |
988 | 0 | } |
989 | | |
990 | 0 | void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) { |
991 | 0 | VisitOMPLoopDirective(S); |
992 | 0 | } |
993 | | |
994 | 0 | void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) { |
995 | 0 | VisitOMPExecutableDirective(S); |
996 | 0 | } |
997 | | |
998 | 0 | void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) { |
999 | 0 | VisitOMPExecutableDirective(S); |
1000 | 0 | } |
1001 | | |
1002 | 0 | void StmtProfiler::VisitOMPScopeDirective(const OMPScopeDirective *S) { |
1003 | 0 | VisitOMPExecutableDirective(S); |
1004 | 0 | } |
1005 | | |
1006 | 0 | void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) { |
1007 | 0 | VisitOMPExecutableDirective(S); |
1008 | 0 | } |
1009 | | |
1010 | 0 | void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) { |
1011 | 0 | VisitOMPExecutableDirective(S); |
1012 | 0 | } |
1013 | | |
1014 | 0 | void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) { |
1015 | 0 | VisitOMPExecutableDirective(S); |
1016 | 0 | VisitName(S->getDirectiveName().getName()); |
1017 | 0 | } |
1018 | | |
1019 | | void |
1020 | 0 | StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) { |
1021 | 0 | VisitOMPLoopDirective(S); |
1022 | 0 | } |
1023 | | |
1024 | | void StmtProfiler::VisitOMPParallelForSimdDirective( |
1025 | 0 | const OMPParallelForSimdDirective *S) { |
1026 | 0 | VisitOMPLoopDirective(S); |
1027 | 0 | } |
1028 | | |
1029 | | void StmtProfiler::VisitOMPParallelMasterDirective( |
1030 | 0 | const OMPParallelMasterDirective *S) { |
1031 | 0 | VisitOMPExecutableDirective(S); |
1032 | 0 | } |
1033 | | |
1034 | | void StmtProfiler::VisitOMPParallelMaskedDirective( |
1035 | 0 | const OMPParallelMaskedDirective *S) { |
1036 | 0 | VisitOMPExecutableDirective(S); |
1037 | 0 | } |
1038 | | |
1039 | | void StmtProfiler::VisitOMPParallelSectionsDirective( |
1040 | 0 | const OMPParallelSectionsDirective *S) { |
1041 | 0 | VisitOMPExecutableDirective(S); |
1042 | 0 | } |
1043 | | |
1044 | 0 | void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) { |
1045 | 0 | VisitOMPExecutableDirective(S); |
1046 | 0 | } |
1047 | | |
1048 | 0 | void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) { |
1049 | 0 | VisitOMPExecutableDirective(S); |
1050 | 0 | } |
1051 | | |
1052 | 0 | void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) { |
1053 | 0 | VisitOMPExecutableDirective(S); |
1054 | 0 | } |
1055 | | |
1056 | 0 | void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) { |
1057 | 0 | VisitOMPExecutableDirective(S); |
1058 | 0 | } |
1059 | | |
1060 | 0 | void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) { |
1061 | 0 | VisitOMPExecutableDirective(S); |
1062 | 0 | } |
1063 | 0 | void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) { |
1064 | 0 | VisitOMPExecutableDirective(S); |
1065 | 0 | if (const Expr *E = S->getReductionRef()) |
1066 | 0 | VisitStmt(E); |
1067 | 0 | } |
1068 | | |
1069 | 0 | void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) { |
1070 | 0 | VisitOMPExecutableDirective(S); |
1071 | 0 | } |
1072 | | |
1073 | 0 | void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) { |
1074 | 0 | VisitOMPExecutableDirective(S); |
1075 | 0 | } |
1076 | | |
1077 | 0 | void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) { |
1078 | 0 | VisitOMPExecutableDirective(S); |
1079 | 0 | } |
1080 | | |
1081 | 0 | void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) { |
1082 | 0 | VisitOMPExecutableDirective(S); |
1083 | 0 | } |
1084 | | |
1085 | 0 | void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) { |
1086 | 0 | VisitOMPExecutableDirective(S); |
1087 | 0 | } |
1088 | | |
1089 | 0 | void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) { |
1090 | 0 | VisitOMPExecutableDirective(S); |
1091 | 0 | } |
1092 | | |
1093 | 0 | void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) { |
1094 | 0 | VisitOMPExecutableDirective(S); |
1095 | 0 | } |
1096 | | |
1097 | | void StmtProfiler::VisitOMPTargetEnterDataDirective( |
1098 | 0 | const OMPTargetEnterDataDirective *S) { |
1099 | 0 | VisitOMPExecutableDirective(S); |
1100 | 0 | } |
1101 | | |
1102 | | void StmtProfiler::VisitOMPTargetExitDataDirective( |
1103 | 0 | const OMPTargetExitDataDirective *S) { |
1104 | 0 | VisitOMPExecutableDirective(S); |
1105 | 0 | } |
1106 | | |
1107 | | void StmtProfiler::VisitOMPTargetParallelDirective( |
1108 | 0 | const OMPTargetParallelDirective *S) { |
1109 | 0 | VisitOMPExecutableDirective(S); |
1110 | 0 | } |
1111 | | |
1112 | | void StmtProfiler::VisitOMPTargetParallelForDirective( |
1113 | 0 | const OMPTargetParallelForDirective *S) { |
1114 | 0 | VisitOMPExecutableDirective(S); |
1115 | 0 | } |
1116 | | |
1117 | 0 | void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) { |
1118 | 0 | VisitOMPExecutableDirective(S); |
1119 | 0 | } |
1120 | | |
1121 | | void StmtProfiler::VisitOMPCancellationPointDirective( |
1122 | 0 | const OMPCancellationPointDirective *S) { |
1123 | 0 | VisitOMPExecutableDirective(S); |
1124 | 0 | } |
1125 | | |
1126 | 0 | void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) { |
1127 | 0 | VisitOMPExecutableDirective(S); |
1128 | 0 | } |
1129 | | |
1130 | 0 | void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) { |
1131 | 0 | VisitOMPLoopDirective(S); |
1132 | 0 | } |
1133 | | |
1134 | | void StmtProfiler::VisitOMPTaskLoopSimdDirective( |
1135 | 0 | const OMPTaskLoopSimdDirective *S) { |
1136 | 0 | VisitOMPLoopDirective(S); |
1137 | 0 | } |
1138 | | |
1139 | | void StmtProfiler::VisitOMPMasterTaskLoopDirective( |
1140 | 0 | const OMPMasterTaskLoopDirective *S) { |
1141 | 0 | VisitOMPLoopDirective(S); |
1142 | 0 | } |
1143 | | |
1144 | | void StmtProfiler::VisitOMPMaskedTaskLoopDirective( |
1145 | 0 | const OMPMaskedTaskLoopDirective *S) { |
1146 | 0 | VisitOMPLoopDirective(S); |
1147 | 0 | } |
1148 | | |
1149 | | void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective( |
1150 | 0 | const OMPMasterTaskLoopSimdDirective *S) { |
1151 | 0 | VisitOMPLoopDirective(S); |
1152 | 0 | } |
1153 | | |
1154 | | void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective( |
1155 | 0 | const OMPMaskedTaskLoopSimdDirective *S) { |
1156 | 0 | VisitOMPLoopDirective(S); |
1157 | 0 | } |
1158 | | |
1159 | | void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective( |
1160 | 0 | const OMPParallelMasterTaskLoopDirective *S) { |
1161 | 0 | VisitOMPLoopDirective(S); |
1162 | 0 | } |
1163 | | |
1164 | | void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective( |
1165 | 0 | const OMPParallelMaskedTaskLoopDirective *S) { |
1166 | 0 | VisitOMPLoopDirective(S); |
1167 | 0 | } |
1168 | | |
1169 | | void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective( |
1170 | 0 | const OMPParallelMasterTaskLoopSimdDirective *S) { |
1171 | 0 | VisitOMPLoopDirective(S); |
1172 | 0 | } |
1173 | | |
1174 | | void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective( |
1175 | 0 | const OMPParallelMaskedTaskLoopSimdDirective *S) { |
1176 | 0 | VisitOMPLoopDirective(S); |
1177 | 0 | } |
1178 | | |
1179 | | void StmtProfiler::VisitOMPDistributeDirective( |
1180 | 0 | const OMPDistributeDirective *S) { |
1181 | 0 | VisitOMPLoopDirective(S); |
1182 | 0 | } |
1183 | | |
1184 | | void OMPClauseProfiler::VisitOMPDistScheduleClause( |
1185 | 0 | const OMPDistScheduleClause *C) { |
1186 | 0 | VistOMPClauseWithPreInit(C); |
1187 | 0 | if (auto *S = C->getChunkSize()) |
1188 | 0 | Profiler->VisitStmt(S); |
1189 | 0 | } |
1190 | | |
1191 | 0 | void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {} |
1192 | | |
1193 | | void StmtProfiler::VisitOMPTargetUpdateDirective( |
1194 | 0 | const OMPTargetUpdateDirective *S) { |
1195 | 0 | VisitOMPExecutableDirective(S); |
1196 | 0 | } |
1197 | | |
1198 | | void StmtProfiler::VisitOMPDistributeParallelForDirective( |
1199 | 0 | const OMPDistributeParallelForDirective *S) { |
1200 | 0 | VisitOMPLoopDirective(S); |
1201 | 0 | } |
1202 | | |
1203 | | void StmtProfiler::VisitOMPDistributeParallelForSimdDirective( |
1204 | 0 | const OMPDistributeParallelForSimdDirective *S) { |
1205 | 0 | VisitOMPLoopDirective(S); |
1206 | 0 | } |
1207 | | |
1208 | | void StmtProfiler::VisitOMPDistributeSimdDirective( |
1209 | 0 | const OMPDistributeSimdDirective *S) { |
1210 | 0 | VisitOMPLoopDirective(S); |
1211 | 0 | } |
1212 | | |
1213 | | void StmtProfiler::VisitOMPTargetParallelForSimdDirective( |
1214 | 0 | const OMPTargetParallelForSimdDirective *S) { |
1215 | 0 | VisitOMPLoopDirective(S); |
1216 | 0 | } |
1217 | | |
1218 | | void StmtProfiler::VisitOMPTargetSimdDirective( |
1219 | 0 | const OMPTargetSimdDirective *S) { |
1220 | 0 | VisitOMPLoopDirective(S); |
1221 | 0 | } |
1222 | | |
1223 | | void StmtProfiler::VisitOMPTeamsDistributeDirective( |
1224 | 0 | const OMPTeamsDistributeDirective *S) { |
1225 | 0 | VisitOMPLoopDirective(S); |
1226 | 0 | } |
1227 | | |
1228 | | void StmtProfiler::VisitOMPTeamsDistributeSimdDirective( |
1229 | 0 | const OMPTeamsDistributeSimdDirective *S) { |
1230 | 0 | VisitOMPLoopDirective(S); |
1231 | 0 | } |
1232 | | |
1233 | | void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective( |
1234 | 0 | const OMPTeamsDistributeParallelForSimdDirective *S) { |
1235 | 0 | VisitOMPLoopDirective(S); |
1236 | 0 | } |
1237 | | |
1238 | | void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective( |
1239 | 0 | const OMPTeamsDistributeParallelForDirective *S) { |
1240 | 0 | VisitOMPLoopDirective(S); |
1241 | 0 | } |
1242 | | |
1243 | | void StmtProfiler::VisitOMPTargetTeamsDirective( |
1244 | 0 | const OMPTargetTeamsDirective *S) { |
1245 | 0 | VisitOMPExecutableDirective(S); |
1246 | 0 | } |
1247 | | |
1248 | | void StmtProfiler::VisitOMPTargetTeamsDistributeDirective( |
1249 | 0 | const OMPTargetTeamsDistributeDirective *S) { |
1250 | 0 | VisitOMPLoopDirective(S); |
1251 | 0 | } |
1252 | | |
1253 | | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective( |
1254 | 0 | const OMPTargetTeamsDistributeParallelForDirective *S) { |
1255 | 0 | VisitOMPLoopDirective(S); |
1256 | 0 | } |
1257 | | |
1258 | | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
1259 | 0 | const OMPTargetTeamsDistributeParallelForSimdDirective *S) { |
1260 | 0 | VisitOMPLoopDirective(S); |
1261 | 0 | } |
1262 | | |
1263 | | void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective( |
1264 | 0 | const OMPTargetTeamsDistributeSimdDirective *S) { |
1265 | 0 | VisitOMPLoopDirective(S); |
1266 | 0 | } |
1267 | | |
1268 | 0 | void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) { |
1269 | 0 | VisitOMPExecutableDirective(S); |
1270 | 0 | } |
1271 | | |
1272 | 0 | void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) { |
1273 | 0 | VisitOMPExecutableDirective(S); |
1274 | 0 | } |
1275 | | |
1276 | 0 | void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) { |
1277 | 0 | VisitOMPExecutableDirective(S); |
1278 | 0 | } |
1279 | | |
1280 | | void StmtProfiler::VisitOMPGenericLoopDirective( |
1281 | 0 | const OMPGenericLoopDirective *S) { |
1282 | 0 | VisitOMPLoopDirective(S); |
1283 | 0 | } |
1284 | | |
1285 | | void StmtProfiler::VisitOMPTeamsGenericLoopDirective( |
1286 | 0 | const OMPTeamsGenericLoopDirective *S) { |
1287 | 0 | VisitOMPLoopDirective(S); |
1288 | 0 | } |
1289 | | |
1290 | | void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective( |
1291 | 0 | const OMPTargetTeamsGenericLoopDirective *S) { |
1292 | 0 | VisitOMPLoopDirective(S); |
1293 | 0 | } |
1294 | | |
1295 | | void StmtProfiler::VisitOMPParallelGenericLoopDirective( |
1296 | 0 | const OMPParallelGenericLoopDirective *S) { |
1297 | 0 | VisitOMPLoopDirective(S); |
1298 | 0 | } |
1299 | | |
1300 | | void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective( |
1301 | 0 | const OMPTargetParallelGenericLoopDirective *S) { |
1302 | 0 | VisitOMPLoopDirective(S); |
1303 | 0 | } |
1304 | | |
1305 | 76 | void StmtProfiler::VisitExpr(const Expr *S) { |
1306 | 76 | VisitStmt(S); |
1307 | 76 | } |
1308 | | |
1309 | 0 | void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) { |
1310 | 0 | VisitExpr(S); |
1311 | 0 | } |
1312 | | |
1313 | 1 | void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) { |
1314 | 1 | VisitExpr(S); |
1315 | 1 | if (!Canonical) |
1316 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
1317 | 1 | VisitDecl(S->getDecl()); |
1318 | 1 | if (!Canonical) { |
1319 | 0 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
1320 | 0 | if (S->hasExplicitTemplateArgs()) |
1321 | 0 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
1322 | 0 | } |
1323 | 1 | } |
1324 | | |
1325 | | void StmtProfiler::VisitSYCLUniqueStableNameExpr( |
1326 | 0 | const SYCLUniqueStableNameExpr *S) { |
1327 | 0 | VisitExpr(S); |
1328 | 0 | VisitType(S->getTypeSourceInfo()->getType()); |
1329 | 0 | } |
1330 | | |
1331 | 0 | void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) { |
1332 | 0 | VisitExpr(S); |
1333 | 0 | ID.AddInteger(llvm::to_underlying(S->getIdentKind())); |
1334 | 0 | } |
1335 | | |
1336 | 0 | void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) { |
1337 | 0 | VisitExpr(S); |
1338 | 0 | S->getValue().Profile(ID); |
1339 | |
|
1340 | 0 | QualType T = S->getType(); |
1341 | 0 | if (Canonical) |
1342 | 0 | T = T.getCanonicalType(); |
1343 | 0 | ID.AddInteger(T->getTypeClass()); |
1344 | 0 | if (auto BitIntT = T->getAs<BitIntType>()) |
1345 | 0 | BitIntT->Profile(ID); |
1346 | 0 | else |
1347 | 0 | ID.AddInteger(T->castAs<BuiltinType>()->getKind()); |
1348 | 0 | } |
1349 | | |
1350 | 0 | void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) { |
1351 | 0 | VisitExpr(S); |
1352 | 0 | S->getValue().Profile(ID); |
1353 | 0 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
1354 | 0 | } |
1355 | | |
1356 | 0 | void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) { |
1357 | 0 | VisitExpr(S); |
1358 | 0 | ID.AddInteger(llvm::to_underlying(S->getKind())); |
1359 | 0 | ID.AddInteger(S->getValue()); |
1360 | 0 | } |
1361 | | |
1362 | 0 | void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) { |
1363 | 0 | VisitExpr(S); |
1364 | 0 | S->getValue().Profile(ID); |
1365 | 0 | ID.AddBoolean(S->isExact()); |
1366 | 0 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
1367 | 0 | } |
1368 | | |
1369 | 0 | void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) { |
1370 | 0 | VisitExpr(S); |
1371 | 0 | } |
1372 | | |
1373 | 0 | void StmtProfiler::VisitStringLiteral(const StringLiteral *S) { |
1374 | 0 | VisitExpr(S); |
1375 | 0 | ID.AddString(S->getBytes()); |
1376 | 0 | ID.AddInteger(llvm::to_underlying(S->getKind())); |
1377 | 0 | } |
1378 | | |
1379 | 0 | void StmtProfiler::VisitParenExpr(const ParenExpr *S) { |
1380 | 0 | VisitExpr(S); |
1381 | 0 | } |
1382 | | |
1383 | 0 | void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) { |
1384 | 0 | VisitExpr(S); |
1385 | 0 | } |
1386 | | |
1387 | 2 | void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) { |
1388 | 2 | VisitExpr(S); |
1389 | 2 | ID.AddInteger(S->getOpcode()); |
1390 | 2 | } |
1391 | | |
1392 | 0 | void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) { |
1393 | 0 | VisitType(S->getTypeSourceInfo()->getType()); |
1394 | 0 | unsigned n = S->getNumComponents(); |
1395 | 0 | for (unsigned i = 0; i < n; ++i) { |
1396 | 0 | const OffsetOfNode &ON = S->getComponent(i); |
1397 | 0 | ID.AddInteger(ON.getKind()); |
1398 | 0 | switch (ON.getKind()) { |
1399 | 0 | case OffsetOfNode::Array: |
1400 | | // Expressions handled below. |
1401 | 0 | break; |
1402 | | |
1403 | 0 | case OffsetOfNode::Field: |
1404 | 0 | VisitDecl(ON.getField()); |
1405 | 0 | break; |
1406 | | |
1407 | 0 | case OffsetOfNode::Identifier: |
1408 | 0 | VisitIdentifierInfo(ON.getFieldName()); |
1409 | 0 | break; |
1410 | | |
1411 | 0 | case OffsetOfNode::Base: |
1412 | | // These nodes are implicit, and therefore don't need profiling. |
1413 | 0 | break; |
1414 | 0 | } |
1415 | 0 | } |
1416 | | |
1417 | 0 | VisitExpr(S); |
1418 | 0 | } |
1419 | | |
1420 | | void |
1421 | 0 | StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) { |
1422 | 0 | VisitExpr(S); |
1423 | 0 | ID.AddInteger(S->getKind()); |
1424 | 0 | if (S->isArgumentType()) |
1425 | 0 | VisitType(S->getArgumentType()); |
1426 | 0 | } |
1427 | | |
1428 | 0 | void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) { |
1429 | 0 | VisitExpr(S); |
1430 | 0 | } |
1431 | | |
1432 | 0 | void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) { |
1433 | 0 | VisitExpr(S); |
1434 | 0 | } |
1435 | | |
1436 | 0 | void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) { |
1437 | 0 | VisitExpr(S); |
1438 | 0 | } |
1439 | | |
1440 | 0 | void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) { |
1441 | 0 | VisitExpr(S); |
1442 | 0 | } |
1443 | | |
1444 | 0 | void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) { |
1445 | 0 | VisitExpr(S); |
1446 | 0 | for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I) |
1447 | 0 | VisitDecl(S->getIteratorDecl(I)); |
1448 | 0 | } |
1449 | | |
1450 | 0 | void StmtProfiler::VisitCallExpr(const CallExpr *S) { |
1451 | 0 | VisitExpr(S); |
1452 | 0 | } |
1453 | | |
1454 | 0 | void StmtProfiler::VisitMemberExpr(const MemberExpr *S) { |
1455 | 0 | VisitExpr(S); |
1456 | 0 | VisitDecl(S->getMemberDecl()); |
1457 | 0 | if (!Canonical) |
1458 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
1459 | 0 | ID.AddBoolean(S->isArrow()); |
1460 | 0 | } |
1461 | | |
1462 | 0 | void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) { |
1463 | 0 | VisitExpr(S); |
1464 | 0 | ID.AddBoolean(S->isFileScope()); |
1465 | 0 | } |
1466 | | |
1467 | 22 | void StmtProfiler::VisitCastExpr(const CastExpr *S) { |
1468 | 22 | VisitExpr(S); |
1469 | 22 | } |
1470 | | |
1471 | 22 | void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) { |
1472 | 22 | VisitCastExpr(S); |
1473 | 22 | ID.AddInteger(S->getValueKind()); |
1474 | 22 | } |
1475 | | |
1476 | 0 | void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) { |
1477 | 0 | VisitCastExpr(S); |
1478 | 0 | VisitType(S->getTypeAsWritten()); |
1479 | 0 | } |
1480 | | |
1481 | 0 | void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) { |
1482 | 0 | VisitExplicitCastExpr(S); |
1483 | 0 | } |
1484 | | |
1485 | 0 | void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) { |
1486 | 0 | VisitExpr(S); |
1487 | 0 | ID.AddInteger(S->getOpcode()); |
1488 | 0 | } |
1489 | | |
1490 | | void |
1491 | 0 | StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) { |
1492 | 0 | VisitBinaryOperator(S); |
1493 | 0 | } |
1494 | | |
1495 | 0 | void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) { |
1496 | 0 | VisitExpr(S); |
1497 | 0 | } |
1498 | | |
1499 | | void StmtProfiler::VisitBinaryConditionalOperator( |
1500 | 0 | const BinaryConditionalOperator *S) { |
1501 | 0 | VisitExpr(S); |
1502 | 0 | } |
1503 | | |
1504 | 0 | void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) { |
1505 | 0 | VisitExpr(S); |
1506 | 0 | VisitDecl(S->getLabel()); |
1507 | 0 | } |
1508 | | |
1509 | 0 | void StmtProfiler::VisitStmtExpr(const StmtExpr *S) { |
1510 | 0 | VisitExpr(S); |
1511 | 0 | } |
1512 | | |
1513 | 0 | void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) { |
1514 | 0 | VisitExpr(S); |
1515 | 0 | } |
1516 | | |
1517 | 0 | void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) { |
1518 | 0 | VisitExpr(S); |
1519 | 0 | } |
1520 | | |
1521 | 0 | void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) { |
1522 | 0 | VisitExpr(S); |
1523 | 0 | } |
1524 | | |
1525 | 0 | void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) { |
1526 | 0 | VisitExpr(S); |
1527 | 0 | } |
1528 | | |
1529 | 0 | void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) { |
1530 | 0 | VisitExpr(S); |
1531 | 0 | } |
1532 | | |
1533 | 0 | void StmtProfiler::VisitInitListExpr(const InitListExpr *S) { |
1534 | 0 | if (S->getSyntacticForm()) { |
1535 | 0 | VisitInitListExpr(S->getSyntacticForm()); |
1536 | 0 | return; |
1537 | 0 | } |
1538 | | |
1539 | 0 | VisitExpr(S); |
1540 | 0 | } |
1541 | | |
1542 | 0 | void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) { |
1543 | 0 | VisitExpr(S); |
1544 | 0 | ID.AddBoolean(S->usesGNUSyntax()); |
1545 | 0 | for (const DesignatedInitExpr::Designator &D : S->designators()) { |
1546 | 0 | if (D.isFieldDesignator()) { |
1547 | 0 | ID.AddInteger(0); |
1548 | 0 | VisitName(D.getFieldName()); |
1549 | 0 | continue; |
1550 | 0 | } |
1551 | | |
1552 | 0 | if (D.isArrayDesignator()) { |
1553 | 0 | ID.AddInteger(1); |
1554 | 0 | } else { |
1555 | 0 | assert(D.isArrayRangeDesignator()); |
1556 | 0 | ID.AddInteger(2); |
1557 | 0 | } |
1558 | 0 | ID.AddInteger(D.getArrayIndex()); |
1559 | 0 | } |
1560 | 0 | } |
1561 | | |
1562 | | // Seems that if VisitInitListExpr() only works on the syntactic form of an |
1563 | | // InitListExpr, then a DesignatedInitUpdateExpr is not encountered. |
1564 | | void StmtProfiler::VisitDesignatedInitUpdateExpr( |
1565 | 0 | const DesignatedInitUpdateExpr *S) { |
1566 | 0 | llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of " |
1567 | 0 | "initializer"); |
1568 | 0 | } |
1569 | | |
1570 | 0 | void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) { |
1571 | 0 | VisitExpr(S); |
1572 | 0 | } |
1573 | | |
1574 | 0 | void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) { |
1575 | 0 | VisitExpr(S); |
1576 | 0 | } |
1577 | | |
1578 | 0 | void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) { |
1579 | 0 | llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer"); |
1580 | 0 | } |
1581 | | |
1582 | 0 | void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) { |
1583 | 0 | VisitExpr(S); |
1584 | 0 | } |
1585 | | |
1586 | 0 | void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) { |
1587 | 0 | VisitExpr(S); |
1588 | 0 | VisitName(&S->getAccessor()); |
1589 | 0 | } |
1590 | | |
1591 | 0 | void StmtProfiler::VisitBlockExpr(const BlockExpr *S) { |
1592 | 0 | VisitExpr(S); |
1593 | 0 | VisitDecl(S->getBlockDecl()); |
1594 | 0 | } |
1595 | | |
1596 | 0 | void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) { |
1597 | 0 | VisitExpr(S); |
1598 | 0 | for (const GenericSelectionExpr::ConstAssociation Assoc : |
1599 | 0 | S->associations()) { |
1600 | 0 | QualType T = Assoc.getType(); |
1601 | 0 | if (T.isNull()) |
1602 | 0 | ID.AddPointer(nullptr); |
1603 | 0 | else |
1604 | 0 | VisitType(T); |
1605 | 0 | VisitExpr(Assoc.getAssociationExpr()); |
1606 | 0 | } |
1607 | 0 | } |
1608 | | |
1609 | 0 | void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) { |
1610 | 0 | VisitExpr(S); |
1611 | 0 | for (PseudoObjectExpr::const_semantics_iterator |
1612 | 0 | i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i) |
1613 | | // Normally, we would not profile the source expressions of OVEs. |
1614 | 0 | if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i)) |
1615 | 0 | Visit(OVE->getSourceExpr()); |
1616 | 0 | } |
1617 | | |
1618 | 0 | void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) { |
1619 | 0 | VisitExpr(S); |
1620 | 0 | ID.AddInteger(S->getOp()); |
1621 | 0 | } |
1622 | | |
1623 | | void StmtProfiler::VisitConceptSpecializationExpr( |
1624 | 0 | const ConceptSpecializationExpr *S) { |
1625 | 0 | VisitExpr(S); |
1626 | 0 | VisitDecl(S->getNamedConcept()); |
1627 | 0 | for (const TemplateArgument &Arg : S->getTemplateArguments()) |
1628 | 0 | VisitTemplateArgument(Arg); |
1629 | 0 | } |
1630 | | |
1631 | 0 | void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) { |
1632 | 0 | VisitExpr(S); |
1633 | 0 | ID.AddInteger(S->getLocalParameters().size()); |
1634 | 0 | for (ParmVarDecl *LocalParam : S->getLocalParameters()) |
1635 | 0 | VisitDecl(LocalParam); |
1636 | 0 | ID.AddInteger(S->getRequirements().size()); |
1637 | 0 | for (concepts::Requirement *Req : S->getRequirements()) { |
1638 | 0 | if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) { |
1639 | 0 | ID.AddInteger(concepts::Requirement::RK_Type); |
1640 | 0 | ID.AddBoolean(TypeReq->isSubstitutionFailure()); |
1641 | 0 | if (!TypeReq->isSubstitutionFailure()) |
1642 | 0 | VisitType(TypeReq->getType()->getType()); |
1643 | 0 | } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) { |
1644 | 0 | ID.AddInteger(concepts::Requirement::RK_Compound); |
1645 | 0 | ID.AddBoolean(ExprReq->isExprSubstitutionFailure()); |
1646 | 0 | if (!ExprReq->isExprSubstitutionFailure()) |
1647 | 0 | Visit(ExprReq->getExpr()); |
1648 | | // C++2a [expr.prim.req.compound]p1 Example: |
1649 | | // [...] The compound-requirement in C1 requires that x++ is a valid |
1650 | | // expression. It is equivalent to the simple-requirement x++; [...] |
1651 | | // We therefore do not profile isSimple() here. |
1652 | 0 | ID.AddBoolean(ExprReq->getNoexceptLoc().isValid()); |
1653 | 0 | const concepts::ExprRequirement::ReturnTypeRequirement &RetReq = |
1654 | 0 | ExprReq->getReturnTypeRequirement(); |
1655 | 0 | if (RetReq.isEmpty()) { |
1656 | 0 | ID.AddInteger(0); |
1657 | 0 | } else if (RetReq.isTypeConstraint()) { |
1658 | 0 | ID.AddInteger(1); |
1659 | 0 | Visit(RetReq.getTypeConstraint()->getImmediatelyDeclaredConstraint()); |
1660 | 0 | } else { |
1661 | 0 | assert(RetReq.isSubstitutionFailure()); |
1662 | 0 | ID.AddInteger(2); |
1663 | 0 | } |
1664 | 0 | } else { |
1665 | 0 | ID.AddInteger(concepts::Requirement::RK_Nested); |
1666 | 0 | auto *NestedReq = cast<concepts::NestedRequirement>(Req); |
1667 | 0 | ID.AddBoolean(NestedReq->hasInvalidConstraint()); |
1668 | 0 | if (!NestedReq->hasInvalidConstraint()) |
1669 | 0 | Visit(NestedReq->getConstraintExpr()); |
1670 | 0 | } |
1671 | 0 | } |
1672 | 0 | } |
1673 | | |
1674 | | static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, |
1675 | | UnaryOperatorKind &UnaryOp, |
1676 | | BinaryOperatorKind &BinaryOp, |
1677 | 0 | unsigned &NumArgs) { |
1678 | 0 | switch (S->getOperator()) { |
1679 | 0 | case OO_None: |
1680 | 0 | case OO_New: |
1681 | 0 | case OO_Delete: |
1682 | 0 | case OO_Array_New: |
1683 | 0 | case OO_Array_Delete: |
1684 | 0 | case OO_Arrow: |
1685 | 0 | case OO_Conditional: |
1686 | 0 | case NUM_OVERLOADED_OPERATORS: |
1687 | 0 | llvm_unreachable("Invalid operator call kind"); |
1688 | |
|
1689 | 0 | case OO_Plus: |
1690 | 0 | if (NumArgs == 1) { |
1691 | 0 | UnaryOp = UO_Plus; |
1692 | 0 | return Stmt::UnaryOperatorClass; |
1693 | 0 | } |
1694 | | |
1695 | 0 | BinaryOp = BO_Add; |
1696 | 0 | return Stmt::BinaryOperatorClass; |
1697 | | |
1698 | 0 | case OO_Minus: |
1699 | 0 | if (NumArgs == 1) { |
1700 | 0 | UnaryOp = UO_Minus; |
1701 | 0 | return Stmt::UnaryOperatorClass; |
1702 | 0 | } |
1703 | | |
1704 | 0 | BinaryOp = BO_Sub; |
1705 | 0 | return Stmt::BinaryOperatorClass; |
1706 | | |
1707 | 0 | case OO_Star: |
1708 | 0 | if (NumArgs == 1) { |
1709 | 0 | UnaryOp = UO_Deref; |
1710 | 0 | return Stmt::UnaryOperatorClass; |
1711 | 0 | } |
1712 | | |
1713 | 0 | BinaryOp = BO_Mul; |
1714 | 0 | return Stmt::BinaryOperatorClass; |
1715 | | |
1716 | 0 | case OO_Slash: |
1717 | 0 | BinaryOp = BO_Div; |
1718 | 0 | return Stmt::BinaryOperatorClass; |
1719 | | |
1720 | 0 | case OO_Percent: |
1721 | 0 | BinaryOp = BO_Rem; |
1722 | 0 | return Stmt::BinaryOperatorClass; |
1723 | | |
1724 | 0 | case OO_Caret: |
1725 | 0 | BinaryOp = BO_Xor; |
1726 | 0 | return Stmt::BinaryOperatorClass; |
1727 | | |
1728 | 0 | case OO_Amp: |
1729 | 0 | if (NumArgs == 1) { |
1730 | 0 | UnaryOp = UO_AddrOf; |
1731 | 0 | return Stmt::UnaryOperatorClass; |
1732 | 0 | } |
1733 | | |
1734 | 0 | BinaryOp = BO_And; |
1735 | 0 | return Stmt::BinaryOperatorClass; |
1736 | | |
1737 | 0 | case OO_Pipe: |
1738 | 0 | BinaryOp = BO_Or; |
1739 | 0 | return Stmt::BinaryOperatorClass; |
1740 | | |
1741 | 0 | case OO_Tilde: |
1742 | 0 | UnaryOp = UO_Not; |
1743 | 0 | return Stmt::UnaryOperatorClass; |
1744 | | |
1745 | 0 | case OO_Exclaim: |
1746 | 0 | UnaryOp = UO_LNot; |
1747 | 0 | return Stmt::UnaryOperatorClass; |
1748 | | |
1749 | 0 | case OO_Equal: |
1750 | 0 | BinaryOp = BO_Assign; |
1751 | 0 | return Stmt::BinaryOperatorClass; |
1752 | | |
1753 | 0 | case OO_Less: |
1754 | 0 | BinaryOp = BO_LT; |
1755 | 0 | return Stmt::BinaryOperatorClass; |
1756 | | |
1757 | 0 | case OO_Greater: |
1758 | 0 | BinaryOp = BO_GT; |
1759 | 0 | return Stmt::BinaryOperatorClass; |
1760 | | |
1761 | 0 | case OO_PlusEqual: |
1762 | 0 | BinaryOp = BO_AddAssign; |
1763 | 0 | return Stmt::CompoundAssignOperatorClass; |
1764 | | |
1765 | 0 | case OO_MinusEqual: |
1766 | 0 | BinaryOp = BO_SubAssign; |
1767 | 0 | return Stmt::CompoundAssignOperatorClass; |
1768 | | |
1769 | 0 | case OO_StarEqual: |
1770 | 0 | BinaryOp = BO_MulAssign; |
1771 | 0 | return Stmt::CompoundAssignOperatorClass; |
1772 | | |
1773 | 0 | case OO_SlashEqual: |
1774 | 0 | BinaryOp = BO_DivAssign; |
1775 | 0 | return Stmt::CompoundAssignOperatorClass; |
1776 | | |
1777 | 0 | case OO_PercentEqual: |
1778 | 0 | BinaryOp = BO_RemAssign; |
1779 | 0 | return Stmt::CompoundAssignOperatorClass; |
1780 | | |
1781 | 0 | case OO_CaretEqual: |
1782 | 0 | BinaryOp = BO_XorAssign; |
1783 | 0 | return Stmt::CompoundAssignOperatorClass; |
1784 | | |
1785 | 0 | case OO_AmpEqual: |
1786 | 0 | BinaryOp = BO_AndAssign; |
1787 | 0 | return Stmt::CompoundAssignOperatorClass; |
1788 | | |
1789 | 0 | case OO_PipeEqual: |
1790 | 0 | BinaryOp = BO_OrAssign; |
1791 | 0 | return Stmt::CompoundAssignOperatorClass; |
1792 | | |
1793 | 0 | case OO_LessLess: |
1794 | 0 | BinaryOp = BO_Shl; |
1795 | 0 | return Stmt::BinaryOperatorClass; |
1796 | | |
1797 | 0 | case OO_GreaterGreater: |
1798 | 0 | BinaryOp = BO_Shr; |
1799 | 0 | return Stmt::BinaryOperatorClass; |
1800 | | |
1801 | 0 | case OO_LessLessEqual: |
1802 | 0 | BinaryOp = BO_ShlAssign; |
1803 | 0 | return Stmt::CompoundAssignOperatorClass; |
1804 | | |
1805 | 0 | case OO_GreaterGreaterEqual: |
1806 | 0 | BinaryOp = BO_ShrAssign; |
1807 | 0 | return Stmt::CompoundAssignOperatorClass; |
1808 | | |
1809 | 0 | case OO_EqualEqual: |
1810 | 0 | BinaryOp = BO_EQ; |
1811 | 0 | return Stmt::BinaryOperatorClass; |
1812 | | |
1813 | 0 | case OO_ExclaimEqual: |
1814 | 0 | BinaryOp = BO_NE; |
1815 | 0 | return Stmt::BinaryOperatorClass; |
1816 | | |
1817 | 0 | case OO_LessEqual: |
1818 | 0 | BinaryOp = BO_LE; |
1819 | 0 | return Stmt::BinaryOperatorClass; |
1820 | | |
1821 | 0 | case OO_GreaterEqual: |
1822 | 0 | BinaryOp = BO_GE; |
1823 | 0 | return Stmt::BinaryOperatorClass; |
1824 | | |
1825 | 0 | case OO_Spaceship: |
1826 | 0 | BinaryOp = BO_Cmp; |
1827 | 0 | return Stmt::BinaryOperatorClass; |
1828 | | |
1829 | 0 | case OO_AmpAmp: |
1830 | 0 | BinaryOp = BO_LAnd; |
1831 | 0 | return Stmt::BinaryOperatorClass; |
1832 | | |
1833 | 0 | case OO_PipePipe: |
1834 | 0 | BinaryOp = BO_LOr; |
1835 | 0 | return Stmt::BinaryOperatorClass; |
1836 | | |
1837 | 0 | case OO_PlusPlus: |
1838 | 0 | UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc; |
1839 | 0 | NumArgs = 1; |
1840 | 0 | return Stmt::UnaryOperatorClass; |
1841 | | |
1842 | 0 | case OO_MinusMinus: |
1843 | 0 | UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec; |
1844 | 0 | NumArgs = 1; |
1845 | 0 | return Stmt::UnaryOperatorClass; |
1846 | | |
1847 | 0 | case OO_Comma: |
1848 | 0 | BinaryOp = BO_Comma; |
1849 | 0 | return Stmt::BinaryOperatorClass; |
1850 | | |
1851 | 0 | case OO_ArrowStar: |
1852 | 0 | BinaryOp = BO_PtrMemI; |
1853 | 0 | return Stmt::BinaryOperatorClass; |
1854 | | |
1855 | 0 | case OO_Subscript: |
1856 | 0 | return Stmt::ArraySubscriptExprClass; |
1857 | | |
1858 | 0 | case OO_Call: |
1859 | 0 | return Stmt::CallExprClass; |
1860 | | |
1861 | 0 | case OO_Coawait: |
1862 | 0 | UnaryOp = UO_Coawait; |
1863 | 0 | return Stmt::UnaryOperatorClass; |
1864 | 0 | } |
1865 | | |
1866 | 0 | llvm_unreachable("Invalid overloaded operator expression"); |
1867 | 0 | } |
1868 | | |
1869 | | #if defined(_MSC_VER) && !defined(__clang__) |
1870 | | #if _MSC_VER == 1911 |
1871 | | // Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html |
1872 | | // MSVC 2017 update 3 miscompiles this function, and a clang built with it |
1873 | | // will crash in stage 2 of a bootstrap build. |
1874 | | #pragma optimize("", off) |
1875 | | #endif |
1876 | | #endif |
1877 | | |
1878 | 0 | void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) { |
1879 | 0 | if (S->isTypeDependent()) { |
1880 | | // Type-dependent operator calls are profiled like their underlying |
1881 | | // syntactic operator. |
1882 | | // |
1883 | | // An operator call to operator-> is always implicit, so just skip it. The |
1884 | | // enclosing MemberExpr will profile the actual member access. |
1885 | 0 | if (S->getOperator() == OO_Arrow) |
1886 | 0 | return Visit(S->getArg(0)); |
1887 | | |
1888 | 0 | UnaryOperatorKind UnaryOp = UO_Extension; |
1889 | 0 | BinaryOperatorKind BinaryOp = BO_Comma; |
1890 | 0 | unsigned NumArgs = S->getNumArgs(); |
1891 | 0 | Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp, NumArgs); |
1892 | |
|
1893 | 0 | ID.AddInteger(SC); |
1894 | 0 | for (unsigned I = 0; I != NumArgs; ++I) |
1895 | 0 | Visit(S->getArg(I)); |
1896 | 0 | if (SC == Stmt::UnaryOperatorClass) |
1897 | 0 | ID.AddInteger(UnaryOp); |
1898 | 0 | else if (SC == Stmt::BinaryOperatorClass || |
1899 | 0 | SC == Stmt::CompoundAssignOperatorClass) |
1900 | 0 | ID.AddInteger(BinaryOp); |
1901 | 0 | else |
1902 | 0 | assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass); |
1903 | | |
1904 | 0 | return; |
1905 | 0 | } |
1906 | | |
1907 | 0 | VisitCallExpr(S); |
1908 | 0 | ID.AddInteger(S->getOperator()); |
1909 | 0 | } |
1910 | | |
1911 | | void StmtProfiler::VisitCXXRewrittenBinaryOperator( |
1912 | 0 | const CXXRewrittenBinaryOperator *S) { |
1913 | | // If a rewritten operator were ever to be type-dependent, we should profile |
1914 | | // it following its syntactic operator. |
1915 | 0 | assert(!S->isTypeDependent() && |
1916 | 0 | "resolved rewritten operator should never be type-dependent"); |
1917 | 0 | ID.AddBoolean(S->isReversed()); |
1918 | 0 | VisitExpr(S->getSemanticForm()); |
1919 | 0 | } |
1920 | | |
1921 | | #if defined(_MSC_VER) && !defined(__clang__) |
1922 | | #if _MSC_VER == 1911 |
1923 | | #pragma optimize("", on) |
1924 | | #endif |
1925 | | #endif |
1926 | | |
1927 | 0 | void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { |
1928 | 0 | VisitCallExpr(S); |
1929 | 0 | } |
1930 | | |
1931 | 0 | void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) { |
1932 | 0 | VisitCallExpr(S); |
1933 | 0 | } |
1934 | | |
1935 | 0 | void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) { |
1936 | 0 | VisitExpr(S); |
1937 | 0 | } |
1938 | | |
1939 | 0 | void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) { |
1940 | 0 | VisitExplicitCastExpr(S); |
1941 | 0 | } |
1942 | | |
1943 | 0 | void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) { |
1944 | 0 | VisitCXXNamedCastExpr(S); |
1945 | 0 | } |
1946 | | |
1947 | 0 | void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) { |
1948 | 0 | VisitCXXNamedCastExpr(S); |
1949 | 0 | } |
1950 | | |
1951 | | void |
1952 | 0 | StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) { |
1953 | 0 | VisitCXXNamedCastExpr(S); |
1954 | 0 | } |
1955 | | |
1956 | 0 | void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) { |
1957 | 0 | VisitCXXNamedCastExpr(S); |
1958 | 0 | } |
1959 | | |
1960 | 0 | void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) { |
1961 | 0 | VisitExpr(S); |
1962 | 0 | VisitType(S->getTypeInfoAsWritten()->getType()); |
1963 | 0 | } |
1964 | | |
1965 | 0 | void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) { |
1966 | 0 | VisitCXXNamedCastExpr(S); |
1967 | 0 | } |
1968 | | |
1969 | 0 | void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) { |
1970 | 0 | VisitCallExpr(S); |
1971 | 0 | } |
1972 | | |
1973 | 0 | void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { |
1974 | 0 | VisitExpr(S); |
1975 | 0 | ID.AddBoolean(S->getValue()); |
1976 | 0 | } |
1977 | | |
1978 | 0 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) { |
1979 | 0 | VisitExpr(S); |
1980 | 0 | } |
1981 | | |
1982 | | void StmtProfiler::VisitCXXStdInitializerListExpr( |
1983 | 0 | const CXXStdInitializerListExpr *S) { |
1984 | 0 | VisitExpr(S); |
1985 | 0 | } |
1986 | | |
1987 | 0 | void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) { |
1988 | 0 | VisitExpr(S); |
1989 | 0 | if (S->isTypeOperand()) |
1990 | 0 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
1991 | 0 | } |
1992 | | |
1993 | 0 | void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) { |
1994 | 0 | VisitExpr(S); |
1995 | 0 | if (S->isTypeOperand()) |
1996 | 0 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
1997 | 0 | } |
1998 | | |
1999 | 0 | void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) { |
2000 | 0 | VisitExpr(S); |
2001 | 0 | VisitDecl(S->getPropertyDecl()); |
2002 | 0 | } |
2003 | | |
2004 | | void StmtProfiler::VisitMSPropertySubscriptExpr( |
2005 | 0 | const MSPropertySubscriptExpr *S) { |
2006 | 0 | VisitExpr(S); |
2007 | 0 | } |
2008 | | |
2009 | 0 | void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { |
2010 | 0 | VisitExpr(S); |
2011 | 0 | ID.AddBoolean(S->isImplicit()); |
2012 | 0 | } |
2013 | | |
2014 | 0 | void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) { |
2015 | 0 | VisitExpr(S); |
2016 | 0 | } |
2017 | | |
2018 | 0 | void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) { |
2019 | 0 | VisitExpr(S); |
2020 | 0 | VisitDecl(S->getParam()); |
2021 | 0 | } |
2022 | | |
2023 | 0 | void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) { |
2024 | 0 | VisitExpr(S); |
2025 | 0 | VisitDecl(S->getField()); |
2026 | 0 | } |
2027 | | |
2028 | 0 | void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { |
2029 | 0 | VisitExpr(S); |
2030 | 0 | VisitDecl( |
2031 | 0 | const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
2032 | 0 | } |
2033 | | |
2034 | 0 | void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) { |
2035 | 0 | VisitExpr(S); |
2036 | 0 | VisitDecl(S->getConstructor()); |
2037 | 0 | ID.AddBoolean(S->isElidable()); |
2038 | 0 | } |
2039 | | |
2040 | | void StmtProfiler::VisitCXXInheritedCtorInitExpr( |
2041 | 0 | const CXXInheritedCtorInitExpr *S) { |
2042 | 0 | VisitExpr(S); |
2043 | 0 | VisitDecl(S->getConstructor()); |
2044 | 0 | } |
2045 | | |
2046 | 0 | void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { |
2047 | 0 | VisitExplicitCastExpr(S); |
2048 | 0 | } |
2049 | | |
2050 | | void |
2051 | 0 | StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { |
2052 | 0 | VisitCXXConstructExpr(S); |
2053 | 0 | } |
2054 | | |
2055 | | void |
2056 | 0 | StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) { |
2057 | 0 | if (!ProfileLambdaExpr) { |
2058 | | // Do not recursively visit the children of this expression. Profiling the |
2059 | | // body would result in unnecessary work, and is not safe to do during |
2060 | | // deserialization. |
2061 | 0 | VisitStmtNoChildren(S); |
2062 | | |
2063 | | // C++20 [temp.over.link]p5: |
2064 | | // Two lambda-expressions are never considered equivalent. |
2065 | 0 | VisitDecl(S->getLambdaClass()); |
2066 | |
|
2067 | 0 | return; |
2068 | 0 | } |
2069 | | |
2070 | 0 | CXXRecordDecl *Lambda = S->getLambdaClass(); |
2071 | 0 | ID.AddInteger(Lambda->getODRHash()); |
2072 | |
|
2073 | 0 | for (const auto &Capture : Lambda->captures()) { |
2074 | 0 | ID.AddInteger(Capture.getCaptureKind()); |
2075 | 0 | if (Capture.capturesVariable()) |
2076 | 0 | VisitDecl(Capture.getCapturedVar()); |
2077 | 0 | } |
2078 | 0 | } |
2079 | | |
2080 | | void |
2081 | 0 | StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) { |
2082 | 0 | VisitExpr(S); |
2083 | 0 | } |
2084 | | |
2085 | 0 | void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) { |
2086 | 0 | VisitExpr(S); |
2087 | 0 | ID.AddBoolean(S->isGlobalDelete()); |
2088 | 0 | ID.AddBoolean(S->isArrayForm()); |
2089 | 0 | VisitDecl(S->getOperatorDelete()); |
2090 | 0 | } |
2091 | | |
2092 | 0 | void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) { |
2093 | 0 | VisitExpr(S); |
2094 | 0 | VisitType(S->getAllocatedType()); |
2095 | 0 | VisitDecl(S->getOperatorNew()); |
2096 | 0 | VisitDecl(S->getOperatorDelete()); |
2097 | 0 | ID.AddBoolean(S->isArray()); |
2098 | 0 | ID.AddInteger(S->getNumPlacementArgs()); |
2099 | 0 | ID.AddBoolean(S->isGlobalNew()); |
2100 | 0 | ID.AddBoolean(S->isParenTypeId()); |
2101 | 0 | ID.AddInteger(llvm::to_underlying(S->getInitializationStyle())); |
2102 | 0 | } |
2103 | | |
2104 | | void |
2105 | 0 | StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { |
2106 | 0 | VisitExpr(S); |
2107 | 0 | ID.AddBoolean(S->isArrow()); |
2108 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
2109 | 0 | ID.AddBoolean(S->getScopeTypeInfo() != nullptr); |
2110 | 0 | if (S->getScopeTypeInfo()) |
2111 | 0 | VisitType(S->getScopeTypeInfo()->getType()); |
2112 | 0 | ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr); |
2113 | 0 | if (S->getDestroyedTypeInfo()) |
2114 | 0 | VisitType(S->getDestroyedType()); |
2115 | 0 | else |
2116 | 0 | VisitIdentifierInfo(S->getDestroyedTypeIdentifier()); |
2117 | 0 | } |
2118 | | |
2119 | 0 | void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { |
2120 | 0 | VisitExpr(S); |
2121 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
2122 | 0 | VisitName(S->getName(), /*TreatAsDecl*/ true); |
2123 | 0 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
2124 | 0 | if (S->hasExplicitTemplateArgs()) |
2125 | 0 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
2126 | 0 | } |
2127 | | |
2128 | | void |
2129 | 0 | StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) { |
2130 | 0 | VisitOverloadExpr(S); |
2131 | 0 | } |
2132 | | |
2133 | 0 | void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) { |
2134 | 0 | VisitExpr(S); |
2135 | 0 | ID.AddInteger(S->getTrait()); |
2136 | 0 | ID.AddInteger(S->getNumArgs()); |
2137 | 0 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
2138 | 0 | VisitType(S->getArg(I)->getType()); |
2139 | 0 | } |
2140 | | |
2141 | 0 | void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) { |
2142 | 0 | VisitExpr(S); |
2143 | 0 | ID.AddInteger(S->getTrait()); |
2144 | 0 | VisitType(S->getQueriedType()); |
2145 | 0 | } |
2146 | | |
2147 | 0 | void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) { |
2148 | 0 | VisitExpr(S); |
2149 | 0 | ID.AddInteger(S->getTrait()); |
2150 | 0 | VisitExpr(S->getQueriedExpression()); |
2151 | 0 | } |
2152 | | |
2153 | | void StmtProfiler::VisitDependentScopeDeclRefExpr( |
2154 | 0 | const DependentScopeDeclRefExpr *S) { |
2155 | 0 | VisitExpr(S); |
2156 | 0 | VisitName(S->getDeclName()); |
2157 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
2158 | 0 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
2159 | 0 | if (S->hasExplicitTemplateArgs()) |
2160 | 0 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
2161 | 0 | } |
2162 | | |
2163 | 0 | void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) { |
2164 | 0 | VisitExpr(S); |
2165 | 0 | } |
2166 | | |
2167 | | void StmtProfiler::VisitCXXUnresolvedConstructExpr( |
2168 | 0 | const CXXUnresolvedConstructExpr *S) { |
2169 | 0 | VisitExpr(S); |
2170 | 0 | VisitType(S->getTypeAsWritten()); |
2171 | 0 | ID.AddInteger(S->isListInitialization()); |
2172 | 0 | } |
2173 | | |
2174 | | void StmtProfiler::VisitCXXDependentScopeMemberExpr( |
2175 | 1 | const CXXDependentScopeMemberExpr *S) { |
2176 | 1 | ID.AddBoolean(S->isImplicitAccess()); |
2177 | 1 | if (!S->isImplicitAccess()) { |
2178 | 1 | VisitExpr(S); |
2179 | 1 | ID.AddBoolean(S->isArrow()); |
2180 | 1 | } |
2181 | 1 | VisitNestedNameSpecifier(S->getQualifier()); |
2182 | 1 | VisitName(S->getMember()); |
2183 | 1 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
2184 | 1 | if (S->hasExplicitTemplateArgs()) |
2185 | 0 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
2186 | 1 | } |
2187 | | |
2188 | 0 | void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) { |
2189 | 0 | ID.AddBoolean(S->isImplicitAccess()); |
2190 | 0 | if (!S->isImplicitAccess()) { |
2191 | 0 | VisitExpr(S); |
2192 | 0 | ID.AddBoolean(S->isArrow()); |
2193 | 0 | } |
2194 | 0 | VisitNestedNameSpecifier(S->getQualifier()); |
2195 | 0 | VisitName(S->getMemberName()); |
2196 | 0 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
2197 | 0 | if (S->hasExplicitTemplateArgs()) |
2198 | 0 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
2199 | 0 | } |
2200 | | |
2201 | 0 | void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) { |
2202 | 0 | VisitExpr(S); |
2203 | 0 | } |
2204 | | |
2205 | 0 | void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) { |
2206 | 0 | VisitExpr(S); |
2207 | 0 | } |
2208 | | |
2209 | 0 | void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) { |
2210 | 0 | VisitExpr(S); |
2211 | 0 | VisitDecl(S->getPack()); |
2212 | 0 | if (S->isPartiallySubstituted()) { |
2213 | 0 | auto Args = S->getPartialArguments(); |
2214 | 0 | ID.AddInteger(Args.size()); |
2215 | 0 | for (const auto &TA : Args) |
2216 | 0 | VisitTemplateArgument(TA); |
2217 | 0 | } else { |
2218 | 0 | ID.AddInteger(0); |
2219 | 0 | } |
2220 | 0 | } |
2221 | | |
2222 | | void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr( |
2223 | 0 | const SubstNonTypeTemplateParmPackExpr *S) { |
2224 | 0 | VisitExpr(S); |
2225 | 0 | VisitDecl(S->getParameterPack()); |
2226 | 0 | VisitTemplateArgument(S->getArgumentPack()); |
2227 | 0 | } |
2228 | | |
2229 | | void StmtProfiler::VisitSubstNonTypeTemplateParmExpr( |
2230 | 0 | const SubstNonTypeTemplateParmExpr *E) { |
2231 | | // Profile exactly as the replacement expression. |
2232 | 0 | Visit(E->getReplacement()); |
2233 | 0 | } |
2234 | | |
2235 | 0 | void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) { |
2236 | 0 | VisitExpr(S); |
2237 | 0 | VisitDecl(S->getParameterPack()); |
2238 | 0 | ID.AddInteger(S->getNumExpansions()); |
2239 | 0 | for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I) |
2240 | 0 | VisitDecl(*I); |
2241 | 0 | } |
2242 | | |
2243 | | void StmtProfiler::VisitMaterializeTemporaryExpr( |
2244 | 0 | const MaterializeTemporaryExpr *S) { |
2245 | 0 | VisitExpr(S); |
2246 | 0 | } |
2247 | | |
2248 | 0 | void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) { |
2249 | 0 | VisitExpr(S); |
2250 | 0 | ID.AddInteger(S->getOperator()); |
2251 | 0 | } |
2252 | | |
2253 | 0 | void StmtProfiler::VisitCXXParenListInitExpr(const CXXParenListInitExpr *S) { |
2254 | 0 | VisitExpr(S); |
2255 | 0 | } |
2256 | | |
2257 | 0 | void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) { |
2258 | 0 | VisitStmt(S); |
2259 | 0 | } |
2260 | | |
2261 | 0 | void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) { |
2262 | 0 | VisitStmt(S); |
2263 | 0 | } |
2264 | | |
2265 | 0 | void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) { |
2266 | 0 | VisitExpr(S); |
2267 | 0 | } |
2268 | | |
2269 | 0 | void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) { |
2270 | 0 | VisitExpr(S); |
2271 | 0 | } |
2272 | | |
2273 | 0 | void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) { |
2274 | 0 | VisitExpr(S); |
2275 | 0 | } |
2276 | | |
2277 | 0 | void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { |
2278 | 0 | VisitExpr(E); |
2279 | 0 | } |
2280 | | |
2281 | 0 | void StmtProfiler::VisitTypoExpr(const TypoExpr *E) { |
2282 | 0 | VisitExpr(E); |
2283 | 0 | } |
2284 | | |
2285 | 0 | void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) { |
2286 | 0 | VisitExpr(E); |
2287 | 0 | } |
2288 | | |
2289 | 50 | void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); } |
2290 | | |
2291 | 0 | void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) { |
2292 | 0 | VisitExpr(S); |
2293 | 0 | } |
2294 | | |
2295 | 0 | void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { |
2296 | 0 | VisitExpr(E); |
2297 | 0 | } |
2298 | | |
2299 | 0 | void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) { |
2300 | 0 | VisitExpr(E); |
2301 | 0 | } |
2302 | | |
2303 | 0 | void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) { |
2304 | 0 | VisitExpr(E); |
2305 | 0 | } |
2306 | | |
2307 | 0 | void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) { |
2308 | 0 | VisitExpr(S); |
2309 | 0 | VisitType(S->getEncodedType()); |
2310 | 0 | } |
2311 | | |
2312 | 0 | void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) { |
2313 | 0 | VisitExpr(S); |
2314 | 0 | VisitName(S->getSelector()); |
2315 | 0 | } |
2316 | | |
2317 | 0 | void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) { |
2318 | 0 | VisitExpr(S); |
2319 | 0 | VisitDecl(S->getProtocol()); |
2320 | 0 | } |
2321 | | |
2322 | 0 | void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) { |
2323 | 0 | VisitExpr(S); |
2324 | 0 | VisitDecl(S->getDecl()); |
2325 | 0 | ID.AddBoolean(S->isArrow()); |
2326 | 0 | ID.AddBoolean(S->isFreeIvar()); |
2327 | 0 | } |
2328 | | |
2329 | 0 | void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) { |
2330 | 0 | VisitExpr(S); |
2331 | 0 | if (S->isImplicitProperty()) { |
2332 | 0 | VisitDecl(S->getImplicitPropertyGetter()); |
2333 | 0 | VisitDecl(S->getImplicitPropertySetter()); |
2334 | 0 | } else { |
2335 | 0 | VisitDecl(S->getExplicitProperty()); |
2336 | 0 | } |
2337 | 0 | if (S->isSuperReceiver()) { |
2338 | 0 | ID.AddBoolean(S->isSuperReceiver()); |
2339 | 0 | VisitType(S->getSuperReceiverType()); |
2340 | 0 | } |
2341 | 0 | } |
2342 | | |
2343 | 0 | void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) { |
2344 | 0 | VisitExpr(S); |
2345 | 0 | VisitDecl(S->getAtIndexMethodDecl()); |
2346 | 0 | VisitDecl(S->setAtIndexMethodDecl()); |
2347 | 0 | } |
2348 | | |
2349 | 0 | void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) { |
2350 | 0 | VisitExpr(S); |
2351 | 0 | VisitName(S->getSelector()); |
2352 | 0 | VisitDecl(S->getMethodDecl()); |
2353 | 0 | } |
2354 | | |
2355 | 0 | void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) { |
2356 | 0 | VisitExpr(S); |
2357 | 0 | ID.AddBoolean(S->isArrow()); |
2358 | 0 | } |
2359 | | |
2360 | 0 | void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) { |
2361 | 0 | VisitExpr(S); |
2362 | 0 | ID.AddBoolean(S->getValue()); |
2363 | 0 | } |
2364 | | |
2365 | | void StmtProfiler::VisitObjCIndirectCopyRestoreExpr( |
2366 | 0 | const ObjCIndirectCopyRestoreExpr *S) { |
2367 | 0 | VisitExpr(S); |
2368 | 0 | ID.AddBoolean(S->shouldCopy()); |
2369 | 0 | } |
2370 | | |
2371 | 0 | void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) { |
2372 | 0 | VisitExplicitCastExpr(S); |
2373 | 0 | ID.AddBoolean(S->getBridgeKind()); |
2374 | 0 | } |
2375 | | |
2376 | | void StmtProfiler::VisitObjCAvailabilityCheckExpr( |
2377 | 0 | const ObjCAvailabilityCheckExpr *S) { |
2378 | 0 | VisitExpr(S); |
2379 | 0 | } |
2380 | | |
2381 | | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
2382 | 0 | unsigned NumArgs) { |
2383 | 0 | ID.AddInteger(NumArgs); |
2384 | 0 | for (unsigned I = 0; I != NumArgs; ++I) |
2385 | 0 | VisitTemplateArgument(Args[I].getArgument()); |
2386 | 0 | } |
2387 | | |
2388 | 0 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
2389 | | // Mostly repetitive with TemplateArgument::Profile! |
2390 | 0 | ID.AddInteger(Arg.getKind()); |
2391 | 0 | switch (Arg.getKind()) { |
2392 | 0 | case TemplateArgument::Null: |
2393 | 0 | break; |
2394 | | |
2395 | 0 | case TemplateArgument::Type: |
2396 | 0 | VisitType(Arg.getAsType()); |
2397 | 0 | break; |
2398 | | |
2399 | 0 | case TemplateArgument::Template: |
2400 | 0 | case TemplateArgument::TemplateExpansion: |
2401 | 0 | VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); |
2402 | 0 | break; |
2403 | | |
2404 | 0 | case TemplateArgument::Declaration: |
2405 | 0 | VisitType(Arg.getParamTypeForDecl()); |
2406 | | // FIXME: Do we need to recursively decompose template parameter objects? |
2407 | 0 | VisitDecl(Arg.getAsDecl()); |
2408 | 0 | break; |
2409 | | |
2410 | 0 | case TemplateArgument::NullPtr: |
2411 | 0 | VisitType(Arg.getNullPtrType()); |
2412 | 0 | break; |
2413 | | |
2414 | 0 | case TemplateArgument::Integral: |
2415 | 0 | VisitType(Arg.getIntegralType()); |
2416 | 0 | Arg.getAsIntegral().Profile(ID); |
2417 | 0 | break; |
2418 | | |
2419 | 0 | case TemplateArgument::Expression: |
2420 | 0 | Visit(Arg.getAsExpr()); |
2421 | 0 | break; |
2422 | | |
2423 | 0 | case TemplateArgument::Pack: |
2424 | 0 | for (const auto &P : Arg.pack_elements()) |
2425 | 0 | VisitTemplateArgument(P); |
2426 | 0 | break; |
2427 | 0 | } |
2428 | 0 | } |
2429 | | |
2430 | | void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
2431 | 51 | bool Canonical, bool ProfileLambdaExpr) const { |
2432 | 51 | StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr); |
2433 | 51 | Profiler.Visit(this); |
2434 | 51 | } |
2435 | | |
2436 | | void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID, |
2437 | 0 | class ODRHash &Hash) const { |
2438 | 0 | StmtProfilerWithoutPointers Profiler(ID, Hash); |
2439 | 0 | Profiler.Visit(this); |
2440 | 0 | } |