Coverage Report

Created: 2021-09-21 08:58

/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.21M
        : ID(ID), Canonical(Canonical) {}
36
37
6.21M
    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.84M
        : 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.61M
    void VisitDecl(const Decl *D) override {
90
2.61M
      ID.AddInteger(D ? 
D->getKind()2.60M
:
03.24k
);
91
92
2.61M
      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
575k
        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
114k
          VisitType(Parm->getType());
111
114k
          ID.AddInteger(Parm->getFunctionScopeDepth());
112
114k
          ID.AddInteger(Parm->getFunctionScopeIndex());
113
114k
          return;
114
114k
        }
115
116
460k
        if (const TemplateTypeParmDecl *TTP =
117
460k
                dyn_cast<TemplateTypeParmDecl>(D)) {
118
248k
          ID.AddInteger(TTP->getDepth());
119
248k
          ID.AddInteger(TTP->getIndex());
120
248k
          ID.AddBoolean(TTP->isParameterPack());
121
248k
          return;
122
248k
        }
123
124
212k
        if (const TemplateTemplateParmDecl *TTP =
125
212k
                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
212k
      }
132
133
554k
      ID.AddPointer(D ? 
D->getCanonicalDecl()550k
:
nullptr3.24k
);
134
554k
    }
135
136
3.10M
    void VisitType(QualType T) override {
137
3.10M
      if (Canonical && 
!T.isNull()2.96M
)
138
2.96M
        T = Context.getCanonicalType(T);
139
140
3.10M
      ID.AddPointer(T.getAsOpaquePtr());
141
3.10M
    }
142
143
4.30M
    void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override {
144
4.30M
      ID.AddPointer(Name.getAsOpaquePtr());
145
4.30M
    }
146
147
9
    void VisitIdentifierInfo(IdentifierInfo *II) override {
148
9
      ID.AddPointer(II);
149
9
    }
150
151
4.65M
    void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
152
4.65M
      if (Canonical)
153
3.03M
        NNS = Context.getCanonicalNestedNameSpecifier(NNS);
154
4.65M
      ID.AddPointer(NNS);
155
4.65M
    }
156
157
13.4k
    void VisitTemplateName(TemplateName Name) override {
158
13.4k
      if (Canonical)
159
13.4k
        Name = Context.getCanonicalTemplateName(Name);
160
161
13.4k
      Name.Profile(ID);
162
13.4k
    }
163
  };
164
165
  class StmtProfilerWithoutPointers : public StmtProfiler {
166
    ODRHash &Hash;
167
  public:
168
    StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
169
374k
        : StmtProfiler(ID, false), Hash(Hash) {}
170
171
  private:
172
3.16M
    void HandleStmtClass(Stmt::StmtClass SC) override {
173
3.16M
      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.1k
        ID.AddInteger(Stmt::DeclRefExprClass);
177
3.12M
      } else {
178
3.12M
        ID.AddInteger(SC);
179
3.12M
      }
180
3.16M
    }
181
182
209k
    void VisitType(QualType T) override {
183
209k
      Hash.AddQualType(T);
184
209k
    }
185
186
179k
    void VisitName(DeclarationName Name, bool TreatAsDecl) override {
187
179k
      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
30.8k
        ID.AddBoolean(true);
191
30.8k
      }
192
179k
      Hash.AddDeclarationName(Name, TreatAsDecl);
193
179k
    }
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
878k
    void VisitDecl(const Decl *D) override {
201
878k
      ID.AddBoolean(D);
202
878k
      if (D) {
203
843k
        Hash.AddDecl(D);
204
843k
      }
205
878k
    }
206
20
    void VisitTemplateName(TemplateName Name) override {
207
20
      Hash.AddTemplateName(Name);
208
20
    }
209
936k
    void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
210
936k
      ID.AddBoolean(NNS);
211
936k
      if (NNS) {
212
70.9k
        Hash.AddNestedNameSpecifier(NNS);
213
70.9k
      }
214
936k
    }
215
  };
216
}
217
218
17.3M
void StmtProfiler::VisitStmt(const Stmt *S) {
219
17.3M
  assert(S && "Requires non-null Stmt pointer");
220
221
0
  HandleStmtClass(S->getStmtClass());
222
223
17.3M
  for (const Stmt *SubStmt : S->children()) {
224
11.0M
    if (SubStmt)
225
11.0M
      Visit(SubStmt);
226
14.1k
    else
227
14.1k
      ID.AddInteger(0);
228
11.0M
  }
229
17.3M
}
230
231
68.1k
void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
232
68.1k
  VisitStmt(S);
233
68.1k
  for (const auto *D : S->decls())
234
70.7k
    VisitDecl(D);
235
68.1k
}
236
237
372
void StmtProfiler::VisitNullStmt(const NullStmt *S) {
238
372
  VisitStmt(S);
239
372
}
240
241
170k
void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
242
170k
  VisitStmt(S);
243
170k
}
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.6k
void StmtProfiler::VisitIfStmt(const IfStmt *S) {
264
29.6k
  VisitStmt(S);
265
29.6k
  VisitDecl(S->getConditionVariable());
266
29.6k
}
267
268
669
void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
269
669
  VisitStmt(S);
270
669
  VisitDecl(S->getConditionVariable());
271
669
}
272
273
2.38k
void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
274
2.38k
  VisitStmt(S);
275
2.38k
  VisitDecl(S->getConditionVariable());
276
2.38k
}
277
278
821
void StmtProfiler::VisitDoStmt(const DoStmt *S) {
279
821
  VisitStmt(S);
280
821
}
281
282
5.96k
void StmtProfiler::VisitForStmt(const ForStmt *S) {
283
5.96k
  VisitStmt(S);
284
5.96k
}
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.4k
void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
372
13.4k
  VisitStmt(S);
373
13.4k
}
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.4k
  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.64k
    const OMPClauseWithPreInit *C) {
426
8.64k
  if (auto *S = C->getPreInitStmt())
427
846
    Profiler->VisitStmt(S);
428
8.64k
}
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
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
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
247
void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
484
247
  if (C->getNumForLoops())
485
247
    Profiler->VisitStmt(C->getNumForLoops());
486
247
}
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
328
void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
525
328
  VistOMPClauseWithPreInit(C);
526
328
  if (auto *S = C->getChunkSize())
527
142
    Profiler->VisitStmt(S);
528
328
}
529
530
85
void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
531
85
  if (auto *Num = C->getNumForLoops())
532
26
    Profiler->VisitStmt(Num);
533
85
}
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
254
void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
548
549
64
void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
550
551
22
void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
552
553
28
void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
554
555
38
void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
556
557
42
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.3k
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
587
19.1k
  for (auto *E : Node->varlists()) {
588
19.1k
    if (E)
589
19.1k
      Profiler->VisitStmt(E);
590
19.1k
  }
591
12.3k
}
StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPAlignedClause const>(clang::OMPAlignedClause const*)
Line
Count
Source
586
138
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
587
142
  for (auto *E : Node->varlists()) {
588
142
    if (E)
589
142
      Profiler->VisitStmt(E);
590
142
  }
591
138
}
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.48k
  for (auto *E : Node->varlists()) {
588
7.48k
    if (E)
589
7.48k
      Profiler->VisitStmt(E);
590
7.48k
  }
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
4.09k
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
587
5.01k
  for (auto *E : Node->varlists()) {
588
5.01k
    if (E)
589
5.01k
      Profiler->VisitStmt(E);
590
5.01k
  }
591
4.09k
}
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.48k
  for (auto *E : C->private_copies()) {
605
7.48k
    if (E)
606
7.11k
      Profiler->VisitStmt(E);
607
7.48k
  }
608
7.48k
  for (auto *E : C->inits()) {
609
7.48k
    if (E)
610
7.11k
      Profiler->VisitStmt(E);
611
7.48k
  }
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
138
void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
748
138
  VisitOMPClauseList(C);
749
138
  if (C->getAlignment())
750
96
    Profiler->VisitStmt(C->getAlignment());
751
138
}
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
4.09k
void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
798
4.09k
  VisitOMPClauseList(C);
799
4.09k
}
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
348
void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
806
348
  VistOMPClauseWithPreInit(C);
807
348
  if (C->getNumTeams())
808
348
    Profiler->VisitStmt(C->getNumTeams());
809
348
}
810
void OMPClauseProfiler::VisitOMPThreadLimitClause(
811
246
    const OMPThreadLimitClause *C) {
812
246
  VistOMPClauseWithPreInit(C);
813
246
  if (C->getThreadLimit())
814
246
    Profiler->VisitStmt(C->getThreadLimit());
815
246
}
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
34
void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
832
34
  if (C->getHint())
833
34
    Profiler->VisitStmt(C->getHint());
834
34
}
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.4k
StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
885
14.4k
  VisitStmt(S);
886
14.4k
  OMPClauseProfiler P(this);
887
14.4k
  ArrayRef<OMPClause *> Clauses = S->clauses();
888
14.4k
  for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
889
33.3k
       I != E; 
++I18.8k
)
890
18.8k
    if (*I)
891
18.8k
      P.Visit(*I);
892
14.4k
}
893
894
0
void StmtProfiler::VisitOMPCanonicalLoop(const OMPCanonicalLoop *L) {
895
0
  VisitStmt(L);
896
0
}
897
898
4.02k
void StmtProfiler::VisitOMPLoopBasedDirective(const OMPLoopBasedDirective *S) {
899
4.02k
  VisitOMPExecutableDirective(S);
900
4.02k
}
901
902
4.01k
void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
903
4.01k
  VisitOMPLoopBasedDirective(S);
904
4.01k
}
905
906
0
void StmtProfiler::VisitOMPMetaDirective(const OMPMetaDirective *S) {
907
0
  VisitOMPExecutableDirective(S);
908
0
}
909
910
988
void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
911
988
  VisitOMPExecutableDirective(S);
912
988
}
913
914
153
void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
915
153
  VisitOMPLoopDirective(S);
916
153
}
917
918
7
void StmtProfiler::VisitOMPTileDirective(const OMPTileDirective *S) {
919
7
  VisitOMPLoopBasedDirective(S);
920
7
}
921
922
9
void StmtProfiler::VisitOMPUnrollDirective(const OMPUnrollDirective *S) {
923
9
  VisitOMPLoopBasedDirective(S);
924
9
}
925
926
243
void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
927
243
  VisitOMPLoopDirective(S);
928
243
}
929
930
93
void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
931
93
  VisitOMPLoopDirective(S);
932
93
}
933
934
28
void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
935
28
  VisitOMPExecutableDirective(S);
936
28
}
937
938
0
void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
939
0
  VisitOMPExecutableDirective(S);
940
0
}
941
942
11
void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
943
11
  VisitOMPExecutableDirective(S);
944
11
}
945
946
21
void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
947
21
  VisitOMPExecutableDirective(S);
948
21
}
949
950
82
void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
951
82
  VisitOMPExecutableDirective(S);
952
82
  VisitName(S->getDirectiveName().getName());
953
82
}
954
955
void
956
98
StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
957
98
  VisitOMPLoopDirective(S);
958
98
}
959
960
void StmtProfiler::VisitOMPParallelForSimdDirective(
961
114
    const OMPParallelForSimdDirective *S) {
962
114
  VisitOMPLoopDirective(S);
963
114
}
964
965
void StmtProfiler::VisitOMPParallelMasterDirective(
966
89
    const OMPParallelMasterDirective *S) {
967
89
  VisitOMPExecutableDirective(S);
968
89
}
969
970
void StmtProfiler::VisitOMPParallelSectionsDirective(
971
32
    const OMPParallelSectionsDirective *S) {
972
32
  VisitOMPExecutableDirective(S);
973
32
}
974
975
139
void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
976
139
  VisitOMPExecutableDirective(S);
977
139
}
978
979
10
void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
980
10
  VisitOMPExecutableDirective(S);
981
10
}
982
983
24
void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
984
24
  VisitOMPExecutableDirective(S);
985
24
}
986
987
10
void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
988
10
  VisitOMPExecutableDirective(S);
989
10
}
990
991
72
void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
992
72
  VisitOMPExecutableDirective(S);
993
72
  if (const Expr *E = S->getReductionRef())
994
40
    VisitStmt(E);
995
72
}
996
997
50
void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
998
50
  VisitOMPExecutableDirective(S);
999
50
}
1000
1001
28
void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1002
28
  VisitOMPExecutableDirective(S);
1003
28
}
1004
1005
0
void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1006
0
  VisitOMPExecutableDirective(S);
1007
0
}
1008
1009
0
void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1010
0
  VisitOMPExecutableDirective(S);
1011
0
}
1012
1013
676
void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1014
676
  VisitOMPExecutableDirective(S);
1015
676
}
1016
1017
5.08k
void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1018
5.08k
  VisitOMPExecutableDirective(S);
1019
5.08k
}
1020
1021
250
void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
1022
250
  VisitOMPExecutableDirective(S);
1023
250
}
1024
1025
void StmtProfiler::VisitOMPTargetEnterDataDirective(
1026
289
    const OMPTargetEnterDataDirective *S) {
1027
289
  VisitOMPExecutableDirective(S);
1028
289
}
1029
1030
void StmtProfiler::VisitOMPTargetExitDataDirective(
1031
277
    const OMPTargetExitDataDirective *S) {
1032
277
  VisitOMPExecutableDirective(S);
1033
277
}
1034
1035
void StmtProfiler::VisitOMPTargetParallelDirective(
1036
612
    const OMPTargetParallelDirective *S) {
1037
612
  VisitOMPExecutableDirective(S);
1038
612
}
1039
1040
void StmtProfiler::VisitOMPTargetParallelForDirective(
1041
429
    const OMPTargetParallelForDirective *S) {
1042
429
  VisitOMPExecutableDirective(S);
1043
429
}
1044
1045
5
void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1046
5
  VisitOMPExecutableDirective(S);
1047
5
}
1048
1049
void StmtProfiler::VisitOMPCancellationPointDirective(
1050
0
    const OMPCancellationPointDirective *S) {
1051
0
  VisitOMPExecutableDirective(S);
1052
0
}
1053
1054
0
void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1055
0
  VisitOMPExecutableDirective(S);
1056
0
}
1057
1058
26
void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1059
26
  VisitOMPLoopDirective(S);
1060
26
}
1061
1062
void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1063
28
    const OMPTaskLoopSimdDirective *S) {
1064
28
  VisitOMPLoopDirective(S);
1065
28
}
1066
1067
void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1068
22
    const OMPMasterTaskLoopDirective *S) {
1069
22
  VisitOMPLoopDirective(S);
1070
22
}
1071
1072
void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1073
28
    const OMPMasterTaskLoopSimdDirective *S) {
1074
28
  VisitOMPLoopDirective(S);
1075
28
}
1076
1077
void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1078
22
    const OMPParallelMasterTaskLoopDirective *S) {
1079
22
  VisitOMPLoopDirective(S);
1080
22
}
1081
1082
void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1083
28
    const OMPParallelMasterTaskLoopSimdDirective *S) {
1084
28
  VisitOMPLoopDirective(S);
1085
28
}
1086
1087
void StmtProfiler::VisitOMPDistributeDirective(
1088
20
    const OMPDistributeDirective *S) {
1089
20
  VisitOMPLoopDirective(S);
1090
20
}
1091
1092
void OMPClauseProfiler::VisitOMPDistScheduleClause(
1093
144
    const OMPDistScheduleClause *C) {
1094
144
  VistOMPClauseWithPreInit(C);
1095
144
  if (auto *S = C->getChunkSize())
1096
84
    Profiler->VisitStmt(S);
1097
144
}
1098
1099
358
void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1100
1101
void StmtProfiler::VisitOMPTargetUpdateDirective(
1102
404
    const OMPTargetUpdateDirective *S) {
1103
404
  VisitOMPExecutableDirective(S);
1104
404
}
1105
1106
void StmtProfiler::VisitOMPDistributeParallelForDirective(
1107
0
    const OMPDistributeParallelForDirective *S) {
1108
0
  VisitOMPLoopDirective(S);
1109
0
}
1110
1111
void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1112
4
    const OMPDistributeParallelForSimdDirective *S) {
1113
4
  VisitOMPLoopDirective(S);
1114
4
}
1115
1116
void StmtProfiler::VisitOMPDistributeSimdDirective(
1117
0
    const OMPDistributeSimdDirective *S) {
1118
0
  VisitOMPLoopDirective(S);
1119
0
}
1120
1121
void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1122
515
    const OMPTargetParallelForSimdDirective *S) {
1123
515
  VisitOMPLoopDirective(S);
1124
515
}
1125
1126
void StmtProfiler::VisitOMPTargetSimdDirective(
1127
487
    const OMPTargetSimdDirective *S) {
1128
487
  VisitOMPLoopDirective(S);
1129
487
}
1130
1131
void StmtProfiler::VisitOMPTeamsDistributeDirective(
1132
0
    const OMPTeamsDistributeDirective *S) {
1133
0
  VisitOMPLoopDirective(S);
1134
0
}
1135
1136
void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1137
0
    const OMPTeamsDistributeSimdDirective *S) {
1138
0
  VisitOMPLoopDirective(S);
1139
0
}
1140
1141
void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1142
0
    const OMPTeamsDistributeParallelForSimdDirective *S) {
1143
0
  VisitOMPLoopDirective(S);
1144
0
}
1145
1146
void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1147
0
    const OMPTeamsDistributeParallelForDirective *S) {
1148
0
  VisitOMPLoopDirective(S);
1149
0
}
1150
1151
void StmtProfiler::VisitOMPTargetTeamsDirective(
1152
723
    const OMPTargetTeamsDirective *S) {
1153
723
  VisitOMPExecutableDirective(S);
1154
723
}
1155
1156
void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1157
497
    const OMPTargetTeamsDistributeDirective *S) {
1158
497
  VisitOMPLoopDirective(S);
1159
497
}
1160
1161
void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1162
475
    const OMPTargetTeamsDistributeParallelForDirective *S) {
1163
475
  VisitOMPLoopDirective(S);
1164
475
}
1165
1166
void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1167
591
    const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1168
591
  VisitOMPLoopDirective(S);
1169
591
}
1170
1171
void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1172
569
    const OMPTargetTeamsDistributeSimdDirective *S) {
1173
569
  VisitOMPLoopDirective(S);
1174
569
}
1175
1176
24
void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1177
24
  VisitOMPExecutableDirective(S);
1178
24
}
1179
1180
20
void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1181
20
  VisitOMPExecutableDirective(S);
1182
20
}
1183
1184
24
void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1185
24
  VisitOMPExecutableDirective(S);
1186
24
}
1187
1188
16.8M
void StmtProfiler::VisitExpr(const Expr *S) {
1189
16.8M
  VisitStmt(S);
1190
16.8M
}
1191
1192
208k
void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1193
208k
  VisitExpr(S);
1194
208k
}
1195
1196
3.03M
void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1197
3.03M
  VisitExpr(S);
1198
3.03M
  if (!Canonical)
1199
1.01M
    VisitNestedNameSpecifier(S->getQualifier());
1200
3.03M
  VisitDecl(S->getDecl());
1201
3.03M
  if (!Canonical) {
1202
1.01M
    ID.AddBoolean(S->hasExplicitTemplateArgs());
1203
1.01M
    if (S->hasExplicitTemplateArgs())
1204
2.14k
      VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1205
1.01M
  }
1206
3.03M
}
1207
1208
void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1209
1
    const SYCLUniqueStableNameExpr *S) {
1210
1
  VisitExpr(S);
1211
1
  VisitType(S->getTypeSourceInfo()->getType());
1212
1
}
1213
1214
17
void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1215
17
  VisitExpr(S);
1216
17
  ID.AddInteger(S->getIdentKind());
1217
17
}
1218
1219
682k
void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1220
682k
  VisitExpr(S);
1221
682k
  S->getValue().Profile(ID);
1222
682k
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1223
682k
}
1224
1225
0
void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1226
0
  VisitExpr(S);
1227
0
  S->getValue().Profile(ID);
1228
0
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1229
0
}
1230
1231
21.0k
void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1232
21.0k
  VisitExpr(S);
1233
21.0k
  ID.AddInteger(S->getKind());
1234
21.0k
  ID.AddInteger(S->getValue());
1235
21.0k
}
1236
1237
1.98k
void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1238
1.98k
  VisitExpr(S);
1239
1.98k
  S->getValue().Profile(ID);
1240
1.98k
  ID.AddBoolean(S->isExact());
1241
1.98k
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1242
1.98k
}
1243
1244
6
void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1245
6
  VisitExpr(S);
1246
6
}
1247
1248
6.58k
void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1249
6.58k
  VisitExpr(S);
1250
6.58k
  ID.AddString(S->getBytes());
1251
6.58k
  ID.AddInteger(S->getKind());
1252
6.58k
}
1253
1254
724k
void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1255
724k
  VisitExpr(S);
1256
724k
}
1257
1258
9.03k
void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1259
9.03k
  VisitExpr(S);
1260
9.03k
}
1261
1262
731k
void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1263
731k
  VisitExpr(S);
1264
731k
  ID.AddInteger(S->getOpcode());
1265
731k
}
1266
1267
13
void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1268
13
  VisitType(S->getTypeSourceInfo()->getType());
1269
13
  unsigned n = S->getNumComponents();
1270
33
  for (unsigned i = 0; i < n; 
++i20
) {
1271
20
    const OffsetOfNode &ON = S->getComponent(i);
1272
20
    ID.AddInteger(ON.getKind());
1273
20
    switch (ON.getKind()) {
1274
6
    case OffsetOfNode::Array:
1275
      // Expressions handled below.
1276
6
      break;
1277
1278
7
    case OffsetOfNode::Field:
1279
7
      VisitDecl(ON.getField());
1280
7
      break;
1281
1282
7
    case OffsetOfNode::Identifier:
1283
7
      VisitIdentifierInfo(ON.getFieldName());
1284
7
      break;
1285
1286
0
    case OffsetOfNode::Base:
1287
      // These nodes are implicit, and therefore don't need profiling.
1288
0
      break;
1289
20
    }
1290
20
  }
1291
1292
13
  VisitExpr(S);
1293
13
}
1294
1295
void
1296
72.0k
StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1297
72.0k
  VisitExpr(S);
1298
72.0k
  ID.AddInteger(S->getKind());
1299
72.0k
  if (S->isArgumentType())
1300
70.6k
    VisitType(S->getArgumentType());
1301
72.0k
}
1302
1303
9.85k
void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1304
9.85k
  VisitExpr(S);
1305
9.85k
}
1306
1307
1
void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1308
1
  VisitExpr(S);
1309
1
}
1310
1311
591
void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) {
1312
591
  VisitExpr(S);
1313
591
}
1314
1315
0
void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1316
0
  VisitExpr(S);
1317
0
}
1318
1319
0
void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1320
0
  VisitExpr(S);
1321
0
  for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1322
0
    VisitDecl(S->getIteratorDecl(I));
1323
0
}
1324
1325
747k
void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1326
747k
  VisitExpr(S);
1327
747k
}
1328
1329
82.3k
void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1330
82.3k
  VisitExpr(S);
1331
82.3k
  VisitDecl(S->getMemberDecl());
1332
82.3k
  if (!Canonical)
1333
81.4k
    VisitNestedNameSpecifier(S->getQualifier());
1334
82.3k
  ID.AddBoolean(S->isArrow());
1335
82.3k
}
1336
1337
1.06k
void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1338
1.06k
  VisitExpr(S);
1339
1.06k
  ID.AddBoolean(S->isFileScope());
1340
1.06k
}
1341
1342
3.21M
void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1343
3.21M
  VisitExpr(S);
1344
3.21M
}
1345
1346
2.83M
void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1347
2.83M
  VisitCastExpr(S);
1348
2.83M
  ID.AddInteger(S->getValueKind());
1349
2.83M
}
1350
1351
372k
void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1352
372k
  VisitCastExpr(S);
1353
372k
  VisitType(S->getTypeAsWritten());
1354
372k
}
1355
1356
203k
void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1357
203k
  VisitExplicitCastExpr(S);
1358
203k
}
1359
1360
1.65M
void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1361
1.65M
  VisitExpr(S);
1362
1.65M
  ID.AddInteger(S->getOpcode());
1363
1.65M
}
1364
1365
void
1366
8.25k
StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1367
8.25k
  VisitBinaryOperator(S);
1368
8.25k
}
1369
1370
10.1k
void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1371
10.1k
  VisitExpr(S);
1372
10.1k
}
1373
1374
void StmtProfiler::VisitBinaryConditionalOperator(
1375
1
    const BinaryConditionalOperator *S) {
1376
1
  VisitExpr(S);
1377
1
}
1378
1379
5
void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1380
5
  VisitExpr(S);
1381
5
  VisitDecl(S->getLabel());
1382
5
}
1383
1384
770
void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1385
770
  VisitExpr(S);
1386
770
}
1387
1388
2.17k
void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1389
2.17k
  VisitExpr(S);
1390
2.17k
}
1391
1392
781
void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1393
781
  VisitExpr(S);
1394
781
}
1395
1396
1
void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1397
1
  VisitExpr(S);
1398
1
}
1399
1400
74
void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1401
74
  VisitExpr(S);
1402
74
}
1403
1404
2
void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1405
2
  VisitExpr(S);
1406
2
}
1407
1408
32.1k
void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1409
32.1k
  if (S->getSyntacticForm()) {
1410
3.35k
    VisitInitListExpr(S->getSyntacticForm());
1411
3.35k
    return;
1412
3.35k
  }
1413
1414
28.7k
  VisitExpr(S);
1415
28.7k
}
1416
1417
200
void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1418
200
  VisitExpr(S);
1419
200
  ID.AddBoolean(S->usesGNUSyntax());
1420
229
  for (const DesignatedInitExpr::Designator &D : S->designators()) {
1421
229
    if (D.isFieldDesignator()) {
1422
220
      ID.AddInteger(0);
1423
220
      VisitName(D.getFieldName());
1424
220
      continue;
1425
220
    }
1426
1427
9
    if (D.isArrayDesignator()) {
1428
8
      ID.AddInteger(1);
1429
8
    } else {
1430
1
      assert(D.isArrayRangeDesignator());
1431
0
      ID.AddInteger(2);
1432
1
    }
1433
0
    ID.AddInteger(D.getFirstExprIndex());
1434
9
  }
1435
200
}
1436
1437
// Seems that if VisitInitListExpr() only works on the syntactic form of an
1438
// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1439
void StmtProfiler::VisitDesignatedInitUpdateExpr(
1440
0
    const DesignatedInitUpdateExpr *S) {
1441
0
  llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1442
0
                   "initializer");
1443
0
}
1444
1445
4
void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1446
4
  VisitExpr(S);
1447
4
}
1448
1449
4
void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1450
4
  VisitExpr(S);
1451
4
}
1452
1453
0
void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1454
0
  llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1455
0
}
1456
1457
34
void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1458
34
  VisitExpr(S);
1459
34
}
1460
1461
60
void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1462
60
  VisitExpr(S);
1463
60
  VisitName(&S->getAccessor());
1464
60
}
1465
1466
57
void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1467
57
  VisitExpr(S);
1468
57
  VisitDecl(S->getBlockDecl());
1469
57
}
1470
1471
10
void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1472
10
  VisitExpr(S);
1473
10
  for (const GenericSelectionExpr::ConstAssociation Assoc :
1474
20
       S->associations()) {
1475
20
    QualType T = Assoc.getType();
1476
20
    if (T.isNull())
1477
3
      ID.AddPointer(nullptr);
1478
17
    else
1479
17
      VisitType(T);
1480
20
    VisitExpr(Assoc.getAssociationExpr());
1481
20
  }
1482
10
}
1483
1484
226
void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1485
226
  VisitExpr(S);
1486
226
  for (PseudoObjectExpr::const_semantics_iterator
1487
557
         i = S->semantics_begin(), e = S->semantics_end(); i != e; 
++i331
)
1488
    // Normally, we would not profile the source expressions of OVEs.
1489
331
    if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1490
105
      Visit(OVE->getSourceExpr());
1491
226
}
1492
1493
149
void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1494
149
  VisitExpr(S);
1495
149
  ID.AddInteger(S->getOp());
1496
149
}
1497
1498
void StmtProfiler::VisitConceptSpecializationExpr(
1499
176
                                           const ConceptSpecializationExpr *S) {
1500
176
  VisitExpr(S);
1501
176
  VisitDecl(S->getNamedConcept());
1502
176
  for (const TemplateArgument &Arg : S->getTemplateArguments())
1503
214
    VisitTemplateArgument(Arg);
1504
176
}
1505
1506
66
void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1507
66
  VisitExpr(S);
1508
66
  ID.AddInteger(S->getLocalParameters().size());
1509
66
  for (ParmVarDecl *LocalParam : S->getLocalParameters())
1510
17
    VisitDecl(LocalParam);
1511
66
  ID.AddInteger(S->getRequirements().size());
1512
78
  for (concepts::Requirement *Req : S->getRequirements()) {
1513
78
    if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1514
22
      ID.AddInteger(concepts::Requirement::RK_Type);
1515
22
      ID.AddBoolean(TypeReq->isSubstitutionFailure());
1516
22
      if (!TypeReq->isSubstitutionFailure())
1517
22
        VisitType(TypeReq->getType()->getType());
1518
56
    } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1519
32
      ID.AddInteger(concepts::Requirement::RK_Compound);
1520
32
      ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1521
32
      if (!ExprReq->isExprSubstitutionFailure())
1522
32
        Visit(ExprReq->getExpr());
1523
      // C++2a [expr.prim.req.compound]p1 Example:
1524
      //    [...] The compound-requirement in C1 requires that x++ is a valid
1525
      //    expression. It is equivalent to the simple-requirement x++; [...]
1526
      // We therefore do not profile isSimple() here.
1527
32
      ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1528
32
      const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1529
32
          ExprReq->getReturnTypeRequirement();
1530
32
      if (RetReq.isEmpty()) {
1531
18
        ID.AddInteger(0);
1532
18
      } else 
if (14
RetReq.isTypeConstraint()14
) {
1533
14
        ID.AddInteger(1);
1534
14
        Visit(RetReq.getTypeConstraint()->getImmediatelyDeclaredConstraint());
1535
14
      } else {
1536
0
        assert(RetReq.isSubstitutionFailure());
1537
0
        ID.AddInteger(2);
1538
0
      }
1539
32
    } else {
1540
24
      ID.AddInteger(concepts::Requirement::RK_Nested);
1541
24
      auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1542
24
      ID.AddBoolean(NestedReq->isSubstitutionFailure());
1543
24
      if (!NestedReq->isSubstitutionFailure())
1544
24
        Visit(NestedReq->getConstraintExpr());
1545
24
    }
1546
78
  }
1547
66
}
1548
1549
static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
1550
                                          UnaryOperatorKind &UnaryOp,
1551
107k
                                          BinaryOperatorKind &BinaryOp) {
1552
107k
  switch (S->getOperator()) {
1553
0
  case OO_None:
1554
0
  case OO_New:
1555
0
  case OO_Delete:
1556
0
  case OO_Array_New:
1557
0
  case OO_Array_Delete:
1558
0
  case OO_Arrow:
1559
0
  case OO_Conditional:
1560
0
  case NUM_OVERLOADED_OPERATORS:
1561
0
    llvm_unreachable("Invalid operator call kind");
1562
1563
11.6k
  case OO_Plus:
1564
11.6k
    if (S->getNumArgs() == 1) {
1565
24
      UnaryOp = UO_Plus;
1566
24
      return Stmt::UnaryOperatorClass;
1567
24
    }
1568
1569
11.6k
    BinaryOp = BO_Add;
1570
11.6k
    return Stmt::BinaryOperatorClass;
1571
1572
17.0k
  case OO_Minus:
1573
17.0k
    if (S->getNumArgs() == 1) {
1574
1.25k
      UnaryOp = UO_Minus;
1575
1.25k
      return Stmt::UnaryOperatorClass;
1576
1.25k
    }
1577
1578
15.7k
    BinaryOp = BO_Sub;
1579
15.7k
    return Stmt::BinaryOperatorClass;
1580
1581
12.2k
  case OO_Star:
1582
12.2k
    if (S->getNumArgs() == 1) {
1583
9.97k
      UnaryOp = UO_Deref;
1584
9.97k
      return Stmt::UnaryOperatorClass;
1585
9.97k
    }
1586
1587
2.26k
    BinaryOp = BO_Mul;
1588
2.26k
    return Stmt::BinaryOperatorClass;
1589
1590
1.52k
  case OO_Slash:
1591
1.52k
    BinaryOp = BO_Div;
1592
1.52k
    return Stmt::BinaryOperatorClass;
1593
1594
24
  case OO_Percent:
1595
24
    BinaryOp = BO_Rem;
1596
24
    return Stmt::BinaryOperatorClass;
1597
1598
448
  case OO_Caret:
1599
448
    BinaryOp = BO_Xor;
1600
448
    return Stmt::BinaryOperatorClass;
1601
1602
3.05k
  case OO_Amp:
1603
3.05k
    if (S->getNumArgs() == 1) {
1604
1.76k
      UnaryOp = UO_AddrOf;
1605
1.76k
      return Stmt::UnaryOperatorClass;
1606
1.76k
    }
1607
1608
1.28k
    BinaryOp = BO_And;
1609
1.28k
    return Stmt::BinaryOperatorClass;
1610
1611
1.29k
  case OO_Pipe:
1612
1.29k
    BinaryOp = BO_Or;
1613
1.29k
    return Stmt::BinaryOperatorClass;
1614
1615
646
  case OO_Tilde:
1616
646
    UnaryOp = UO_Not;
1617
646
    return Stmt::UnaryOperatorClass;
1618
1619
0
  case OO_Exclaim:
1620
0
    UnaryOp = UO_LNot;
1621
0
    return Stmt::UnaryOperatorClass;
1622
1623
0
  case OO_Equal:
1624
0
    BinaryOp = BO_Assign;
1625
0
    return Stmt::BinaryOperatorClass;
1626
1627
8.39k
  case OO_Less:
1628
8.39k
    BinaryOp = BO_LT;
1629
8.39k
    return Stmt::BinaryOperatorClass;
1630
1631
3.35k
  case OO_Greater:
1632
3.35k
    BinaryOp = BO_GT;
1633
3.35k
    return Stmt::BinaryOperatorClass;
1634
1635
0
  case OO_PlusEqual:
1636
0
    BinaryOp = BO_AddAssign;
1637
0
    return Stmt::CompoundAssignOperatorClass;
1638
1639
0
  case OO_MinusEqual:
1640
0
    BinaryOp = BO_SubAssign;
1641
0
    return Stmt::CompoundAssignOperatorClass;
1642
1643
0
  case OO_StarEqual:
1644
0
    BinaryOp = BO_MulAssign;
1645
0
    return Stmt::CompoundAssignOperatorClass;
1646
1647
0
  case OO_SlashEqual:
1648
0
    BinaryOp = BO_DivAssign;
1649
0
    return Stmt::CompoundAssignOperatorClass;
1650
1651
0
  case OO_PercentEqual:
1652
0
    BinaryOp = BO_RemAssign;
1653
0
    return Stmt::CompoundAssignOperatorClass;
1654
1655
118
  case OO_CaretEqual:
1656
118
    BinaryOp = BO_XorAssign;
1657
118
    return Stmt::CompoundAssignOperatorClass;
1658
1659
134
  case OO_AmpEqual:
1660
134
    BinaryOp = BO_AndAssign;
1661
134
    return Stmt::CompoundAssignOperatorClass;
1662
1663
190
  case OO_PipeEqual:
1664
190
    BinaryOp = BO_OrAssign;
1665
190
    return Stmt::CompoundAssignOperatorClass;
1666
1667
3.18k
  case OO_LessLess:
1668
3.18k
    BinaryOp = BO_Shl;
1669
3.18k
    return Stmt::BinaryOperatorClass;
1670
1671
2.03k
  case OO_GreaterGreater:
1672
2.03k
    BinaryOp = BO_Shr;
1673
2.03k
    return Stmt::BinaryOperatorClass;
1674
1675
18
  case OO_LessLessEqual:
1676
18
    BinaryOp = BO_ShlAssign;
1677
18
    return Stmt::CompoundAssignOperatorClass;
1678
1679
18
  case OO_GreaterGreaterEqual:
1680
18
    BinaryOp = BO_ShrAssign;
1681
18
    return Stmt::CompoundAssignOperatorClass;
1682
1683
22.2k
  case OO_EqualEqual:
1684
22.2k
    BinaryOp = BO_EQ;
1685
22.2k
    return Stmt::BinaryOperatorClass;
1686
1687
10.5k
  case OO_ExclaimEqual:
1688
10.5k
    BinaryOp = BO_NE;
1689
10.5k
    return Stmt::BinaryOperatorClass;
1690
1691
2.76k
  case OO_LessEqual:
1692
2.76k
    BinaryOp = BO_LE;
1693
2.76k
    return Stmt::BinaryOperatorClass;
1694
1695
1.15k
  case OO_GreaterEqual:
1696
1.15k
    BinaryOp = BO_GE;
1697
1.15k
    return Stmt::BinaryOperatorClass;
1698
1699
1
  case OO_Spaceship:
1700
1
    BinaryOp = BO_Cmp;
1701
1
    return Stmt::BinaryOperatorClass;
1702
1703
5.59k
  case OO_AmpAmp:
1704
5.59k
    BinaryOp = BO_LAnd;
1705
5.59k
    return Stmt::BinaryOperatorClass;
1706
1707
43
  case OO_PipePipe:
1708
43
    BinaryOp = BO_LOr;
1709
43
    return Stmt::BinaryOperatorClass;
1710
1711
0
  case OO_PlusPlus:
1712
0
    UnaryOp = S->getNumArgs() == 1? UO_PreInc
1713
0
                                  : UO_PostInc;
1714
0
    return Stmt::UnaryOperatorClass;
1715
1716
0
  case OO_MinusMinus:
1717
0
    UnaryOp = S->getNumArgs() == 1? UO_PreDec
1718
0
                                  : UO_PostDec;
1719
0
    return Stmt::UnaryOperatorClass;
1720
1721
0
  case OO_Comma:
1722
0
    BinaryOp = BO_Comma;
1723
0
    return Stmt::BinaryOperatorClass;
1724
1725
0
  case OO_ArrowStar:
1726
0
    BinaryOp = BO_PtrMemI;
1727
0
    return Stmt::BinaryOperatorClass;
1728
1729
0
  case OO_Subscript:
1730
0
    return Stmt::ArraySubscriptExprClass;
1731
1732
0
  case OO_Call:
1733
0
    return Stmt::CallExprClass;
1734
1735
2
  case OO_Coawait:
1736
2
    UnaryOp = UO_Coawait;
1737
2
    return Stmt::UnaryOperatorClass;
1738
107k
  }
1739
1740
0
  llvm_unreachable("Invalid overloaded operator expression");
1741
0
}
1742
1743
#if defined(_MSC_VER) && !defined(__clang__)
1744
#if _MSC_VER == 1911
1745
// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1746
// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1747
// will crash in stage 2 of a bootstrap build.
1748
#pragma optimize("", off)
1749
#endif
1750
#endif
1751
1752
111k
void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1753
111k
  if (S->isTypeDependent()) {
1754
    // Type-dependent operator calls are profiled like their underlying
1755
    // syntactic operator.
1756
    //
1757
    // An operator call to operator-> is always implicit, so just skip it. The
1758
    // enclosing MemberExpr will profile the actual member access.
1759
107k
    if (S->getOperator() == OO_Arrow)
1760
0
      return Visit(S->getArg(0));
1761
1762
107k
    UnaryOperatorKind UnaryOp = UO_Extension;
1763
107k
    BinaryOperatorKind BinaryOp = BO_Comma;
1764
107k
    Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
1765
1766
107k
    ID.AddInteger(SC);
1767
309k
    for (unsigned I = 0, N = S->getNumArgs(); I != N; 
++I201k
)
1768
201k
      Visit(S->getArg(I));
1769
107k
    if (SC == Stmt::UnaryOperatorClass)
1770
13.6k
      ID.AddInteger(UnaryOp);
1771
94.0k
    else if (SC == Stmt::BinaryOperatorClass ||
1772
94.0k
             
SC == Stmt::CompoundAssignOperatorClass478
)
1773
94.0k
      ID.AddInteger(BinaryOp);
1774
0
    else
1775
0
      assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1776
1777
0
    return;
1778
107k
  }
1779
1780
3.69k
  VisitCallExpr(S);
1781
3.69k
  ID.AddInteger(S->getOperator());
1782
3.69k
}
1783
1784
void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1785
3
    const CXXRewrittenBinaryOperator *S) {
1786
  // If a rewritten operator were ever to be type-dependent, we should profile
1787
  // it following its syntactic operator.
1788
3
  assert(!S->isTypeDependent() &&
1789
3
         "resolved rewritten operator should never be type-dependent");
1790
0
  ID.AddBoolean(S->isReversed());
1791
3
  VisitExpr(S->getSemanticForm());
1792
3
}
1793
1794
#if defined(_MSC_VER) && !defined(__clang__)
1795
#if _MSC_VER == 1911
1796
#pragma optimize("", on)
1797
#endif
1798
#endif
1799
1800
9.22k
void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1801
9.22k
  VisitCallExpr(S);
1802
9.22k
}
1803
1804
1
void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1805
1
  VisitCallExpr(S);
1806
1
}
1807
1808
0
void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1809
0
  VisitExpr(S);
1810
0
}
1811
1812
165k
void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1813
165k
  VisitExplicitCastExpr(S);
1814
165k
}
1815
1816
164k
void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1817
164k
  VisitCXXNamedCastExpr(S);
1818
164k
}
1819
1820
69
void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1821
69
  VisitCXXNamedCastExpr(S);
1822
69
}
1823
1824
void
1825
209
StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1826
209
  VisitCXXNamedCastExpr(S);
1827
209
}
1828
1829
659
void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1830
659
  VisitCXXNamedCastExpr(S);
1831
659
}
1832
1833
45
void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1834
45
  VisitExpr(S);
1835
45
  VisitType(S->getTypeInfoAsWritten()->getType());
1836
45
}
1837
1838
0
void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1839
0
  VisitCXXNamedCastExpr(S);
1840
0
}
1841
1842
7
void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1843
7
  VisitCallExpr(S);
1844
7
}
1845
1846
61.5k
void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1847
61.5k
  VisitExpr(S);
1848
61.5k
  ID.AddBoolean(S->getValue());
1849
61.5k
}
1850
1851
6.99k
void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1852
6.99k
  VisitExpr(S);
1853
6.99k
}
1854
1855
void StmtProfiler::VisitCXXStdInitializerListExpr(
1856
9
    const CXXStdInitializerListExpr *S) {
1857
9
  VisitExpr(S);
1858
9
}
1859
1860
104
void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1861
104
  VisitExpr(S);
1862
104
  if (S->isTypeOperand())
1863
101
    VisitType(S->getTypeOperandSourceInfo()->getType());
1864
104
}
1865
1866
6
void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1867
6
  VisitExpr(S);
1868
6
  if (S->isTypeOperand())
1869
2
    VisitType(S->getTypeOperandSourceInfo()->getType());
1870
6
}
1871
1872
26
void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1873
26
  VisitExpr(S);
1874
26
  VisitDecl(S->getPropertyDecl());
1875
26
}
1876
1877
void StmtProfiler::VisitMSPropertySubscriptExpr(
1878
44
    const MSPropertySubscriptExpr *S) {
1879
44
  VisitExpr(S);
1880
44
}
1881
1882
84.4k
void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1883
84.4k
  VisitExpr(S);
1884
84.4k
  ID.AddBoolean(S->isImplicit());
1885
84.4k
}
1886
1887
578
void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1888
578
  VisitExpr(S);
1889
578
}
1890
1891
1.49k
void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1892
1.49k
  VisitExpr(S);
1893
1.49k
  VisitDecl(S->getParam());
1894
1.49k
}
1895
1896
0
void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1897
0
  VisitExpr(S);
1898
0
  VisitDecl(S->getField());
1899
0
}
1900
1901
2.53k
void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
1902
2.53k
  VisitExpr(S);
1903
2.53k
  VisitDecl(
1904
2.53k
         const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1905
2.53k
}
1906
1907
10.5k
void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
1908
10.5k
  VisitExpr(S);
1909
10.5k
  VisitDecl(S->getConstructor());
1910
10.5k
  ID.AddBoolean(S->isElidable());
1911
10.5k
}
1912
1913
void StmtProfiler::VisitCXXInheritedCtorInitExpr(
1914
0
    const CXXInheritedCtorInitExpr *S) {
1915
0
  VisitExpr(S);
1916
0
  VisitDecl(S->getConstructor());
1917
0
}
1918
1919
3.35k
void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
1920
3.35k
  VisitExplicitCastExpr(S);
1921
3.35k
}
1922
1923
void
1924
985
StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
1925
985
  VisitCXXConstructExpr(S);
1926
985
}
1927
1928
void
1929
588
StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1930
588
  VisitExpr(S);
1931
588
  for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(),
1932
588
                                 CEnd = S->explicit_capture_end();
1933
652
       C != CEnd; 
++C64
) {
1934
64
    if (C->capturesVLAType())
1935
1
      continue;
1936
1937
63
    ID.AddInteger(C->getCaptureKind());
1938
63
    switch (C->getCaptureKind()) {
1939
2
    case LCK_StarThis:
1940
25
    case LCK_This:
1941
25
      break;
1942
6
    case LCK_ByRef:
1943
38
    case LCK_ByCopy:
1944
38
      VisitDecl(C->getCapturedVar());
1945
38
      ID.AddBoolean(C->isPackExpansion());
1946
38
      break;
1947
0
    case LCK_VLAType:
1948
0
      llvm_unreachable("VLA type in explicit captures.");
1949
63
    }
1950
63
  }
1951
  // Note: If we actually needed to be able to match lambda
1952
  // expressions, we would have to consider parameters and return type
1953
  // here, among other things.
1954
588
  VisitStmt(S->getBody());
1955
588
}
1956
1957
void
1958
735
StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
1959
735
  VisitExpr(S);
1960
735
}
1961
1962
3.44k
void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
1963
3.44k
  VisitExpr(S);
1964
3.44k
  ID.AddBoolean(S->isGlobalDelete());
1965
3.44k
  ID.AddBoolean(S->isArrayForm());
1966
3.44k
  VisitDecl(S->getOperatorDelete());
1967
3.44k
}
1968
1969
1.30k
void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
1970
1.30k
  VisitExpr(S);
1971
1.30k
  VisitType(S->getAllocatedType());
1972
1.30k
  VisitDecl(S->getOperatorNew());
1973
1.30k
  VisitDecl(S->getOperatorDelete());
1974
1.30k
  ID.AddBoolean(S->isArray());
1975
1.30k
  ID.AddInteger(S->getNumPlacementArgs());
1976
1.30k
  ID.AddBoolean(S->isGlobalNew());
1977
1.30k
  ID.AddBoolean(S->isParenTypeId());
1978
1.30k
  ID.AddInteger(S->getInitializationStyle());
1979
1.30k
}
1980
1981
void
1982
5.12k
StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
1983
5.12k
  VisitExpr(S);
1984
5.12k
  ID.AddBoolean(S->isArrow());
1985
5.12k
  VisitNestedNameSpecifier(S->getQualifier());
1986
5.12k
  ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
1987
5.12k
  if (S->getScopeTypeInfo())
1988
2
    VisitType(S->getScopeTypeInfo()->getType());
1989
5.12k
  ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
1990
5.12k
  if (S->getDestroyedTypeInfo())
1991
5.12k
    VisitType(S->getDestroyedType());
1992
2
  else
1993
2
    VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
1994
5.12k
}
1995
1996
317k
void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
1997
317k
  VisitExpr(S);
1998
317k
  VisitNestedNameSpecifier(S->getQualifier());
1999
317k
  VisitName(S->getName(), /*TreatAsDecl*/ true);
2000
317k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2001
317k
  if (S->hasExplicitTemplateArgs())
2002
259k
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2003
317k
}
2004
2005
void
2006
317k
StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
2007
317k
  VisitOverloadExpr(S);
2008
317k
}
2009
2010
327k
void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2011
327k
  VisitExpr(S);
2012
327k
  ID.AddInteger(S->getTrait());
2013
327k
  ID.AddInteger(S->getNumArgs());
2014
803k
  for (unsigned I = 0, N = S->getNumArgs(); I != N; 
++I475k
)
2015
475k
    VisitType(S->getArg(I)->getType());
2016
327k
}
2017
2018
4.39k
void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2019
4.39k
  VisitExpr(S);
2020
4.39k
  ID.AddInteger(S->getTrait());
2021
4.39k
  VisitType(S->getQueriedType());
2022
4.39k
}
2023
2024
10
void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2025
10
  VisitExpr(S);
2026
10
  ID.AddInteger(S->getTrait());
2027
10
  VisitExpr(S->getQueriedExpression());
2028
10
}
2029
2030
void StmtProfiler::VisitDependentScopeDeclRefExpr(
2031
3.93M
    const DependentScopeDeclRefExpr *S) {
2032
3.93M
  VisitExpr(S);
2033
3.93M
  VisitName(S->getDeclName());
2034
3.93M
  VisitNestedNameSpecifier(S->getQualifier());
2035
3.93M
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2036
3.93M
  if (S->hasExplicitTemplateArgs())
2037
39.9k
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2038
3.93M
}
2039
2040
5.03k
void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2041
5.03k
  VisitExpr(S);
2042
5.03k
}
2043
2044
void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2045
50.0k
    const CXXUnresolvedConstructExpr *S) {
2046
50.0k
  VisitExpr(S);
2047
50.0k
  VisitType(S->getTypeAsWritten());
2048
50.0k
  ID.AddInteger(S->isListInitialization());
2049
50.0k
}
2050
2051
void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2052
217k
    const CXXDependentScopeMemberExpr *S) {
2053
217k
  ID.AddBoolean(S->isImplicitAccess());
2054
217k
  if (!S->isImplicitAccess()) {
2055
184k
    VisitExpr(S);
2056
184k
    ID.AddBoolean(S->isArrow());
2057
184k
  }
2058
217k
  VisitNestedNameSpecifier(S->getQualifier());
2059
217k
  VisitName(S->getMember());
2060
217k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2061
217k
  if (S->hasExplicitTemplateArgs())
2062
109
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2063
217k
}
2064
2065
16.1k
void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2066
16.1k
  ID.AddBoolean(S->isImplicitAccess());
2067
16.1k
  if (!S->isImplicitAccess()) {
2068
371
    VisitExpr(S);
2069
371
    ID.AddBoolean(S->isArrow());
2070
371
  }
2071
16.1k
  VisitNestedNameSpecifier(S->getQualifier());
2072
16.1k
  VisitName(S->getMemberName());
2073
16.1k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2074
16.1k
  if (S->hasExplicitTemplateArgs())
2075
272
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2076
16.1k
}
2077
2078
153k
void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2079
153k
  VisitExpr(S);
2080
153k
}
2081
2082
227k
void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2083
227k
  VisitExpr(S);
2084
227k
}
2085
2086
249k
void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2087
249k
  VisitExpr(S);
2088
249k
  VisitDecl(S->getPack());
2089
249k
  if (S->isPartiallySubstituted()) {
2090
36.1k
    auto Args = S->getPartialArguments();
2091
36.1k
    ID.AddInteger(Args.size());
2092
36.1k
    for (const auto &TA : Args)
2093
44.8k
      VisitTemplateArgument(TA);
2094
213k
  } else {
2095
213k
    ID.AddInteger(0);
2096
213k
  }
2097
249k
}
2098
2099
void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2100
24
    const SubstNonTypeTemplateParmPackExpr *S) {
2101
24
  VisitExpr(S);
2102
24
  VisitDecl(S->getParameterPack());
2103
24
  VisitTemplateArgument(S->getArgumentPack());
2104
24
}
2105
2106
void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2107
880k
    const SubstNonTypeTemplateParmExpr *E) {
2108
  // Profile exactly as the replacement expression.
2109
880k
  Visit(E->getReplacement());
2110
880k
}
2111
2112
90
void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2113
90
  VisitExpr(S);
2114
90
  VisitDecl(S->getParameterPack());
2115
90
  ID.AddInteger(S->getNumExpansions());
2116
599
  for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; 
++I509
)
2117
509
    VisitDecl(*I);
2118
90
}
2119
2120
void StmtProfiler::VisitMaterializeTemporaryExpr(
2121
4.41k
                                           const MaterializeTemporaryExpr *S) {
2122
4.41k
  VisitExpr(S);
2123
4.41k
}
2124
2125
70
void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2126
70
  VisitExpr(S);
2127
70
  ID.AddInteger(S->getOperator());
2128
70
}
2129
2130
4
void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2131
4
  VisitStmt(S);
2132
4
}
2133
2134
3
void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2135
3
  VisitStmt(S);
2136
3
}
2137
2138
9
void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2139
9
  VisitExpr(S);
2140
9
}
2141
2142
2
void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2143
2
  VisitExpr(S);
2144
2
}
2145
2146
1
void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2147
1
  VisitExpr(S);
2148
1
}
2149
2150
555
void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2151
555
  VisitExpr(E);
2152
555
}
2153
2154
0
void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2155
0
  VisitExpr(E);
2156
0
}
2157
2158
0
void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2159
0
  VisitExpr(E);
2160
0
}
2161
2162
243
void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2163
2164
4
void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2165
4
  VisitExpr(S);
2166
4
}
2167
2168
21
void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2169
21
  VisitExpr(E);
2170
21
}
2171
2172
4
void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2173
4
  VisitExpr(E);
2174
4
}
2175
2176
6
void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2177
6
  VisitExpr(E);
2178
6
}
2179
2180
0
void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2181
0
  VisitExpr(S);
2182
0
  VisitType(S->getEncodedType());
2183
0
}
2184
2185
1
void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2186
1
  VisitExpr(S);
2187
1
  VisitName(S->getSelector());
2188
1
}
2189
2190
0
void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2191
0
  VisitExpr(S);
2192
0
  VisitDecl(S->getProtocol());
2193
0
}
2194
2195
8
void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2196
8
  VisitExpr(S);
2197
8
  VisitDecl(S->getDecl());
2198
8
  ID.AddBoolean(S->isArrow());
2199
8
  ID.AddBoolean(S->isFreeIvar());
2200
8
}
2201
2202
2
void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2203
2
  VisitExpr(S);
2204
2
  if (S->isImplicitProperty()) {
2205
1
    VisitDecl(S->getImplicitPropertyGetter());
2206
1
    VisitDecl(S->getImplicitPropertySetter());
2207
1
  } else {
2208
1
    VisitDecl(S->getExplicitProperty());
2209
1
  }
2210
2
  if (S->isSuperReceiver()) {
2211
0
    ID.AddBoolean(S->isSuperReceiver());
2212
0
    VisitType(S->getSuperReceiverType());
2213
0
  }
2214
2
}
2215
2216
9
void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2217
9
  VisitExpr(S);
2218
9
  VisitDecl(S->getAtIndexMethodDecl());
2219
9
  VisitDecl(S->setAtIndexMethodDecl());
2220
9
}
2221
2222
40
void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2223
40
  VisitExpr(S);
2224
40
  VisitName(S->getSelector());
2225
40
  VisitDecl(S->getMethodDecl());
2226
40
}
2227
2228
0
void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2229
0
  VisitExpr(S);
2230
0
  ID.AddBoolean(S->isArrow());
2231
0
}
2232
2233
26
void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2234
26
  VisitExpr(S);
2235
26
  ID.AddBoolean(S->getValue());
2236
26
}
2237
2238
void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2239
0
    const ObjCIndirectCopyRestoreExpr *S) {
2240
0
  VisitExpr(S);
2241
0
  ID.AddBoolean(S->shouldCopy());
2242
0
}
2243
2244
11
void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2245
11
  VisitExplicitCastExpr(S);
2246
11
  ID.AddBoolean(S->getBridgeKind());
2247
11
}
2248
2249
void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2250
0
    const ObjCAvailabilityCheckExpr *S) {
2251
0
  VisitExpr(S);
2252
0
}
2253
2254
void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2255
302k
                                          unsigned NumArgs) {
2256
302k
  ID.AddInteger(NumArgs);
2257
800k
  for (unsigned I = 0; I != NumArgs; 
++I498k
)
2258
498k
    VisitTemplateArgument(Args[I].getArgument());
2259
302k
}
2260
2261
543k
void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2262
  // Mostly repetitive with TemplateArgument::Profile!
2263
543k
  ID.AddInteger(Arg.getKind());
2264
543k
  switch (Arg.getKind()) {
2265
0
  case TemplateArgument::Null:
2266
0
    break;
2267
2268
526k
  case TemplateArgument::Type:
2269
526k
    VisitType(Arg.getAsType());
2270
526k
    break;
2271
2272
13.4k
  case TemplateArgument::Template:
2273
13.4k
  case TemplateArgument::TemplateExpansion:
2274
13.4k
    VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2275
13.4k
    break;
2276
2277
1
  case TemplateArgument::Declaration:
2278
1
    VisitType(Arg.getParamTypeForDecl());
2279
    // FIXME: Do we need to recursively decompose template parameter objects?
2280
1
    VisitDecl(Arg.getAsDecl());
2281
1
    break;
2282
2283
0
  case TemplateArgument::NullPtr:
2284
0
    VisitType(Arg.getNullPtrType());
2285
0
    break;
2286
2287
44
  case TemplateArgument::Integral:
2288
44
    VisitType(Arg.getIntegralType());
2289
44
    Arg.getAsIntegral().Profile(ID);
2290
44
    break;
2291
2292
3.46k
  case TemplateArgument::Expression:
2293
3.46k
    Visit(Arg.getAsExpr());
2294
3.46k
    break;
2295
2296
42
  case TemplateArgument::Pack:
2297
42
    for (const auto &P : Arg.pack_elements())
2298
81
      VisitTemplateArgument(P);
2299
42
    break;
2300
543k
  }
2301
543k
}
2302
2303
void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2304
5.84M
                   bool Canonical) const {
2305
5.84M
  StmtProfilerWithPointers Profiler(ID, Context, Canonical);
2306
5.84M
  Profiler.Visit(this);
2307
5.84M
}
2308
2309
void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2310
374k
                          class ODRHash &Hash) const {
2311
374k
  StmtProfilerWithoutPointers Profiler(ID, Hash);
2312
374k
  Profiler.Visit(this);
2313
374k
}