blob: 1b6c83fe30fe37fba1d1a50b87c0fc4def6dd9e9 [file] [log] [blame]
Douglas Gregor5c193b92009-07-28 00:33:38 +00001//===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Stmt::Profile method, which builds a unique bit
Douglas Gregor32615a12009-07-28 16:39:25 +000011// representation that identifies a statement/expression.
Douglas Gregor5c193b92009-07-28 00:33:38 +000012//
13//===----------------------------------------------------------------------===//
14#include "clang/AST/ASTContext.h"
Douglas Gregora7095092009-07-28 14:44:31 +000015#include "clang/AST/DeclCXX.h"
16#include "clang/AST/DeclObjC.h"
Douglas Gregor5c193b92009-07-28 00:33:38 +000017#include "clang/AST/DeclTemplate.h"
18#include "clang/AST/Expr.h"
19#include "clang/AST/ExprCXX.h"
20#include "clang/AST/ExprObjC.h"
Alexey Bataev1a3320e2015-08-25 14:24:04 +000021#include "clang/AST/ExprOpenMP.h"
Richard Trieu639d7b62017-02-22 22:22:42 +000022#include "clang/AST/ODRHash.h"
Douglas Gregor5c193b92009-07-28 00:33:38 +000023#include "clang/AST/StmtVisitor.h"
24#include "llvm/ADT/FoldingSet.h"
Douglas Gregor5c193b92009-07-28 00:33:38 +000025using namespace clang;
26
27namespace {
Chandler Carruth631abd92011-06-16 06:47:06 +000028 class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
Richard Trieu639d7b62017-02-22 22:22:42 +000029 protected:
Douglas Gregor5c193b92009-07-28 00:33:38 +000030 llvm::FoldingSetNodeID &ID;
Douglas Gregor5c193b92009-07-28 00:33:38 +000031 bool Canonical;
Mike Stump11289f42009-09-09 15:08:12 +000032
Douglas Gregor5c193b92009-07-28 00:33:38 +000033 public:
Richard Trieu639d7b62017-02-22 22:22:42 +000034 StmtProfiler(llvm::FoldingSetNodeID &ID, bool Canonical)
35 : ID(ID), Canonical(Canonical) {}
36
37 virtual ~StmtProfiler() {}
Mike Stump11289f42009-09-09 15:08:12 +000038
Chandler Carruth631abd92011-06-16 06:47:06 +000039 void VisitStmt(const Stmt *S);
Mike Stump11289f42009-09-09 15:08:12 +000040
Chandler Carruth631abd92011-06-16 06:47:06 +000041#define STMT(Node, Base) void Visit##Node(const Node *S);
Alexis Hunt656bb312010-05-05 15:24:00 +000042#include "clang/AST/StmtNodes.inc"
Mike Stump11289f42009-09-09 15:08:12 +000043
Douglas Gregor5c193b92009-07-28 00:33:38 +000044 /// \brief Visit a declaration that is referenced within an expression
45 /// or statement.
Richard Trieu639d7b62017-02-22 22:22:42 +000046 virtual void VisitDecl(const Decl *D) = 0;
Mike Stump11289f42009-09-09 15:08:12 +000047
48 /// \brief Visit a type that is referenced within an expression or
Douglas Gregor5c193b92009-07-28 00:33:38 +000049 /// statement.
Richard Trieu639d7b62017-02-22 22:22:42 +000050 virtual void VisitType(QualType T) = 0;
Mike Stump11289f42009-09-09 15:08:12 +000051
Douglas Gregor5c193b92009-07-28 00:33:38 +000052 /// \brief Visit a name that occurs within an expression or statement.
Richard Trieu639d7b62017-02-22 22:22:42 +000053 virtual void VisitName(DeclarationName Name) = 0;
54
55 /// \brief Visit identifiers that are not in Decl's or Type's.
56 virtual void VisitIdentifierInfo(IdentifierInfo *II) = 0;
Mike Stump11289f42009-09-09 15:08:12 +000057
Douglas Gregor5c193b92009-07-28 00:33:38 +000058 /// \brief Visit a nested-name-specifier that occurs within an expression
59 /// or statement.
Richard Trieu639d7b62017-02-22 22:22:42 +000060 virtual void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) = 0;
Mike Stump11289f42009-09-09 15:08:12 +000061
Douglas Gregor5c193b92009-07-28 00:33:38 +000062 /// \brief Visit a template name that occurs within an expression or
63 /// statement.
Richard Trieu639d7b62017-02-22 22:22:42 +000064 virtual void VisitTemplateName(TemplateName Name) = 0;
Mike Stump11289f42009-09-09 15:08:12 +000065
Douglas Gregor5c193b92009-07-28 00:33:38 +000066 /// \brief Visit template arguments that occur within an expression or
67 /// statement.
Chandler Carruth631abd92011-06-16 06:47:06 +000068 void VisitTemplateArguments(const TemplateArgumentLoc *Args,
69 unsigned NumArgs);
John McCall0ad16662009-10-29 08:12:44 +000070
71 /// \brief Visit a single template argument.
72 void VisitTemplateArgument(const TemplateArgument &Arg);
Douglas Gregor5c193b92009-07-28 00:33:38 +000073 };
Richard Trieu639d7b62017-02-22 22:22:42 +000074
75 class StmtProfilerWithPointers : public StmtProfiler {
76 const ASTContext &Context;
77
78 public:
79 StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
80 const ASTContext &Context, bool Canonical)
81 : StmtProfiler(ID, Canonical), Context(Context) {}
82 private:
83 void VisitDecl(const Decl *D) override {
84 ID.AddInteger(D ? D->getKind() : 0);
85
86 if (Canonical && D) {
87 if (const NonTypeTemplateParmDecl *NTTP =
88 dyn_cast<NonTypeTemplateParmDecl>(D)) {
89 ID.AddInteger(NTTP->getDepth());
90 ID.AddInteger(NTTP->getIndex());
91 ID.AddBoolean(NTTP->isParameterPack());
92 VisitType(NTTP->getType());
93 return;
94 }
95
96 if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
97 // The Itanium C++ ABI uses the type, scope depth, and scope
98 // index of a parameter when mangling expressions that involve
99 // function parameters, so we will use the parameter's type for
100 // establishing function parameter identity. That way, our
101 // definition of "equivalent" (per C++ [temp.over.link]) is at
102 // least as strong as the definition of "equivalent" used for
103 // name mangling.
104 VisitType(Parm->getType());
105 ID.AddInteger(Parm->getFunctionScopeDepth());
106 ID.AddInteger(Parm->getFunctionScopeIndex());
107 return;
108 }
109
110 if (const TemplateTypeParmDecl *TTP =
111 dyn_cast<TemplateTypeParmDecl>(D)) {
112 ID.AddInteger(TTP->getDepth());
113 ID.AddInteger(TTP->getIndex());
114 ID.AddBoolean(TTP->isParameterPack());
115 return;
116 }
117
118 if (const TemplateTemplateParmDecl *TTP =
119 dyn_cast<TemplateTemplateParmDecl>(D)) {
120 ID.AddInteger(TTP->getDepth());
121 ID.AddInteger(TTP->getIndex());
122 ID.AddBoolean(TTP->isParameterPack());
123 return;
124 }
125 }
126
127 ID.AddPointer(D ? D->getCanonicalDecl() : nullptr);
128 }
129
130 void VisitType(QualType T) override {
Richard Trieua5f4ade2017-03-04 02:42:41 +0000131 if (Canonical && !T.isNull())
Richard Trieu639d7b62017-02-22 22:22:42 +0000132 T = Context.getCanonicalType(T);
133
134 ID.AddPointer(T.getAsOpaquePtr());
135 }
136
137 void VisitName(DeclarationName Name) override {
138 ID.AddPointer(Name.getAsOpaquePtr());
139 }
140
141 void VisitIdentifierInfo(IdentifierInfo *II) override {
142 ID.AddPointer(II);
143 }
144
145 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
146 if (Canonical)
147 NNS = Context.getCanonicalNestedNameSpecifier(NNS);
148 ID.AddPointer(NNS);
149 }
150
151 void VisitTemplateName(TemplateName Name) override {
152 if (Canonical)
153 Name = Context.getCanonicalTemplateName(Name);
154
155 Name.Profile(ID);
156 }
157 };
158
159 class StmtProfilerWithoutPointers : public StmtProfiler {
160 ODRHash &Hash;
161 public:
162 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
163 : StmtProfiler(ID, false), Hash(Hash) {}
164
165 private:
166 void VisitType(QualType T) override {
167 Hash.AddQualType(T);
168 }
169
170 void VisitName(DeclarationName Name) override {
171 Hash.AddDeclarationName(Name);
172 }
173 void VisitIdentifierInfo(IdentifierInfo *II) override {
174 ID.AddBoolean(II);
175 if (II) {
176 Hash.AddIdentifierInfo(II);
177 }
178 }
179 void VisitDecl(const Decl *D) override {
180 ID.AddBoolean(D);
181 if (D) {
182 Hash.AddDecl(D);
183 }
184 }
185 void VisitTemplateName(TemplateName Name) override {
186 Hash.AddTemplateName(Name);
187 }
188 void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
Richard Trieu96b41642017-07-01 02:00:05 +0000189 ID.AddBoolean(NNS);
190 if (NNS) {
191 Hash.AddNestedNameSpecifier(NNS);
192 }
Richard Trieu639d7b62017-02-22 22:22:42 +0000193 }
194 };
Alexander Kornienkoab9db512015-06-22 23:07:51 +0000195}
Douglas Gregor5c193b92009-07-28 00:33:38 +0000196
Chandler Carruth631abd92011-06-16 06:47:06 +0000197void StmtProfiler::VisitStmt(const Stmt *S) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000198 assert(S && "Requires non-null Stmt pointer");
Douglas Gregor5c193b92009-07-28 00:33:38 +0000199 ID.AddInteger(S->getStmtClass());
Benjamin Kramer642f1732015-07-02 21:03:14 +0000200 for (const Stmt *SubStmt : S->children()) {
201 if (SubStmt)
202 Visit(SubStmt);
Peter Collingbournecdb9f302012-03-01 16:34:31 +0000203 else
204 ID.AddInteger(0);
205 }
Douglas Gregor5c193b92009-07-28 00:33:38 +0000206}
207
Chandler Carruth631abd92011-06-16 06:47:06 +0000208void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000209 VisitStmt(S);
Aaron Ballman535bbcc2014-03-14 17:01:24 +0000210 for (const auto *D : S->decls())
211 VisitDecl(D);
Douglas Gregor44882592009-07-28 15:27:13 +0000212}
213
Chandler Carruth631abd92011-06-16 06:47:06 +0000214void StmtProfiler::VisitNullStmt(const NullStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000215 VisitStmt(S);
216}
217
Chandler Carruth631abd92011-06-16 06:47:06 +0000218void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000219 VisitStmt(S);
220}
221
Chandler Carruth631abd92011-06-16 06:47:06 +0000222void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000223 VisitStmt(S);
224}
225
Chandler Carruth631abd92011-06-16 06:47:06 +0000226void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000227 VisitStmt(S);
228}
229
Chandler Carruth631abd92011-06-16 06:47:06 +0000230void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000231 VisitStmt(S);
Chris Lattnerc8e630e2011-02-17 07:39:24 +0000232 VisitDecl(S->getDecl());
Douglas Gregor44882592009-07-28 15:27:13 +0000233}
234
Richard Smithc202b282012-04-14 00:33:13 +0000235void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
236 VisitStmt(S);
237 // TODO: maybe visit attributes?
238}
239
Chandler Carruth631abd92011-06-16 06:47:06 +0000240void StmtProfiler::VisitIfStmt(const IfStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000241 VisitStmt(S);
Douglas Gregor7bab5ff2009-11-25 00:27:52 +0000242 VisitDecl(S->getConditionVariable());
Douglas Gregor44882592009-07-28 15:27:13 +0000243}
244
Chandler Carruth631abd92011-06-16 06:47:06 +0000245void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
Douglas Gregor00044172009-07-29 16:09:57 +0000246 VisitStmt(S);
Douglas Gregor7bab5ff2009-11-25 00:27:52 +0000247 VisitDecl(S->getConditionVariable());
Douglas Gregor00044172009-07-29 16:09:57 +0000248}
249
Chandler Carruth631abd92011-06-16 06:47:06 +0000250void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000251 VisitStmt(S);
Douglas Gregor7bab5ff2009-11-25 00:27:52 +0000252 VisitDecl(S->getConditionVariable());
Douglas Gregor44882592009-07-28 15:27:13 +0000253}
254
Chandler Carruth631abd92011-06-16 06:47:06 +0000255void StmtProfiler::VisitDoStmt(const DoStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000256 VisitStmt(S);
257}
258
Chandler Carruth631abd92011-06-16 06:47:06 +0000259void StmtProfiler::VisitForStmt(const ForStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000260 VisitStmt(S);
261}
262
Chandler Carruth631abd92011-06-16 06:47:06 +0000263void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000264 VisitStmt(S);
Chris Lattnerc8e630e2011-02-17 07:39:24 +0000265 VisitDecl(S->getLabel());
Douglas Gregor44882592009-07-28 15:27:13 +0000266}
267
Chandler Carruth631abd92011-06-16 06:47:06 +0000268void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000269 VisitStmt(S);
270}
271
Chandler Carruth631abd92011-06-16 06:47:06 +0000272void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000273 VisitStmt(S);
274}
275
Chandler Carruth631abd92011-06-16 06:47:06 +0000276void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000277 VisitStmt(S);
278}
279
Chandler Carruth631abd92011-06-16 06:47:06 +0000280void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000281 VisitStmt(S);
282}
283
Chad Rosierde70e0e2012-08-25 00:11:56 +0000284void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000285 VisitStmt(S);
286 ID.AddBoolean(S->isVolatile());
287 ID.AddBoolean(S->isSimple());
288 VisitStringLiteral(S->getAsmString());
289 ID.AddInteger(S->getNumOutputs());
290 for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
291 ID.AddString(S->getOutputName(I));
292 VisitStringLiteral(S->getOutputConstraintLiteral(I));
293 }
294 ID.AddInteger(S->getNumInputs());
295 for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
296 ID.AddString(S->getInputName(I));
297 VisitStringLiteral(S->getInputConstraintLiteral(I));
298 }
299 ID.AddInteger(S->getNumClobbers());
300 for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
Chad Rosierd9fb09a2012-08-27 23:28:41 +0000301 VisitStringLiteral(S->getClobberStringLiteral(I));
Douglas Gregor44882592009-07-28 15:27:13 +0000302}
303
Chad Rosier32503022012-06-11 20:47:18 +0000304void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
305 // FIXME: Implement MS style inline asm statement profiler.
306 VisitStmt(S);
307}
308
Chandler Carruth631abd92011-06-16 06:47:06 +0000309void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000310 VisitStmt(S);
311 VisitType(S->getCaughtType());
312}
313
Chandler Carruth631abd92011-06-16 06:47:06 +0000314void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000315 VisitStmt(S);
316}
317
Chandler Carruth631abd92011-06-16 06:47:06 +0000318void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
Richard Smith02e85f32011-04-14 22:09:26 +0000319 VisitStmt(S);
320}
321
Douglas Gregordeb4a2be2011-10-25 01:33:02 +0000322void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
323 VisitStmt(S);
324 ID.AddBoolean(S->isIfExists());
325 VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
326 VisitName(S->getNameInfo().getName());
327}
328
Chandler Carruth631abd92011-06-16 06:47:06 +0000329void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
John Wiegley1c0675e2011-04-28 01:08:34 +0000330 VisitStmt(S);
331}
332
Chandler Carruth631abd92011-06-16 06:47:06 +0000333void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
John Wiegley1c0675e2011-04-28 01:08:34 +0000334 VisitStmt(S);
335}
336
Chandler Carruth631abd92011-06-16 06:47:06 +0000337void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
John Wiegley1c0675e2011-04-28 01:08:34 +0000338 VisitStmt(S);
339}
340
Nico Weber9b982072014-07-07 00:12:30 +0000341void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
342 VisitStmt(S);
343}
344
Tareq A. Siraj24110cc2013-04-16 18:53:08 +0000345void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
346 VisitStmt(S);
347}
348
Chandler Carruth631abd92011-06-16 06:47:06 +0000349void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000350 VisitStmt(S);
351}
352
Chandler Carruth631abd92011-06-16 06:47:06 +0000353void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000354 VisitStmt(S);
355 ID.AddBoolean(S->hasEllipsis());
356 if (S->getCatchParamDecl())
357 VisitType(S->getCatchParamDecl()->getType());
358}
359
Chandler Carruth631abd92011-06-16 06:47:06 +0000360void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000361 VisitStmt(S);
362}
363
Chandler Carruth631abd92011-06-16 06:47:06 +0000364void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000365 VisitStmt(S);
366}
367
Chandler Carruth631abd92011-06-16 06:47:06 +0000368void
369StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000370 VisitStmt(S);
371}
372
Chandler Carruth631abd92011-06-16 06:47:06 +0000373void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
Douglas Gregor44882592009-07-28 15:27:13 +0000374 VisitStmt(S);
375}
376
Chandler Carruth631abd92011-06-16 06:47:06 +0000377void
378StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
John McCall31168b02011-06-15 23:02:42 +0000379 VisitStmt(S);
380}
381
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000382namespace {
383class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
384 StmtProfiler *Profiler;
Alexey Bataev756c1962013-09-24 03:17:45 +0000385 /// \brief Process clauses with list of variables.
386 template <typename T>
387 void VisitOMPClauseList(T *Node);
NAKAMURA Takumiaa13f942015-12-09 07:52:46 +0000388
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000389public:
390 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
391#define OPENMP_CLAUSE(Name, Class) \
392 void Visit##Class(const Class *C);
393#include "clang/Basic/OpenMPKinds.def"
Alexey Bataev3392d762016-02-16 11:18:12 +0000394 void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
Alexey Bataev005248a2016-02-25 05:25:57 +0000395 void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000396};
397
Alexey Bataev3392d762016-02-16 11:18:12 +0000398void OMPClauseProfiler::VistOMPClauseWithPreInit(
399 const OMPClauseWithPreInit *C) {
400 if (auto *S = C->getPreInitStmt())
401 Profiler->VisitStmt(S);
402}
403
Alexey Bataev005248a2016-02-25 05:25:57 +0000404void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
405 const OMPClauseWithPostUpdate *C) {
Alexey Bataev37e594c2016-03-04 07:21:16 +0000406 VistOMPClauseWithPreInit(C);
Alexey Bataev005248a2016-02-25 05:25:57 +0000407 if (auto *E = C->getPostUpdateExpr())
408 Profiler->VisitStmt(E);
409}
410
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000411void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
Arpith Chacko Jacobfe4890a2017-01-18 20:40:48 +0000412 VistOMPClauseWithPreInit(C);
Alexey Bataevaadd52e2014-02-13 05:29:23 +0000413 if (C->getCondition())
414 Profiler->VisitStmt(C->getCondition());
415}
416
Alexey Bataev3778b602014-07-17 07:32:53 +0000417void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
418 if (C->getCondition())
419 Profiler->VisitStmt(C->getCondition());
420}
421
Alexey Bataev568a8332014-03-06 06:15:19 +0000422void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
Arpith Chacko Jacob33c849a2017-01-25 00:57:16 +0000423 VistOMPClauseWithPreInit(C);
Alexey Bataev568a8332014-03-06 06:15:19 +0000424 if (C->getNumThreads())
425 Profiler->VisitStmt(C->getNumThreads());
426}
427
Alexey Bataev62c87d22014-03-21 04:51:18 +0000428void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
429 if (C->getSafelen())
430 Profiler->VisitStmt(C->getSafelen());
431}
432
Alexey Bataev66b15b52015-08-21 11:14:16 +0000433void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) {
434 if (C->getSimdlen())
435 Profiler->VisitStmt(C->getSimdlen());
436}
437
Alexander Musman8bd31e62014-05-27 15:12:19 +0000438void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
439 if (C->getNumForLoops())
440 Profiler->VisitStmt(C->getNumForLoops());
441}
442
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000443void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
Alexey Bataev756c1962013-09-24 03:17:45 +0000444
Alexey Bataevbcbadb62014-05-06 06:04:14 +0000445void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
446
Alexey Bataev56dafe82014-06-20 07:16:17 +0000447void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
Alexey Bataev3392d762016-02-16 11:18:12 +0000448 VistOMPClauseWithPreInit(C);
449 if (auto *S = C->getChunkSize())
450 Profiler->VisitStmt(S);
Alexey Bataev56dafe82014-06-20 07:16:17 +0000451}
452
Alexey Bataev10e775f2015-07-30 11:36:16 +0000453void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
454 if (auto *Num = C->getNumForLoops())
455 Profiler->VisitStmt(Num);
456}
Alexey Bataev142e1fc2014-06-20 09:44:06 +0000457
Alexey Bataev236070f2014-06-20 11:19:47 +0000458void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
459
Alexey Bataev7aea99a2014-07-17 12:19:31 +0000460void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
461
Alexey Bataev74ba3a52014-07-17 12:47:03 +0000462void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
463
Alexey Bataevf98b00c2014-07-23 02:27:21 +0000464void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
465
Alexey Bataevdea47612014-07-23 07:46:59 +0000466void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
467
Alexey Bataev67a4f222014-07-23 10:25:33 +0000468void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
469
Alexey Bataev459dec02014-07-24 06:46:57 +0000470void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
471
Alexey Bataev82bad8b2014-07-24 08:55:34 +0000472void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
473
Alexey Bataev346265e2015-09-25 10:37:12 +0000474void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
475
Alexey Bataevd14d1e62015-09-28 06:39:35 +0000476void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
477
Alexey Bataevb825de12015-12-07 10:51:44 +0000478void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
479
Alexey Bataev756c1962013-09-24 03:17:45 +0000480template<typename T>
481void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
Alexey Bataev03b340a2014-10-21 03:16:40 +0000482 for (auto *E : Node->varlists()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000483 if (E)
484 Profiler->VisitStmt(E);
Alexey Bataev03b340a2014-10-21 03:16:40 +0000485 }
Alexey Bataev756c1962013-09-24 03:17:45 +0000486}
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000487
488void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
Alexey Bataev756c1962013-09-24 03:17:45 +0000489 VisitOMPClauseList(C);
Alexey Bataev03b340a2014-10-21 03:16:40 +0000490 for (auto *E : C->private_copies()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000491 if (E)
492 Profiler->VisitStmt(E);
Alexey Bataev03b340a2014-10-21 03:16:40 +0000493 }
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000494}
Alexey Bataev4a5bb772014-10-08 14:01:46 +0000495void
496OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000497 VisitOMPClauseList(C);
Alexey Bataev417089f2016-02-17 13:19:37 +0000498 VistOMPClauseWithPreInit(C);
Alexey Bataev4a5bb772014-10-08 14:01:46 +0000499 for (auto *E : C->private_copies()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000500 if (E)
501 Profiler->VisitStmt(E);
Alexey Bataev4a5bb772014-10-08 14:01:46 +0000502 }
503 for (auto *E : C->inits()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000504 if (E)
505 Profiler->VisitStmt(E);
Alexey Bataev4a5bb772014-10-08 14:01:46 +0000506 }
Alexey Bataevd5af8e42013-10-01 05:32:34 +0000507}
Alexander Musman1bb328c2014-06-04 13:06:39 +0000508void
509OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
510 VisitOMPClauseList(C);
Alexey Bataev005248a2016-02-25 05:25:57 +0000511 VistOMPClauseWithPostUpdate(C);
Alexey Bataev38e89532015-04-16 04:54:05 +0000512 for (auto *E : C->source_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000513 if (E)
514 Profiler->VisitStmt(E);
Alexey Bataev38e89532015-04-16 04:54:05 +0000515 }
516 for (auto *E : C->destination_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000517 if (E)
518 Profiler->VisitStmt(E);
Alexey Bataev38e89532015-04-16 04:54:05 +0000519 }
520 for (auto *E : C->assignment_ops()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000521 if (E)
522 Profiler->VisitStmt(E);
Alexey Bataev38e89532015-04-16 04:54:05 +0000523 }
Alexander Musman1bb328c2014-06-04 13:06:39 +0000524}
Alexey Bataev758e55e2013-09-06 18:03:48 +0000525void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
Alexey Bataev756c1962013-09-24 03:17:45 +0000526 VisitOMPClauseList(C);
Alexey Bataev758e55e2013-09-06 18:03:48 +0000527}
Alexey Bataevc5e02582014-06-16 07:08:35 +0000528void OMPClauseProfiler::VisitOMPReductionClause(
529 const OMPReductionClause *C) {
530 Profiler->VisitNestedNameSpecifier(
531 C->getQualifierLoc().getNestedNameSpecifier());
532 Profiler->VisitName(C->getNameInfo().getName());
533 VisitOMPClauseList(C);
Alexey Bataev61205072016-03-02 04:57:40 +0000534 VistOMPClauseWithPostUpdate(C);
Alexey Bataevf24e7b12015-10-08 09:10:53 +0000535 for (auto *E : C->privates()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000536 if (E)
537 Profiler->VisitStmt(E);
Alexey Bataevf24e7b12015-10-08 09:10:53 +0000538 }
Alexey Bataev794ba0d2015-04-10 10:43:45 +0000539 for (auto *E : C->lhs_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000540 if (E)
541 Profiler->VisitStmt(E);
Alexey Bataev794ba0d2015-04-10 10:43:45 +0000542 }
543 for (auto *E : C->rhs_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000544 if (E)
545 Profiler->VisitStmt(E);
Alexey Bataev794ba0d2015-04-10 10:43:45 +0000546 }
547 for (auto *E : C->reduction_ops()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000548 if (E)
549 Profiler->VisitStmt(E);
Alexey Bataev794ba0d2015-04-10 10:43:45 +0000550 }
Alexey Bataevc5e02582014-06-16 07:08:35 +0000551}
Alexey Bataev169d96a2017-07-18 20:17:46 +0000552void OMPClauseProfiler::VisitOMPTaskReductionClause(
553 const OMPTaskReductionClause *C) {
554 Profiler->VisitNestedNameSpecifier(
555 C->getQualifierLoc().getNestedNameSpecifier());
556 Profiler->VisitName(C->getNameInfo().getName());
557 VisitOMPClauseList(C);
558 VistOMPClauseWithPostUpdate(C);
559 for (auto *E : C->privates()) {
560 if (E)
561 Profiler->VisitStmt(E);
562 }
563 for (auto *E : C->lhs_exprs()) {
564 if (E)
565 Profiler->VisitStmt(E);
566 }
567 for (auto *E : C->rhs_exprs()) {
568 if (E)
569 Profiler->VisitStmt(E);
570 }
571 for (auto *E : C->reduction_ops()) {
572 if (E)
573 Profiler->VisitStmt(E);
574 }
575}
Alexey Bataevfa312f32017-07-21 18:48:21 +0000576void OMPClauseProfiler::VisitOMPInReductionClause(
577 const OMPInReductionClause *C) {
578 Profiler->VisitNestedNameSpecifier(
579 C->getQualifierLoc().getNestedNameSpecifier());
580 Profiler->VisitName(C->getNameInfo().getName());
581 VisitOMPClauseList(C);
582 VistOMPClauseWithPostUpdate(C);
583 for (auto *E : C->privates()) {
584 if (E)
585 Profiler->VisitStmt(E);
586 }
587 for (auto *E : C->lhs_exprs()) {
588 if (E)
589 Profiler->VisitStmt(E);
590 }
591 for (auto *E : C->rhs_exprs()) {
592 if (E)
593 Profiler->VisitStmt(E);
594 }
595 for (auto *E : C->reduction_ops()) {
596 if (E)
597 Profiler->VisitStmt(E);
598 }
599}
Alexander Musman8dba6642014-04-22 13:09:42 +0000600void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
601 VisitOMPClauseList(C);
Alexey Bataev78849fb2016-03-09 09:49:00 +0000602 VistOMPClauseWithPostUpdate(C);
Alexey Bataevbd9fec12015-08-18 06:47:21 +0000603 for (auto *E : C->privates()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000604 if (E)
605 Profiler->VisitStmt(E);
Alexey Bataevbd9fec12015-08-18 06:47:21 +0000606 }
Alexander Musman3276a272015-03-21 10:12:56 +0000607 for (auto *E : C->inits()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000608 if (E)
609 Profiler->VisitStmt(E);
Alexander Musman3276a272015-03-21 10:12:56 +0000610 }
611 for (auto *E : C->updates()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000612 if (E)
613 Profiler->VisitStmt(E);
Alexander Musman3276a272015-03-21 10:12:56 +0000614 }
615 for (auto *E : C->finals()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000616 if (E)
617 Profiler->VisitStmt(E);
Alexander Musman3276a272015-03-21 10:12:56 +0000618 }
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000619 if (C->getStep())
620 Profiler->VisitStmt(C->getStep());
621 if (C->getCalcStep())
622 Profiler->VisitStmt(C->getCalcStep());
Alexander Musman8dba6642014-04-22 13:09:42 +0000623}
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000624void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
625 VisitOMPClauseList(C);
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000626 if (C->getAlignment())
627 Profiler->VisitStmt(C->getAlignment());
Alexander Musmanf0d76e72014-05-29 14:36:25 +0000628}
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000629void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
630 VisitOMPClauseList(C);
Alexey Bataevf56f98c2015-04-16 05:39:01 +0000631 for (auto *E : C->source_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000632 if (E)
633 Profiler->VisitStmt(E);
Alexey Bataevf56f98c2015-04-16 05:39:01 +0000634 }
635 for (auto *E : C->destination_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000636 if (E)
637 Profiler->VisitStmt(E);
Alexey Bataevf56f98c2015-04-16 05:39:01 +0000638 }
639 for (auto *E : C->assignment_ops()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000640 if (E)
641 Profiler->VisitStmt(E);
Alexey Bataevf56f98c2015-04-16 05:39:01 +0000642 }
Alexey Bataevd48bcd82014-03-31 03:36:38 +0000643}
Alexey Bataevbae9a792014-06-27 10:37:06 +0000644void
645OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
646 VisitOMPClauseList(C);
Alexey Bataeva63048e2015-03-23 06:18:07 +0000647 for (auto *E : C->source_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000648 if (E)
649 Profiler->VisitStmt(E);
Alexey Bataeva63048e2015-03-23 06:18:07 +0000650 }
651 for (auto *E : C->destination_exprs()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000652 if (E)
653 Profiler->VisitStmt(E);
Alexey Bataeva63048e2015-03-23 06:18:07 +0000654 }
655 for (auto *E : C->assignment_ops()) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000656 if (E)
657 Profiler->VisitStmt(E);
Alexey Bataeva63048e2015-03-23 06:18:07 +0000658 }
Alexey Bataevbae9a792014-06-27 10:37:06 +0000659}
Alexey Bataev6125da92014-07-21 11:26:11 +0000660void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
661 VisitOMPClauseList(C);
662}
Alexey Bataev1c2cfbc2015-06-23 14:25:19 +0000663void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
664 VisitOMPClauseList(C);
665}
Michael Wonge710d542015-08-07 16:16:36 +0000666void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000667 if (C->getDevice())
668 Profiler->VisitStmt(C->getDevice());
Michael Wonge710d542015-08-07 16:16:36 +0000669}
Kelvin Li0bff7af2015-11-23 05:32:03 +0000670void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
671 VisitOMPClauseList(C);
672}
Kelvin Li099bb8c2015-11-24 20:50:12 +0000673void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
Arpith Chacko Jacobbc126342017-01-25 11:28:18 +0000674 VistOMPClauseWithPreInit(C);
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000675 if (C->getNumTeams())
676 Profiler->VisitStmt(C->getNumTeams());
Kelvin Li099bb8c2015-11-24 20:50:12 +0000677}
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000678void OMPClauseProfiler::VisitOMPThreadLimitClause(
679 const OMPThreadLimitClause *C) {
Arpith Chacko Jacob7ecc0b72017-01-25 11:44:35 +0000680 VistOMPClauseWithPreInit(C);
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000681 if (C->getThreadLimit())
682 Profiler->VisitStmt(C->getThreadLimit());
Kelvin Lia15fb1a2015-11-27 18:47:36 +0000683}
Alexey Bataeva0569352015-12-01 10:17:31 +0000684void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000685 if (C->getPriority())
686 Profiler->VisitStmt(C->getPriority());
Alexey Bataeva0569352015-12-01 10:17:31 +0000687}
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000688void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000689 if (C->getGrainsize())
690 Profiler->VisitStmt(C->getGrainsize());
Alexey Bataev1fd4aed2015-12-07 12:52:51 +0000691}
Alexey Bataev382967a2015-12-08 12:06:20 +0000692void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000693 if (C->getNumTasks())
694 Profiler->VisitStmt(C->getNumTasks());
Alexey Bataev382967a2015-12-08 12:06:20 +0000695}
Alexey Bataev28c75412015-12-15 08:19:24 +0000696void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
Richard Trieu6a77a1c2016-06-10 04:52:09 +0000697 if (C->getHint())
698 Profiler->VisitStmt(C->getHint());
Alexey Bataev28c75412015-12-15 08:19:24 +0000699}
Samuel Antao661c0902016-05-26 17:39:58 +0000700void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
701 VisitOMPClauseList(C);
702}
Samuel Antaoec172c62016-05-26 17:49:04 +0000703void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
704 VisitOMPClauseList(C);
705}
Carlo Bertolli2404b172016-07-13 15:37:16 +0000706void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
707 const OMPUseDevicePtrClause *C) {
708 VisitOMPClauseList(C);
709}
Carlo Bertolli70594e92016-07-13 17:16:49 +0000710void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
711 const OMPIsDevicePtrClause *C) {
712 VisitOMPClauseList(C);
713}
Alexander Kornienkoab9db512015-06-22 23:07:51 +0000714}
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000715
716void
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000717StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
Alexey Bataev5ec3eb12013-07-19 03:13:43 +0000718 VisitStmt(S);
719 OMPClauseProfiler P(this);
720 ArrayRef<OMPClause *> Clauses = S->clauses();
721 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
722 I != E; ++I)
723 if (*I)
724 P.Visit(*I);
725}
726
Alexander Musman3aaab662014-08-19 11:27:13 +0000727void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
728 VisitOMPExecutableDirective(S);
729}
730
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000731void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
732 VisitOMPExecutableDirective(S);
733}
734
735void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
Alexander Musman3aaab662014-08-19 11:27:13 +0000736 VisitOMPLoopDirective(S);
Alexey Bataev1b59ab52014-02-27 08:29:12 +0000737}
738
Alexey Bataevf29276e2014-06-18 04:14:57 +0000739void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
Alexander Musman3aaab662014-08-19 11:27:13 +0000740 VisitOMPLoopDirective(S);
Alexey Bataevf29276e2014-06-18 04:14:57 +0000741}
742
Alexander Musmanf82886e2014-09-18 05:12:34 +0000743void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
744 VisitOMPLoopDirective(S);
745}
746
Alexey Bataevd3f8dd22014-06-25 11:44:49 +0000747void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
748 VisitOMPExecutableDirective(S);
749}
750
Alexey Bataev1e0498a2014-06-26 08:21:58 +0000751void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
752 VisitOMPExecutableDirective(S);
753}
754
Alexey Bataevd1e40fb2014-06-26 12:05:45 +0000755void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
756 VisitOMPExecutableDirective(S);
757}
758
Alexander Musman80c22892014-07-17 08:54:58 +0000759void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
760 VisitOMPExecutableDirective(S);
761}
762
Alexander Musmand9ed09f2014-07-21 09:42:05 +0000763void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
764 VisitOMPExecutableDirective(S);
765 VisitName(S->getDirectiveName().getName());
766}
767
Alexey Bataev4acb8592014-07-07 13:01:15 +0000768void
769StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
Alexander Musman3aaab662014-08-19 11:27:13 +0000770 VisitOMPLoopDirective(S);
Alexey Bataev4acb8592014-07-07 13:01:15 +0000771}
772
Alexander Musmane4e893b2014-09-23 09:33:00 +0000773void StmtProfiler::VisitOMPParallelForSimdDirective(
774 const OMPParallelForSimdDirective *S) {
775 VisitOMPLoopDirective(S);
776}
777
Alexey Bataev84d0b3e2014-07-08 08:12:03 +0000778void StmtProfiler::VisitOMPParallelSectionsDirective(
779 const OMPParallelSectionsDirective *S) {
780 VisitOMPExecutableDirective(S);
781}
782
Alexey Bataev9c2e8ee2014-07-11 11:25:16 +0000783void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
784 VisitOMPExecutableDirective(S);
785}
786
Alexey Bataev68446b72014-07-18 07:47:19 +0000787void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
788 VisitOMPExecutableDirective(S);
789}
790
Alexey Bataev4d1dfea2014-07-18 09:11:51 +0000791void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
792 VisitOMPExecutableDirective(S);
793}
794
Alexey Bataev2df347a2014-07-18 10:17:07 +0000795void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
796 VisitOMPExecutableDirective(S);
797}
798
Alexey Bataevc30dd2d2015-06-18 12:14:09 +0000799void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
800 VisitOMPExecutableDirective(S);
Alexey Bataev3b1b8952017-07-25 15:53:26 +0000801 if (const Expr *E = S->getReductionRef())
802 VisitStmt(E);
Alexey Bataevc30dd2d2015-06-18 12:14:09 +0000803}
804
Alexey Bataev6125da92014-07-21 11:26:11 +0000805void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
806 VisitOMPExecutableDirective(S);
807}
808
Alexey Bataev9fb6e642014-07-22 06:45:04 +0000809void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
810 VisitOMPExecutableDirective(S);
811}
812
Alexey Bataev0162e452014-07-22 10:10:35 +0000813void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
814 VisitOMPExecutableDirective(S);
815}
816
Alexey Bataev0bd520b2014-09-19 08:19:49 +0000817void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
818 VisitOMPExecutableDirective(S);
819}
820
Michael Wong65f367f2015-07-21 13:44:28 +0000821void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
822 VisitOMPExecutableDirective(S);
823}
824
Samuel Antaodf67fc42016-01-19 19:15:56 +0000825void StmtProfiler::VisitOMPTargetEnterDataDirective(
826 const OMPTargetEnterDataDirective *S) {
827 VisitOMPExecutableDirective(S);
828}
829
Samuel Antao72590762016-01-19 20:04:50 +0000830void StmtProfiler::VisitOMPTargetExitDataDirective(
831 const OMPTargetExitDataDirective *S) {
832 VisitOMPExecutableDirective(S);
833}
834
Arpith Chacko Jacobe955b3d2016-01-26 18:48:41 +0000835void StmtProfiler::VisitOMPTargetParallelDirective(
836 const OMPTargetParallelDirective *S) {
837 VisitOMPExecutableDirective(S);
838}
839
Arpith Chacko Jacob05bebb52016-02-03 15:46:42 +0000840void StmtProfiler::VisitOMPTargetParallelForDirective(
841 const OMPTargetParallelForDirective *S) {
842 VisitOMPExecutableDirective(S);
843}
844
Alexey Bataev13314bf2014-10-09 04:18:56 +0000845void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
846 VisitOMPExecutableDirective(S);
847}
848
Alexey Bataev6d4ed052015-07-01 06:57:41 +0000849void StmtProfiler::VisitOMPCancellationPointDirective(
850 const OMPCancellationPointDirective *S) {
851 VisitOMPExecutableDirective(S);
852}
853
Alexey Bataev80909872015-07-02 11:25:17 +0000854void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
855 VisitOMPExecutableDirective(S);
856}
857
Alexey Bataev49f6e782015-12-01 04:18:41 +0000858void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
859 VisitOMPLoopDirective(S);
860}
861
Alexey Bataev0a6ed842015-12-03 09:40:15 +0000862void StmtProfiler::VisitOMPTaskLoopSimdDirective(
863 const OMPTaskLoopSimdDirective *S) {
864 VisitOMPLoopDirective(S);
865}
866
Carlo Bertolli6200a3d2015-12-14 14:51:25 +0000867void StmtProfiler::VisitOMPDistributeDirective(
868 const OMPDistributeDirective *S) {
869 VisitOMPLoopDirective(S);
870}
871
Carlo Bertollib4adf552016-01-15 18:50:31 +0000872void OMPClauseProfiler::VisitOMPDistScheduleClause(
873 const OMPDistScheduleClause *C) {
Alexey Bataev3392d762016-02-16 11:18:12 +0000874 VistOMPClauseWithPreInit(C);
875 if (auto *S = C->getChunkSize())
876 Profiler->VisitStmt(S);
Carlo Bertollib4adf552016-01-15 18:50:31 +0000877}
878
Arpith Chacko Jacob3cf89042016-01-26 16:37:23 +0000879void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
880
Samuel Antao686c70c2016-05-26 17:30:50 +0000881void StmtProfiler::VisitOMPTargetUpdateDirective(
882 const OMPTargetUpdateDirective *S) {
883 VisitOMPExecutableDirective(S);
884}
885
Carlo Bertolli9925f152016-06-27 14:55:37 +0000886void StmtProfiler::VisitOMPDistributeParallelForDirective(
887 const OMPDistributeParallelForDirective *S) {
888 VisitOMPLoopDirective(S);
889}
890
Kelvin Li4a39add2016-07-05 05:00:15 +0000891void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
892 const OMPDistributeParallelForSimdDirective *S) {
893 VisitOMPLoopDirective(S);
894}
895
Kelvin Li787f3fc2016-07-06 04:45:38 +0000896void StmtProfiler::VisitOMPDistributeSimdDirective(
897 const OMPDistributeSimdDirective *S) {
898 VisitOMPLoopDirective(S);
899}
900
Kelvin Lia579b912016-07-14 02:54:56 +0000901void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
902 const OMPTargetParallelForSimdDirective *S) {
903 VisitOMPLoopDirective(S);
904}
905
Kelvin Li986330c2016-07-20 22:57:10 +0000906void StmtProfiler::VisitOMPTargetSimdDirective(
907 const OMPTargetSimdDirective *S) {
908 VisitOMPLoopDirective(S);
909}
910
Kelvin Li02532872016-08-05 14:37:37 +0000911void StmtProfiler::VisitOMPTeamsDistributeDirective(
912 const OMPTeamsDistributeDirective *S) {
913 VisitOMPLoopDirective(S);
914}
915
Kelvin Li4e325f72016-10-25 12:50:55 +0000916void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
917 const OMPTeamsDistributeSimdDirective *S) {
918 VisitOMPLoopDirective(S);
919}
920
Kelvin Li579e41c2016-11-30 23:51:03 +0000921void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
922 const OMPTeamsDistributeParallelForSimdDirective *S) {
923 VisitOMPLoopDirective(S);
924}
925
Kelvin Li7ade93f2016-12-09 03:24:30 +0000926void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
927 const OMPTeamsDistributeParallelForDirective *S) {
928 VisitOMPLoopDirective(S);
929}
930
Kelvin Libf594a52016-12-17 05:48:59 +0000931void StmtProfiler::VisitOMPTargetTeamsDirective(
932 const OMPTargetTeamsDirective *S) {
933 VisitOMPExecutableDirective(S);
934}
935
Kelvin Li83c451e2016-12-25 04:52:54 +0000936void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
937 const OMPTargetTeamsDistributeDirective *S) {
938 VisitOMPLoopDirective(S);
939}
940
Kelvin Li80e8f562016-12-29 22:16:30 +0000941void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
942 const OMPTargetTeamsDistributeParallelForDirective *S) {
943 VisitOMPLoopDirective(S);
944}
945
Kelvin Li1851df52017-01-03 05:23:48 +0000946void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
947 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
948 VisitOMPLoopDirective(S);
949}
950
Kelvin Lida681182017-01-10 18:08:18 +0000951void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
952 const OMPTargetTeamsDistributeSimdDirective *S) {
953 VisitOMPLoopDirective(S);
954}
955
Chandler Carruth631abd92011-06-16 06:47:06 +0000956void StmtProfiler::VisitExpr(const Expr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000957 VisitStmt(S);
958}
959
Chandler Carruth631abd92011-06-16 06:47:06 +0000960void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000961 VisitExpr(S);
Douglas Gregorf5b160f2010-07-13 08:37:11 +0000962 if (!Canonical)
963 VisitNestedNameSpecifier(S->getQualifier());
Douglas Gregor5c193b92009-07-28 00:33:38 +0000964 VisitDecl(S->getDecl());
Douglas Gregorf5b160f2010-07-13 08:37:11 +0000965 if (!Canonical)
966 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
Douglas Gregor5c193b92009-07-28 00:33:38 +0000967}
968
Chandler Carruth631abd92011-06-16 06:47:06 +0000969void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000970 VisitExpr(S);
971 ID.AddInteger(S->getIdentType());
972}
973
Chandler Carruth631abd92011-06-16 06:47:06 +0000974void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000975 VisitExpr(S);
976 S->getValue().Profile(ID);
Richard Smithe9f130c2014-11-20 03:37:32 +0000977 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +0000978}
979
Chandler Carruth631abd92011-06-16 06:47:06 +0000980void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000981 VisitExpr(S);
Douglas Gregorfb65e592011-07-27 05:40:30 +0000982 ID.AddInteger(S->getKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +0000983 ID.AddInteger(S->getValue());
984}
985
Chandler Carruth631abd92011-06-16 06:47:06 +0000986void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000987 VisitExpr(S);
988 S->getValue().Profile(ID);
989 ID.AddBoolean(S->isExact());
Richard Smithe9f130c2014-11-20 03:37:32 +0000990 ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +0000991}
992
Chandler Carruth631abd92011-06-16 06:47:06 +0000993void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000994 VisitExpr(S);
995}
996
Chandler Carruth631abd92011-06-16 06:47:06 +0000997void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +0000998 VisitExpr(S);
Douglas Gregor9d0eb8f2011-11-02 17:26:05 +0000999 ID.AddString(S->getBytes());
Douglas Gregorfb65e592011-07-27 05:40:30 +00001000 ID.AddInteger(S->getKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001001}
1002
Chandler Carruth631abd92011-06-16 06:47:06 +00001003void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001004 VisitExpr(S);
1005}
1006
Chandler Carruth631abd92011-06-16 06:47:06 +00001007void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
Nate Begeman5ec4b312009-08-10 23:49:36 +00001008 VisitExpr(S);
1009}
1010
Chandler Carruth631abd92011-06-16 06:47:06 +00001011void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001012 VisitExpr(S);
1013 ID.AddInteger(S->getOpcode());
1014}
1015
Chandler Carruth631abd92011-06-16 06:47:06 +00001016void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
Douglas Gregor882211c2010-04-28 22:16:22 +00001017 VisitType(S->getTypeSourceInfo()->getType());
1018 unsigned n = S->getNumComponents();
1019 for (unsigned i = 0; i < n; ++i) {
James Y Knight7281c352015-12-29 22:31:18 +00001020 const OffsetOfNode &ON = S->getComponent(i);
Douglas Gregor882211c2010-04-28 22:16:22 +00001021 ID.AddInteger(ON.getKind());
1022 switch (ON.getKind()) {
James Y Knight7281c352015-12-29 22:31:18 +00001023 case OffsetOfNode::Array:
Douglas Gregor882211c2010-04-28 22:16:22 +00001024 // Expressions handled below.
1025 break;
1026
James Y Knight7281c352015-12-29 22:31:18 +00001027 case OffsetOfNode::Field:
Douglas Gregor882211c2010-04-28 22:16:22 +00001028 VisitDecl(ON.getField());
1029 break;
1030
James Y Knight7281c352015-12-29 22:31:18 +00001031 case OffsetOfNode::Identifier:
Richard Trieu639d7b62017-02-22 22:22:42 +00001032 VisitIdentifierInfo(ON.getFieldName());
Douglas Gregor882211c2010-04-28 22:16:22 +00001033 break;
James Y Knight7281c352015-12-29 22:31:18 +00001034
1035 case OffsetOfNode::Base:
Douglas Gregord1702062010-04-29 00:18:15 +00001036 // These nodes are implicit, and therefore don't need profiling.
1037 break;
Douglas Gregor882211c2010-04-28 22:16:22 +00001038 }
1039 }
Richard Trieu639d7b62017-02-22 22:22:42 +00001040
Douglas Gregor882211c2010-04-28 22:16:22 +00001041 VisitExpr(S);
1042}
1043
Chandler Carruth631abd92011-06-16 06:47:06 +00001044void
1045StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001046 VisitExpr(S);
Peter Collingbournee190dee2011-03-11 19:24:49 +00001047 ID.AddInteger(S->getKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001048 if (S->isArgumentType())
1049 VisitType(S->getArgumentType());
1050}
1051
Chandler Carruth631abd92011-06-16 06:47:06 +00001052void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001053 VisitExpr(S);
1054}
1055
Alexey Bataev1a3320e2015-08-25 14:24:04 +00001056void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) {
1057 VisitExpr(S);
1058}
1059
Chandler Carruth631abd92011-06-16 06:47:06 +00001060void StmtProfiler::VisitCallExpr(const CallExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001061 VisitExpr(S);
1062}
1063
Chandler Carruth631abd92011-06-16 06:47:06 +00001064void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001065 VisitExpr(S);
1066 VisitDecl(S->getMemberDecl());
Douglas Gregorf5b160f2010-07-13 08:37:11 +00001067 if (!Canonical)
1068 VisitNestedNameSpecifier(S->getQualifier());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001069 ID.AddBoolean(S->isArrow());
1070}
1071
Chandler Carruth631abd92011-06-16 06:47:06 +00001072void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001073 VisitExpr(S);
1074 ID.AddBoolean(S->isFileScope());
1075}
1076
Chandler Carruth631abd92011-06-16 06:47:06 +00001077void StmtProfiler::VisitCastExpr(const CastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001078 VisitExpr(S);
1079}
1080
Chandler Carruth631abd92011-06-16 06:47:06 +00001081void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001082 VisitCastExpr(S);
John McCall2536c6d2010-08-25 10:28:54 +00001083 ID.AddInteger(S->getValueKind());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001084}
1085
Chandler Carruth631abd92011-06-16 06:47:06 +00001086void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001087 VisitCastExpr(S);
1088 VisitType(S->getTypeAsWritten());
1089}
1090
Chandler Carruth631abd92011-06-16 06:47:06 +00001091void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001092 VisitExplicitCastExpr(S);
1093}
1094
Chandler Carruth631abd92011-06-16 06:47:06 +00001095void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001096 VisitExpr(S);
1097 ID.AddInteger(S->getOpcode());
1098}
1099
Chandler Carruth631abd92011-06-16 06:47:06 +00001100void
1101StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001102 VisitBinaryOperator(S);
1103}
1104
Chandler Carruth631abd92011-06-16 06:47:06 +00001105void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001106 VisitExpr(S);
1107}
1108
Chandler Carruth631abd92011-06-16 06:47:06 +00001109void StmtProfiler::VisitBinaryConditionalOperator(
Chandler Carruthcf5f43c2011-06-21 23:26:32 +00001110 const BinaryConditionalOperator *S) {
John McCallc07a0c72011-02-17 10:25:35 +00001111 VisitExpr(S);
1112}
1113
Chandler Carruth631abd92011-06-16 06:47:06 +00001114void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001115 VisitExpr(S);
Chris Lattnerc8e630e2011-02-17 07:39:24 +00001116 VisitDecl(S->getLabel());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001117}
1118
Chandler Carruth631abd92011-06-16 06:47:06 +00001119void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001120 VisitExpr(S);
1121}
1122
Chandler Carruth631abd92011-06-16 06:47:06 +00001123void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001124 VisitExpr(S);
1125}
1126
Hal Finkelc4d7c822013-09-18 03:29:45 +00001127void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1128 VisitExpr(S);
1129}
1130
Chandler Carruth631abd92011-06-16 06:47:06 +00001131void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001132 VisitExpr(S);
1133}
1134
Chandler Carruth631abd92011-06-16 06:47:06 +00001135void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001136 VisitExpr(S);
1137}
1138
Chandler Carruth631abd92011-06-16 06:47:06 +00001139void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
Douglas Gregor00044172009-07-29 16:09:57 +00001140 VisitExpr(S);
1141}
1142
Chandler Carruth631abd92011-06-16 06:47:06 +00001143void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001144 if (S->getSyntacticForm()) {
1145 VisitInitListExpr(S->getSyntacticForm());
1146 return;
1147 }
Mike Stump11289f42009-09-09 15:08:12 +00001148
Douglas Gregor5c193b92009-07-28 00:33:38 +00001149 VisitExpr(S);
1150}
1151
Chandler Carruth631abd92011-06-16 06:47:06 +00001152void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001153 VisitExpr(S);
1154 ID.AddBoolean(S->usesGNUSyntax());
David Majnemerf7e36092016-06-23 00:15:04 +00001155 for (const DesignatedInitExpr::Designator &D : S->designators()) {
1156 if (D.isFieldDesignator()) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001157 ID.AddInteger(0);
David Majnemerf7e36092016-06-23 00:15:04 +00001158 VisitName(D.getFieldName());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001159 continue;
1160 }
Mike Stump11289f42009-09-09 15:08:12 +00001161
David Majnemerf7e36092016-06-23 00:15:04 +00001162 if (D.isArrayDesignator()) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001163 ID.AddInteger(1);
1164 } else {
David Majnemerf7e36092016-06-23 00:15:04 +00001165 assert(D.isArrayRangeDesignator());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001166 ID.AddInteger(2);
1167 }
David Majnemerf7e36092016-06-23 00:15:04 +00001168 ID.AddInteger(D.getFirstExprIndex());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001169 }
1170}
1171
Yunzhong Gaocb779302015-06-10 00:27:52 +00001172// Seems that if VisitInitListExpr() only works on the syntactic form of an
1173// InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1174void StmtProfiler::VisitDesignatedInitUpdateExpr(
1175 const DesignatedInitUpdateExpr *S) {
1176 llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1177 "initializer");
1178}
1179
Richard Smith410306b2016-12-12 02:53:20 +00001180void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1181 VisitExpr(S);
1182}
1183
1184void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1185 VisitExpr(S);
1186}
1187
Yunzhong Gaocb779302015-06-10 00:27:52 +00001188void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1189 llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1190}
1191
Chandler Carruth631abd92011-06-16 06:47:06 +00001192void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001193 VisitExpr(S);
1194}
1195
Chandler Carruth631abd92011-06-16 06:47:06 +00001196void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001197 VisitExpr(S);
1198 VisitName(&S->getAccessor());
1199}
1200
Chandler Carruth631abd92011-06-16 06:47:06 +00001201void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001202 VisitExpr(S);
1203 VisitDecl(S->getBlockDecl());
1204}
1205
Chandler Carruth631abd92011-06-16 06:47:06 +00001206void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
Peter Collingbourne91147592011-04-15 00:35:48 +00001207 VisitExpr(S);
1208 for (unsigned i = 0; i != S->getNumAssocs(); ++i) {
1209 QualType T = S->getAssocType(i);
1210 if (T.isNull())
Craig Topper36250ad2014-05-12 05:36:57 +00001211 ID.AddPointer(nullptr);
Peter Collingbourne91147592011-04-15 00:35:48 +00001212 else
1213 VisitType(T);
1214 VisitExpr(S->getAssocExpr(i));
1215 }
1216}
1217
John McCallfe96e0b2011-11-06 09:01:30 +00001218void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1219 VisitExpr(S);
1220 for (PseudoObjectExpr::const_semantics_iterator
1221 i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1222 // Normally, we would not profile the source expressions of OVEs.
1223 if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1224 Visit(OVE->getSourceExpr());
1225}
1226
Eli Friedmandf14b3a2011-10-11 02:20:01 +00001227void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1228 VisitExpr(S);
Eli Friedman4b72fdd2011-10-14 20:59:01 +00001229 ID.AddInteger(S->getOp());
Eli Friedmandf14b3a2011-10-11 02:20:01 +00001230}
1231
Chandler Carruth631abd92011-06-16 06:47:06 +00001232static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
John McCalle3027922010-08-25 11:45:40 +00001233 UnaryOperatorKind &UnaryOp,
1234 BinaryOperatorKind &BinaryOp) {
Douglas Gregore9ceb312010-05-19 04:13:23 +00001235 switch (S->getOperator()) {
1236 case OO_None:
1237 case OO_New:
1238 case OO_Delete:
1239 case OO_Array_New:
1240 case OO_Array_Delete:
1241 case OO_Arrow:
1242 case OO_Call:
1243 case OO_Conditional:
Richard Smith9be594e2015-10-22 05:12:22 +00001244 case OO_Coawait:
Douglas Gregore9ceb312010-05-19 04:13:23 +00001245 case NUM_OVERLOADED_OPERATORS:
1246 llvm_unreachable("Invalid operator call kind");
Douglas Gregore9ceb312010-05-19 04:13:23 +00001247
1248 case OO_Plus:
1249 if (S->getNumArgs() == 1) {
John McCalle3027922010-08-25 11:45:40 +00001250 UnaryOp = UO_Plus;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001251 return Stmt::UnaryOperatorClass;
1252 }
1253
John McCalle3027922010-08-25 11:45:40 +00001254 BinaryOp = BO_Add;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001255 return Stmt::BinaryOperatorClass;
1256
1257 case OO_Minus:
1258 if (S->getNumArgs() == 1) {
John McCalle3027922010-08-25 11:45:40 +00001259 UnaryOp = UO_Minus;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001260 return Stmt::UnaryOperatorClass;
1261 }
1262
John McCalle3027922010-08-25 11:45:40 +00001263 BinaryOp = BO_Sub;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001264 return Stmt::BinaryOperatorClass;
1265
1266 case OO_Star:
1267 if (S->getNumArgs() == 1) {
Richard Smithf15acc52014-06-05 22:43:40 +00001268 UnaryOp = UO_Deref;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001269 return Stmt::UnaryOperatorClass;
1270 }
1271
Richard Smithf15acc52014-06-05 22:43:40 +00001272 BinaryOp = BO_Mul;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001273 return Stmt::BinaryOperatorClass;
1274
1275 case OO_Slash:
John McCalle3027922010-08-25 11:45:40 +00001276 BinaryOp = BO_Div;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001277 return Stmt::BinaryOperatorClass;
1278
1279 case OO_Percent:
John McCalle3027922010-08-25 11:45:40 +00001280 BinaryOp = BO_Rem;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001281 return Stmt::BinaryOperatorClass;
1282
1283 case OO_Caret:
John McCalle3027922010-08-25 11:45:40 +00001284 BinaryOp = BO_Xor;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001285 return Stmt::BinaryOperatorClass;
1286
1287 case OO_Amp:
1288 if (S->getNumArgs() == 1) {
John McCalle3027922010-08-25 11:45:40 +00001289 UnaryOp = UO_AddrOf;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001290 return Stmt::UnaryOperatorClass;
1291 }
1292
John McCalle3027922010-08-25 11:45:40 +00001293 BinaryOp = BO_And;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001294 return Stmt::BinaryOperatorClass;
1295
1296 case OO_Pipe:
John McCalle3027922010-08-25 11:45:40 +00001297 BinaryOp = BO_Or;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001298 return Stmt::BinaryOperatorClass;
1299
1300 case OO_Tilde:
John McCalle3027922010-08-25 11:45:40 +00001301 UnaryOp = UO_Not;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001302 return Stmt::UnaryOperatorClass;
1303
1304 case OO_Exclaim:
John McCalle3027922010-08-25 11:45:40 +00001305 UnaryOp = UO_LNot;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001306 return Stmt::UnaryOperatorClass;
1307
1308 case OO_Equal:
John McCalle3027922010-08-25 11:45:40 +00001309 BinaryOp = BO_Assign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001310 return Stmt::BinaryOperatorClass;
1311
1312 case OO_Less:
John McCalle3027922010-08-25 11:45:40 +00001313 BinaryOp = BO_LT;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001314 return Stmt::BinaryOperatorClass;
1315
1316 case OO_Greater:
John McCalle3027922010-08-25 11:45:40 +00001317 BinaryOp = BO_GT;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001318 return Stmt::BinaryOperatorClass;
1319
1320 case OO_PlusEqual:
John McCalle3027922010-08-25 11:45:40 +00001321 BinaryOp = BO_AddAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001322 return Stmt::CompoundAssignOperatorClass;
1323
1324 case OO_MinusEqual:
John McCalle3027922010-08-25 11:45:40 +00001325 BinaryOp = BO_SubAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001326 return Stmt::CompoundAssignOperatorClass;
1327
1328 case OO_StarEqual:
John McCalle3027922010-08-25 11:45:40 +00001329 BinaryOp = BO_MulAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001330 return Stmt::CompoundAssignOperatorClass;
1331
1332 case OO_SlashEqual:
John McCalle3027922010-08-25 11:45:40 +00001333 BinaryOp = BO_DivAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001334 return Stmt::CompoundAssignOperatorClass;
1335
1336 case OO_PercentEqual:
John McCalle3027922010-08-25 11:45:40 +00001337 BinaryOp = BO_RemAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001338 return Stmt::CompoundAssignOperatorClass;
1339
1340 case OO_CaretEqual:
John McCalle3027922010-08-25 11:45:40 +00001341 BinaryOp = BO_XorAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001342 return Stmt::CompoundAssignOperatorClass;
1343
1344 case OO_AmpEqual:
John McCalle3027922010-08-25 11:45:40 +00001345 BinaryOp = BO_AndAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001346 return Stmt::CompoundAssignOperatorClass;
1347
1348 case OO_PipeEqual:
John McCalle3027922010-08-25 11:45:40 +00001349 BinaryOp = BO_OrAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001350 return Stmt::CompoundAssignOperatorClass;
1351
1352 case OO_LessLess:
John McCalle3027922010-08-25 11:45:40 +00001353 BinaryOp = BO_Shl;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001354 return Stmt::BinaryOperatorClass;
1355
1356 case OO_GreaterGreater:
John McCalle3027922010-08-25 11:45:40 +00001357 BinaryOp = BO_Shr;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001358 return Stmt::BinaryOperatorClass;
1359
1360 case OO_LessLessEqual:
John McCalle3027922010-08-25 11:45:40 +00001361 BinaryOp = BO_ShlAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001362 return Stmt::CompoundAssignOperatorClass;
1363
1364 case OO_GreaterGreaterEqual:
John McCalle3027922010-08-25 11:45:40 +00001365 BinaryOp = BO_ShrAssign;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001366 return Stmt::CompoundAssignOperatorClass;
1367
1368 case OO_EqualEqual:
John McCalle3027922010-08-25 11:45:40 +00001369 BinaryOp = BO_EQ;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001370 return Stmt::BinaryOperatorClass;
1371
1372 case OO_ExclaimEqual:
John McCalle3027922010-08-25 11:45:40 +00001373 BinaryOp = BO_NE;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001374 return Stmt::BinaryOperatorClass;
1375
1376 case OO_LessEqual:
John McCalle3027922010-08-25 11:45:40 +00001377 BinaryOp = BO_LE;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001378 return Stmt::BinaryOperatorClass;
1379
1380 case OO_GreaterEqual:
John McCalle3027922010-08-25 11:45:40 +00001381 BinaryOp = BO_GE;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001382 return Stmt::BinaryOperatorClass;
1383
1384 case OO_AmpAmp:
John McCalle3027922010-08-25 11:45:40 +00001385 BinaryOp = BO_LAnd;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001386 return Stmt::BinaryOperatorClass;
1387
1388 case OO_PipePipe:
John McCalle3027922010-08-25 11:45:40 +00001389 BinaryOp = BO_LOr;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001390 return Stmt::BinaryOperatorClass;
1391
1392 case OO_PlusPlus:
John McCalle3027922010-08-25 11:45:40 +00001393 UnaryOp = S->getNumArgs() == 1? UO_PreInc
1394 : UO_PostInc;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001395 return Stmt::UnaryOperatorClass;
1396
1397 case OO_MinusMinus:
John McCalle3027922010-08-25 11:45:40 +00001398 UnaryOp = S->getNumArgs() == 1? UO_PreDec
1399 : UO_PostDec;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001400 return Stmt::UnaryOperatorClass;
1401
1402 case OO_Comma:
John McCalle3027922010-08-25 11:45:40 +00001403 BinaryOp = BO_Comma;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001404 return Stmt::BinaryOperatorClass;
1405
Douglas Gregore9ceb312010-05-19 04:13:23 +00001406 case OO_ArrowStar:
John McCalle3027922010-08-25 11:45:40 +00001407 BinaryOp = BO_PtrMemI;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001408 return Stmt::BinaryOperatorClass;
1409
1410 case OO_Subscript:
1411 return Stmt::ArraySubscriptExprClass;
1412 }
1413
1414 llvm_unreachable("Invalid overloaded operator expression");
1415}
Richard Smithf15acc52014-06-05 22:43:40 +00001416
Nico Weberf56f4462017-07-24 16:54:11 +00001417#if defined(_MSC_VER)
1418#if _MSC_VER == 1911
1419// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1420// MSVC 2017 update 3 miscompiles this function, and a clang built with it
1421// will crash in stage 2 of a bootstrap build.
1422#pragma optimize("", off)
1423#endif
1424#endif
1425
Chandler Carruth631abd92011-06-16 06:47:06 +00001426void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
Douglas Gregore9ceb312010-05-19 04:13:23 +00001427 if (S->isTypeDependent()) {
1428 // Type-dependent operator calls are profiled like their underlying
1429 // syntactic operator.
Richard Smithbac0a0d2016-10-24 18:47:04 +00001430 //
1431 // An operator call to operator-> is always implicit, so just skip it. The
1432 // enclosing MemberExpr will profile the actual member access.
1433 if (S->getOperator() == OO_Arrow)
1434 return Visit(S->getArg(0));
1435
John McCalle3027922010-08-25 11:45:40 +00001436 UnaryOperatorKind UnaryOp = UO_Extension;
1437 BinaryOperatorKind BinaryOp = BO_Comma;
Douglas Gregore9ceb312010-05-19 04:13:23 +00001438 Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
Richard Smithf15acc52014-06-05 22:43:40 +00001439
Douglas Gregore9ceb312010-05-19 04:13:23 +00001440 ID.AddInteger(SC);
1441 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1442 Visit(S->getArg(I));
1443 if (SC == Stmt::UnaryOperatorClass)
1444 ID.AddInteger(UnaryOp);
1445 else if (SC == Stmt::BinaryOperatorClass ||
1446 SC == Stmt::CompoundAssignOperatorClass)
1447 ID.AddInteger(BinaryOp);
1448 else
1449 assert(SC == Stmt::ArraySubscriptExprClass);
Richard Smithf15acc52014-06-05 22:43:40 +00001450
Douglas Gregore9ceb312010-05-19 04:13:23 +00001451 return;
1452 }
Richard Smithf15acc52014-06-05 22:43:40 +00001453
Douglas Gregor5c193b92009-07-28 00:33:38 +00001454 VisitCallExpr(S);
1455 ID.AddInteger(S->getOperator());
1456}
1457
Nico Weberf56f4462017-07-24 16:54:11 +00001458#if defined(_MSC_VER)
1459#if _MSC_VER == 1911
1460#pragma optimize("", on)
1461#endif
1462#endif
1463
Chandler Carruth631abd92011-06-16 06:47:06 +00001464void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001465 VisitCallExpr(S);
1466}
1467
Chandler Carruth631abd92011-06-16 06:47:06 +00001468void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
Peter Collingbourne41f85462011-02-09 21:07:24 +00001469 VisitCallExpr(S);
1470}
1471
Chandler Carruth631abd92011-06-16 06:47:06 +00001472void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
Tanya Lattner55808c12011-06-04 00:47:47 +00001473 VisitExpr(S);
1474}
1475
Chandler Carruth631abd92011-06-16 06:47:06 +00001476void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001477 VisitExplicitCastExpr(S);
1478}
1479
Chandler Carruth631abd92011-06-16 06:47:06 +00001480void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001481 VisitCXXNamedCastExpr(S);
1482}
1483
Chandler Carruth631abd92011-06-16 06:47:06 +00001484void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001485 VisitCXXNamedCastExpr(S);
1486}
1487
Chandler Carruth631abd92011-06-16 06:47:06 +00001488void
1489StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001490 VisitCXXNamedCastExpr(S);
1491}
1492
Chandler Carruth631abd92011-06-16 06:47:06 +00001493void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001494 VisitCXXNamedCastExpr(S);
1495}
1496
Richard Smithc67fdd42012-03-07 08:35:16 +00001497void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1498 VisitCallExpr(S);
1499}
1500
Chandler Carruth631abd92011-06-16 06:47:06 +00001501void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001502 VisitExpr(S);
1503 ID.AddBoolean(S->getValue());
1504}
1505
Chandler Carruth631abd92011-06-16 06:47:06 +00001506void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
Douglas Gregor00044172009-07-29 16:09:57 +00001507 VisitExpr(S);
1508}
1509
Richard Smithcc1b96d2013-06-12 22:31:48 +00001510void StmtProfiler::VisitCXXStdInitializerListExpr(
1511 const CXXStdInitializerListExpr *S) {
1512 VisitExpr(S);
1513}
1514
Chandler Carruth631abd92011-06-16 06:47:06 +00001515void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001516 VisitExpr(S);
1517 if (S->isTypeOperand())
David Majnemer143c55e2013-09-27 07:04:31 +00001518 VisitType(S->getTypeOperandSourceInfo()->getType());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001519}
1520
Chandler Carruth631abd92011-06-16 06:47:06 +00001521void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
Francois Pichet9f4f2072010-09-08 12:20:18 +00001522 VisitExpr(S);
1523 if (S->isTypeOperand())
David Majnemer143c55e2013-09-27 07:04:31 +00001524 VisitType(S->getTypeOperandSourceInfo()->getType());
Francois Pichet9f4f2072010-09-08 12:20:18 +00001525}
1526
John McCall5e77d762013-04-16 07:28:30 +00001527void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1528 VisitExpr(S);
1529 VisitDecl(S->getPropertyDecl());
1530}
1531
Alexey Bataevf7630272015-11-25 12:01:00 +00001532void StmtProfiler::VisitMSPropertySubscriptExpr(
1533 const MSPropertySubscriptExpr *S) {
1534 VisitExpr(S);
1535}
1536
Chandler Carruth631abd92011-06-16 06:47:06 +00001537void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001538 VisitExpr(S);
Douglas Gregor3024f072012-04-16 07:05:22 +00001539 ID.AddBoolean(S->isImplicit());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001540}
1541
Chandler Carruth631abd92011-06-16 06:47:06 +00001542void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001543 VisitExpr(S);
1544}
1545
Chandler Carruth631abd92011-06-16 06:47:06 +00001546void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001547 VisitExpr(S);
1548 VisitDecl(S->getParam());
1549}
1550
Richard Smith852c9db2013-04-20 22:23:05 +00001551void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1552 VisitExpr(S);
1553 VisitDecl(S->getField());
1554}
1555
Chandler Carruth631abd92011-06-16 06:47:06 +00001556void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001557 VisitExpr(S);
1558 VisitDecl(
1559 const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1560}
1561
Chandler Carruth631abd92011-06-16 06:47:06 +00001562void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001563 VisitExpr(S);
1564 VisitDecl(S->getConstructor());
1565 ID.AddBoolean(S->isElidable());
1566}
1567
Richard Smith5179eb72016-06-28 19:03:57 +00001568void StmtProfiler::VisitCXXInheritedCtorInitExpr(
1569 const CXXInheritedCtorInitExpr *S) {
1570 VisitExpr(S);
1571 VisitDecl(S->getConstructor());
1572}
1573
Chandler Carruth631abd92011-06-16 06:47:06 +00001574void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001575 VisitExplicitCastExpr(S);
1576}
1577
Chandler Carruth631abd92011-06-16 06:47:06 +00001578void
1579StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001580 VisitCXXConstructExpr(S);
1581}
1582
Chandler Carruth631abd92011-06-16 06:47:06 +00001583void
Douglas Gregore31e6062012-02-07 10:09:13 +00001584StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1585 VisitExpr(S);
1586 for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(),
1587 CEnd = S->explicit_capture_end();
1588 C != CEnd; ++C) {
1589 ID.AddInteger(C->getCaptureKind());
Richard Smithba71c082013-05-16 06:20:58 +00001590 switch (C->getCaptureKind()) {
Faisal Validc6b5962016-03-21 09:25:37 +00001591 case LCK_StarThis:
Richard Smithba71c082013-05-16 06:20:58 +00001592 case LCK_This:
1593 break;
1594 case LCK_ByRef:
1595 case LCK_ByCopy:
Douglas Gregore31e6062012-02-07 10:09:13 +00001596 VisitDecl(C->getCapturedVar());
1597 ID.AddBoolean(C->isPackExpansion());
Richard Smithba71c082013-05-16 06:20:58 +00001598 break;
Alexey Bataev39c81e22014-08-28 04:28:19 +00001599 case LCK_VLAType:
1600 llvm_unreachable("VLA type in explicit captures.");
Douglas Gregore31e6062012-02-07 10:09:13 +00001601 }
1602 }
1603 // Note: If we actually needed to be able to match lambda
1604 // expressions, we would have to consider parameters and return type
1605 // here, among other things.
1606 VisitStmt(S->getBody());
1607}
1608
1609void
Chandler Carruth631abd92011-06-16 06:47:06 +00001610StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001611 VisitExpr(S);
1612}
1613
Chandler Carruth631abd92011-06-16 06:47:06 +00001614void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001615 VisitExpr(S);
1616 ID.AddBoolean(S->isGlobalDelete());
1617 ID.AddBoolean(S->isArrayForm());
1618 VisitDecl(S->getOperatorDelete());
1619}
1620
Chandler Carruth631abd92011-06-16 06:47:06 +00001621void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001622 VisitExpr(S);
1623 VisitType(S->getAllocatedType());
1624 VisitDecl(S->getOperatorNew());
1625 VisitDecl(S->getOperatorDelete());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001626 ID.AddBoolean(S->isArray());
1627 ID.AddInteger(S->getNumPlacementArgs());
1628 ID.AddBoolean(S->isGlobalNew());
1629 ID.AddBoolean(S->isParenTypeId());
Sebastian Redl6047f072012-02-16 12:22:20 +00001630 ID.AddInteger(S->getInitializationStyle());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001631}
1632
Chandler Carruth631abd92011-06-16 06:47:06 +00001633void
1634StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
Douglas Gregorad8a3362009-09-04 17:36:40 +00001635 VisitExpr(S);
1636 ID.AddBoolean(S->isArrow());
1637 VisitNestedNameSpecifier(S->getQualifier());
Craig Topper36250ad2014-05-12 05:36:57 +00001638 ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
Eli Friedman85641392013-08-09 23:37:05 +00001639 if (S->getScopeTypeInfo())
1640 VisitType(S->getScopeTypeInfo()->getType());
Craig Topper36250ad2014-05-12 05:36:57 +00001641 ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
Eli Friedman85641392013-08-09 23:37:05 +00001642 if (S->getDestroyedTypeInfo())
1643 VisitType(S->getDestroyedType());
1644 else
Richard Trieu639d7b62017-02-22 22:22:42 +00001645 VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
Douglas Gregorad8a3362009-09-04 17:36:40 +00001646}
1647
Chandler Carruth631abd92011-06-16 06:47:06 +00001648void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
Argyrios Kyrtzidisb482eb82010-08-15 20:53:20 +00001649 VisitExpr(S);
John McCalle66edc12009-11-24 19:00:30 +00001650 VisitNestedNameSpecifier(S->getQualifier());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001651 VisitName(S->getName());
John McCalle66edc12009-11-24 19:00:30 +00001652 ID.AddBoolean(S->hasExplicitTemplateArgs());
1653 if (S->hasExplicitTemplateArgs())
James Y Knight04ec5bf2015-12-24 02:59:37 +00001654 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
Argyrios Kyrtzidisf4505452010-08-15 01:15:38 +00001655}
1656
1657void
Chandler Carruth631abd92011-06-16 06:47:06 +00001658StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
Argyrios Kyrtzidisf4505452010-08-15 01:15:38 +00001659 VisitOverloadExpr(S);
Douglas Gregor5c193b92009-07-28 00:33:38 +00001660}
1661
Douglas Gregor29c42f22012-02-24 07:38:34 +00001662void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
1663 VisitExpr(S);
1664 ID.AddInteger(S->getTrait());
1665 ID.AddInteger(S->getNumArgs());
1666 for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1667 VisitType(S->getArg(I)->getType());
1668}
1669
Chandler Carruth631abd92011-06-16 06:47:06 +00001670void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
John Wiegley6242b6a2011-04-28 00:16:57 +00001671 VisitExpr(S);
1672 ID.AddInteger(S->getTrait());
1673 VisitType(S->getQueriedType());
1674}
1675
Chandler Carruth631abd92011-06-16 06:47:06 +00001676void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
John Wiegleyf9f65842011-04-25 06:54:41 +00001677 VisitExpr(S);
1678 ID.AddInteger(S->getTrait());
1679 VisitExpr(S->getQueriedExpression());
1680}
1681
Chandler Carruth631abd92011-06-16 06:47:06 +00001682void StmtProfiler::VisitDependentScopeDeclRefExpr(
1683 const DependentScopeDeclRefExpr *S) {
Douglas Gregor5c193b92009-07-28 00:33:38 +00001684 VisitExpr(S);
1685 VisitName(S->getDeclName());
1686 VisitNestedNameSpecifier(S->getQualifier());
John McCalle66edc12009-11-24 19:00:30 +00001687 ID.AddBoolean(S->hasExplicitTemplateArgs());
1688 if (S->hasExplicitTemplateArgs())
1689 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
Douglas Gregor5c193b92009-07-28 00:33:38 +00001690}
1691
Chandler Carruth631abd92011-06-16 06:47:06 +00001692void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001693 VisitExpr(S);
Douglas Gregora7095092009-07-28 14:44:31 +00001694}
1695
Chandler Carruth631abd92011-06-16 06:47:06 +00001696void StmtProfiler::VisitCXXUnresolvedConstructExpr(
1697 const CXXUnresolvedConstructExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001698 VisitExpr(S);
1699 VisitType(S->getTypeAsWritten());
1700}
1701
Chandler Carruth631abd92011-06-16 06:47:06 +00001702void StmtProfiler::VisitCXXDependentScopeMemberExpr(
1703 const CXXDependentScopeMemberExpr *S) {
John McCall2d74de92009-12-01 22:10:20 +00001704 ID.AddBoolean(S->isImplicitAccess());
1705 if (!S->isImplicitAccess()) {
1706 VisitExpr(S);
1707 ID.AddBoolean(S->isArrow());
1708 }
Douglas Gregorc26e0f62009-09-03 16:14:30 +00001709 VisitNestedNameSpecifier(S->getQualifier());
Douglas Gregora7095092009-07-28 14:44:31 +00001710 VisitName(S->getMember());
John McCall2d74de92009-12-01 22:10:20 +00001711 ID.AddBoolean(S->hasExplicitTemplateArgs());
1712 if (S->hasExplicitTemplateArgs())
John McCall10eae182009-11-30 22:42:35 +00001713 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1714}
1715
Chandler Carruth631abd92011-06-16 06:47:06 +00001716void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
John McCall2d74de92009-12-01 22:10:20 +00001717 ID.AddBoolean(S->isImplicitAccess());
1718 if (!S->isImplicitAccess()) {
1719 VisitExpr(S);
1720 ID.AddBoolean(S->isArrow());
1721 }
John McCall10eae182009-11-30 22:42:35 +00001722 VisitNestedNameSpecifier(S->getQualifier());
1723 VisitName(S->getMemberName());
1724 ID.AddBoolean(S->hasExplicitTemplateArgs());
1725 if (S->hasExplicitTemplateArgs())
1726 VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
Douglas Gregora7095092009-07-28 14:44:31 +00001727}
1728
Chandler Carruth631abd92011-06-16 06:47:06 +00001729void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
Sebastian Redl4202c0f2010-09-10 20:55:43 +00001730 VisitExpr(S);
1731}
1732
Chandler Carruth631abd92011-06-16 06:47:06 +00001733void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
Douglas Gregore8e9dd62011-01-03 17:17:50 +00001734 VisitExpr(S);
1735}
1736
Chandler Carruth631abd92011-06-16 06:47:06 +00001737void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
Douglas Gregor820ba7b2011-01-04 17:33:58 +00001738 VisitExpr(S);
1739 VisitDecl(S->getPack());
Richard Smithd784e682015-09-23 21:41:42 +00001740 if (S->isPartiallySubstituted()) {
1741 auto Args = S->getPartialArguments();
1742 ID.AddInteger(Args.size());
1743 for (const auto &TA : Args)
1744 VisitTemplateArgument(TA);
1745 } else {
1746 ID.AddInteger(0);
1747 }
Douglas Gregor820ba7b2011-01-04 17:33:58 +00001748}
1749
Douglas Gregorcdbc5392011-01-15 01:15:58 +00001750void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
Chandler Carruth631abd92011-06-16 06:47:06 +00001751 const SubstNonTypeTemplateParmPackExpr *S) {
Douglas Gregorcdbc5392011-01-15 01:15:58 +00001752 VisitExpr(S);
1753 VisitDecl(S->getParameterPack());
1754 VisitTemplateArgument(S->getArgumentPack());
1755}
1756
John McCall7c454bb2011-07-15 05:09:51 +00001757void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
1758 const SubstNonTypeTemplateParmExpr *E) {
1759 // Profile exactly as the replacement expression.
1760 Visit(E->getReplacement());
1761}
1762
Richard Smithb15fe3a2012-09-12 00:56:43 +00001763void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
1764 VisitExpr(S);
1765 VisitDecl(S->getParameterPack());
1766 ID.AddInteger(S->getNumExpansions());
1767 for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
1768 VisitDecl(*I);
1769}
1770
Douglas Gregorfe314812011-06-21 17:03:29 +00001771void StmtProfiler::VisitMaterializeTemporaryExpr(
1772 const MaterializeTemporaryExpr *S) {
1773 VisitExpr(S);
1774}
1775
Richard Smith0f0af192014-11-08 05:07:16 +00001776void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
1777 VisitExpr(S);
1778 ID.AddInteger(S->getOperator());
1779}
1780
Richard Smith9f690bd2015-10-27 06:02:45 +00001781void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
1782 VisitStmt(S);
1783}
1784
1785void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
1786 VisitStmt(S);
1787}
1788
1789void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
1790 VisitExpr(S);
1791}
1792
Eric Fiselier20f25cb2017-03-06 23:38:15 +00001793void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
1794 VisitExpr(S);
1795}
1796
Richard Smith9f690bd2015-10-27 06:02:45 +00001797void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
1798 VisitExpr(S);
1799}
1800
Chandler Carruth631abd92011-06-16 06:47:06 +00001801void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
John McCall8d69a212010-11-15 23:31:06 +00001802 VisitExpr(E);
1803}
1804
Kaelyn Takatae1f49d52014-10-27 18:07:20 +00001805void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
1806 VisitExpr(E);
1807}
1808
Chandler Carruth631abd92011-06-16 06:47:06 +00001809void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001810 VisitExpr(S);
1811}
1812
Patrick Beard0caa3942012-04-19 00:25:12 +00001813void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
Ted Kremeneke65b0862012-03-06 20:05:56 +00001814 VisitExpr(E);
1815}
1816
1817void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
1818 VisitExpr(E);
1819}
1820
1821void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
1822 VisitExpr(E);
1823}
1824
Chandler Carruth631abd92011-06-16 06:47:06 +00001825void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001826 VisitExpr(S);
1827 VisitType(S->getEncodedType());
1828}
1829
Chandler Carruth631abd92011-06-16 06:47:06 +00001830void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001831 VisitExpr(S);
1832 VisitName(S->getSelector());
1833}
1834
Chandler Carruth631abd92011-06-16 06:47:06 +00001835void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001836 VisitExpr(S);
1837 VisitDecl(S->getProtocol());
1838}
1839
Chandler Carruth631abd92011-06-16 06:47:06 +00001840void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001841 VisitExpr(S);
1842 VisitDecl(S->getDecl());
1843 ID.AddBoolean(S->isArrow());
1844 ID.AddBoolean(S->isFreeIvar());
1845}
1846
Chandler Carruth631abd92011-06-16 06:47:06 +00001847void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001848 VisitExpr(S);
John McCallb7bd14f2010-12-02 01:19:52 +00001849 if (S->isImplicitProperty()) {
1850 VisitDecl(S->getImplicitPropertyGetter());
1851 VisitDecl(S->getImplicitPropertySetter());
1852 } else {
1853 VisitDecl(S->getExplicitProperty());
Fariborz Jahanian681c0752010-10-14 16:04:05 +00001854 }
Fariborz Jahanian681c0752010-10-14 16:04:05 +00001855 if (S->isSuperReceiver()) {
1856 ID.AddBoolean(S->isSuperReceiver());
John McCallb7bd14f2010-12-02 01:19:52 +00001857 VisitType(S->getSuperReceiverType());
Fariborz Jahanian681c0752010-10-14 16:04:05 +00001858 }
Douglas Gregora7095092009-07-28 14:44:31 +00001859}
1860
Ted Kremeneke65b0862012-03-06 20:05:56 +00001861void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
1862 VisitExpr(S);
1863 VisitDecl(S->getAtIndexMethodDecl());
1864 VisitDecl(S->setAtIndexMethodDecl());
1865}
1866
Chandler Carruth631abd92011-06-16 06:47:06 +00001867void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001868 VisitExpr(S);
1869 VisitName(S->getSelector());
1870 VisitDecl(S->getMethodDecl());
1871}
1872
Chandler Carruth631abd92011-06-16 06:47:06 +00001873void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
Douglas Gregora7095092009-07-28 14:44:31 +00001874 VisitExpr(S);
1875 ID.AddBoolean(S->isArrow());
1876}
1877
Ted Kremeneke65b0862012-03-06 20:05:56 +00001878void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
1879 VisitExpr(S);
1880 ID.AddBoolean(S->getValue());
1881}
1882
Chandler Carruth631abd92011-06-16 06:47:06 +00001883void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
1884 const ObjCIndirectCopyRestoreExpr *S) {
John McCall31168b02011-06-15 23:02:42 +00001885 VisitExpr(S);
1886 ID.AddBoolean(S->shouldCopy());
1887}
1888
Chandler Carruth631abd92011-06-16 06:47:06 +00001889void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
John McCall31168b02011-06-15 23:02:42 +00001890 VisitExplicitCastExpr(S);
1891 ID.AddBoolean(S->getBridgeKind());
1892}
1893
Erik Pilkington29099de2016-07-16 00:35:23 +00001894void StmtProfiler::VisitObjCAvailabilityCheckExpr(
1895 const ObjCAvailabilityCheckExpr *S) {
1896 VisitExpr(S);
1897}
1898
John McCall0ad16662009-10-29 08:12:44 +00001899void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
Douglas Gregor5c193b92009-07-28 00:33:38 +00001900 unsigned NumArgs) {
1901 ID.AddInteger(NumArgs);
John McCall0ad16662009-10-29 08:12:44 +00001902 for (unsigned I = 0; I != NumArgs; ++I)
1903 VisitTemplateArgument(Args[I].getArgument());
1904}
Mike Stump11289f42009-09-09 15:08:12 +00001905
John McCall0ad16662009-10-29 08:12:44 +00001906void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
1907 // Mostly repetitive with TemplateArgument::Profile!
1908 ID.AddInteger(Arg.getKind());
1909 switch (Arg.getKind()) {
1910 case TemplateArgument::Null:
1911 break;
Mike Stump11289f42009-09-09 15:08:12 +00001912
John McCall0ad16662009-10-29 08:12:44 +00001913 case TemplateArgument::Type:
1914 VisitType(Arg.getAsType());
1915 break;
Mike Stump11289f42009-09-09 15:08:12 +00001916
Douglas Gregor9167f8b2009-11-11 01:00:40 +00001917 case TemplateArgument::Template:
Douglas Gregore4ff4b52011-01-05 18:58:31 +00001918 case TemplateArgument::TemplateExpansion:
1919 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
Douglas Gregor9167f8b2009-11-11 01:00:40 +00001920 break;
Alexis Hunta8136cc2010-05-05 15:23:54 +00001921
John McCall0ad16662009-10-29 08:12:44 +00001922 case TemplateArgument::Declaration:
1923 VisitDecl(Arg.getAsDecl());
1924 break;
Mike Stump11289f42009-09-09 15:08:12 +00001925
Eli Friedmanb826a002012-09-26 02:36:12 +00001926 case TemplateArgument::NullPtr:
1927 VisitType(Arg.getNullPtrType());
1928 break;
1929
John McCall0ad16662009-10-29 08:12:44 +00001930 case TemplateArgument::Integral:
Benjamin Kramer6003ad52012-06-07 15:09:51 +00001931 Arg.getAsIntegral().Profile(ID);
John McCall0ad16662009-10-29 08:12:44 +00001932 VisitType(Arg.getIntegralType());
1933 break;
Mike Stump11289f42009-09-09 15:08:12 +00001934
John McCall0ad16662009-10-29 08:12:44 +00001935 case TemplateArgument::Expression:
1936 Visit(Arg.getAsExpr());
1937 break;
Mike Stump11289f42009-09-09 15:08:12 +00001938
John McCall0ad16662009-10-29 08:12:44 +00001939 case TemplateArgument::Pack:
Aaron Ballman2a89e852014-07-15 21:32:31 +00001940 for (const auto &P : Arg.pack_elements())
1941 VisitTemplateArgument(P);
John McCall0ad16662009-10-29 08:12:44 +00001942 break;
Douglas Gregor5c193b92009-07-28 00:33:38 +00001943 }
1944}
1945
Jay Foad39c79802011-01-12 09:06:06 +00001946void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
Chandler Carruth631abd92011-06-16 06:47:06 +00001947 bool Canonical) const {
Richard Trieu639d7b62017-02-22 22:22:42 +00001948 StmtProfilerWithPointers Profiler(ID, Context, Canonical);
1949 Profiler.Visit(this);
1950}
1951
1952void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
1953 class ODRHash &Hash) const {
1954 StmtProfilerWithoutPointers Profiler(ID, Hash);
Douglas Gregor5c193b92009-07-28 00:33:38 +00001955 Profiler.Visit(this);
1956}