Coverage Report

Created: 2022-05-21 09:15

/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.49M
        : ID(ID), Canonical(Canonical) {}
36
37
6.49M
    virtual ~StmtProfiler() {}
38
39
    void VisitStmt(const Stmt *S);
40
41
17.6M
    void VisitStmtNoChildren(const Stmt *S) {
42
17.6M
      HandleStmtClass(S->getStmtClass());
43
17.6M
    }
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
6.09M
        : StmtProfiler(ID, Canonical), Context(Context) {}
88
  private:
89
14.2M
    void HandleStmtClass(Stmt::StmtClass SC) override {
90
14.2M
      ID.AddInteger(SC);
91
14.2M
    }
92
93
2.52M
    void VisitDecl(const Decl *D) override {
94
2.52M
      ID.AddInteger(D ? 
D->getKind()2.51M
:
03.20k
);
95
96
2.52M
      if (Canonical && 
D2.36M
) {
97
2.36M
        if (const NonTypeTemplateParmDecl *NTTP =
98
2.36M
                dyn_cast<NonTypeTemplateParmDecl>(D)) {
99
1.76M
          ID.AddInteger(NTTP->getDepth());
100
1.76M
          ID.AddInteger(NTTP->getIndex());
101
1.76M
          ID.AddBoolean(NTTP->isParameterPack());
102
1.76M
          VisitType(NTTP->getType());
103
1.76M
          return;
104
1.76M
        }
105
106
598k
        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
95.6k
          VisitType(Parm->getType());
115
95.6k
          ID.AddInteger(Parm->getFunctionScopeDepth());
116
95.6k
          ID.AddInteger(Parm->getFunctionScopeIndex());
117
95.6k
          return;
118
95.6k
        }
119
120
502k
        if (const TemplateTypeParmDecl *TTP =
121
502k
                dyn_cast<TemplateTypeParmDecl>(D)) {
122
253k
          ID.AddInteger(TTP->getDepth());
123
253k
          ID.AddInteger(TTP->getIndex());
124
253k
          ID.AddBoolean(TTP->isParameterPack());
125
253k
          return;
126
253k
        }
127
128
249k
        if (const TemplateTemplateParmDecl *TTP =
129
249k
                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
249k
      }
136
137
405k
      ID.AddPointer(D ? 
D->getCanonicalDecl()401k
:
nullptr3.20k
);
138
405k
    }
139
140
3.13M
    void VisitType(QualType T) override {
141
3.13M
      if (Canonical && 
!T.isNull()3.09M
)
142
3.09M
        T = Context.getCanonicalType(T);
143
144
3.13M
      ID.AddPointer(T.getAsOpaquePtr());
145
3.13M
    }
146
147
4.59M
    void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override {
148
4.59M
      ID.AddPointer(Name.getAsOpaquePtr());
149
4.59M
    }
150
151
9
    void VisitIdentifierInfo(IdentifierInfo *II) override {
152
9
      ID.AddPointer(II);
153
9
    }
154
155
4.75M
    void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
156
4.75M
      if (Canonical)
157
3.52M
        NNS = Context.getCanonicalNestedNameSpecifier(NNS);
158
4.75M
      ID.AddPointer(NNS);
159
4.75M
    }
160
161
13.0k
    void VisitTemplateName(TemplateName Name) override {
162
13.0k
      if (Canonical)
163
13.0k
        Name = Context.getCanonicalTemplateName(Name);
164
165
13.0k
      Name.Profile(ID);
166
13.0k
    }
167
  };
168
169
  class StmtProfilerWithoutPointers : public StmtProfiler {
170
    ODRHash &Hash;
171
  public:
172
    StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
173
401k
        : StmtProfiler(ID, false), Hash(Hash) {}
174
175
  private:
176
3.32M
    void HandleStmtClass(Stmt::StmtClass SC) override {
177
3.32M
      if (SC == Stmt::UnresolvedLookupExprClass) {
178
        // Pretend that the name looked up is a Decl due to how templates
179
        // handle some Decl lookups.
180
35.1k
        ID.AddInteger(Stmt::DeclRefExprClass);
181
3.29M
      } else {
182
3.29M
        ID.AddInteger(SC);
183
3.29M
      }
184
3.32M
    }
185
186
227k
    void VisitType(QualType T) override {
187
227k
      Hash.AddQualType(T);
188
227k
    }
189
190
186k
    void VisitName(DeclarationName Name, bool TreatAsDecl) override {
191
186k
      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
34.8k
        ID.AddBoolean(true);
195
34.8k
      }
196
186k
      Hash.AddDeclarationName(Name, TreatAsDecl);
197
186k
    }
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
915k
    void VisitDecl(const Decl *D) override {
205
915k
      ID.AddBoolean(D);
206
915k
      if (D) {
207
878k
        Hash.AddDecl(D);
208
878k
      }
209
915k
    }
210
30
    void VisitTemplateName(TemplateName Name) override {
211
30
      Hash.AddTemplateName(Name);
212
30
    }
213
976k
    void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
214
976k
      ID.AddBoolean(NNS);
215
976k
      if (NNS) {
216
74.8k
        Hash.AddNestedNameSpecifier(NNS);
217
74.8k
      }
218
976k
    }
219
  };
220
}
221
222
17.6M
void StmtProfiler::VisitStmt(const Stmt *S) {
223
17.6M
  assert(S && "Requires non-null Stmt pointer");
224
225
0
  VisitStmtNoChildren(S);
226
227
17.6M
  for (const Stmt *SubStmt : S->children()) {
228
11.0M
    if (SubStmt)
229
11.0M
      Visit(SubStmt);
230
14.0k
    else
231
14.0k
      ID.AddInteger(0);
232
11.0M
  }
233
17.6M
}
234
235
68.8k
void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
236
68.8k
  VisitStmt(S);
237
68.8k
  for (const auto *D : S->decls())
238
71.4k
    VisitDecl(D);
239
68.8k
}
240
241
369
void StmtProfiler::VisitNullStmt(const NullStmt *S) {
242
369
  VisitStmt(S);
243
369
}
244
245
175k
void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
246
175k
  VisitStmt(S);
247
175k
}
248
249
3.46k
void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
250
3.46k
  VisitStmt(S);
251
3.46k
}
252
253
326
void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
254
326
  VisitStmt(S);
255
326
}
256
257
101
void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
258
101
  VisitStmt(S);
259
101
  VisitDecl(S->getDecl());
260
101
}
261
262
34
void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
263
34
  VisitStmt(S);
264
  // TODO: maybe visit attributes?
265
34
}
266
267
30.5k
void StmtProfiler::VisitIfStmt(const IfStmt *S) {
268
30.5k
  VisitStmt(S);
269
30.5k
  VisitDecl(S->getConditionVariable());
270
30.5k
}
271
272
661
void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
273
661
  VisitStmt(S);
274
661
  VisitDecl(S->getConditionVariable());
275
661
}
276
277
2.38k
void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
278
2.38k
  VisitStmt(S);
279
2.38k
  VisitDecl(S->getConditionVariable());
280
2.38k
}
281
282
888
void StmtProfiler::VisitDoStmt(const DoStmt *S) {
283
888
  VisitStmt(S);
284
888
}
285
286
5.88k
void StmtProfiler::VisitForStmt(const ForStmt *S) {
287
5.88k
  VisitStmt(S);
288
5.88k
}
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
95
void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
300
95
  VisitStmt(S);
301
95
}
302
303
3.07k
void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
304
3.07k
  VisitStmt(S);
305
3.07k
}
306
307
121k
void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
308
121k
  VisitStmt(S);
309
121k
}
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
818
void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
340
818
  VisitStmt(S);
341
818
  VisitType(S->getCaughtType());
342
818
}
343
344
818
void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
345
818
  VisitStmt(S);
346
818
}
347
348
60
void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
349
60
  VisitStmt(S);
350
60
}
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
12.9k
void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
376
12.9k
  VisitStmt(S);
377
12.9k
}
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
15.6k
  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.38k
    const OMPClauseWithPreInit *C) {
430
8.38k
  if (auto *S = C->getPreInitStmt())
431
846
    Profiler->VisitStmt(S);
432
8.38k
}
433
434
void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
435
1.11k
    const OMPClauseWithPostUpdate *C) {
436
1.11k
  VistOMPClauseWithPreInit(C);
437
1.11k
  if (auto *E = C->getPostUpdateExpr())
438
4
    Profiler->VisitStmt(E);
439
1.11k
}
440
441
2.07k
void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
442
2.07k
  VistOMPClauseWithPreInit(C);
443
2.07k
  if (C->getCondition())
444
2.07k
    Profiler->VisitStmt(C->getCondition());
445
2.07k
}
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
197
void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
454
197
  VistOMPClauseWithPreInit(C);
455
197
  if (C->getNumThreads())
456
197
    Profiler->VisitStmt(C->getNumThreads());
457
197
}
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
125
void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
515
516
90
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
394
void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
557
558
1.60k
void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
559
560
352
void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
561
562
294
void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
563
564
304
void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
565
566
322
void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
567
568
326
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
6
void OMPClauseProfiler::VisitOMPFilterClause(const OMPFilterClause *C) {
591
6
  VistOMPClauseWithPreInit(C);
592
6
  if (C->getThreadID())
593
6
    Profiler->VisitStmt(C->getThreadID());
594
6
}
595
596
template<typename T>
597
12.1k
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
18.0k
  for (auto *E : Node->varlists()) {
599
18.0k
    if (E)
600
18.0k
      Profiler->VisitStmt(E);
601
18.0k
  }
602
12.1k
}
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
163
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
163
  for (auto *E : Node->varlists()) {
599
163
    if (E)
600
163
      Profiler->VisitStmt(E);
601
163
  }
602
163
}
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
42
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
74
  for (auto *E : Node->varlists()) {
599
74
    if (E)
600
74
      Profiler->VisitStmt(E);
601
74
  }
602
42
}
StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPDependClause const>(clang::OMPDependClause const*)
Line
Count
Source
597
666
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
1.51k
  for (auto *E : Node->varlists()) {
599
1.51k
    if (E)
600
1.51k
      Profiler->VisitStmt(E);
601
1.51k
  }
602
666
}
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.81k
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
6.40k
  for (auto *E : Node->varlists()) {
599
6.40k
    if (E)
600
6.40k
      Profiler->VisitStmt(E);
601
6.40k
  }
602
3.81k
}
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
830
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
1.39k
  for (auto *E : Node->varlists()) {
599
1.39k
    if (E)
600
1.39k
      Profiler->VisitStmt(E);
601
1.39k
  }
602
830
}
StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPReductionClause const>(clang::OMPReductionClause const*)
Line
Count
Source
597
552
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
773
  for (auto *E : Node->varlists()) {
599
773
    if (E)
600
773
      Profiler->VisitStmt(E);
601
773
  }
602
552
}
StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPSharedClause const>(clang::OMPSharedClause const*)
Line
Count
Source
597
241
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
286
  for (auto *E : Node->varlists()) {
599
286
    if (E)
600
286
      Profiler->VisitStmt(E);
601
286
  }
602
241
}
StmtProfile.cpp:void (anonymous namespace)::OMPClauseProfiler::VisitOMPClauseList<clang::OMPTaskReductionClause const>(clang::OMPTaskReductionClause const*)
Line
Count
Source
597
74
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
598
98
  for (auto *E : Node->varlists()) {
599
98
    if (E)
600
98
      Profiler->VisitStmt(E);
601
98
  }
602
74
}
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
830
void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
605
830
  VisitOMPClauseList(C);
606
1.39k
  for (auto *E : C->private_copies()) {
607
1.39k
    if (E)
608
830
      Profiler->VisitStmt(E);
609
1.39k
  }
610
830
}
611
void
612
3.81k
OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
613
3.81k
  VisitOMPClauseList(C);
614
3.81k
  VistOMPClauseWithPreInit(C);
615
6.40k
  for (auto *E : C->private_copies()) {
616
6.40k
    if (E)
617
6.03k
      Profiler->VisitStmt(E);
618
6.40k
  }
619
6.40k
  for (auto *E : C->inits()) {
620
6.40k
    if (E)
621
6.03k
      Profiler->VisitStmt(E);
622
6.40k
  }
623
3.81k
}
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
241
void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
642
241
  VisitOMPClauseList(C);
643
241
}
644
void OMPClauseProfiler::VisitOMPReductionClause(
645
552
                                         const OMPReductionClause *C) {
646
552
  Profiler->VisitNestedNameSpecifier(
647
552
      C->getQualifierLoc().getNestedNameSpecifier());
648
552
  Profiler->VisitName(C->getNameInfo().getName());
649
552
  VisitOMPClauseList(C);
650
552
  VistOMPClauseWithPostUpdate(C);
651
773
  for (auto *E : C->privates()) {
652
773
    if (E)
653
463
      Profiler->VisitStmt(E);
654
773
  }
655
773
  for (auto *E : C->lhs_exprs()) {
656
773
    if (E)
657
463
      Profiler->VisitStmt(E);
658
773
  }
659
773
  for (auto *E : C->rhs_exprs()) {
660
773
    if (E)
661
463
      Profiler->VisitStmt(E);
662
773
  }
663
773
  for (auto *E : C->reduction_ops()) {
664
773
    if (E)
665
773
      Profiler->VisitStmt(E);
666
773
  }
667
552
  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
552
}
682
void OMPClauseProfiler::VisitOMPTaskReductionClause(
683
74
    const OMPTaskReductionClause *C) {
684
74
  Profiler->VisitNestedNameSpecifier(
685
74
      C->getQualifierLoc().getNestedNameSpecifier());
686
74
  Profiler->VisitName(C->getNameInfo().getName());
687
74
  VisitOMPClauseList(C);
688
74
  VistOMPClauseWithPostUpdate(C);
689
98
  for (auto *E : C->privates()) {
690
98
    if (E)
691
68
      Profiler->VisitStmt(E);
692
98
  }
693
98
  for (auto *E : C->lhs_exprs()) {
694
98
    if (E)
695
68
      Profiler->VisitStmt(E);
696
98
  }
697
98
  for (auto *E : C->rhs_exprs()) {
698
98
    if (E)
699
68
      Profiler->VisitStmt(E);
700
98
  }
701
98
  for (auto *E : C->reduction_ops()) {
702
98
    if (E)
703
98
      Profiler->VisitStmt(E);
704
98
  }
705
74
}
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
42
void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
764
42
  VisitOMPClauseList(C);
765
74
  for (auto *E : C->source_exprs()) {
766
74
    if (E)
767
42
      Profiler->VisitStmt(E);
768
74
  }
769
74
  for (auto *E : C->destination_exprs()) {
770
74
    if (E)
771
42
      Profiler->VisitStmt(E);
772
74
  }
773
74
  for (auto *E : C->assignment_ops()) {
774
74
    if (E)
775
42
      Profiler->VisitStmt(E);
776
74
  }
777
42
}
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
666
void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
802
666
  VisitOMPClauseList(C);
803
666
}
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
163
void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
812
163
  if (Expr *Allocator = C->getAllocator())
813
53
    Profiler->VisitStmt(Allocator);
814
163
  VisitOMPClauseList(C);
815
163
}
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
15.6k
StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
901
15.6k
  VisitStmt(S);
902
15.6k
  OMPClauseProfiler P(this);
903
15.6k
  ArrayRef<OMPClause *> Clauses = S->clauses();
904
15.6k
  for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
905
37.8k
       I != E; 
++I22.2k
)
906
22.2k
    if (*I)
907
22.2k
      P.Visit(*I);
908
15.6k
}
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
641
void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
927
641
  VisitOMPExecutableDirective(S);
928
641
}
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::VisitOMPParallelSectionsDirective(
992
32
    const OMPParallelSectionsDirective *S) {
993
32
  VisitOMPExecutableDirective(S);
994
32
}
995
996
183
void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
997
183
  VisitOMPExecutableDirective(S);
998
183
}
999
1000
10
void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
1001
10
  VisitOMPExecutableDirective(S);
1002
10
}
1003
1004
24
void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
1005
24
  VisitOMPExecutableDirective(S);
1006
24
}
1007
1008
16
void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
1009
16
  VisitOMPExecutableDirective(S);
1010
16
}
1011
1012
72
void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
1013
72
  VisitOMPExecutableDirective(S);
1014
72
  if (const Expr *E = S->getReductionRef())
1015
40
    VisitStmt(E);
1016
72
}
1017
1018
50
void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
1019
50
  VisitOMPExecutableDirective(S);
1020
50
}
1021
1022
28
void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
1023
28
  VisitOMPExecutableDirective(S);
1024
28
}
1025
1026
0
void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
1027
0
  VisitOMPExecutableDirective(S);
1028
0
}
1029
1030
0
void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
1031
0
  VisitOMPExecutableDirective(S);
1032
0
}
1033
1034
2.45k
void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
1035
2.45k
  VisitOMPExecutableDirective(S);
1036
2.45k
}
1037
1038
4.93k
void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
1039
4.93k
  VisitOMPExecutableDirective(S);
1040
4.93k
}
1041
1042
250
void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
1043
250
  VisitOMPExecutableDirective(S);
1044
250
}
1045
1046
void StmtProfiler::VisitOMPTargetEnterDataDirective(
1047
289
    const OMPTargetEnterDataDirective *S) {
1048
289
  VisitOMPExecutableDirective(S);
1049
289
}
1050
1051
void StmtProfiler::VisitOMPTargetExitDataDirective(
1052
277
    const OMPTargetExitDataDirective *S) {
1053
277
  VisitOMPExecutableDirective(S);
1054
277
}
1055
1056
void StmtProfiler::VisitOMPTargetParallelDirective(
1057
609
    const OMPTargetParallelDirective *S) {
1058
609
  VisitOMPExecutableDirective(S);
1059
609
}
1060
1061
void StmtProfiler::VisitOMPTargetParallelForDirective(
1062
429
    const OMPTargetParallelForDirective *S) {
1063
429
  VisitOMPExecutableDirective(S);
1064
429
}
1065
1066
5
void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
1067
5
  VisitOMPExecutableDirective(S);
1068
5
}
1069
1070
void StmtProfiler::VisitOMPCancellationPointDirective(
1071
0
    const OMPCancellationPointDirective *S) {
1072
0
  VisitOMPExecutableDirective(S);
1073
0
}
1074
1075
0
void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
1076
0
  VisitOMPExecutableDirective(S);
1077
0
}
1078
1079
26
void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
1080
26
  VisitOMPLoopDirective(S);
1081
26
}
1082
1083
void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1084
28
    const OMPTaskLoopSimdDirective *S) {
1085
28
  VisitOMPLoopDirective(S);
1086
28
}
1087
1088
void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1089
22
    const OMPMasterTaskLoopDirective *S) {
1090
22
  VisitOMPLoopDirective(S);
1091
22
}
1092
1093
void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1094
28
    const OMPMasterTaskLoopSimdDirective *S) {
1095
28
  VisitOMPLoopDirective(S);
1096
28
}
1097
1098
void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1099
22
    const OMPParallelMasterTaskLoopDirective *S) {
1100
22
  VisitOMPLoopDirective(S);
1101
22
}
1102
1103
void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1104
28
    const OMPParallelMasterTaskLoopSimdDirective *S) {
1105
28
  VisitOMPLoopDirective(S);
1106
28
}
1107
1108
void StmtProfiler::VisitOMPDistributeDirective(
1109
20
    const OMPDistributeDirective *S) {
1110
20
  VisitOMPLoopDirective(S);
1111
20
}
1112
1113
void OMPClauseProfiler::VisitOMPDistScheduleClause(
1114
144
    const OMPDistScheduleClause *C) {
1115
144
  VistOMPClauseWithPreInit(C);
1116
144
  if (auto *S = C->getChunkSize())
1117
84
    Profiler->VisitStmt(S);
1118
144
}
1119
1120
516
void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1121
1122
void StmtProfiler::VisitOMPTargetUpdateDirective(
1123
404
    const OMPTargetUpdateDirective *S) {
1124
404
  VisitOMPExecutableDirective(S);
1125
404
}
1126
1127
void StmtProfiler::VisitOMPDistributeParallelForDirective(
1128
0
    const OMPDistributeParallelForDirective *S) {
1129
0
  VisitOMPLoopDirective(S);
1130
0
}
1131
1132
void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1133
4
    const OMPDistributeParallelForSimdDirective *S) {
1134
4
  VisitOMPLoopDirective(S);
1135
4
}
1136
1137
void StmtProfiler::VisitOMPDistributeSimdDirective(
1138
0
    const OMPDistributeSimdDirective *S) {
1139
0
  VisitOMPLoopDirective(S);
1140
0
}
1141
1142
void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1143
515
    const OMPTargetParallelForSimdDirective *S) {
1144
515
  VisitOMPLoopDirective(S);
1145
515
}
1146
1147
void StmtProfiler::VisitOMPTargetSimdDirective(
1148
487
    const OMPTargetSimdDirective *S) {
1149
487
  VisitOMPLoopDirective(S);
1150
487
}
1151
1152
void StmtProfiler::VisitOMPTeamsDistributeDirective(
1153
0
    const OMPTeamsDistributeDirective *S) {
1154
0
  VisitOMPLoopDirective(S);
1155
0
}
1156
1157
void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1158
0
    const OMPTeamsDistributeSimdDirective *S) {
1159
0
  VisitOMPLoopDirective(S);
1160
0
}
1161
1162
void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1163
0
    const OMPTeamsDistributeParallelForSimdDirective *S) {
1164
0
  VisitOMPLoopDirective(S);
1165
0
}
1166
1167
void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1168
0
    const OMPTeamsDistributeParallelForDirective *S) {
1169
0
  VisitOMPLoopDirective(S);
1170
0
}
1171
1172
void StmtProfiler::VisitOMPTargetTeamsDirective(
1173
727
    const OMPTargetTeamsDirective *S) {
1174
727
  VisitOMPExecutableDirective(S);
1175
727
}
1176
1177
void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1178
477
    const OMPTargetTeamsDistributeDirective *S) {
1179
477
  VisitOMPLoopDirective(S);
1180
477
}
1181
1182
void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1183
457
    const OMPTargetTeamsDistributeParallelForDirective *S) {
1184
457
  VisitOMPLoopDirective(S);
1185
457
}
1186
1187
void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1188
571
    const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1189
571
  VisitOMPLoopDirective(S);
1190
571
}
1191
1192
void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1193
549
    const OMPTargetTeamsDistributeSimdDirective *S) {
1194
549
  VisitOMPLoopDirective(S);
1195
549
}
1196
1197
24
void StmtProfiler::VisitOMPInteropDirective(const OMPInteropDirective *S) {
1198
24
  VisitOMPExecutableDirective(S);
1199
24
}
1200
1201
20
void StmtProfiler::VisitOMPDispatchDirective(const OMPDispatchDirective *S) {
1202
20
  VisitOMPExecutableDirective(S);
1203
20
}
1204
1205
12
void StmtProfiler::VisitOMPMaskedDirective(const OMPMaskedDirective *S) {
1206
12
  VisitOMPExecutableDirective(S);
1207
12
}
1208
1209
void StmtProfiler::VisitOMPGenericLoopDirective(
1210
3
    const OMPGenericLoopDirective *S) {
1211
3
  VisitOMPLoopDirective(S);
1212
3
}
1213
1214
void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1215
3
    const OMPTeamsGenericLoopDirective *S) {
1216
3
  VisitOMPLoopDirective(S);
1217
3
}
1218
1219
void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1220
8
    const OMPTargetTeamsGenericLoopDirective *S) {
1221
8
  VisitOMPLoopDirective(S);
1222
8
}
1223
1224
void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1225
3
    const OMPParallelGenericLoopDirective *S) {
1226
3
  VisitOMPLoopDirective(S);
1227
3
}
1228
1229
void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1230
8
    const OMPTargetParallelGenericLoopDirective *S) {
1231
8
  VisitOMPLoopDirective(S);
1232
8
}
1233
1234
17.1M
void StmtProfiler::VisitExpr(const Expr *S) {
1235
17.1M
  VisitStmt(S);
1236
17.1M
}
1237
1238
231k
void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1239
231k
  VisitExpr(S);
1240
231k
}
1241
1242
2.96M
void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1243
2.96M
  VisitExpr(S);
1244
2.96M
  if (!Canonical)
1245
859k
    VisitNestedNameSpecifier(S->getQualifier());
1246
2.96M
  VisitDecl(S->getDecl());
1247
2.96M
  if (!Canonical) {
1248
859k
    ID.AddBoolean(S->hasExplicitTemplateArgs());
1249
859k
    if (S->hasExplicitTemplateArgs())
1250
2.11k
      VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1251
859k
  }
1252
2.96M
}
1253
1254
void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1255
1
    const SYCLUniqueStableNameExpr *S) {
1256
1
  VisitExpr(S);
1257
1
  VisitType(S->getTypeSourceInfo()->getType());
1258
1
}
1259
1260
17
void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1261
17
  VisitExpr(S);
1262
17
  ID.AddInteger(S->getIdentKind());
1263
17
}
1264
1265
715k
void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1266
715k
  VisitExpr(S);
1267
715k
  S->getValue().Profile(ID);
1268
715k
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1269
715k
}
1270
1271
0
void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1272
0
  VisitExpr(S);
1273
0
  S->getValue().Profile(ID);
1274
0
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1275
0
}
1276
1277
23.2k
void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1278
23.2k
  VisitExpr(S);
1279
23.2k
  ID.AddInteger(S->getKind());
1280
23.2k
  ID.AddInteger(S->getValue());
1281
23.2k
}
1282
1283
2.03k
void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1284
2.03k
  VisitExpr(S);
1285
2.03k
  S->getValue().Profile(ID);
1286
2.03k
  ID.AddBoolean(S->isExact());
1287
2.03k
  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1288
2.03k
}
1289
1290
6
void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1291
6
  VisitExpr(S);
1292
6
}
1293
1294
6.90k
void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1295
6.90k
  VisitExpr(S);
1296
6.90k
  ID.AddString(S->getBytes());
1297
6.90k
  ID.AddInteger(S->getKind());
1298
6.90k
}
1299
1300
572k
void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1301
572k
  VisitExpr(S);
1302
572k
}
1303
1304
9.02k
void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1305
9.02k
  VisitExpr(S);
1306
9.02k
}
1307
1308
758k
void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1309
758k
  VisitExpr(S);
1310
758k
  ID.AddInteger(S->getOpcode());
1311
758k
}
1312
1313
12
void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1314
12
  VisitType(S->getTypeSourceInfo()->getType());
1315
12
  unsigned n = S->getNumComponents();
1316
30
  for (unsigned i = 0; i < n; 
++i18
) {
1317
18
    const OffsetOfNode &ON = S->getComponent(i);
1318
18
    ID.AddInteger(ON.getKind());
1319
18
    switch (ON.getKind()) {
1320
5
    case OffsetOfNode::Array:
1321
      // Expressions handled below.
1322
5
      break;
1323
1324
6
    case OffsetOfNode::Field:
1325
6
      VisitDecl(ON.getField());
1326
6
      break;
1327
1328
7
    case OffsetOfNode::Identifier:
1329
7
      VisitIdentifierInfo(ON.getFieldName());
1330
7
      break;
1331
1332
0
    case OffsetOfNode::Base:
1333
      // These nodes are implicit, and therefore don't need profiling.
1334
0
      break;
1335
18
    }
1336
18
  }
1337
1338
12
  VisitExpr(S);
1339
12
}
1340
1341
void
1342
75.3k
StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1343
75.3k
  VisitExpr(S);
1344
75.3k
  ID.AddInteger(S->getKind());
1345
75.3k
  if (S->isArgumentType())
1346
72.8k
    VisitType(S->getArgumentType());
1347
75.3k
}
1348
1349
9.90k
void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1350
9.90k
  VisitExpr(S);
1351
9.90k
}
1352
1353
2
void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1354
2
  VisitExpr(S);
1355
2
}
1356
1357
602
void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) {
1358
602
  VisitExpr(S);
1359
602
}
1360
1361
0
void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1362
0
  VisitExpr(S);
1363
0
}
1364
1365
0
void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1366
0
  VisitExpr(S);
1367
0
  for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1368
0
    VisitDecl(S->getIteratorDecl(I));
1369
0
}
1370
1371
719k
void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1372
719k
  VisitExpr(S);
1373
719k
}
1374
1375
84.6k
void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1376
84.6k
  VisitExpr(S);
1377
84.6k
  VisitDecl(S->getMemberDecl());
1378
84.6k
  if (!Canonical)
1379
83.6k
    VisitNestedNameSpecifier(S->getQualifier());
1380
84.6k
  ID.AddBoolean(S->isArrow());
1381
84.6k
}
1382
1383
1.13k
void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1384
1.13k
  VisitExpr(S);
1385
1.13k
  ID.AddBoolean(S->isFileScope());
1386
1.13k
}
1387
1388
3.44M
void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1389
3.44M
  VisitExpr(S);
1390
3.44M
}
1391
1392
3.17M
void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1393
3.17M
  VisitCastExpr(S);
1394
3.17M
  ID.AddInteger(S->getValueKind());
1395
3.17M
}
1396
1397
263k
void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1398
263k
  VisitCastExpr(S);
1399
263k
  VisitType(S->getTypeAsWritten());
1400
263k
}
1401
1402
198k
void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1403
198k
  VisitExplicitCastExpr(S);
1404
198k
}
1405
1406
1.68M
void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1407
1.68M
  VisitExpr(S);
1408
1.68M
  ID.AddInteger(S->getOpcode());
1409
1.68M
}
1410
1411
void
1412
8.16k
StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1413
8.16k
  VisitBinaryOperator(S);
1414
8.16k
}
1415
1416
11.5k
void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1417
11.5k
  VisitExpr(S);
1418
11.5k
}
1419
1420
void StmtProfiler::VisitBinaryConditionalOperator(
1421
1
    const BinaryConditionalOperator *S) {
1422
1
  VisitExpr(S);
1423
1
}
1424
1425
5
void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1426
5
  VisitExpr(S);
1427
5
  VisitDecl(S->getLabel());
1428
5
}
1429
1430
769
void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1431
769
  VisitExpr(S);
1432
769
}
1433
1434
2.34k
void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1435
2.34k
  VisitExpr(S);
1436
2.34k
}
1437
1438
852
void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1439
852
  VisitExpr(S);
1440
852
}
1441
1442
1
void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1443
1
  VisitExpr(S);
1444
1
}
1445
1446
96
void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1447
96
  VisitExpr(S);
1448
96
}
1449
1450
2
void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1451
2
  VisitExpr(S);
1452
2
}
1453
1454
29.0k
void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1455
29.0k
  if (S->getSyntacticForm()) {
1456
3.74k
    VisitInitListExpr(S->getSyntacticForm());
1457
3.74k
    return;
1458
3.74k
  }
1459
1460
25.2k
  VisitExpr(S);
1461
25.2k
}
1462
1463
209
void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1464
209
  VisitExpr(S);
1465
209
  ID.AddBoolean(S->usesGNUSyntax());
1466
238
  for (const DesignatedInitExpr::Designator &D : S->designators()) {
1467
238
    if (D.isFieldDesignator()) {
1468
229
      ID.AddInteger(0);
1469
229
      VisitName(D.getFieldName());
1470
229
      continue;
1471
229
    }
1472
1473
9
    if (D.isArrayDesignator()) {
1474
8
      ID.AddInteger(1);
1475
8
    } else {
1476
1
      assert(D.isArrayRangeDesignator());
1477
0
      ID.AddInteger(2);
1478
1
    }
1479
0
    ID.AddInteger(D.getFirstExprIndex());
1480
9
  }
1481
209
}
1482
1483
// Seems that if VisitInitListExpr() only works on the syntactic form of an
1484
// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1485
void StmtProfiler::VisitDesignatedInitUpdateExpr(
1486
0
    const DesignatedInitUpdateExpr *S) {
1487
0
  llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1488
0
                   "initializer");
1489
0
}
1490
1491
0
void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1492
0
  VisitExpr(S);
1493
0
}
1494
1495
0
void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1496
0
  VisitExpr(S);
1497
0
}
1498
1499
0
void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1500
0
  llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1501
0
}
1502
1503
34
void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1504
34
  VisitExpr(S);
1505
34
}
1506
1507
60
void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1508
60
  VisitExpr(S);
1509
60
  VisitName(&S->getAccessor());
1510
60
}
1511
1512
57
void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1513
57
  VisitExpr(S);
1514
57
  VisitDecl(S->getBlockDecl());
1515
57
}
1516
1517
10
void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1518
10
  VisitExpr(S);
1519
10
  for (const GenericSelectionExpr::ConstAssociation Assoc :
1520
20
       S->associations()) {
1521
20
    QualType T = Assoc.getType();
1522
20
    if (T.isNull())
1523
3
      ID.AddPointer(nullptr);
1524
17
    else
1525
17
      VisitType(T);
1526
20
    VisitExpr(Assoc.getAssociationExpr());
1527
20
  }
1528
10
}
1529
1530
226
void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1531
226
  VisitExpr(S);
1532
226
  for (PseudoObjectExpr::const_semantics_iterator
1533
557
         i = S->semantics_begin(), e = S->semantics_end(); i != e; 
++i331
)
1534
    // Normally, we would not profile the source expressions of OVEs.
1535
331
    if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1536
105
      Visit(OVE->getSourceExpr());
1537
226
}
1538
1539
149
void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1540
149
  VisitExpr(S);
1541
149
  ID.AddInteger(S->getOp());
1542
149
}
1543
1544
void StmtProfiler::VisitConceptSpecializationExpr(
1545
210
                                           const ConceptSpecializationExpr *S) {
1546
210
  VisitExpr(S);
1547
210
  VisitDecl(S->getNamedConcept());
1548
210
  for (const TemplateArgument &Arg : S->getTemplateArguments())
1549
248
    VisitTemplateArgument(Arg);
1550
210
}
1551
1552
66
void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1553
66
  VisitExpr(S);
1554
66
  ID.AddInteger(S->getLocalParameters().size());
1555
66
  for (ParmVarDecl *LocalParam : S->getLocalParameters())
1556
17
    VisitDecl(LocalParam);
1557
66
  ID.AddInteger(S->getRequirements().size());
1558
78
  for (concepts::Requirement *Req : S->getRequirements()) {
1559
78
    if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1560
22
      ID.AddInteger(concepts::Requirement::RK_Type);
1561
22
      ID.AddBoolean(TypeReq->isSubstitutionFailure());
1562
22
      if (!TypeReq->isSubstitutionFailure())
1563
22
        VisitType(TypeReq->getType()->getType());
1564
56
    } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1565
32
      ID.AddInteger(concepts::Requirement::RK_Compound);
1566
32
      ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1567
32
      if (!ExprReq->isExprSubstitutionFailure())
1568
32
        Visit(ExprReq->getExpr());
1569
      // C++2a [expr.prim.req.compound]p1 Example:
1570
      //    [...] The compound-requirement in C1 requires that x++ is a valid
1571
      //    expression. It is equivalent to the simple-requirement x++; [...]
1572
      // We therefore do not profile isSimple() here.
1573
32
      ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1574
32
      const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1575
32
          ExprReq->getReturnTypeRequirement();
1576
32
      if (RetReq.isEmpty()) {
1577
18
        ID.AddInteger(0);
1578
18
      } else 
if (14
RetReq.isTypeConstraint()14
) {
1579
14
        ID.AddInteger(1);
1580
14
        Visit(RetReq.getTypeConstraint()->getImmediatelyDeclaredConstraint());
1581
14
      } else {
1582
0
        assert(RetReq.isSubstitutionFailure());
1583
0
        ID.AddInteger(2);
1584
0
      }
1585
32
    } else {
1586
24
      ID.AddInteger(concepts::Requirement::RK_Nested);
1587
24
      auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1588
24
      ID.AddBoolean(NestedReq->isSubstitutionFailure());
1589
24
      if (!NestedReq->isSubstitutionFailure())
1590
24
        Visit(NestedReq->getConstraintExpr());
1591
24
    }
1592
78
  }
1593
66
}
1594
1595
static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
1596
                                          UnaryOperatorKind &UnaryOp,
1597
141k
                                          BinaryOperatorKind &BinaryOp) {
1598
141k
  switch (S->getOperator()) {
1599
0
  case OO_None:
1600
0
  case OO_New:
1601
0
  case OO_Delete:
1602
0
  case OO_Array_New:
1603
0
  case OO_Array_Delete:
1604
0
  case OO_Arrow:
1605
0
  case OO_Conditional:
1606
0
  case NUM_OVERLOADED_OPERATORS:
1607
0
    llvm_unreachable("Invalid operator call kind");
1608
1609
13.0k
  case OO_Plus:
1610
13.0k
    if (S->getNumArgs() == 1) {
1611
25
      UnaryOp = UO_Plus;
1612
25
      return Stmt::UnaryOperatorClass;
1613
25
    }
1614
1615
13.0k
    BinaryOp = BO_Add;
1616
13.0k
    return Stmt::BinaryOperatorClass;
1617
1618
17.5k
  case OO_Minus:
1619
17.5k
    if (S->getNumArgs() == 1) {
1620
2.12k
      UnaryOp = UO_Minus;
1621
2.12k
      return Stmt::UnaryOperatorClass;
1622
2.12k
    }
1623
1624
15.4k
    BinaryOp = BO_Sub;
1625
15.4k
    return Stmt::BinaryOperatorClass;
1626
1627
17.9k
  case OO_Star:
1628
17.9k
    if (S->getNumArgs() == 1) {
1629
15.6k
      UnaryOp = UO_Deref;
1630
15.6k
      return Stmt::UnaryOperatorClass;
1631
15.6k
    }
1632
1633
2.31k
    BinaryOp = BO_Mul;
1634
2.31k
    return Stmt::BinaryOperatorClass;
1635
1636
2.19k
  case OO_Slash:
1637
2.19k
    BinaryOp = BO_Div;
1638
2.19k
    return Stmt::BinaryOperatorClass;
1639
1640
25
  case OO_Percent:
1641
25
    BinaryOp = BO_Rem;
1642
25
    return Stmt::BinaryOperatorClass;
1643
1644
405
  case OO_Caret:
1645
405
    BinaryOp = BO_Xor;
1646
405
    return Stmt::BinaryOperatorClass;
1647
1648
3.20k
  case OO_Amp:
1649
3.20k
    if (S->getNumArgs() == 1) {
1650
1.74k
      UnaryOp = UO_AddrOf;
1651
1.74k
      return Stmt::UnaryOperatorClass;
1652
1.74k
    }
1653
1654
1.45k
    BinaryOp = BO_And;
1655
1.45k
    return Stmt::BinaryOperatorClass;
1656
1657
1.26k
  case OO_Pipe:
1658
1.26k
    BinaryOp = BO_Or;
1659
1.26k
    return Stmt::BinaryOperatorClass;
1660
1661
760
  case OO_Tilde:
1662
760
    UnaryOp = UO_Not;
1663
760
    return Stmt::UnaryOperatorClass;
1664
1665
0
  case OO_Exclaim:
1666
0
    UnaryOp = UO_LNot;
1667
0
    return Stmt::UnaryOperatorClass;
1668
1669
0
  case OO_Equal:
1670
0
    BinaryOp = BO_Assign;
1671
0
    return Stmt::BinaryOperatorClass;
1672
1673
5.21k
  case OO_Less:
1674
5.21k
    BinaryOp = BO_LT;
1675
5.21k
    return Stmt::BinaryOperatorClass;
1676
1677
3.60k
  case OO_Greater:
1678
3.60k
    BinaryOp = BO_GT;
1679
3.60k
    return Stmt::BinaryOperatorClass;
1680
1681
0
  case OO_PlusEqual:
1682
0
    BinaryOp = BO_AddAssign;
1683
0
    return Stmt::CompoundAssignOperatorClass;
1684
1685
0
  case OO_MinusEqual:
1686
0
    BinaryOp = BO_SubAssign;
1687
0
    return Stmt::CompoundAssignOperatorClass;
1688
1689
0
  case OO_StarEqual:
1690
0
    BinaryOp = BO_MulAssign;
1691
0
    return Stmt::CompoundAssignOperatorClass;
1692
1693
0
  case OO_SlashEqual:
1694
0
    BinaryOp = BO_DivAssign;
1695
0
    return Stmt::CompoundAssignOperatorClass;
1696
1697
0
  case OO_PercentEqual:
1698
0
    BinaryOp = BO_RemAssign;
1699
0
    return Stmt::CompoundAssignOperatorClass;
1700
1701
122
  case OO_CaretEqual:
1702
122
    BinaryOp = BO_XorAssign;
1703
122
    return Stmt::CompoundAssignOperatorClass;
1704
1705
168
  case OO_AmpEqual:
1706
168
    BinaryOp = BO_AndAssign;
1707
168
    return Stmt::CompoundAssignOperatorClass;
1708
1709
230
  case OO_PipeEqual:
1710
230
    BinaryOp = BO_OrAssign;
1711
230
    return Stmt::CompoundAssignOperatorClass;
1712
1713
2.66k
  case OO_LessLess:
1714
2.66k
    BinaryOp = BO_Shl;
1715
2.66k
    return Stmt::BinaryOperatorClass;
1716
1717
1.43k
  case OO_GreaterGreater:
1718
1.43k
    BinaryOp = BO_Shr;
1719
1.43k
    return Stmt::BinaryOperatorClass;
1720
1721
27
  case OO_LessLessEqual:
1722
27
    BinaryOp = BO_ShlAssign;
1723
27
    return Stmt::CompoundAssignOperatorClass;
1724
1725
30
  case OO_GreaterGreaterEqual:
1726
30
    BinaryOp = BO_ShrAssign;
1727
30
    return Stmt::CompoundAssignOperatorClass;
1728
1729
49.1k
  case OO_EqualEqual:
1730
49.1k
    BinaryOp = BO_EQ;
1731
49.1k
    return Stmt::BinaryOperatorClass;
1732
1733
11.1k
  case OO_ExclaimEqual:
1734
11.1k
    BinaryOp = BO_NE;
1735
11.1k
    return Stmt::BinaryOperatorClass;
1736
1737
1.91k
  case OO_LessEqual:
1738
1.91k
    BinaryOp = BO_LE;
1739
1.91k
    return Stmt::BinaryOperatorClass;
1740
1741
1.71k
  case OO_GreaterEqual:
1742
1.71k
    BinaryOp = BO_GE;
1743
1.71k
    return Stmt::BinaryOperatorClass;
1744
1745
1
  case OO_Spaceship:
1746
1
    BinaryOp = BO_Cmp;
1747
1
    return Stmt::BinaryOperatorClass;
1748
1749
7.12k
  case OO_AmpAmp:
1750
7.12k
    BinaryOp = BO_LAnd;
1751
7.12k
    return Stmt::BinaryOperatorClass;
1752
1753
26
  case OO_PipePipe:
1754
26
    BinaryOp = BO_LOr;
1755
26
    return Stmt::BinaryOperatorClass;
1756
1757
0
  case OO_PlusPlus:
1758
0
    UnaryOp = S->getNumArgs() == 1? UO_PreInc
1759
0
                                  : UO_PostInc;
1760
0
    return Stmt::UnaryOperatorClass;
1761
1762
0
  case OO_MinusMinus:
1763
0
    UnaryOp = S->getNumArgs() == 1? UO_PreDec
1764
0
                                  : UO_PostDec;
1765
0
    return Stmt::UnaryOperatorClass;
1766
1767
0
  case OO_Comma:
1768
0
    BinaryOp = BO_Comma;
1769
0
    return Stmt::BinaryOperatorClass;
1770
1771
0
  case OO_ArrowStar:
1772
0
    BinaryOp = BO_PtrMemI;
1773
0
    return Stmt::BinaryOperatorClass;
1774
1775
0
  case OO_Subscript:
1776
0
    return Stmt::ArraySubscriptExprClass;
1777
1778
0
  case OO_Call:
1779
0
    return Stmt::CallExprClass;
1780
1781
2
  case OO_Coawait:
1782
2
    UnaryOp = UO_Coawait;
1783
2
    return Stmt::UnaryOperatorClass;
1784
141k
  }
1785
1786
0
  llvm_unreachable("Invalid overloaded operator expression");
1787
0
}
1788
1789
#if defined(_MSC_VER) && !defined(__clang__)
1790
#if _MSC_VER == 1911
1791
// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1792
// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1793
// will crash in stage 2 of a bootstrap build.
1794
#pragma optimize("", off)
1795
#endif
1796
#endif
1797
1798
144k
void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1799
144k
  if (S->isTypeDependent()) {
1800
    // Type-dependent operator calls are profiled like their underlying
1801
    // syntactic operator.
1802
    //
1803
    // An operator call to operator-> is always implicit, so just skip it. The
1804
    // enclosing MemberExpr will profile the actual member access.
1805
141k
    if (S->getOperator() == OO_Arrow)
1806
0
      return Visit(S->getArg(0));
1807
1808
141k
    UnaryOperatorKind UnaryOp = UO_Extension;
1809
141k
    BinaryOperatorKind BinaryOp = BO_Comma;
1810
141k
    Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
1811
1812
141k
    ID.AddInteger(SC);
1813
402k
    for (unsigned I = 0, N = S->getNumArgs(); I != N; 
++I261k
)
1814
261k
      Visit(S->getArg(I));
1815
141k
    if (SC == Stmt::UnaryOperatorClass)
1816
20.3k
      ID.AddInteger(UnaryOp);
1817
120k
    else if (SC == Stmt::BinaryOperatorClass ||
1818
120k
             
SC == Stmt::CompoundAssignOperatorClass577
)
1819
120k
      ID.AddInteger(BinaryOp);
1820
0
    else
1821
0
      assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1822
1823
0
    return;
1824
141k
  }
1825
1826
3.48k
  VisitCallExpr(S);
1827
3.48k
  ID.AddInteger(S->getOperator());
1828
3.48k
}
1829
1830
void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1831
3
    const CXXRewrittenBinaryOperator *S) {
1832
  // If a rewritten operator were ever to be type-dependent, we should profile
1833
  // it following its syntactic operator.
1834
3
  assert(!S->isTypeDependent() &&
1835
3
         "resolved rewritten operator should never be type-dependent");
1836
0
  ID.AddBoolean(S->isReversed());
1837
3
  VisitExpr(S->getSemanticForm());
1838
3
}
1839
1840
#if defined(_MSC_VER) && !defined(__clang__)
1841
#if _MSC_VER == 1911
1842
#pragma optimize("", on)
1843
#endif
1844
#endif
1845
1846
9.34k
void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1847
9.34k
  VisitCallExpr(S);
1848
9.34k
}
1849
1850
1
void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1851
1
  VisitCallExpr(S);
1852
1
}
1853
1854
0
void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1855
0
  VisitExpr(S);
1856
0
}
1857
1858
59.2k
void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1859
59.2k
  VisitExplicitCastExpr(S);
1860
59.2k
}
1861
1862
58.3k
void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1863
58.3k
  VisitCXXNamedCastExpr(S);
1864
58.3k
}
1865
1866
69
void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1867
69
  VisitCXXNamedCastExpr(S);
1868
69
}
1869
1870
void
1871
216
StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1872
216
  VisitCXXNamedCastExpr(S);
1873
216
}
1874
1875
668
void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1876
668
  VisitCXXNamedCastExpr(S);
1877
668
}
1878
1879
49
void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1880
49
  VisitExpr(S);
1881
49
  VisitType(S->getTypeInfoAsWritten()->getType());
1882
49
}
1883
1884
0
void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1885
0
  VisitCXXNamedCastExpr(S);
1886
0
}
1887
1888
7
void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1889
7
  VisitCallExpr(S);
1890
7
}
1891
1892
38.3k
void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1893
38.3k
  VisitExpr(S);
1894
38.3k
  ID.AddBoolean(S->getValue());
1895
38.3k
}
1896
1897
7.40k
void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1898
7.40k
  VisitExpr(S);
1899
7.40k
}
1900
1901
void StmtProfiler::VisitCXXStdInitializerListExpr(
1902
8
    const CXXStdInitializerListExpr *S) {
1903
8
  VisitExpr(S);
1904
8
}
1905
1906
110
void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1907
110
  VisitExpr(S);
1908
110
  if (S->isTypeOperand())
1909
107
    VisitType(S->getTypeOperandSourceInfo()->getType());
1910
110
}
1911
1912
6
void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1913
6
  VisitExpr(S);
1914
6
  if (S->isTypeOperand())
1915
2
    VisitType(S->getTypeOperandSourceInfo()->getType());
1916
6
}
1917
1918
26
void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1919
26
  VisitExpr(S);
1920
26
  VisitDecl(S->getPropertyDecl());
1921
26
}
1922
1923
void StmtProfiler::VisitMSPropertySubscriptExpr(
1924
44
    const MSPropertySubscriptExpr *S) {
1925
44
  VisitExpr(S);
1926
44
}
1927
1928
87.6k
void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1929
87.6k
  VisitExpr(S);
1930
87.6k
  ID.AddBoolean(S->isImplicit());
1931
87.6k
}
1932
1933
667
void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1934
667
  VisitExpr(S);
1935
667
}
1936
1937
1.50k
void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1938
1.50k
  VisitExpr(S);
1939
1.50k
  VisitDecl(S->getParam());
1940
1.50k
}
1941
1942
0
void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1943
0
  VisitExpr(S);
1944
0
  VisitDecl(S->getField());
1945
0
}
1946
1947
2.59k
void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
1948
2.59k
  VisitExpr(S);
1949
2.59k
  VisitDecl(
1950
2.59k
         const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1951
2.59k
}
1952
1953
10.7k
void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
1954
10.7k
  VisitExpr(S);
1955
10.7k
  VisitDecl(S->getConstructor());
1956
10.7k
  ID.AddBoolean(S->isElidable());
1957
10.7k
}
1958
1959
void StmtProfiler::VisitCXXInheritedCtorInitExpr(
1960
0
    const CXXInheritedCtorInitExpr *S) {
1961
0
  VisitExpr(S);
1962
0
  VisitDecl(S->getConstructor());
1963
0
}
1964
1965
5.48k
void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
1966
5.48k
  VisitExplicitCastExpr(S);
1967
5.48k
}
1968
1969
void
1970
1.17k
StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
1971
1.17k
  VisitCXXConstructExpr(S);
1972
1.17k
}
1973
1974
void
1975
642
StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1976
  // Do not recursively visit the children of this expression. Profiling the
1977
  // body would result in unnecessary work, and is not safe to do during
1978
  // deserialization.
1979
642
  VisitStmtNoChildren(S);
1980
1981
  // C++20 [temp.over.link]p5:
1982
  //   Two lambda-expressions are never considered equivalent.
1983
642
  VisitDecl(S->getLambdaClass());
1984
642
}
1985
1986
void
1987
742
StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
1988
742
  VisitExpr(S);
1989
742
}
1990
1991
3.41k
void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
1992
3.41k
  VisitExpr(S);
1993
3.41k
  ID.AddBoolean(S->isGlobalDelete());
1994
3.41k
  ID.AddBoolean(S->isArrayForm());
1995
3.41k
  VisitDecl(S->getOperatorDelete());
1996
3.41k
}
1997
1998
1.33k
void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
1999
1.33k
  VisitExpr(S);
2000
1.33k
  VisitType(S->getAllocatedType());
2001
1.33k
  VisitDecl(S->getOperatorNew());
2002
1.33k
  VisitDecl(S->getOperatorDelete());
2003
1.33k
  ID.AddBoolean(S->isArray());
2004
1.33k
  ID.AddInteger(S->getNumPlacementArgs());
2005
1.33k
  ID.AddBoolean(S->isGlobalNew());
2006
1.33k
  ID.AddBoolean(S->isParenTypeId());
2007
1.33k
  ID.AddInteger(S->getInitializationStyle());
2008
1.33k
}
2009
2010
void
2011
5.05k
StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
2012
5.05k
  VisitExpr(S);
2013
5.05k
  ID.AddBoolean(S->isArrow());
2014
5.05k
  VisitNestedNameSpecifier(S->getQualifier());
2015
5.05k
  ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
2016
5.05k
  if (S->getScopeTypeInfo())
2017
3
    VisitType(S->getScopeTypeInfo()->getType());
2018
5.05k
  ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
2019
5.05k
  if (S->getDestroyedTypeInfo())
2020
5.04k
    VisitType(S->getDestroyedType());
2021
2
  else
2022
2
    VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
2023
5.05k
}
2024
2025
318k
void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
2026
318k
  VisitExpr(S);
2027
318k
  VisitNestedNameSpecifier(S->getQualifier());
2028
318k
  VisitName(S->getName(), /*TreatAsDecl*/ true);
2029
318k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2030
318k
  if (S->hasExplicitTemplateArgs())
2031
266k
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2032
318k
}
2033
2034
void
2035
318k
StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
2036
318k
  VisitOverloadExpr(S);
2037
318k
}
2038
2039
355k
void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
2040
355k
  VisitExpr(S);
2041
355k
  ID.AddInteger(S->getTrait());
2042
355k
  ID.AddInteger(S->getNumArgs());
2043
881k
  for (unsigned I = 0, N = S->getNumArgs(); I != N; 
++I526k
)
2044
526k
    VisitType(S->getArg(I)->getType());
2045
355k
}
2046
2047
4.65k
void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
2048
4.65k
  VisitExpr(S);
2049
4.65k
  ID.AddInteger(S->getTrait());
2050
4.65k
  VisitType(S->getQueriedType());
2051
4.65k
}
2052
2053
9
void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
2054
9
  VisitExpr(S);
2055
9
  ID.AddInteger(S->getTrait());
2056
9
  VisitExpr(S->getQueriedExpression());
2057
9
}
2058
2059
void StmtProfiler::VisitDependentScopeDeclRefExpr(
2060
4.24M
    const DependentScopeDeclRefExpr *S) {
2061
4.24M
  VisitExpr(S);
2062
4.24M
  VisitName(S->getDeclName());
2063
4.24M
  VisitNestedNameSpecifier(S->getQualifier());
2064
4.24M
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2065
4.24M
  if (S->hasExplicitTemplateArgs())
2066
59.2k
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2067
4.24M
}
2068
2069
4.97k
void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
2070
4.97k
  VisitExpr(S);
2071
4.97k
}
2072
2073
void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2074
47.3k
    const CXXUnresolvedConstructExpr *S) {
2075
47.3k
  VisitExpr(S);
2076
47.3k
  VisitType(S->getTypeAsWritten());
2077
47.3k
  ID.AddInteger(S->isListInitialization());
2078
47.3k
}
2079
2080
void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2081
208k
    const CXXDependentScopeMemberExpr *S) {
2082
208k
  ID.AddBoolean(S->isImplicitAccess());
2083
208k
  if (!S->isImplicitAccess()) {
2084
169k
    VisitExpr(S);
2085
169k
    ID.AddBoolean(S->isArrow());
2086
169k
  }
2087
208k
  VisitNestedNameSpecifier(S->getQualifier());
2088
208k
  VisitName(S->getMember());
2089
208k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2090
208k
  if (S->hasExplicitTemplateArgs())
2091
148
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2092
208k
}
2093
2094
16.5k
void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
2095
16.5k
  ID.AddBoolean(S->isImplicitAccess());
2096
16.5k
  if (!S->isImplicitAccess()) {
2097
379
    VisitExpr(S);
2098
379
    ID.AddBoolean(S->isArrow());
2099
379
  }
2100
16.5k
  VisitNestedNameSpecifier(S->getQualifier());
2101
16.5k
  VisitName(S->getMemberName());
2102
16.5k
  ID.AddBoolean(S->hasExplicitTemplateArgs());
2103
16.5k
  if (S->hasExplicitTemplateArgs())
2104
274
    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
2105
16.5k
}
2106
2107
64.8k
void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
2108
64.8k
  VisitExpr(S);
2109
64.8k
}
2110
2111
161k
void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2112
161k
  VisitExpr(S);
2113
161k
}
2114
2115
253k
void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2116
253k
  VisitExpr(S);
2117
253k
  VisitDecl(S->getPack());
2118
253k
  if (S->isPartiallySubstituted()) {
2119
37.6k
    auto Args = S->getPartialArguments();
2120
37.6k
    ID.AddInteger(Args.size());
2121
37.6k
    for (const auto &TA : Args)
2122
46.3k
      VisitTemplateArgument(TA);
2123
216k
  } else {
2124
216k
    ID.AddInteger(0);
2125
216k
  }
2126
253k
}
2127
2128
void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2129
18
    const SubstNonTypeTemplateParmPackExpr *S) {
2130
18
  VisitExpr(S);
2131
18
  VisitDecl(S->getParameterPack());
2132
18
  VisitTemplateArgument(S->getArgumentPack());
2133
18
}
2134
2135
void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2136
1.08M
    const SubstNonTypeTemplateParmExpr *E) {
2137
  // Profile exactly as the replacement expression.
2138
1.08M
  Visit(E->getReplacement());
2139
1.08M
}
2140
2141
92
void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2142
92
  VisitExpr(S);
2143
92
  VisitDecl(S->getParameterPack());
2144
92
  ID.AddInteger(S->getNumExpansions());
2145
600
  for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; 
++I508
)
2146
508
    VisitDecl(*I);
2147
92
}
2148
2149
void StmtProfiler::VisitMaterializeTemporaryExpr(
2150
4.20k
                                           const MaterializeTemporaryExpr *S) {
2151
4.20k
  VisitExpr(S);
2152
4.20k
}
2153
2154
82
void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2155
82
  VisitExpr(S);
2156
82
  ID.AddInteger(S->getOperator());
2157
82
}
2158
2159
5
void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2160
5
  VisitStmt(S);
2161
5
}
2162
2163
4
void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2164
4
  VisitStmt(S);
2165
4
}
2166
2167
12
void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2168
12
  VisitExpr(S);
2169
12
}
2170
2171
2
void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2172
2
  VisitExpr(S);
2173
2
}
2174
2175
1
void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2176
1
  VisitExpr(S);
2177
1
}
2178
2179
614
void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2180
614
  VisitExpr(E);
2181
614
}
2182
2183
0
void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2184
0
  VisitExpr(E);
2185
0
}
2186
2187
0
void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2188
0
  VisitExpr(E);
2189
0
}
2190
2191
144
void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2192
2193
4
void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2194
4
  VisitExpr(S);
2195
4
}
2196
2197
21
void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2198
21
  VisitExpr(E);
2199
21
}
2200
2201
4
void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2202
4
  VisitExpr(E);
2203
4
}
2204
2205
6
void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2206
6
  VisitExpr(E);
2207
6
}
2208
2209
0
void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2210
0
  VisitExpr(S);
2211
0
  VisitType(S->getEncodedType());
2212
0
}
2213
2214
1
void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2215
1
  VisitExpr(S);
2216
1
  VisitName(S->getSelector());
2217
1
}
2218
2219
0
void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2220
0
  VisitExpr(S);
2221
0
  VisitDecl(S->getProtocol());
2222
0
}
2223
2224
11
void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2225
11
  VisitExpr(S);
2226
11
  VisitDecl(S->getDecl());
2227
11
  ID.AddBoolean(S->isArrow());
2228
11
  ID.AddBoolean(S->isFreeIvar());
2229
11
}
2230
2231
2
void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2232
2
  VisitExpr(S);
2233
2
  if (S->isImplicitProperty()) {
2234
1
    VisitDecl(S->getImplicitPropertyGetter());
2235
1
    VisitDecl(S->getImplicitPropertySetter());
2236
1
  } else {
2237
1
    VisitDecl(S->getExplicitProperty());
2238
1
  }
2239
2
  if (S->isSuperReceiver()) {
2240
0
    ID.AddBoolean(S->isSuperReceiver());
2241
0
    VisitType(S->getSuperReceiverType());
2242
0
  }
2243
2
}
2244
2245
9
void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2246
9
  VisitExpr(S);
2247
9
  VisitDecl(S->getAtIndexMethodDecl());
2248
9
  VisitDecl(S->setAtIndexMethodDecl());
2249
9
}
2250
2251
41
void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2252
41
  VisitExpr(S);
2253
41
  VisitName(S->getSelector());
2254
41
  VisitDecl(S->getMethodDecl());
2255
41
}
2256
2257
0
void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2258
0
  VisitExpr(S);
2259
0
  ID.AddBoolean(S->isArrow());
2260
0
}
2261
2262
28
void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2263
28
  VisitExpr(S);
2264
28
  ID.AddBoolean(S->getValue());
2265
28
}
2266
2267
void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2268
0
    const ObjCIndirectCopyRestoreExpr *S) {
2269
0
  VisitExpr(S);
2270
0
  ID.AddBoolean(S->shouldCopy());
2271
0
}
2272
2273
11
void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2274
11
  VisitExplicitCastExpr(S);
2275
11
  ID.AddBoolean(S->getBridgeKind());
2276
11
}
2277
2278
void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2279
0
    const ObjCAvailabilityCheckExpr *S) {
2280
0
  VisitExpr(S);
2281
0
}
2282
2283
void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2284
328k
                                          unsigned NumArgs) {
2285
328k
  ID.AddInteger(NumArgs);
2286
871k
  for (unsigned I = 0; I != NumArgs; 
++I543k
)
2287
543k
    VisitTemplateArgument(Args[I].getArgument());
2288
328k
}
2289
2290
589k
void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2291
  // Mostly repetitive with TemplateArgument::Profile!
2292
589k
  ID.AddInteger(Arg.getKind());
2293
589k
  switch (Arg.getKind()) {
2294
0
  case TemplateArgument::Null:
2295
0
    break;
2296
2297
573k
  case TemplateArgument::Type:
2298
573k
    VisitType(Arg.getAsType());
2299
573k
    break;
2300
2301
13.1k
  case TemplateArgument::Template:
2302
13.1k
  case TemplateArgument::TemplateExpansion:
2303
13.1k
    VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2304
13.1k
    break;
2305
2306
1
  case TemplateArgument::Declaration:
2307
1
    VisitType(Arg.getParamTypeForDecl());
2308
    // FIXME: Do we need to recursively decompose template parameter objects?
2309
1
    VisitDecl(Arg.getAsDecl());
2310
1
    break;
2311
2312
0
  case TemplateArgument::NullPtr:
2313
0
    VisitType(Arg.getNullPtrType());
2314
0
    break;
2315
2316
32
  case TemplateArgument::Integral:
2317
32
    VisitType(Arg.getIntegralType());
2318
32
    Arg.getAsIntegral().Profile(ID);
2319
32
    break;
2320
2321
3.44k
  case TemplateArgument::Expression:
2322
3.44k
    Visit(Arg.getAsExpr());
2323
3.44k
    break;
2324
2325
36
  case TemplateArgument::Pack:
2326
36
    for (const auto &P : Arg.pack_elements())
2327
69
      VisitTemplateArgument(P);
2328
36
    break;
2329
589k
  }
2330
589k
}
2331
2332
void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2333
6.09M
                   bool Canonical) const {
2334
6.09M
  StmtProfilerWithPointers Profiler(ID, Context, Canonical);
2335
6.09M
  Profiler.Visit(this);
2336
6.09M
}
2337
2338
void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2339
401k
                          class ODRHash &Hash) const {
2340
401k
  StmtProfilerWithoutPointers Profiler(ID, Hash);
2341
401k
  Profiler.Visit(this);
2342
401k
}