Coverage Report

Created: 2022-01-25 06:29

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