Coverage Report

Created: 2020-02-25 14:32

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