xref: /minix3/external/bsd/llvm/dist/clang/lib/AST/StmtProfile.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc //===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2f4a2713aSLionel Sambuc //
3f4a2713aSLionel Sambuc //                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc //
5f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc //
8f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc //
10f4a2713aSLionel Sambuc // This file implements the Stmt::Profile method, which builds a unique bit
11f4a2713aSLionel Sambuc // representation that identifies a statement/expression.
12f4a2713aSLionel Sambuc //
13f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
14f4a2713aSLionel Sambuc #include "clang/AST/ASTContext.h"
15f4a2713aSLionel Sambuc #include "clang/AST/DeclCXX.h"
16f4a2713aSLionel Sambuc #include "clang/AST/DeclObjC.h"
17f4a2713aSLionel Sambuc #include "clang/AST/DeclTemplate.h"
18f4a2713aSLionel Sambuc #include "clang/AST/Expr.h"
19f4a2713aSLionel Sambuc #include "clang/AST/ExprCXX.h"
20f4a2713aSLionel Sambuc #include "clang/AST/ExprObjC.h"
21f4a2713aSLionel Sambuc #include "clang/AST/StmtVisitor.h"
22f4a2713aSLionel Sambuc #include "llvm/ADT/FoldingSet.h"
23f4a2713aSLionel Sambuc using namespace clang;
24f4a2713aSLionel Sambuc 
25f4a2713aSLionel Sambuc namespace {
26f4a2713aSLionel Sambuc   class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
27f4a2713aSLionel Sambuc     llvm::FoldingSetNodeID &ID;
28f4a2713aSLionel Sambuc     const ASTContext &Context;
29f4a2713aSLionel Sambuc     bool Canonical;
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc   public:
StmtProfiler(llvm::FoldingSetNodeID & ID,const ASTContext & Context,bool Canonical)32f4a2713aSLionel Sambuc     StmtProfiler(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
33f4a2713aSLionel Sambuc                  bool Canonical)
34f4a2713aSLionel Sambuc       : ID(ID), Context(Context), Canonical(Canonical) { }
35f4a2713aSLionel Sambuc 
36f4a2713aSLionel Sambuc     void VisitStmt(const Stmt *S);
37f4a2713aSLionel Sambuc 
38f4a2713aSLionel Sambuc #define STMT(Node, Base) void Visit##Node(const Node *S);
39f4a2713aSLionel Sambuc #include "clang/AST/StmtNodes.inc"
40f4a2713aSLionel Sambuc 
41f4a2713aSLionel Sambuc     /// \brief Visit a declaration that is referenced within an expression
42f4a2713aSLionel Sambuc     /// or statement.
43f4a2713aSLionel Sambuc     void VisitDecl(const Decl *D);
44f4a2713aSLionel Sambuc 
45f4a2713aSLionel Sambuc     /// \brief Visit a type that is referenced within an expression or
46f4a2713aSLionel Sambuc     /// statement.
47f4a2713aSLionel Sambuc     void VisitType(QualType T);
48f4a2713aSLionel Sambuc 
49f4a2713aSLionel Sambuc     /// \brief Visit a name that occurs within an expression or statement.
50f4a2713aSLionel Sambuc     void VisitName(DeclarationName Name);
51f4a2713aSLionel Sambuc 
52f4a2713aSLionel Sambuc     /// \brief Visit a nested-name-specifier that occurs within an expression
53f4a2713aSLionel Sambuc     /// or statement.
54f4a2713aSLionel Sambuc     void VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
55f4a2713aSLionel Sambuc 
56f4a2713aSLionel Sambuc     /// \brief Visit a template name that occurs within an expression or
57f4a2713aSLionel Sambuc     /// statement.
58f4a2713aSLionel Sambuc     void VisitTemplateName(TemplateName Name);
59f4a2713aSLionel Sambuc 
60f4a2713aSLionel Sambuc     /// \brief Visit template arguments that occur within an expression or
61f4a2713aSLionel Sambuc     /// statement.
62f4a2713aSLionel Sambuc     void VisitTemplateArguments(const TemplateArgumentLoc *Args,
63f4a2713aSLionel Sambuc                                 unsigned NumArgs);
64f4a2713aSLionel Sambuc 
65f4a2713aSLionel Sambuc     /// \brief Visit a single template argument.
66f4a2713aSLionel Sambuc     void VisitTemplateArgument(const TemplateArgument &Arg);
67f4a2713aSLionel Sambuc   };
68f4a2713aSLionel Sambuc }
69f4a2713aSLionel Sambuc 
VisitStmt(const Stmt * S)70f4a2713aSLionel Sambuc void StmtProfiler::VisitStmt(const Stmt *S) {
71f4a2713aSLionel Sambuc   ID.AddInteger(S->getStmtClass());
72f4a2713aSLionel Sambuc   for (Stmt::const_child_range C = S->children(); C; ++C) {
73f4a2713aSLionel Sambuc     if (*C)
74f4a2713aSLionel Sambuc       Visit(*C);
75f4a2713aSLionel Sambuc     else
76f4a2713aSLionel Sambuc       ID.AddInteger(0);
77f4a2713aSLionel Sambuc   }
78f4a2713aSLionel Sambuc }
79f4a2713aSLionel Sambuc 
VisitDeclStmt(const DeclStmt * S)80f4a2713aSLionel Sambuc void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
81f4a2713aSLionel Sambuc   VisitStmt(S);
82*0a6a1f1dSLionel Sambuc   for (const auto *D : S->decls())
83*0a6a1f1dSLionel Sambuc     VisitDecl(D);
84f4a2713aSLionel Sambuc }
85f4a2713aSLionel Sambuc 
VisitNullStmt(const NullStmt * S)86f4a2713aSLionel Sambuc void StmtProfiler::VisitNullStmt(const NullStmt *S) {
87f4a2713aSLionel Sambuc   VisitStmt(S);
88f4a2713aSLionel Sambuc }
89f4a2713aSLionel Sambuc 
VisitCompoundStmt(const CompoundStmt * S)90f4a2713aSLionel Sambuc void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
91f4a2713aSLionel Sambuc   VisitStmt(S);
92f4a2713aSLionel Sambuc }
93f4a2713aSLionel Sambuc 
VisitSwitchCase(const SwitchCase * S)94f4a2713aSLionel Sambuc void StmtProfiler::VisitSwitchCase(const SwitchCase *S) {
95f4a2713aSLionel Sambuc   VisitStmt(S);
96f4a2713aSLionel Sambuc }
97f4a2713aSLionel Sambuc 
VisitCaseStmt(const CaseStmt * S)98f4a2713aSLionel Sambuc void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
99f4a2713aSLionel Sambuc   VisitStmt(S);
100f4a2713aSLionel Sambuc }
101f4a2713aSLionel Sambuc 
VisitDefaultStmt(const DefaultStmt * S)102f4a2713aSLionel Sambuc void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
103f4a2713aSLionel Sambuc   VisitStmt(S);
104f4a2713aSLionel Sambuc }
105f4a2713aSLionel Sambuc 
VisitLabelStmt(const LabelStmt * S)106f4a2713aSLionel Sambuc void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
107f4a2713aSLionel Sambuc   VisitStmt(S);
108f4a2713aSLionel Sambuc   VisitDecl(S->getDecl());
109f4a2713aSLionel Sambuc }
110f4a2713aSLionel Sambuc 
VisitAttributedStmt(const AttributedStmt * S)111f4a2713aSLionel Sambuc void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
112f4a2713aSLionel Sambuc   VisitStmt(S);
113f4a2713aSLionel Sambuc   // TODO: maybe visit attributes?
114f4a2713aSLionel Sambuc }
115f4a2713aSLionel Sambuc 
VisitIfStmt(const IfStmt * S)116f4a2713aSLionel Sambuc void StmtProfiler::VisitIfStmt(const IfStmt *S) {
117f4a2713aSLionel Sambuc   VisitStmt(S);
118f4a2713aSLionel Sambuc   VisitDecl(S->getConditionVariable());
119f4a2713aSLionel Sambuc }
120f4a2713aSLionel Sambuc 
VisitSwitchStmt(const SwitchStmt * S)121f4a2713aSLionel Sambuc void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
122f4a2713aSLionel Sambuc   VisitStmt(S);
123f4a2713aSLionel Sambuc   VisitDecl(S->getConditionVariable());
124f4a2713aSLionel Sambuc }
125f4a2713aSLionel Sambuc 
VisitWhileStmt(const WhileStmt * S)126f4a2713aSLionel Sambuc void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
127f4a2713aSLionel Sambuc   VisitStmt(S);
128f4a2713aSLionel Sambuc   VisitDecl(S->getConditionVariable());
129f4a2713aSLionel Sambuc }
130f4a2713aSLionel Sambuc 
VisitDoStmt(const DoStmt * S)131f4a2713aSLionel Sambuc void StmtProfiler::VisitDoStmt(const DoStmt *S) {
132f4a2713aSLionel Sambuc   VisitStmt(S);
133f4a2713aSLionel Sambuc }
134f4a2713aSLionel Sambuc 
VisitForStmt(const ForStmt * S)135f4a2713aSLionel Sambuc void StmtProfiler::VisitForStmt(const ForStmt *S) {
136f4a2713aSLionel Sambuc   VisitStmt(S);
137f4a2713aSLionel Sambuc }
138f4a2713aSLionel Sambuc 
VisitGotoStmt(const GotoStmt * S)139f4a2713aSLionel Sambuc void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
140f4a2713aSLionel Sambuc   VisitStmt(S);
141f4a2713aSLionel Sambuc   VisitDecl(S->getLabel());
142f4a2713aSLionel Sambuc }
143f4a2713aSLionel Sambuc 
VisitIndirectGotoStmt(const IndirectGotoStmt * S)144f4a2713aSLionel Sambuc void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
145f4a2713aSLionel Sambuc   VisitStmt(S);
146f4a2713aSLionel Sambuc }
147f4a2713aSLionel Sambuc 
VisitContinueStmt(const ContinueStmt * S)148f4a2713aSLionel Sambuc void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
149f4a2713aSLionel Sambuc   VisitStmt(S);
150f4a2713aSLionel Sambuc }
151f4a2713aSLionel Sambuc 
VisitBreakStmt(const BreakStmt * S)152f4a2713aSLionel Sambuc void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
153f4a2713aSLionel Sambuc   VisitStmt(S);
154f4a2713aSLionel Sambuc }
155f4a2713aSLionel Sambuc 
VisitReturnStmt(const ReturnStmt * S)156f4a2713aSLionel Sambuc void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
157f4a2713aSLionel Sambuc   VisitStmt(S);
158f4a2713aSLionel Sambuc }
159f4a2713aSLionel Sambuc 
VisitGCCAsmStmt(const GCCAsmStmt * S)160f4a2713aSLionel Sambuc void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
161f4a2713aSLionel Sambuc   VisitStmt(S);
162f4a2713aSLionel Sambuc   ID.AddBoolean(S->isVolatile());
163f4a2713aSLionel Sambuc   ID.AddBoolean(S->isSimple());
164f4a2713aSLionel Sambuc   VisitStringLiteral(S->getAsmString());
165f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumOutputs());
166f4a2713aSLionel Sambuc   for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
167f4a2713aSLionel Sambuc     ID.AddString(S->getOutputName(I));
168f4a2713aSLionel Sambuc     VisitStringLiteral(S->getOutputConstraintLiteral(I));
169f4a2713aSLionel Sambuc   }
170f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumInputs());
171f4a2713aSLionel Sambuc   for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
172f4a2713aSLionel Sambuc     ID.AddString(S->getInputName(I));
173f4a2713aSLionel Sambuc     VisitStringLiteral(S->getInputConstraintLiteral(I));
174f4a2713aSLionel Sambuc   }
175f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumClobbers());
176f4a2713aSLionel Sambuc   for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
177f4a2713aSLionel Sambuc     VisitStringLiteral(S->getClobberStringLiteral(I));
178f4a2713aSLionel Sambuc }
179f4a2713aSLionel Sambuc 
VisitMSAsmStmt(const MSAsmStmt * S)180f4a2713aSLionel Sambuc void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
181f4a2713aSLionel Sambuc   // FIXME: Implement MS style inline asm statement profiler.
182f4a2713aSLionel Sambuc   VisitStmt(S);
183f4a2713aSLionel Sambuc }
184f4a2713aSLionel Sambuc 
VisitCXXCatchStmt(const CXXCatchStmt * S)185f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
186f4a2713aSLionel Sambuc   VisitStmt(S);
187f4a2713aSLionel Sambuc   VisitType(S->getCaughtType());
188f4a2713aSLionel Sambuc }
189f4a2713aSLionel Sambuc 
VisitCXXTryStmt(const CXXTryStmt * S)190f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
191f4a2713aSLionel Sambuc   VisitStmt(S);
192f4a2713aSLionel Sambuc }
193f4a2713aSLionel Sambuc 
VisitCXXForRangeStmt(const CXXForRangeStmt * S)194f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
195f4a2713aSLionel Sambuc   VisitStmt(S);
196f4a2713aSLionel Sambuc }
197f4a2713aSLionel Sambuc 
VisitMSDependentExistsStmt(const MSDependentExistsStmt * S)198f4a2713aSLionel Sambuc void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
199f4a2713aSLionel Sambuc   VisitStmt(S);
200f4a2713aSLionel Sambuc   ID.AddBoolean(S->isIfExists());
201f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
202f4a2713aSLionel Sambuc   VisitName(S->getNameInfo().getName());
203f4a2713aSLionel Sambuc }
204f4a2713aSLionel Sambuc 
VisitSEHTryStmt(const SEHTryStmt * S)205f4a2713aSLionel Sambuc void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
206f4a2713aSLionel Sambuc   VisitStmt(S);
207f4a2713aSLionel Sambuc }
208f4a2713aSLionel Sambuc 
VisitSEHFinallyStmt(const SEHFinallyStmt * S)209f4a2713aSLionel Sambuc void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
210f4a2713aSLionel Sambuc   VisitStmt(S);
211f4a2713aSLionel Sambuc }
212f4a2713aSLionel Sambuc 
VisitSEHExceptStmt(const SEHExceptStmt * S)213f4a2713aSLionel Sambuc void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
214f4a2713aSLionel Sambuc   VisitStmt(S);
215f4a2713aSLionel Sambuc }
216f4a2713aSLionel Sambuc 
VisitSEHLeaveStmt(const SEHLeaveStmt * S)217*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
218*0a6a1f1dSLionel Sambuc   VisitStmt(S);
219*0a6a1f1dSLionel Sambuc }
220*0a6a1f1dSLionel Sambuc 
VisitCapturedStmt(const CapturedStmt * S)221f4a2713aSLionel Sambuc void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
222f4a2713aSLionel Sambuc   VisitStmt(S);
223f4a2713aSLionel Sambuc }
224f4a2713aSLionel Sambuc 
VisitObjCForCollectionStmt(const ObjCForCollectionStmt * S)225f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
226f4a2713aSLionel Sambuc   VisitStmt(S);
227f4a2713aSLionel Sambuc }
228f4a2713aSLionel Sambuc 
VisitObjCAtCatchStmt(const ObjCAtCatchStmt * S)229f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
230f4a2713aSLionel Sambuc   VisitStmt(S);
231f4a2713aSLionel Sambuc   ID.AddBoolean(S->hasEllipsis());
232f4a2713aSLionel Sambuc   if (S->getCatchParamDecl())
233f4a2713aSLionel Sambuc     VisitType(S->getCatchParamDecl()->getType());
234f4a2713aSLionel Sambuc }
235f4a2713aSLionel Sambuc 
VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt * S)236f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
237f4a2713aSLionel Sambuc   VisitStmt(S);
238f4a2713aSLionel Sambuc }
239f4a2713aSLionel Sambuc 
VisitObjCAtTryStmt(const ObjCAtTryStmt * S)240f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
241f4a2713aSLionel Sambuc   VisitStmt(S);
242f4a2713aSLionel Sambuc }
243f4a2713aSLionel Sambuc 
244f4a2713aSLionel Sambuc void
VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt * S)245f4a2713aSLionel Sambuc StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
246f4a2713aSLionel Sambuc   VisitStmt(S);
247f4a2713aSLionel Sambuc }
248f4a2713aSLionel Sambuc 
VisitObjCAtThrowStmt(const ObjCAtThrowStmt * S)249f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
250f4a2713aSLionel Sambuc   VisitStmt(S);
251f4a2713aSLionel Sambuc }
252f4a2713aSLionel Sambuc 
253f4a2713aSLionel Sambuc void
VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt * S)254f4a2713aSLionel Sambuc StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
255f4a2713aSLionel Sambuc   VisitStmt(S);
256f4a2713aSLionel Sambuc }
257f4a2713aSLionel Sambuc 
258f4a2713aSLionel Sambuc namespace {
259f4a2713aSLionel Sambuc class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
260f4a2713aSLionel Sambuc   StmtProfiler *Profiler;
261f4a2713aSLionel Sambuc   /// \brief Process clauses with list of variables.
262f4a2713aSLionel Sambuc   template <typename T>
263f4a2713aSLionel Sambuc   void VisitOMPClauseList(T *Node);
264f4a2713aSLionel Sambuc public:
OMPClauseProfiler(StmtProfiler * P)265f4a2713aSLionel Sambuc   OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
266f4a2713aSLionel Sambuc #define OPENMP_CLAUSE(Name, Class)                                             \
267f4a2713aSLionel Sambuc   void Visit##Class(const Class *C);
268f4a2713aSLionel Sambuc #include "clang/Basic/OpenMPKinds.def"
269f4a2713aSLionel Sambuc };
270f4a2713aSLionel Sambuc 
VisitOMPIfClause(const OMPIfClause * C)271*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
272*0a6a1f1dSLionel Sambuc   if (C->getCondition())
273*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getCondition());
274*0a6a1f1dSLionel Sambuc }
275*0a6a1f1dSLionel Sambuc 
VisitOMPFinalClause(const OMPFinalClause * C)276*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
277*0a6a1f1dSLionel Sambuc   if (C->getCondition())
278*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getCondition());
279*0a6a1f1dSLionel Sambuc }
280*0a6a1f1dSLionel Sambuc 
VisitOMPNumThreadsClause(const OMPNumThreadsClause * C)281*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
282*0a6a1f1dSLionel Sambuc   if (C->getNumThreads())
283*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getNumThreads());
284*0a6a1f1dSLionel Sambuc }
285*0a6a1f1dSLionel Sambuc 
VisitOMPSafelenClause(const OMPSafelenClause * C)286*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
287*0a6a1f1dSLionel Sambuc   if (C->getSafelen())
288*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getSafelen());
289*0a6a1f1dSLionel Sambuc }
290*0a6a1f1dSLionel Sambuc 
VisitOMPCollapseClause(const OMPCollapseClause * C)291*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
292*0a6a1f1dSLionel Sambuc   if (C->getNumForLoops())
293*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getNumForLoops());
294*0a6a1f1dSLionel Sambuc }
295*0a6a1f1dSLionel Sambuc 
VisitOMPDefaultClause(const OMPDefaultClause * C)296f4a2713aSLionel Sambuc void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
297f4a2713aSLionel Sambuc 
VisitOMPProcBindClause(const OMPProcBindClause * C)298*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
299*0a6a1f1dSLionel Sambuc 
VisitOMPScheduleClause(const OMPScheduleClause * C)300*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
301*0a6a1f1dSLionel Sambuc   if (C->getChunkSize())
302*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(C->getChunkSize());
303*0a6a1f1dSLionel Sambuc }
304*0a6a1f1dSLionel Sambuc 
VisitOMPOrderedClause(const OMPOrderedClause *)305*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *) {}
306*0a6a1f1dSLionel Sambuc 
VisitOMPNowaitClause(const OMPNowaitClause *)307*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
308*0a6a1f1dSLionel Sambuc 
VisitOMPUntiedClause(const OMPUntiedClause *)309*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
310*0a6a1f1dSLionel Sambuc 
VisitOMPMergeableClause(const OMPMergeableClause *)311*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
312*0a6a1f1dSLionel Sambuc 
VisitOMPReadClause(const OMPReadClause *)313*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
314*0a6a1f1dSLionel Sambuc 
VisitOMPWriteClause(const OMPWriteClause *)315*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
316*0a6a1f1dSLionel Sambuc 
VisitOMPUpdateClause(const OMPUpdateClause *)317*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
318*0a6a1f1dSLionel Sambuc 
VisitOMPCaptureClause(const OMPCaptureClause *)319*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
320*0a6a1f1dSLionel Sambuc 
VisitOMPSeqCstClause(const OMPSeqCstClause *)321*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
322*0a6a1f1dSLionel Sambuc 
323f4a2713aSLionel Sambuc template<typename T>
VisitOMPClauseList(T * Node)324f4a2713aSLionel Sambuc void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
325*0a6a1f1dSLionel Sambuc   for (auto *E : Node->varlists()) {
326*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(E);
327*0a6a1f1dSLionel Sambuc   }
328f4a2713aSLionel Sambuc }
329f4a2713aSLionel Sambuc 
VisitOMPPrivateClause(const OMPPrivateClause * C)330f4a2713aSLionel Sambuc void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
331f4a2713aSLionel Sambuc   VisitOMPClauseList(C);
332*0a6a1f1dSLionel Sambuc   for (auto *E : C->private_copies()) {
333*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(E);
334f4a2713aSLionel Sambuc   }
335*0a6a1f1dSLionel Sambuc }
336*0a6a1f1dSLionel Sambuc void
VisitOMPFirstprivateClause(const OMPFirstprivateClause * C)337*0a6a1f1dSLionel Sambuc OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
338*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
339*0a6a1f1dSLionel Sambuc   for (auto *E : C->private_copies()) {
340*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(E);
341*0a6a1f1dSLionel Sambuc   }
342*0a6a1f1dSLionel Sambuc   for (auto *E : C->inits()) {
343*0a6a1f1dSLionel Sambuc     Profiler->VisitStmt(E);
344*0a6a1f1dSLionel Sambuc   }
345*0a6a1f1dSLionel Sambuc }
346*0a6a1f1dSLionel Sambuc void
VisitOMPLastprivateClause(const OMPLastprivateClause * C)347*0a6a1f1dSLionel Sambuc OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
348f4a2713aSLionel Sambuc   VisitOMPClauseList(C);
349f4a2713aSLionel Sambuc }
VisitOMPSharedClause(const OMPSharedClause * C)350f4a2713aSLionel Sambuc void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
351f4a2713aSLionel Sambuc   VisitOMPClauseList(C);
352f4a2713aSLionel Sambuc }
VisitOMPReductionClause(const OMPReductionClause * C)353*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPReductionClause(
354*0a6a1f1dSLionel Sambuc                                          const OMPReductionClause *C) {
355*0a6a1f1dSLionel Sambuc   Profiler->VisitNestedNameSpecifier(
356*0a6a1f1dSLionel Sambuc       C->getQualifierLoc().getNestedNameSpecifier());
357*0a6a1f1dSLionel Sambuc   Profiler->VisitName(C->getNameInfo().getName());
358*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
359*0a6a1f1dSLionel Sambuc }
VisitOMPLinearClause(const OMPLinearClause * C)360*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
361*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
362*0a6a1f1dSLionel Sambuc   Profiler->VisitStmt(C->getStep());
363*0a6a1f1dSLionel Sambuc }
VisitOMPAlignedClause(const OMPAlignedClause * C)364*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
365*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
366*0a6a1f1dSLionel Sambuc   Profiler->VisitStmt(C->getAlignment());
367*0a6a1f1dSLionel Sambuc }
VisitOMPCopyinClause(const OMPCopyinClause * C)368*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
369*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
370*0a6a1f1dSLionel Sambuc }
371*0a6a1f1dSLionel Sambuc void
VisitOMPCopyprivateClause(const OMPCopyprivateClause * C)372*0a6a1f1dSLionel Sambuc OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
373*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
374*0a6a1f1dSLionel Sambuc }
VisitOMPFlushClause(const OMPFlushClause * C)375*0a6a1f1dSLionel Sambuc void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
376*0a6a1f1dSLionel Sambuc   VisitOMPClauseList(C);
377*0a6a1f1dSLionel Sambuc }
378f4a2713aSLionel Sambuc }
379f4a2713aSLionel Sambuc 
380f4a2713aSLionel Sambuc void
VisitOMPExecutableDirective(const OMPExecutableDirective * S)381*0a6a1f1dSLionel Sambuc StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
382f4a2713aSLionel Sambuc   VisitStmt(S);
383f4a2713aSLionel Sambuc   OMPClauseProfiler P(this);
384f4a2713aSLionel Sambuc   ArrayRef<OMPClause *> Clauses = S->clauses();
385f4a2713aSLionel Sambuc   for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
386f4a2713aSLionel Sambuc        I != E; ++I)
387f4a2713aSLionel Sambuc     if (*I)
388f4a2713aSLionel Sambuc       P.Visit(*I);
389f4a2713aSLionel Sambuc }
390f4a2713aSLionel Sambuc 
VisitOMPLoopDirective(const OMPLoopDirective * S)391*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
392*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
393*0a6a1f1dSLionel Sambuc }
394*0a6a1f1dSLionel Sambuc 
VisitOMPParallelDirective(const OMPParallelDirective * S)395*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
396*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
397*0a6a1f1dSLionel Sambuc }
398*0a6a1f1dSLionel Sambuc 
VisitOMPSimdDirective(const OMPSimdDirective * S)399*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
400*0a6a1f1dSLionel Sambuc   VisitOMPLoopDirective(S);
401*0a6a1f1dSLionel Sambuc }
402*0a6a1f1dSLionel Sambuc 
VisitOMPForDirective(const OMPForDirective * S)403*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
404*0a6a1f1dSLionel Sambuc   VisitOMPLoopDirective(S);
405*0a6a1f1dSLionel Sambuc }
406*0a6a1f1dSLionel Sambuc 
VisitOMPForSimdDirective(const OMPForSimdDirective * S)407*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
408*0a6a1f1dSLionel Sambuc   VisitOMPLoopDirective(S);
409*0a6a1f1dSLionel Sambuc }
410*0a6a1f1dSLionel Sambuc 
VisitOMPSectionsDirective(const OMPSectionsDirective * S)411*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
412*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
413*0a6a1f1dSLionel Sambuc }
414*0a6a1f1dSLionel Sambuc 
VisitOMPSectionDirective(const OMPSectionDirective * S)415*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
416*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
417*0a6a1f1dSLionel Sambuc }
418*0a6a1f1dSLionel Sambuc 
VisitOMPSingleDirective(const OMPSingleDirective * S)419*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
420*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
421*0a6a1f1dSLionel Sambuc }
422*0a6a1f1dSLionel Sambuc 
VisitOMPMasterDirective(const OMPMasterDirective * S)423*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
424*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
425*0a6a1f1dSLionel Sambuc }
426*0a6a1f1dSLionel Sambuc 
VisitOMPCriticalDirective(const OMPCriticalDirective * S)427*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
428*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
429*0a6a1f1dSLionel Sambuc   VisitName(S->getDirectiveName().getName());
430*0a6a1f1dSLionel Sambuc }
431*0a6a1f1dSLionel Sambuc 
432*0a6a1f1dSLionel Sambuc void
VisitOMPParallelForDirective(const OMPParallelForDirective * S)433*0a6a1f1dSLionel Sambuc StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
434*0a6a1f1dSLionel Sambuc   VisitOMPLoopDirective(S);
435*0a6a1f1dSLionel Sambuc }
436*0a6a1f1dSLionel Sambuc 
VisitOMPParallelForSimdDirective(const OMPParallelForSimdDirective * S)437*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPParallelForSimdDirective(
438*0a6a1f1dSLionel Sambuc     const OMPParallelForSimdDirective *S) {
439*0a6a1f1dSLionel Sambuc   VisitOMPLoopDirective(S);
440*0a6a1f1dSLionel Sambuc }
441*0a6a1f1dSLionel Sambuc 
VisitOMPParallelSectionsDirective(const OMPParallelSectionsDirective * S)442*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPParallelSectionsDirective(
443*0a6a1f1dSLionel Sambuc     const OMPParallelSectionsDirective *S) {
444*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
445*0a6a1f1dSLionel Sambuc }
446*0a6a1f1dSLionel Sambuc 
VisitOMPTaskDirective(const OMPTaskDirective * S)447*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
448*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
449*0a6a1f1dSLionel Sambuc }
450*0a6a1f1dSLionel Sambuc 
VisitOMPTaskyieldDirective(const OMPTaskyieldDirective * S)451*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
452*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
453*0a6a1f1dSLionel Sambuc }
454*0a6a1f1dSLionel Sambuc 
VisitOMPBarrierDirective(const OMPBarrierDirective * S)455*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
456*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
457*0a6a1f1dSLionel Sambuc }
458*0a6a1f1dSLionel Sambuc 
VisitOMPTaskwaitDirective(const OMPTaskwaitDirective * S)459*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
460*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
461*0a6a1f1dSLionel Sambuc }
462*0a6a1f1dSLionel Sambuc 
VisitOMPFlushDirective(const OMPFlushDirective * S)463*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
464*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
465*0a6a1f1dSLionel Sambuc }
466*0a6a1f1dSLionel Sambuc 
VisitOMPOrderedDirective(const OMPOrderedDirective * S)467*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
468*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
469*0a6a1f1dSLionel Sambuc }
470*0a6a1f1dSLionel Sambuc 
VisitOMPAtomicDirective(const OMPAtomicDirective * S)471*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
472*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
473*0a6a1f1dSLionel Sambuc }
474*0a6a1f1dSLionel Sambuc 
VisitOMPTargetDirective(const OMPTargetDirective * S)475*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
476*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
477*0a6a1f1dSLionel Sambuc }
478*0a6a1f1dSLionel Sambuc 
VisitOMPTeamsDirective(const OMPTeamsDirective * S)479*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
480*0a6a1f1dSLionel Sambuc   VisitOMPExecutableDirective(S);
481*0a6a1f1dSLionel Sambuc }
482*0a6a1f1dSLionel Sambuc 
VisitExpr(const Expr * S)483f4a2713aSLionel Sambuc void StmtProfiler::VisitExpr(const Expr *S) {
484f4a2713aSLionel Sambuc   VisitStmt(S);
485f4a2713aSLionel Sambuc }
486f4a2713aSLionel Sambuc 
VisitDeclRefExpr(const DeclRefExpr * S)487f4a2713aSLionel Sambuc void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
488f4a2713aSLionel Sambuc   VisitExpr(S);
489f4a2713aSLionel Sambuc   if (!Canonical)
490f4a2713aSLionel Sambuc     VisitNestedNameSpecifier(S->getQualifier());
491f4a2713aSLionel Sambuc   VisitDecl(S->getDecl());
492f4a2713aSLionel Sambuc   if (!Canonical)
493f4a2713aSLionel Sambuc     VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
494f4a2713aSLionel Sambuc }
495f4a2713aSLionel Sambuc 
VisitPredefinedExpr(const PredefinedExpr * S)496f4a2713aSLionel Sambuc void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
497f4a2713aSLionel Sambuc   VisitExpr(S);
498f4a2713aSLionel Sambuc   ID.AddInteger(S->getIdentType());
499f4a2713aSLionel Sambuc }
500f4a2713aSLionel Sambuc 
VisitIntegerLiteral(const IntegerLiteral * S)501f4a2713aSLionel Sambuc void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
502f4a2713aSLionel Sambuc   VisitExpr(S);
503f4a2713aSLionel Sambuc   S->getValue().Profile(ID);
504*0a6a1f1dSLionel Sambuc   ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
505f4a2713aSLionel Sambuc }
506f4a2713aSLionel Sambuc 
VisitCharacterLiteral(const CharacterLiteral * S)507f4a2713aSLionel Sambuc void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
508f4a2713aSLionel Sambuc   VisitExpr(S);
509f4a2713aSLionel Sambuc   ID.AddInteger(S->getKind());
510f4a2713aSLionel Sambuc   ID.AddInteger(S->getValue());
511f4a2713aSLionel Sambuc }
512f4a2713aSLionel Sambuc 
VisitFloatingLiteral(const FloatingLiteral * S)513f4a2713aSLionel Sambuc void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
514f4a2713aSLionel Sambuc   VisitExpr(S);
515f4a2713aSLionel Sambuc   S->getValue().Profile(ID);
516f4a2713aSLionel Sambuc   ID.AddBoolean(S->isExact());
517*0a6a1f1dSLionel Sambuc   ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
518f4a2713aSLionel Sambuc }
519f4a2713aSLionel Sambuc 
VisitImaginaryLiteral(const ImaginaryLiteral * S)520f4a2713aSLionel Sambuc void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
521f4a2713aSLionel Sambuc   VisitExpr(S);
522f4a2713aSLionel Sambuc }
523f4a2713aSLionel Sambuc 
VisitStringLiteral(const StringLiteral * S)524f4a2713aSLionel Sambuc void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
525f4a2713aSLionel Sambuc   VisitExpr(S);
526f4a2713aSLionel Sambuc   ID.AddString(S->getBytes());
527f4a2713aSLionel Sambuc   ID.AddInteger(S->getKind());
528f4a2713aSLionel Sambuc }
529f4a2713aSLionel Sambuc 
VisitParenExpr(const ParenExpr * S)530f4a2713aSLionel Sambuc void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
531f4a2713aSLionel Sambuc   VisitExpr(S);
532f4a2713aSLionel Sambuc }
533f4a2713aSLionel Sambuc 
VisitParenListExpr(const ParenListExpr * S)534f4a2713aSLionel Sambuc void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
535f4a2713aSLionel Sambuc   VisitExpr(S);
536f4a2713aSLionel Sambuc }
537f4a2713aSLionel Sambuc 
VisitUnaryOperator(const UnaryOperator * S)538f4a2713aSLionel Sambuc void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
539f4a2713aSLionel Sambuc   VisitExpr(S);
540f4a2713aSLionel Sambuc   ID.AddInteger(S->getOpcode());
541f4a2713aSLionel Sambuc }
542f4a2713aSLionel Sambuc 
VisitOffsetOfExpr(const OffsetOfExpr * S)543f4a2713aSLionel Sambuc void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
544f4a2713aSLionel Sambuc   VisitType(S->getTypeSourceInfo()->getType());
545f4a2713aSLionel Sambuc   unsigned n = S->getNumComponents();
546f4a2713aSLionel Sambuc   for (unsigned i = 0; i < n; ++i) {
547f4a2713aSLionel Sambuc     const OffsetOfExpr::OffsetOfNode& ON = S->getComponent(i);
548f4a2713aSLionel Sambuc     ID.AddInteger(ON.getKind());
549f4a2713aSLionel Sambuc     switch (ON.getKind()) {
550f4a2713aSLionel Sambuc     case OffsetOfExpr::OffsetOfNode::Array:
551f4a2713aSLionel Sambuc       // Expressions handled below.
552f4a2713aSLionel Sambuc       break;
553f4a2713aSLionel Sambuc 
554f4a2713aSLionel Sambuc     case OffsetOfExpr::OffsetOfNode::Field:
555f4a2713aSLionel Sambuc       VisitDecl(ON.getField());
556f4a2713aSLionel Sambuc       break;
557f4a2713aSLionel Sambuc 
558f4a2713aSLionel Sambuc     case OffsetOfExpr::OffsetOfNode::Identifier:
559f4a2713aSLionel Sambuc       ID.AddPointer(ON.getFieldName());
560f4a2713aSLionel Sambuc       break;
561f4a2713aSLionel Sambuc 
562f4a2713aSLionel Sambuc     case OffsetOfExpr::OffsetOfNode::Base:
563f4a2713aSLionel Sambuc       // These nodes are implicit, and therefore don't need profiling.
564f4a2713aSLionel Sambuc       break;
565f4a2713aSLionel Sambuc     }
566f4a2713aSLionel Sambuc   }
567f4a2713aSLionel Sambuc 
568f4a2713aSLionel Sambuc   VisitExpr(S);
569f4a2713aSLionel Sambuc }
570f4a2713aSLionel Sambuc 
571f4a2713aSLionel Sambuc void
VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr * S)572f4a2713aSLionel Sambuc StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
573f4a2713aSLionel Sambuc   VisitExpr(S);
574f4a2713aSLionel Sambuc   ID.AddInteger(S->getKind());
575f4a2713aSLionel Sambuc   if (S->isArgumentType())
576f4a2713aSLionel Sambuc     VisitType(S->getArgumentType());
577f4a2713aSLionel Sambuc }
578f4a2713aSLionel Sambuc 
VisitArraySubscriptExpr(const ArraySubscriptExpr * S)579f4a2713aSLionel Sambuc void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
580f4a2713aSLionel Sambuc   VisitExpr(S);
581f4a2713aSLionel Sambuc }
582f4a2713aSLionel Sambuc 
VisitCallExpr(const CallExpr * S)583f4a2713aSLionel Sambuc void StmtProfiler::VisitCallExpr(const CallExpr *S) {
584f4a2713aSLionel Sambuc   VisitExpr(S);
585f4a2713aSLionel Sambuc }
586f4a2713aSLionel Sambuc 
VisitMemberExpr(const MemberExpr * S)587f4a2713aSLionel Sambuc void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
588f4a2713aSLionel Sambuc   VisitExpr(S);
589f4a2713aSLionel Sambuc   VisitDecl(S->getMemberDecl());
590f4a2713aSLionel Sambuc   if (!Canonical)
591f4a2713aSLionel Sambuc     VisitNestedNameSpecifier(S->getQualifier());
592f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArrow());
593f4a2713aSLionel Sambuc }
594f4a2713aSLionel Sambuc 
VisitCompoundLiteralExpr(const CompoundLiteralExpr * S)595f4a2713aSLionel Sambuc void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
596f4a2713aSLionel Sambuc   VisitExpr(S);
597f4a2713aSLionel Sambuc   ID.AddBoolean(S->isFileScope());
598f4a2713aSLionel Sambuc }
599f4a2713aSLionel Sambuc 
VisitCastExpr(const CastExpr * S)600f4a2713aSLionel Sambuc void StmtProfiler::VisitCastExpr(const CastExpr *S) {
601f4a2713aSLionel Sambuc   VisitExpr(S);
602f4a2713aSLionel Sambuc }
603f4a2713aSLionel Sambuc 
VisitImplicitCastExpr(const ImplicitCastExpr * S)604f4a2713aSLionel Sambuc void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
605f4a2713aSLionel Sambuc   VisitCastExpr(S);
606f4a2713aSLionel Sambuc   ID.AddInteger(S->getValueKind());
607f4a2713aSLionel Sambuc }
608f4a2713aSLionel Sambuc 
VisitExplicitCastExpr(const ExplicitCastExpr * S)609f4a2713aSLionel Sambuc void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
610f4a2713aSLionel Sambuc   VisitCastExpr(S);
611f4a2713aSLionel Sambuc   VisitType(S->getTypeAsWritten());
612f4a2713aSLionel Sambuc }
613f4a2713aSLionel Sambuc 
VisitCStyleCastExpr(const CStyleCastExpr * S)614f4a2713aSLionel Sambuc void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
615f4a2713aSLionel Sambuc   VisitExplicitCastExpr(S);
616f4a2713aSLionel Sambuc }
617f4a2713aSLionel Sambuc 
VisitBinaryOperator(const BinaryOperator * S)618f4a2713aSLionel Sambuc void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
619f4a2713aSLionel Sambuc   VisitExpr(S);
620f4a2713aSLionel Sambuc   ID.AddInteger(S->getOpcode());
621f4a2713aSLionel Sambuc }
622f4a2713aSLionel Sambuc 
623f4a2713aSLionel Sambuc void
VisitCompoundAssignOperator(const CompoundAssignOperator * S)624f4a2713aSLionel Sambuc StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
625f4a2713aSLionel Sambuc   VisitBinaryOperator(S);
626f4a2713aSLionel Sambuc }
627f4a2713aSLionel Sambuc 
VisitConditionalOperator(const ConditionalOperator * S)628f4a2713aSLionel Sambuc void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
629f4a2713aSLionel Sambuc   VisitExpr(S);
630f4a2713aSLionel Sambuc }
631f4a2713aSLionel Sambuc 
VisitBinaryConditionalOperator(const BinaryConditionalOperator * S)632f4a2713aSLionel Sambuc void StmtProfiler::VisitBinaryConditionalOperator(
633f4a2713aSLionel Sambuc     const BinaryConditionalOperator *S) {
634f4a2713aSLionel Sambuc   VisitExpr(S);
635f4a2713aSLionel Sambuc }
636f4a2713aSLionel Sambuc 
VisitAddrLabelExpr(const AddrLabelExpr * S)637f4a2713aSLionel Sambuc void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
638f4a2713aSLionel Sambuc   VisitExpr(S);
639f4a2713aSLionel Sambuc   VisitDecl(S->getLabel());
640f4a2713aSLionel Sambuc }
641f4a2713aSLionel Sambuc 
VisitStmtExpr(const StmtExpr * S)642f4a2713aSLionel Sambuc void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
643f4a2713aSLionel Sambuc   VisitExpr(S);
644f4a2713aSLionel Sambuc }
645f4a2713aSLionel Sambuc 
VisitShuffleVectorExpr(const ShuffleVectorExpr * S)646f4a2713aSLionel Sambuc void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
647f4a2713aSLionel Sambuc   VisitExpr(S);
648f4a2713aSLionel Sambuc }
649f4a2713aSLionel Sambuc 
VisitConvertVectorExpr(const ConvertVectorExpr * S)650f4a2713aSLionel Sambuc void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
651f4a2713aSLionel Sambuc   VisitExpr(S);
652f4a2713aSLionel Sambuc }
653f4a2713aSLionel Sambuc 
VisitChooseExpr(const ChooseExpr * S)654f4a2713aSLionel Sambuc void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
655f4a2713aSLionel Sambuc   VisitExpr(S);
656f4a2713aSLionel Sambuc }
657f4a2713aSLionel Sambuc 
VisitGNUNullExpr(const GNUNullExpr * S)658f4a2713aSLionel Sambuc void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
659f4a2713aSLionel Sambuc   VisitExpr(S);
660f4a2713aSLionel Sambuc }
661f4a2713aSLionel Sambuc 
VisitVAArgExpr(const VAArgExpr * S)662f4a2713aSLionel Sambuc void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
663f4a2713aSLionel Sambuc   VisitExpr(S);
664f4a2713aSLionel Sambuc }
665f4a2713aSLionel Sambuc 
VisitInitListExpr(const InitListExpr * S)666f4a2713aSLionel Sambuc void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
667f4a2713aSLionel Sambuc   if (S->getSyntacticForm()) {
668f4a2713aSLionel Sambuc     VisitInitListExpr(S->getSyntacticForm());
669f4a2713aSLionel Sambuc     return;
670f4a2713aSLionel Sambuc   }
671f4a2713aSLionel Sambuc 
672f4a2713aSLionel Sambuc   VisitExpr(S);
673f4a2713aSLionel Sambuc }
674f4a2713aSLionel Sambuc 
VisitDesignatedInitExpr(const DesignatedInitExpr * S)675f4a2713aSLionel Sambuc void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
676f4a2713aSLionel Sambuc   VisitExpr(S);
677f4a2713aSLionel Sambuc   ID.AddBoolean(S->usesGNUSyntax());
678f4a2713aSLionel Sambuc   for (DesignatedInitExpr::const_designators_iterator D =
679f4a2713aSLionel Sambuc          S->designators_begin(), DEnd = S->designators_end();
680f4a2713aSLionel Sambuc        D != DEnd; ++D) {
681f4a2713aSLionel Sambuc     if (D->isFieldDesignator()) {
682f4a2713aSLionel Sambuc       ID.AddInteger(0);
683f4a2713aSLionel Sambuc       VisitName(D->getFieldName());
684f4a2713aSLionel Sambuc       continue;
685f4a2713aSLionel Sambuc     }
686f4a2713aSLionel Sambuc 
687f4a2713aSLionel Sambuc     if (D->isArrayDesignator()) {
688f4a2713aSLionel Sambuc       ID.AddInteger(1);
689f4a2713aSLionel Sambuc     } else {
690f4a2713aSLionel Sambuc       assert(D->isArrayRangeDesignator());
691f4a2713aSLionel Sambuc       ID.AddInteger(2);
692f4a2713aSLionel Sambuc     }
693f4a2713aSLionel Sambuc     ID.AddInteger(D->getFirstExprIndex());
694f4a2713aSLionel Sambuc   }
695f4a2713aSLionel Sambuc }
696f4a2713aSLionel Sambuc 
VisitImplicitValueInitExpr(const ImplicitValueInitExpr * S)697f4a2713aSLionel Sambuc void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
698f4a2713aSLionel Sambuc   VisitExpr(S);
699f4a2713aSLionel Sambuc }
700f4a2713aSLionel Sambuc 
VisitExtVectorElementExpr(const ExtVectorElementExpr * S)701f4a2713aSLionel Sambuc void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
702f4a2713aSLionel Sambuc   VisitExpr(S);
703f4a2713aSLionel Sambuc   VisitName(&S->getAccessor());
704f4a2713aSLionel Sambuc }
705f4a2713aSLionel Sambuc 
VisitBlockExpr(const BlockExpr * S)706f4a2713aSLionel Sambuc void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
707f4a2713aSLionel Sambuc   VisitExpr(S);
708f4a2713aSLionel Sambuc   VisitDecl(S->getBlockDecl());
709f4a2713aSLionel Sambuc }
710f4a2713aSLionel Sambuc 
VisitGenericSelectionExpr(const GenericSelectionExpr * S)711f4a2713aSLionel Sambuc void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
712f4a2713aSLionel Sambuc   VisitExpr(S);
713f4a2713aSLionel Sambuc   for (unsigned i = 0; i != S->getNumAssocs(); ++i) {
714f4a2713aSLionel Sambuc     QualType T = S->getAssocType(i);
715f4a2713aSLionel Sambuc     if (T.isNull())
716*0a6a1f1dSLionel Sambuc       ID.AddPointer(nullptr);
717f4a2713aSLionel Sambuc     else
718f4a2713aSLionel Sambuc       VisitType(T);
719f4a2713aSLionel Sambuc     VisitExpr(S->getAssocExpr(i));
720f4a2713aSLionel Sambuc   }
721f4a2713aSLionel Sambuc }
722f4a2713aSLionel Sambuc 
VisitPseudoObjectExpr(const PseudoObjectExpr * S)723f4a2713aSLionel Sambuc void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
724f4a2713aSLionel Sambuc   VisitExpr(S);
725f4a2713aSLionel Sambuc   for (PseudoObjectExpr::const_semantics_iterator
726f4a2713aSLionel Sambuc          i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
727f4a2713aSLionel Sambuc     // Normally, we would not profile the source expressions of OVEs.
728f4a2713aSLionel Sambuc     if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
729f4a2713aSLionel Sambuc       Visit(OVE->getSourceExpr());
730f4a2713aSLionel Sambuc }
731f4a2713aSLionel Sambuc 
VisitAtomicExpr(const AtomicExpr * S)732f4a2713aSLionel Sambuc void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
733f4a2713aSLionel Sambuc   VisitExpr(S);
734f4a2713aSLionel Sambuc   ID.AddInteger(S->getOp());
735f4a2713aSLionel Sambuc }
736f4a2713aSLionel Sambuc 
DecodeOperatorCall(const CXXOperatorCallExpr * S,UnaryOperatorKind & UnaryOp,BinaryOperatorKind & BinaryOp)737f4a2713aSLionel Sambuc static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
738f4a2713aSLionel Sambuc                                           UnaryOperatorKind &UnaryOp,
739f4a2713aSLionel Sambuc                                           BinaryOperatorKind &BinaryOp) {
740f4a2713aSLionel Sambuc   switch (S->getOperator()) {
741f4a2713aSLionel Sambuc   case OO_None:
742f4a2713aSLionel Sambuc   case OO_New:
743f4a2713aSLionel Sambuc   case OO_Delete:
744f4a2713aSLionel Sambuc   case OO_Array_New:
745f4a2713aSLionel Sambuc   case OO_Array_Delete:
746f4a2713aSLionel Sambuc   case OO_Arrow:
747f4a2713aSLionel Sambuc   case OO_Call:
748f4a2713aSLionel Sambuc   case OO_Conditional:
749f4a2713aSLionel Sambuc   case NUM_OVERLOADED_OPERATORS:
750f4a2713aSLionel Sambuc     llvm_unreachable("Invalid operator call kind");
751f4a2713aSLionel Sambuc 
752f4a2713aSLionel Sambuc   case OO_Plus:
753f4a2713aSLionel Sambuc     if (S->getNumArgs() == 1) {
754f4a2713aSLionel Sambuc       UnaryOp = UO_Plus;
755f4a2713aSLionel Sambuc       return Stmt::UnaryOperatorClass;
756f4a2713aSLionel Sambuc     }
757f4a2713aSLionel Sambuc 
758f4a2713aSLionel Sambuc     BinaryOp = BO_Add;
759f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
760f4a2713aSLionel Sambuc 
761f4a2713aSLionel Sambuc   case OO_Minus:
762f4a2713aSLionel Sambuc     if (S->getNumArgs() == 1) {
763f4a2713aSLionel Sambuc       UnaryOp = UO_Minus;
764f4a2713aSLionel Sambuc       return Stmt::UnaryOperatorClass;
765f4a2713aSLionel Sambuc     }
766f4a2713aSLionel Sambuc 
767f4a2713aSLionel Sambuc     BinaryOp = BO_Sub;
768f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
769f4a2713aSLionel Sambuc 
770f4a2713aSLionel Sambuc   case OO_Star:
771f4a2713aSLionel Sambuc     if (S->getNumArgs() == 1) {
772*0a6a1f1dSLionel Sambuc       UnaryOp = UO_Deref;
773f4a2713aSLionel Sambuc       return Stmt::UnaryOperatorClass;
774f4a2713aSLionel Sambuc     }
775f4a2713aSLionel Sambuc 
776*0a6a1f1dSLionel Sambuc     BinaryOp = BO_Mul;
777f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
778f4a2713aSLionel Sambuc 
779f4a2713aSLionel Sambuc   case OO_Slash:
780f4a2713aSLionel Sambuc     BinaryOp = BO_Div;
781f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
782f4a2713aSLionel Sambuc 
783f4a2713aSLionel Sambuc   case OO_Percent:
784f4a2713aSLionel Sambuc     BinaryOp = BO_Rem;
785f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
786f4a2713aSLionel Sambuc 
787f4a2713aSLionel Sambuc   case OO_Caret:
788f4a2713aSLionel Sambuc     BinaryOp = BO_Xor;
789f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
790f4a2713aSLionel Sambuc 
791f4a2713aSLionel Sambuc   case OO_Amp:
792f4a2713aSLionel Sambuc     if (S->getNumArgs() == 1) {
793f4a2713aSLionel Sambuc       UnaryOp = UO_AddrOf;
794f4a2713aSLionel Sambuc       return Stmt::UnaryOperatorClass;
795f4a2713aSLionel Sambuc     }
796f4a2713aSLionel Sambuc 
797f4a2713aSLionel Sambuc     BinaryOp = BO_And;
798f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
799f4a2713aSLionel Sambuc 
800f4a2713aSLionel Sambuc   case OO_Pipe:
801f4a2713aSLionel Sambuc     BinaryOp = BO_Or;
802f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
803f4a2713aSLionel Sambuc 
804f4a2713aSLionel Sambuc   case OO_Tilde:
805f4a2713aSLionel Sambuc     UnaryOp = UO_Not;
806f4a2713aSLionel Sambuc     return Stmt::UnaryOperatorClass;
807f4a2713aSLionel Sambuc 
808f4a2713aSLionel Sambuc   case OO_Exclaim:
809f4a2713aSLionel Sambuc     UnaryOp = UO_LNot;
810f4a2713aSLionel Sambuc     return Stmt::UnaryOperatorClass;
811f4a2713aSLionel Sambuc 
812f4a2713aSLionel Sambuc   case OO_Equal:
813f4a2713aSLionel Sambuc     BinaryOp = BO_Assign;
814f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
815f4a2713aSLionel Sambuc 
816f4a2713aSLionel Sambuc   case OO_Less:
817f4a2713aSLionel Sambuc     BinaryOp = BO_LT;
818f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
819f4a2713aSLionel Sambuc 
820f4a2713aSLionel Sambuc   case OO_Greater:
821f4a2713aSLionel Sambuc     BinaryOp = BO_GT;
822f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
823f4a2713aSLionel Sambuc 
824f4a2713aSLionel Sambuc   case OO_PlusEqual:
825f4a2713aSLionel Sambuc     BinaryOp = BO_AddAssign;
826f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
827f4a2713aSLionel Sambuc 
828f4a2713aSLionel Sambuc   case OO_MinusEqual:
829f4a2713aSLionel Sambuc     BinaryOp = BO_SubAssign;
830f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
831f4a2713aSLionel Sambuc 
832f4a2713aSLionel Sambuc   case OO_StarEqual:
833f4a2713aSLionel Sambuc     BinaryOp = BO_MulAssign;
834f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
835f4a2713aSLionel Sambuc 
836f4a2713aSLionel Sambuc   case OO_SlashEqual:
837f4a2713aSLionel Sambuc     BinaryOp = BO_DivAssign;
838f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
839f4a2713aSLionel Sambuc 
840f4a2713aSLionel Sambuc   case OO_PercentEqual:
841f4a2713aSLionel Sambuc     BinaryOp = BO_RemAssign;
842f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
843f4a2713aSLionel Sambuc 
844f4a2713aSLionel Sambuc   case OO_CaretEqual:
845f4a2713aSLionel Sambuc     BinaryOp = BO_XorAssign;
846f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
847f4a2713aSLionel Sambuc 
848f4a2713aSLionel Sambuc   case OO_AmpEqual:
849f4a2713aSLionel Sambuc     BinaryOp = BO_AndAssign;
850f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
851f4a2713aSLionel Sambuc 
852f4a2713aSLionel Sambuc   case OO_PipeEqual:
853f4a2713aSLionel Sambuc     BinaryOp = BO_OrAssign;
854f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
855f4a2713aSLionel Sambuc 
856f4a2713aSLionel Sambuc   case OO_LessLess:
857f4a2713aSLionel Sambuc     BinaryOp = BO_Shl;
858f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
859f4a2713aSLionel Sambuc 
860f4a2713aSLionel Sambuc   case OO_GreaterGreater:
861f4a2713aSLionel Sambuc     BinaryOp = BO_Shr;
862f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
863f4a2713aSLionel Sambuc 
864f4a2713aSLionel Sambuc   case OO_LessLessEqual:
865f4a2713aSLionel Sambuc     BinaryOp = BO_ShlAssign;
866f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
867f4a2713aSLionel Sambuc 
868f4a2713aSLionel Sambuc   case OO_GreaterGreaterEqual:
869f4a2713aSLionel Sambuc     BinaryOp = BO_ShrAssign;
870f4a2713aSLionel Sambuc     return Stmt::CompoundAssignOperatorClass;
871f4a2713aSLionel Sambuc 
872f4a2713aSLionel Sambuc   case OO_EqualEqual:
873f4a2713aSLionel Sambuc     BinaryOp = BO_EQ;
874f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
875f4a2713aSLionel Sambuc 
876f4a2713aSLionel Sambuc   case OO_ExclaimEqual:
877f4a2713aSLionel Sambuc     BinaryOp = BO_NE;
878f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
879f4a2713aSLionel Sambuc 
880f4a2713aSLionel Sambuc   case OO_LessEqual:
881f4a2713aSLionel Sambuc     BinaryOp = BO_LE;
882f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
883f4a2713aSLionel Sambuc 
884f4a2713aSLionel Sambuc   case OO_GreaterEqual:
885f4a2713aSLionel Sambuc     BinaryOp = BO_GE;
886f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
887f4a2713aSLionel Sambuc 
888f4a2713aSLionel Sambuc   case OO_AmpAmp:
889f4a2713aSLionel Sambuc     BinaryOp = BO_LAnd;
890f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
891f4a2713aSLionel Sambuc 
892f4a2713aSLionel Sambuc   case OO_PipePipe:
893f4a2713aSLionel Sambuc     BinaryOp = BO_LOr;
894f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
895f4a2713aSLionel Sambuc 
896f4a2713aSLionel Sambuc   case OO_PlusPlus:
897f4a2713aSLionel Sambuc     UnaryOp = S->getNumArgs() == 1? UO_PreInc
898f4a2713aSLionel Sambuc                                   : UO_PostInc;
899f4a2713aSLionel Sambuc     return Stmt::UnaryOperatorClass;
900f4a2713aSLionel Sambuc 
901f4a2713aSLionel Sambuc   case OO_MinusMinus:
902f4a2713aSLionel Sambuc     UnaryOp = S->getNumArgs() == 1? UO_PreDec
903f4a2713aSLionel Sambuc                                   : UO_PostDec;
904f4a2713aSLionel Sambuc     return Stmt::UnaryOperatorClass;
905f4a2713aSLionel Sambuc 
906f4a2713aSLionel Sambuc   case OO_Comma:
907f4a2713aSLionel Sambuc     BinaryOp = BO_Comma;
908f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
909f4a2713aSLionel Sambuc 
910f4a2713aSLionel Sambuc 
911f4a2713aSLionel Sambuc   case OO_ArrowStar:
912f4a2713aSLionel Sambuc     BinaryOp = BO_PtrMemI;
913f4a2713aSLionel Sambuc     return Stmt::BinaryOperatorClass;
914f4a2713aSLionel Sambuc 
915f4a2713aSLionel Sambuc   case OO_Subscript:
916f4a2713aSLionel Sambuc     return Stmt::ArraySubscriptExprClass;
917f4a2713aSLionel Sambuc   }
918f4a2713aSLionel Sambuc 
919f4a2713aSLionel Sambuc   llvm_unreachable("Invalid overloaded operator expression");
920f4a2713aSLionel Sambuc }
921f4a2713aSLionel Sambuc 
922f4a2713aSLionel Sambuc 
VisitCXXOperatorCallExpr(const CXXOperatorCallExpr * S)923f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
924f4a2713aSLionel Sambuc   if (S->isTypeDependent()) {
925f4a2713aSLionel Sambuc     // Type-dependent operator calls are profiled like their underlying
926f4a2713aSLionel Sambuc     // syntactic operator.
927f4a2713aSLionel Sambuc     UnaryOperatorKind UnaryOp = UO_Extension;
928f4a2713aSLionel Sambuc     BinaryOperatorKind BinaryOp = BO_Comma;
929f4a2713aSLionel Sambuc     Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
930f4a2713aSLionel Sambuc 
931f4a2713aSLionel Sambuc     ID.AddInteger(SC);
932f4a2713aSLionel Sambuc     for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
933f4a2713aSLionel Sambuc       Visit(S->getArg(I));
934f4a2713aSLionel Sambuc     if (SC == Stmt::UnaryOperatorClass)
935f4a2713aSLionel Sambuc       ID.AddInteger(UnaryOp);
936f4a2713aSLionel Sambuc     else if (SC == Stmt::BinaryOperatorClass ||
937f4a2713aSLionel Sambuc              SC == Stmt::CompoundAssignOperatorClass)
938f4a2713aSLionel Sambuc       ID.AddInteger(BinaryOp);
939f4a2713aSLionel Sambuc     else
940f4a2713aSLionel Sambuc       assert(SC == Stmt::ArraySubscriptExprClass);
941f4a2713aSLionel Sambuc 
942f4a2713aSLionel Sambuc     return;
943f4a2713aSLionel Sambuc   }
944f4a2713aSLionel Sambuc 
945f4a2713aSLionel Sambuc   VisitCallExpr(S);
946f4a2713aSLionel Sambuc   ID.AddInteger(S->getOperator());
947f4a2713aSLionel Sambuc }
948f4a2713aSLionel Sambuc 
VisitCXXMemberCallExpr(const CXXMemberCallExpr * S)949f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
950f4a2713aSLionel Sambuc   VisitCallExpr(S);
951f4a2713aSLionel Sambuc }
952f4a2713aSLionel Sambuc 
VisitCUDAKernelCallExpr(const CUDAKernelCallExpr * S)953f4a2713aSLionel Sambuc void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
954f4a2713aSLionel Sambuc   VisitCallExpr(S);
955f4a2713aSLionel Sambuc }
956f4a2713aSLionel Sambuc 
VisitAsTypeExpr(const AsTypeExpr * S)957f4a2713aSLionel Sambuc void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
958f4a2713aSLionel Sambuc   VisitExpr(S);
959f4a2713aSLionel Sambuc }
960f4a2713aSLionel Sambuc 
VisitCXXNamedCastExpr(const CXXNamedCastExpr * S)961f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
962f4a2713aSLionel Sambuc   VisitExplicitCastExpr(S);
963f4a2713aSLionel Sambuc }
964f4a2713aSLionel Sambuc 
VisitCXXStaticCastExpr(const CXXStaticCastExpr * S)965f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
966f4a2713aSLionel Sambuc   VisitCXXNamedCastExpr(S);
967f4a2713aSLionel Sambuc }
968f4a2713aSLionel Sambuc 
VisitCXXDynamicCastExpr(const CXXDynamicCastExpr * S)969f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
970f4a2713aSLionel Sambuc   VisitCXXNamedCastExpr(S);
971f4a2713aSLionel Sambuc }
972f4a2713aSLionel Sambuc 
973f4a2713aSLionel Sambuc void
VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr * S)974f4a2713aSLionel Sambuc StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
975f4a2713aSLionel Sambuc   VisitCXXNamedCastExpr(S);
976f4a2713aSLionel Sambuc }
977f4a2713aSLionel Sambuc 
VisitCXXConstCastExpr(const CXXConstCastExpr * S)978f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
979f4a2713aSLionel Sambuc   VisitCXXNamedCastExpr(S);
980f4a2713aSLionel Sambuc }
981f4a2713aSLionel Sambuc 
VisitUserDefinedLiteral(const UserDefinedLiteral * S)982f4a2713aSLionel Sambuc void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
983f4a2713aSLionel Sambuc   VisitCallExpr(S);
984f4a2713aSLionel Sambuc }
985f4a2713aSLionel Sambuc 
VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr * S)986f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
987f4a2713aSLionel Sambuc   VisitExpr(S);
988f4a2713aSLionel Sambuc   ID.AddBoolean(S->getValue());
989f4a2713aSLionel Sambuc }
990f4a2713aSLionel Sambuc 
VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr * S)991f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
992f4a2713aSLionel Sambuc   VisitExpr(S);
993f4a2713aSLionel Sambuc }
994f4a2713aSLionel Sambuc 
VisitCXXStdInitializerListExpr(const CXXStdInitializerListExpr * S)995f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXStdInitializerListExpr(
996f4a2713aSLionel Sambuc     const CXXStdInitializerListExpr *S) {
997f4a2713aSLionel Sambuc   VisitExpr(S);
998f4a2713aSLionel Sambuc }
999f4a2713aSLionel Sambuc 
VisitCXXTypeidExpr(const CXXTypeidExpr * S)1000f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1001f4a2713aSLionel Sambuc   VisitExpr(S);
1002f4a2713aSLionel Sambuc   if (S->isTypeOperand())
1003f4a2713aSLionel Sambuc     VisitType(S->getTypeOperandSourceInfo()->getType());
1004f4a2713aSLionel Sambuc }
1005f4a2713aSLionel Sambuc 
VisitCXXUuidofExpr(const CXXUuidofExpr * S)1006f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1007f4a2713aSLionel Sambuc   VisitExpr(S);
1008f4a2713aSLionel Sambuc   if (S->isTypeOperand())
1009f4a2713aSLionel Sambuc     VisitType(S->getTypeOperandSourceInfo()->getType());
1010f4a2713aSLionel Sambuc }
1011f4a2713aSLionel Sambuc 
VisitMSPropertyRefExpr(const MSPropertyRefExpr * S)1012f4a2713aSLionel Sambuc void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1013f4a2713aSLionel Sambuc   VisitExpr(S);
1014f4a2713aSLionel Sambuc   VisitDecl(S->getPropertyDecl());
1015f4a2713aSLionel Sambuc }
1016f4a2713aSLionel Sambuc 
VisitCXXThisExpr(const CXXThisExpr * S)1017f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1018f4a2713aSLionel Sambuc   VisitExpr(S);
1019f4a2713aSLionel Sambuc   ID.AddBoolean(S->isImplicit());
1020f4a2713aSLionel Sambuc }
1021f4a2713aSLionel Sambuc 
VisitCXXThrowExpr(const CXXThrowExpr * S)1022f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1023f4a2713aSLionel Sambuc   VisitExpr(S);
1024f4a2713aSLionel Sambuc }
1025f4a2713aSLionel Sambuc 
VisitCXXDefaultArgExpr(const CXXDefaultArgExpr * S)1026f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1027f4a2713aSLionel Sambuc   VisitExpr(S);
1028f4a2713aSLionel Sambuc   VisitDecl(S->getParam());
1029f4a2713aSLionel Sambuc }
1030f4a2713aSLionel Sambuc 
VisitCXXDefaultInitExpr(const CXXDefaultInitExpr * S)1031f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1032f4a2713aSLionel Sambuc   VisitExpr(S);
1033f4a2713aSLionel Sambuc   VisitDecl(S->getField());
1034f4a2713aSLionel Sambuc }
1035f4a2713aSLionel Sambuc 
VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr * S)1036f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
1037f4a2713aSLionel Sambuc   VisitExpr(S);
1038f4a2713aSLionel Sambuc   VisitDecl(
1039f4a2713aSLionel Sambuc          const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1040f4a2713aSLionel Sambuc }
1041f4a2713aSLionel Sambuc 
VisitCXXConstructExpr(const CXXConstructExpr * S)1042f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
1043f4a2713aSLionel Sambuc   VisitExpr(S);
1044f4a2713aSLionel Sambuc   VisitDecl(S->getConstructor());
1045f4a2713aSLionel Sambuc   ID.AddBoolean(S->isElidable());
1046f4a2713aSLionel Sambuc }
1047f4a2713aSLionel Sambuc 
VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr * S)1048f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
1049f4a2713aSLionel Sambuc   VisitExplicitCastExpr(S);
1050f4a2713aSLionel Sambuc }
1051f4a2713aSLionel Sambuc 
1052f4a2713aSLionel Sambuc void
VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr * S)1053f4a2713aSLionel Sambuc StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
1054f4a2713aSLionel Sambuc   VisitCXXConstructExpr(S);
1055f4a2713aSLionel Sambuc }
1056f4a2713aSLionel Sambuc 
1057f4a2713aSLionel Sambuc void
VisitLambdaExpr(const LambdaExpr * S)1058f4a2713aSLionel Sambuc StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1059f4a2713aSLionel Sambuc   VisitExpr(S);
1060f4a2713aSLionel Sambuc   for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(),
1061f4a2713aSLionel Sambuc                                  CEnd = S->explicit_capture_end();
1062f4a2713aSLionel Sambuc        C != CEnd; ++C) {
1063f4a2713aSLionel Sambuc     ID.AddInteger(C->getCaptureKind());
1064f4a2713aSLionel Sambuc     switch (C->getCaptureKind()) {
1065f4a2713aSLionel Sambuc     case LCK_This:
1066f4a2713aSLionel Sambuc       break;
1067f4a2713aSLionel Sambuc     case LCK_ByRef:
1068f4a2713aSLionel Sambuc     case LCK_ByCopy:
1069f4a2713aSLionel Sambuc       VisitDecl(C->getCapturedVar());
1070f4a2713aSLionel Sambuc       ID.AddBoolean(C->isPackExpansion());
1071f4a2713aSLionel Sambuc       break;
1072*0a6a1f1dSLionel Sambuc     case LCK_VLAType:
1073*0a6a1f1dSLionel Sambuc       llvm_unreachable("VLA type in explicit captures.");
1074f4a2713aSLionel Sambuc     }
1075f4a2713aSLionel Sambuc   }
1076f4a2713aSLionel Sambuc   // Note: If we actually needed to be able to match lambda
1077f4a2713aSLionel Sambuc   // expressions, we would have to consider parameters and return type
1078f4a2713aSLionel Sambuc   // here, among other things.
1079f4a2713aSLionel Sambuc   VisitStmt(S->getBody());
1080f4a2713aSLionel Sambuc }
1081f4a2713aSLionel Sambuc 
1082f4a2713aSLionel Sambuc void
VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr * S)1083f4a2713aSLionel Sambuc StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
1084f4a2713aSLionel Sambuc   VisitExpr(S);
1085f4a2713aSLionel Sambuc }
1086f4a2713aSLionel Sambuc 
VisitCXXDeleteExpr(const CXXDeleteExpr * S)1087f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
1088f4a2713aSLionel Sambuc   VisitExpr(S);
1089f4a2713aSLionel Sambuc   ID.AddBoolean(S->isGlobalDelete());
1090f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArrayForm());
1091f4a2713aSLionel Sambuc   VisitDecl(S->getOperatorDelete());
1092f4a2713aSLionel Sambuc }
1093f4a2713aSLionel Sambuc 
1094f4a2713aSLionel Sambuc 
VisitCXXNewExpr(const CXXNewExpr * S)1095f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
1096f4a2713aSLionel Sambuc   VisitExpr(S);
1097f4a2713aSLionel Sambuc   VisitType(S->getAllocatedType());
1098f4a2713aSLionel Sambuc   VisitDecl(S->getOperatorNew());
1099f4a2713aSLionel Sambuc   VisitDecl(S->getOperatorDelete());
1100f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArray());
1101f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumPlacementArgs());
1102f4a2713aSLionel Sambuc   ID.AddBoolean(S->isGlobalNew());
1103f4a2713aSLionel Sambuc   ID.AddBoolean(S->isParenTypeId());
1104f4a2713aSLionel Sambuc   ID.AddInteger(S->getInitializationStyle());
1105f4a2713aSLionel Sambuc }
1106f4a2713aSLionel Sambuc 
1107f4a2713aSLionel Sambuc void
VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr * S)1108f4a2713aSLionel Sambuc StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
1109f4a2713aSLionel Sambuc   VisitExpr(S);
1110f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArrow());
1111f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifier());
1112*0a6a1f1dSLionel Sambuc   ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
1113f4a2713aSLionel Sambuc   if (S->getScopeTypeInfo())
1114f4a2713aSLionel Sambuc     VisitType(S->getScopeTypeInfo()->getType());
1115*0a6a1f1dSLionel Sambuc   ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
1116f4a2713aSLionel Sambuc   if (S->getDestroyedTypeInfo())
1117f4a2713aSLionel Sambuc     VisitType(S->getDestroyedType());
1118f4a2713aSLionel Sambuc   else
1119f4a2713aSLionel Sambuc     ID.AddPointer(S->getDestroyedTypeIdentifier());
1120f4a2713aSLionel Sambuc }
1121f4a2713aSLionel Sambuc 
VisitOverloadExpr(const OverloadExpr * S)1122f4a2713aSLionel Sambuc void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
1123f4a2713aSLionel Sambuc   VisitExpr(S);
1124f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifier());
1125f4a2713aSLionel Sambuc   VisitName(S->getName());
1126f4a2713aSLionel Sambuc   ID.AddBoolean(S->hasExplicitTemplateArgs());
1127f4a2713aSLionel Sambuc   if (S->hasExplicitTemplateArgs())
1128f4a2713aSLionel Sambuc     VisitTemplateArguments(S->getExplicitTemplateArgs().getTemplateArgs(),
1129f4a2713aSLionel Sambuc                            S->getExplicitTemplateArgs().NumTemplateArgs);
1130f4a2713aSLionel Sambuc }
1131f4a2713aSLionel Sambuc 
1132f4a2713aSLionel Sambuc void
VisitUnresolvedLookupExpr(const UnresolvedLookupExpr * S)1133f4a2713aSLionel Sambuc StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
1134f4a2713aSLionel Sambuc   VisitOverloadExpr(S);
1135f4a2713aSLionel Sambuc }
1136f4a2713aSLionel Sambuc 
VisitTypeTraitExpr(const TypeTraitExpr * S)1137f4a2713aSLionel Sambuc void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
1138f4a2713aSLionel Sambuc   VisitExpr(S);
1139f4a2713aSLionel Sambuc   ID.AddInteger(S->getTrait());
1140f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumArgs());
1141f4a2713aSLionel Sambuc   for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1142f4a2713aSLionel Sambuc     VisitType(S->getArg(I)->getType());
1143f4a2713aSLionel Sambuc }
1144f4a2713aSLionel Sambuc 
VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr * S)1145f4a2713aSLionel Sambuc void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
1146f4a2713aSLionel Sambuc   VisitExpr(S);
1147f4a2713aSLionel Sambuc   ID.AddInteger(S->getTrait());
1148f4a2713aSLionel Sambuc   VisitType(S->getQueriedType());
1149f4a2713aSLionel Sambuc }
1150f4a2713aSLionel Sambuc 
VisitExpressionTraitExpr(const ExpressionTraitExpr * S)1151f4a2713aSLionel Sambuc void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
1152f4a2713aSLionel Sambuc   VisitExpr(S);
1153f4a2713aSLionel Sambuc   ID.AddInteger(S->getTrait());
1154f4a2713aSLionel Sambuc   VisitExpr(S->getQueriedExpression());
1155f4a2713aSLionel Sambuc }
1156f4a2713aSLionel Sambuc 
VisitDependentScopeDeclRefExpr(const DependentScopeDeclRefExpr * S)1157f4a2713aSLionel Sambuc void StmtProfiler::VisitDependentScopeDeclRefExpr(
1158f4a2713aSLionel Sambuc     const DependentScopeDeclRefExpr *S) {
1159f4a2713aSLionel Sambuc   VisitExpr(S);
1160f4a2713aSLionel Sambuc   VisitName(S->getDeclName());
1161f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifier());
1162f4a2713aSLionel Sambuc   ID.AddBoolean(S->hasExplicitTemplateArgs());
1163f4a2713aSLionel Sambuc   if (S->hasExplicitTemplateArgs())
1164f4a2713aSLionel Sambuc     VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1165f4a2713aSLionel Sambuc }
1166f4a2713aSLionel Sambuc 
VisitExprWithCleanups(const ExprWithCleanups * S)1167f4a2713aSLionel Sambuc void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
1168f4a2713aSLionel Sambuc   VisitExpr(S);
1169f4a2713aSLionel Sambuc }
1170f4a2713aSLionel Sambuc 
VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr * S)1171f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXUnresolvedConstructExpr(
1172f4a2713aSLionel Sambuc     const CXXUnresolvedConstructExpr *S) {
1173f4a2713aSLionel Sambuc   VisitExpr(S);
1174f4a2713aSLionel Sambuc   VisitType(S->getTypeAsWritten());
1175f4a2713aSLionel Sambuc }
1176f4a2713aSLionel Sambuc 
VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr * S)1177f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXDependentScopeMemberExpr(
1178f4a2713aSLionel Sambuc     const CXXDependentScopeMemberExpr *S) {
1179f4a2713aSLionel Sambuc   ID.AddBoolean(S->isImplicitAccess());
1180f4a2713aSLionel Sambuc   if (!S->isImplicitAccess()) {
1181f4a2713aSLionel Sambuc     VisitExpr(S);
1182f4a2713aSLionel Sambuc     ID.AddBoolean(S->isArrow());
1183f4a2713aSLionel Sambuc   }
1184f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifier());
1185f4a2713aSLionel Sambuc   VisitName(S->getMember());
1186f4a2713aSLionel Sambuc   ID.AddBoolean(S->hasExplicitTemplateArgs());
1187f4a2713aSLionel Sambuc   if (S->hasExplicitTemplateArgs())
1188f4a2713aSLionel Sambuc     VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1189f4a2713aSLionel Sambuc }
1190f4a2713aSLionel Sambuc 
VisitUnresolvedMemberExpr(const UnresolvedMemberExpr * S)1191f4a2713aSLionel Sambuc void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
1192f4a2713aSLionel Sambuc   ID.AddBoolean(S->isImplicitAccess());
1193f4a2713aSLionel Sambuc   if (!S->isImplicitAccess()) {
1194f4a2713aSLionel Sambuc     VisitExpr(S);
1195f4a2713aSLionel Sambuc     ID.AddBoolean(S->isArrow());
1196f4a2713aSLionel Sambuc   }
1197f4a2713aSLionel Sambuc   VisitNestedNameSpecifier(S->getQualifier());
1198f4a2713aSLionel Sambuc   VisitName(S->getMemberName());
1199f4a2713aSLionel Sambuc   ID.AddBoolean(S->hasExplicitTemplateArgs());
1200f4a2713aSLionel Sambuc   if (S->hasExplicitTemplateArgs())
1201f4a2713aSLionel Sambuc     VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1202f4a2713aSLionel Sambuc }
1203f4a2713aSLionel Sambuc 
VisitCXXNoexceptExpr(const CXXNoexceptExpr * S)1204f4a2713aSLionel Sambuc void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
1205f4a2713aSLionel Sambuc   VisitExpr(S);
1206f4a2713aSLionel Sambuc }
1207f4a2713aSLionel Sambuc 
VisitPackExpansionExpr(const PackExpansionExpr * S)1208f4a2713aSLionel Sambuc void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
1209f4a2713aSLionel Sambuc   VisitExpr(S);
1210f4a2713aSLionel Sambuc }
1211f4a2713aSLionel Sambuc 
VisitSizeOfPackExpr(const SizeOfPackExpr * S)1212f4a2713aSLionel Sambuc void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
1213f4a2713aSLionel Sambuc   VisitExpr(S);
1214f4a2713aSLionel Sambuc   VisitDecl(S->getPack());
1215f4a2713aSLionel Sambuc }
1216f4a2713aSLionel Sambuc 
VisitSubstNonTypeTemplateParmPackExpr(const SubstNonTypeTemplateParmPackExpr * S)1217f4a2713aSLionel Sambuc void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
1218f4a2713aSLionel Sambuc     const SubstNonTypeTemplateParmPackExpr *S) {
1219f4a2713aSLionel Sambuc   VisitExpr(S);
1220f4a2713aSLionel Sambuc   VisitDecl(S->getParameterPack());
1221f4a2713aSLionel Sambuc   VisitTemplateArgument(S->getArgumentPack());
1222f4a2713aSLionel Sambuc }
1223f4a2713aSLionel Sambuc 
VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr * E)1224f4a2713aSLionel Sambuc void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
1225f4a2713aSLionel Sambuc     const SubstNonTypeTemplateParmExpr *E) {
1226f4a2713aSLionel Sambuc   // Profile exactly as the replacement expression.
1227f4a2713aSLionel Sambuc   Visit(E->getReplacement());
1228f4a2713aSLionel Sambuc }
1229f4a2713aSLionel Sambuc 
VisitFunctionParmPackExpr(const FunctionParmPackExpr * S)1230f4a2713aSLionel Sambuc void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
1231f4a2713aSLionel Sambuc   VisitExpr(S);
1232f4a2713aSLionel Sambuc   VisitDecl(S->getParameterPack());
1233f4a2713aSLionel Sambuc   ID.AddInteger(S->getNumExpansions());
1234f4a2713aSLionel Sambuc   for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
1235f4a2713aSLionel Sambuc     VisitDecl(*I);
1236f4a2713aSLionel Sambuc }
1237f4a2713aSLionel Sambuc 
VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr * S)1238f4a2713aSLionel Sambuc void StmtProfiler::VisitMaterializeTemporaryExpr(
1239f4a2713aSLionel Sambuc                                            const MaterializeTemporaryExpr *S) {
1240f4a2713aSLionel Sambuc   VisitExpr(S);
1241f4a2713aSLionel Sambuc }
1242f4a2713aSLionel Sambuc 
VisitCXXFoldExpr(const CXXFoldExpr * S)1243*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
1244*0a6a1f1dSLionel Sambuc   VisitExpr(S);
1245*0a6a1f1dSLionel Sambuc   ID.AddInteger(S->getOperator());
1246*0a6a1f1dSLionel Sambuc }
1247*0a6a1f1dSLionel Sambuc 
VisitOpaqueValueExpr(const OpaqueValueExpr * E)1248f4a2713aSLionel Sambuc void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
1249f4a2713aSLionel Sambuc   VisitExpr(E);
1250f4a2713aSLionel Sambuc }
1251f4a2713aSLionel Sambuc 
VisitTypoExpr(const TypoExpr * E)1252*0a6a1f1dSLionel Sambuc void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
1253*0a6a1f1dSLionel Sambuc   VisitExpr(E);
1254*0a6a1f1dSLionel Sambuc }
1255*0a6a1f1dSLionel Sambuc 
VisitObjCStringLiteral(const ObjCStringLiteral * S)1256f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
1257f4a2713aSLionel Sambuc   VisitExpr(S);
1258f4a2713aSLionel Sambuc }
1259f4a2713aSLionel Sambuc 
VisitObjCBoxedExpr(const ObjCBoxedExpr * E)1260f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
1261f4a2713aSLionel Sambuc   VisitExpr(E);
1262f4a2713aSLionel Sambuc }
1263f4a2713aSLionel Sambuc 
VisitObjCArrayLiteral(const ObjCArrayLiteral * E)1264f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
1265f4a2713aSLionel Sambuc   VisitExpr(E);
1266f4a2713aSLionel Sambuc }
1267f4a2713aSLionel Sambuc 
VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral * E)1268f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
1269f4a2713aSLionel Sambuc   VisitExpr(E);
1270f4a2713aSLionel Sambuc }
1271f4a2713aSLionel Sambuc 
VisitObjCEncodeExpr(const ObjCEncodeExpr * S)1272f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
1273f4a2713aSLionel Sambuc   VisitExpr(S);
1274f4a2713aSLionel Sambuc   VisitType(S->getEncodedType());
1275f4a2713aSLionel Sambuc }
1276f4a2713aSLionel Sambuc 
VisitObjCSelectorExpr(const ObjCSelectorExpr * S)1277f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
1278f4a2713aSLionel Sambuc   VisitExpr(S);
1279f4a2713aSLionel Sambuc   VisitName(S->getSelector());
1280f4a2713aSLionel Sambuc }
1281f4a2713aSLionel Sambuc 
VisitObjCProtocolExpr(const ObjCProtocolExpr * S)1282f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
1283f4a2713aSLionel Sambuc   VisitExpr(S);
1284f4a2713aSLionel Sambuc   VisitDecl(S->getProtocol());
1285f4a2713aSLionel Sambuc }
1286f4a2713aSLionel Sambuc 
VisitObjCIvarRefExpr(const ObjCIvarRefExpr * S)1287f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
1288f4a2713aSLionel Sambuc   VisitExpr(S);
1289f4a2713aSLionel Sambuc   VisitDecl(S->getDecl());
1290f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArrow());
1291f4a2713aSLionel Sambuc   ID.AddBoolean(S->isFreeIvar());
1292f4a2713aSLionel Sambuc }
1293f4a2713aSLionel Sambuc 
VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr * S)1294f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
1295f4a2713aSLionel Sambuc   VisitExpr(S);
1296f4a2713aSLionel Sambuc   if (S->isImplicitProperty()) {
1297f4a2713aSLionel Sambuc     VisitDecl(S->getImplicitPropertyGetter());
1298f4a2713aSLionel Sambuc     VisitDecl(S->getImplicitPropertySetter());
1299f4a2713aSLionel Sambuc   } else {
1300f4a2713aSLionel Sambuc     VisitDecl(S->getExplicitProperty());
1301f4a2713aSLionel Sambuc   }
1302f4a2713aSLionel Sambuc   if (S->isSuperReceiver()) {
1303f4a2713aSLionel Sambuc     ID.AddBoolean(S->isSuperReceiver());
1304f4a2713aSLionel Sambuc     VisitType(S->getSuperReceiverType());
1305f4a2713aSLionel Sambuc   }
1306f4a2713aSLionel Sambuc }
1307f4a2713aSLionel Sambuc 
VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr * S)1308f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
1309f4a2713aSLionel Sambuc   VisitExpr(S);
1310f4a2713aSLionel Sambuc   VisitDecl(S->getAtIndexMethodDecl());
1311f4a2713aSLionel Sambuc   VisitDecl(S->setAtIndexMethodDecl());
1312f4a2713aSLionel Sambuc }
1313f4a2713aSLionel Sambuc 
VisitObjCMessageExpr(const ObjCMessageExpr * S)1314f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
1315f4a2713aSLionel Sambuc   VisitExpr(S);
1316f4a2713aSLionel Sambuc   VisitName(S->getSelector());
1317f4a2713aSLionel Sambuc   VisitDecl(S->getMethodDecl());
1318f4a2713aSLionel Sambuc }
1319f4a2713aSLionel Sambuc 
VisitObjCIsaExpr(const ObjCIsaExpr * S)1320f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
1321f4a2713aSLionel Sambuc   VisitExpr(S);
1322f4a2713aSLionel Sambuc   ID.AddBoolean(S->isArrow());
1323f4a2713aSLionel Sambuc }
1324f4a2713aSLionel Sambuc 
VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr * S)1325f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
1326f4a2713aSLionel Sambuc   VisitExpr(S);
1327f4a2713aSLionel Sambuc   ID.AddBoolean(S->getValue());
1328f4a2713aSLionel Sambuc }
1329f4a2713aSLionel Sambuc 
VisitObjCIndirectCopyRestoreExpr(const ObjCIndirectCopyRestoreExpr * S)1330f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
1331f4a2713aSLionel Sambuc     const ObjCIndirectCopyRestoreExpr *S) {
1332f4a2713aSLionel Sambuc   VisitExpr(S);
1333f4a2713aSLionel Sambuc   ID.AddBoolean(S->shouldCopy());
1334f4a2713aSLionel Sambuc }
1335f4a2713aSLionel Sambuc 
VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr * S)1336f4a2713aSLionel Sambuc void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
1337f4a2713aSLionel Sambuc   VisitExplicitCastExpr(S);
1338f4a2713aSLionel Sambuc   ID.AddBoolean(S->getBridgeKind());
1339f4a2713aSLionel Sambuc }
1340f4a2713aSLionel Sambuc 
VisitDecl(const Decl * D)1341f4a2713aSLionel Sambuc void StmtProfiler::VisitDecl(const Decl *D) {
1342f4a2713aSLionel Sambuc   ID.AddInteger(D? D->getKind() : 0);
1343f4a2713aSLionel Sambuc 
1344f4a2713aSLionel Sambuc   if (Canonical && D) {
1345f4a2713aSLionel Sambuc     if (const NonTypeTemplateParmDecl *NTTP =
1346f4a2713aSLionel Sambuc           dyn_cast<NonTypeTemplateParmDecl>(D)) {
1347f4a2713aSLionel Sambuc       ID.AddInteger(NTTP->getDepth());
1348f4a2713aSLionel Sambuc       ID.AddInteger(NTTP->getIndex());
1349f4a2713aSLionel Sambuc       ID.AddBoolean(NTTP->isParameterPack());
1350f4a2713aSLionel Sambuc       VisitType(NTTP->getType());
1351f4a2713aSLionel Sambuc       return;
1352f4a2713aSLionel Sambuc     }
1353f4a2713aSLionel Sambuc 
1354f4a2713aSLionel Sambuc     if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
1355f4a2713aSLionel Sambuc       // The Itanium C++ ABI uses the type, scope depth, and scope
1356f4a2713aSLionel Sambuc       // index of a parameter when mangling expressions that involve
1357f4a2713aSLionel Sambuc       // function parameters, so we will use the parameter's type for
1358f4a2713aSLionel Sambuc       // establishing function parameter identity. That way, our
1359f4a2713aSLionel Sambuc       // definition of "equivalent" (per C++ [temp.over.link]) is at
1360f4a2713aSLionel Sambuc       // least as strong as the definition of "equivalent" used for
1361f4a2713aSLionel Sambuc       // name mangling.
1362f4a2713aSLionel Sambuc       VisitType(Parm->getType());
1363f4a2713aSLionel Sambuc       ID.AddInteger(Parm->getFunctionScopeDepth());
1364f4a2713aSLionel Sambuc       ID.AddInteger(Parm->getFunctionScopeIndex());
1365f4a2713aSLionel Sambuc       return;
1366f4a2713aSLionel Sambuc     }
1367f4a2713aSLionel Sambuc 
1368f4a2713aSLionel Sambuc     if (const TemplateTypeParmDecl *TTP =
1369f4a2713aSLionel Sambuc           dyn_cast<TemplateTypeParmDecl>(D)) {
1370f4a2713aSLionel Sambuc       ID.AddInteger(TTP->getDepth());
1371f4a2713aSLionel Sambuc       ID.AddInteger(TTP->getIndex());
1372f4a2713aSLionel Sambuc       ID.AddBoolean(TTP->isParameterPack());
1373f4a2713aSLionel Sambuc       return;
1374f4a2713aSLionel Sambuc     }
1375f4a2713aSLionel Sambuc 
1376f4a2713aSLionel Sambuc     if (const TemplateTemplateParmDecl *TTP =
1377f4a2713aSLionel Sambuc           dyn_cast<TemplateTemplateParmDecl>(D)) {
1378f4a2713aSLionel Sambuc       ID.AddInteger(TTP->getDepth());
1379f4a2713aSLionel Sambuc       ID.AddInteger(TTP->getIndex());
1380f4a2713aSLionel Sambuc       ID.AddBoolean(TTP->isParameterPack());
1381f4a2713aSLionel Sambuc       return;
1382f4a2713aSLionel Sambuc     }
1383f4a2713aSLionel Sambuc   }
1384f4a2713aSLionel Sambuc 
1385*0a6a1f1dSLionel Sambuc   ID.AddPointer(D? D->getCanonicalDecl() : nullptr);
1386f4a2713aSLionel Sambuc }
1387f4a2713aSLionel Sambuc 
VisitType(QualType T)1388f4a2713aSLionel Sambuc void StmtProfiler::VisitType(QualType T) {
1389f4a2713aSLionel Sambuc   if (Canonical)
1390f4a2713aSLionel Sambuc     T = Context.getCanonicalType(T);
1391f4a2713aSLionel Sambuc 
1392f4a2713aSLionel Sambuc   ID.AddPointer(T.getAsOpaquePtr());
1393f4a2713aSLionel Sambuc }
1394f4a2713aSLionel Sambuc 
VisitName(DeclarationName Name)1395f4a2713aSLionel Sambuc void StmtProfiler::VisitName(DeclarationName Name) {
1396f4a2713aSLionel Sambuc   ID.AddPointer(Name.getAsOpaquePtr());
1397f4a2713aSLionel Sambuc }
1398f4a2713aSLionel Sambuc 
VisitNestedNameSpecifier(NestedNameSpecifier * NNS)1399f4a2713aSLionel Sambuc void StmtProfiler::VisitNestedNameSpecifier(NestedNameSpecifier *NNS) {
1400f4a2713aSLionel Sambuc   if (Canonical)
1401f4a2713aSLionel Sambuc     NNS = Context.getCanonicalNestedNameSpecifier(NNS);
1402f4a2713aSLionel Sambuc   ID.AddPointer(NNS);
1403f4a2713aSLionel Sambuc }
1404f4a2713aSLionel Sambuc 
VisitTemplateName(TemplateName Name)1405f4a2713aSLionel Sambuc void StmtProfiler::VisitTemplateName(TemplateName Name) {
1406f4a2713aSLionel Sambuc   if (Canonical)
1407f4a2713aSLionel Sambuc     Name = Context.getCanonicalTemplateName(Name);
1408f4a2713aSLionel Sambuc 
1409f4a2713aSLionel Sambuc   Name.Profile(ID);
1410f4a2713aSLionel Sambuc }
1411f4a2713aSLionel Sambuc 
VisitTemplateArguments(const TemplateArgumentLoc * Args,unsigned NumArgs)1412f4a2713aSLionel Sambuc void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
1413f4a2713aSLionel Sambuc                                           unsigned NumArgs) {
1414f4a2713aSLionel Sambuc   ID.AddInteger(NumArgs);
1415f4a2713aSLionel Sambuc   for (unsigned I = 0; I != NumArgs; ++I)
1416f4a2713aSLionel Sambuc     VisitTemplateArgument(Args[I].getArgument());
1417f4a2713aSLionel Sambuc }
1418f4a2713aSLionel Sambuc 
VisitTemplateArgument(const TemplateArgument & Arg)1419f4a2713aSLionel Sambuc void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
1420f4a2713aSLionel Sambuc   // Mostly repetitive with TemplateArgument::Profile!
1421f4a2713aSLionel Sambuc   ID.AddInteger(Arg.getKind());
1422f4a2713aSLionel Sambuc   switch (Arg.getKind()) {
1423f4a2713aSLionel Sambuc   case TemplateArgument::Null:
1424f4a2713aSLionel Sambuc     break;
1425f4a2713aSLionel Sambuc 
1426f4a2713aSLionel Sambuc   case TemplateArgument::Type:
1427f4a2713aSLionel Sambuc     VisitType(Arg.getAsType());
1428f4a2713aSLionel Sambuc     break;
1429f4a2713aSLionel Sambuc 
1430f4a2713aSLionel Sambuc   case TemplateArgument::Template:
1431f4a2713aSLionel Sambuc   case TemplateArgument::TemplateExpansion:
1432f4a2713aSLionel Sambuc     VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
1433f4a2713aSLionel Sambuc     break;
1434f4a2713aSLionel Sambuc 
1435f4a2713aSLionel Sambuc   case TemplateArgument::Declaration:
1436f4a2713aSLionel Sambuc     VisitDecl(Arg.getAsDecl());
1437f4a2713aSLionel Sambuc     break;
1438f4a2713aSLionel Sambuc 
1439f4a2713aSLionel Sambuc   case TemplateArgument::NullPtr:
1440f4a2713aSLionel Sambuc     VisitType(Arg.getNullPtrType());
1441f4a2713aSLionel Sambuc     break;
1442f4a2713aSLionel Sambuc 
1443f4a2713aSLionel Sambuc   case TemplateArgument::Integral:
1444f4a2713aSLionel Sambuc     Arg.getAsIntegral().Profile(ID);
1445f4a2713aSLionel Sambuc     VisitType(Arg.getIntegralType());
1446f4a2713aSLionel Sambuc     break;
1447f4a2713aSLionel Sambuc 
1448f4a2713aSLionel Sambuc   case TemplateArgument::Expression:
1449f4a2713aSLionel Sambuc     Visit(Arg.getAsExpr());
1450f4a2713aSLionel Sambuc     break;
1451f4a2713aSLionel Sambuc 
1452f4a2713aSLionel Sambuc   case TemplateArgument::Pack:
1453*0a6a1f1dSLionel Sambuc     for (const auto &P : Arg.pack_elements())
1454*0a6a1f1dSLionel Sambuc       VisitTemplateArgument(P);
1455f4a2713aSLionel Sambuc     break;
1456f4a2713aSLionel Sambuc   }
1457f4a2713aSLionel Sambuc }
1458f4a2713aSLionel Sambuc 
Profile(llvm::FoldingSetNodeID & ID,const ASTContext & Context,bool Canonical) const1459f4a2713aSLionel Sambuc void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
1460f4a2713aSLionel Sambuc                    bool Canonical) const {
1461f4a2713aSLionel Sambuc   StmtProfiler Profiler(ID, Context, Canonical);
1462f4a2713aSLionel Sambuc   Profiler.Visit(this);
1463f4a2713aSLionel Sambuc }
1464