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