Coverage Report

Created: 2021-06-15 06:44

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