Coverage Report

Created: 2020-09-15 12:33

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