Coverage Report

Created: 2022-07-16 07:03

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