Coverage Report

Created: 2019-07-24 05:18

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