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