Douglas Gregor | 41ef0c3 | 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 | 00aa3a6 | 2009-07-28 16:39:25 +0000 | [diff] [blame] | 11 | // representation that identifies a statement/expression. |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | #include "clang/AST/ASTContext.h" |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 15 | #include "clang/AST/DeclCXX.h" |
| 16 | #include "clang/AST/DeclObjC.h" |
Douglas Gregor | 41ef0c3 | 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 | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 23 | using namespace clang; |
| 24 | |
| 25 | namespace { |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 26 | class StmtProfiler : public ConstStmtVisitor<StmtProfiler> { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 27 | llvm::FoldingSetNodeID &ID; |
Jay Foad | 4ba2a17 | 2011-01-12 09:06:06 +0000 | [diff] [blame] | 28 | const ASTContext &Context; |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 29 | bool Canonical; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 30 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 31 | public: |
Jay Foad | 4ba2a17 | 2011-01-12 09:06:06 +0000 | [diff] [blame] | 32 | StmtProfiler(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 33 | bool Canonical) |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 34 | : ID(ID), Context(Context), Canonical(Canonical) { } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 35 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 36 | void VisitStmt(const Stmt *S); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 37 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 38 | #define STMT(Node, Base) void Visit##Node(const Node *S); |
Sean Hunt | 4bfe196 | 2010-05-05 15:24:00 +0000 | [diff] [blame] | 39 | #include "clang/AST/StmtNodes.inc" |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 40 | |
Douglas Gregor | 41ef0c3 | 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 | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 43 | void VisitDecl(const Decl *D); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 44 | |
| 45 | /// \brief Visit a type that is referenced within an expression or |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 46 | /// statement. |
| 47 | void VisitType(QualType T); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 48 | |
Douglas Gregor | 41ef0c3 | 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 | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 51 | |
Douglas Gregor | 41ef0c3 | 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 | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 55 | |
Douglas Gregor | 41ef0c3 | 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 | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 59 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 60 | /// \brief Visit template arguments that occur within an expression or |
| 61 | /// statement. |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 62 | void VisitTemplateArguments(const TemplateArgumentLoc *Args, |
| 63 | unsigned NumArgs); |
John McCall | 833ca99 | 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 | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 67 | }; |
| 68 | } |
| 69 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 70 | void StmtProfiler::VisitStmt(const Stmt *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 71 | ID.AddInteger(S->getStmtClass()); |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 72 | for (Stmt::const_child_range C = S->children(); C; ++C) |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 73 | Visit(*C); |
| 74 | } |
| 75 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 76 | void StmtProfiler::VisitDeclStmt(const DeclStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 77 | VisitStmt(S); |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 78 | for (DeclStmt::const_decl_iterator D = S->decl_begin(), DEnd = S->decl_end(); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 79 | D != DEnd; ++D) |
| 80 | VisitDecl(*D); |
| 81 | } |
| 82 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 83 | void StmtProfiler::VisitNullStmt(const NullStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 84 | VisitStmt(S); |
| 85 | } |
| 86 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 87 | void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 88 | VisitStmt(S); |
| 89 | } |
| 90 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 91 | void StmtProfiler::VisitSwitchCase(const SwitchCase *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 92 | VisitStmt(S); |
| 93 | } |
| 94 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 95 | void StmtProfiler::VisitCaseStmt(const CaseStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 96 | VisitStmt(S); |
| 97 | } |
| 98 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 99 | void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 100 | VisitStmt(S); |
| 101 | } |
| 102 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 103 | void StmtProfiler::VisitLabelStmt(const LabelStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 104 | VisitStmt(S); |
Chris Lattner | ad8dcf4 | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 105 | VisitDecl(S->getDecl()); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 106 | } |
| 107 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 108 | void StmtProfiler::VisitIfStmt(const IfStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 109 | VisitStmt(S); |
Douglas Gregor | 99e9b4d | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 110 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 111 | } |
| 112 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 113 | void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) { |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 114 | VisitStmt(S); |
Douglas Gregor | 99e9b4d | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 115 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 116 | } |
| 117 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 118 | void StmtProfiler::VisitWhileStmt(const WhileStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 119 | VisitStmt(S); |
Douglas Gregor | 99e9b4d | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 120 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 121 | } |
| 122 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 123 | void StmtProfiler::VisitDoStmt(const DoStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 124 | VisitStmt(S); |
| 125 | } |
| 126 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 127 | void StmtProfiler::VisitForStmt(const ForStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 128 | VisitStmt(S); |
| 129 | } |
| 130 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 131 | void StmtProfiler::VisitGotoStmt(const GotoStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 132 | VisitStmt(S); |
Chris Lattner | ad8dcf4 | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 133 | VisitDecl(S->getLabel()); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 134 | } |
| 135 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 136 | void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 137 | VisitStmt(S); |
| 138 | } |
| 139 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 140 | void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 141 | VisitStmt(S); |
| 142 | } |
| 143 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 144 | void StmtProfiler::VisitBreakStmt(const BreakStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 145 | VisitStmt(S); |
| 146 | } |
| 147 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 148 | void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 149 | VisitStmt(S); |
| 150 | } |
| 151 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 152 | void StmtProfiler::VisitAsmStmt(const AsmStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 153 | VisitStmt(S); |
| 154 | ID.AddBoolean(S->isVolatile()); |
| 155 | ID.AddBoolean(S->isSimple()); |
| 156 | VisitStringLiteral(S->getAsmString()); |
| 157 | ID.AddInteger(S->getNumOutputs()); |
| 158 | for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) { |
| 159 | ID.AddString(S->getOutputName(I)); |
| 160 | VisitStringLiteral(S->getOutputConstraintLiteral(I)); |
| 161 | } |
| 162 | ID.AddInteger(S->getNumInputs()); |
| 163 | for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) { |
| 164 | ID.AddString(S->getInputName(I)); |
| 165 | VisitStringLiteral(S->getInputConstraintLiteral(I)); |
| 166 | } |
| 167 | ID.AddInteger(S->getNumClobbers()); |
| 168 | for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) |
| 169 | VisitStringLiteral(S->getClobber(I)); |
| 170 | } |
| 171 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 172 | void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 173 | VisitStmt(S); |
| 174 | VisitType(S->getCaughtType()); |
| 175 | } |
| 176 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 177 | void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 178 | VisitStmt(S); |
| 179 | } |
| 180 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 181 | void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) { |
Richard Smith | ad762fc | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 182 | VisitStmt(S); |
| 183 | } |
| 184 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 185 | void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) { |
John Wiegley | 28bbe4b | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 186 | VisitStmt(S); |
| 187 | } |
| 188 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 189 | void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) { |
John Wiegley | 28bbe4b | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 190 | VisitStmt(S); |
| 191 | } |
| 192 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 193 | void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) { |
John Wiegley | 28bbe4b | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 194 | VisitStmt(S); |
| 195 | } |
| 196 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 197 | void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 198 | VisitStmt(S); |
| 199 | } |
| 200 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 201 | void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 202 | VisitStmt(S); |
| 203 | ID.AddBoolean(S->hasEllipsis()); |
| 204 | if (S->getCatchParamDecl()) |
| 205 | VisitType(S->getCatchParamDecl()->getType()); |
| 206 | } |
| 207 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 208 | void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 209 | VisitStmt(S); |
| 210 | } |
| 211 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 212 | void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 213 | VisitStmt(S); |
| 214 | } |
| 215 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 216 | void |
| 217 | StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 218 | VisitStmt(S); |
| 219 | } |
| 220 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 221 | void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) { |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 222 | VisitStmt(S); |
| 223 | } |
| 224 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 225 | void |
| 226 | StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) { |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 227 | VisitStmt(S); |
| 228 | } |
| 229 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 230 | void StmtProfiler::VisitExpr(const Expr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 231 | VisitStmt(S); |
| 232 | } |
| 233 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 234 | void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 235 | VisitExpr(S); |
Douglas Gregor | 218f47f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 236 | if (!Canonical) |
| 237 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 238 | VisitDecl(S->getDecl()); |
Douglas Gregor | 218f47f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 239 | if (!Canonical) |
| 240 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 243 | void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 244 | VisitExpr(S); |
| 245 | ID.AddInteger(S->getIdentType()); |
| 246 | } |
| 247 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 248 | void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 249 | VisitExpr(S); |
| 250 | S->getValue().Profile(ID); |
| 251 | } |
| 252 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 253 | void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 254 | VisitExpr(S); |
Douglas Gregor | 5cee119 | 2011-07-27 05:40:30 +0000 | [diff] [blame^] | 255 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 256 | ID.AddInteger(S->getValue()); |
| 257 | } |
| 258 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 259 | void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 260 | VisitExpr(S); |
| 261 | S->getValue().Profile(ID); |
| 262 | ID.AddBoolean(S->isExact()); |
| 263 | } |
| 264 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 265 | void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 266 | VisitExpr(S); |
| 267 | } |
| 268 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 269 | void StmtProfiler::VisitStringLiteral(const StringLiteral *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 270 | VisitExpr(S); |
Daniel Dunbar | 932eb6d | 2009-09-22 10:06:21 +0000 | [diff] [blame] | 271 | ID.AddString(S->getString()); |
Douglas Gregor | 5cee119 | 2011-07-27 05:40:30 +0000 | [diff] [blame^] | 272 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 273 | } |
| 274 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 275 | void StmtProfiler::VisitParenExpr(const ParenExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 276 | VisitExpr(S); |
| 277 | } |
| 278 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 279 | void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) { |
Nate Begeman | 2ef13e5 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 280 | VisitExpr(S); |
| 281 | } |
| 282 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 283 | void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 284 | VisitExpr(S); |
| 285 | ID.AddInteger(S->getOpcode()); |
| 286 | } |
| 287 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 288 | void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) { |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 289 | VisitType(S->getTypeSourceInfo()->getType()); |
| 290 | unsigned n = S->getNumComponents(); |
| 291 | for (unsigned i = 0; i < n; ++i) { |
| 292 | const OffsetOfExpr::OffsetOfNode& ON = S->getComponent(i); |
| 293 | ID.AddInteger(ON.getKind()); |
| 294 | switch (ON.getKind()) { |
| 295 | case OffsetOfExpr::OffsetOfNode::Array: |
| 296 | // Expressions handled below. |
| 297 | break; |
| 298 | |
| 299 | case OffsetOfExpr::OffsetOfNode::Field: |
| 300 | VisitDecl(ON.getField()); |
| 301 | break; |
| 302 | |
| 303 | case OffsetOfExpr::OffsetOfNode::Identifier: |
| 304 | ID.AddPointer(ON.getFieldName()); |
| 305 | break; |
Sean Hunt | c302113 | 2010-05-05 15:23:54 +0000 | [diff] [blame] | 306 | |
Douglas Gregor | cc8a5d5 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 307 | case OffsetOfExpr::OffsetOfNode::Base: |
| 308 | // These nodes are implicit, and therefore don't need profiling. |
| 309 | break; |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 310 | } |
| 311 | } |
Sean Hunt | c302113 | 2010-05-05 15:23:54 +0000 | [diff] [blame] | 312 | |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 313 | VisitExpr(S); |
| 314 | } |
| 315 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 316 | void |
| 317 | StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 318 | VisitExpr(S); |
Peter Collingbourne | f4e3cfb | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 319 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 320 | if (S->isArgumentType()) |
| 321 | VisitType(S->getArgumentType()); |
| 322 | } |
| 323 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 324 | void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 325 | VisitExpr(S); |
| 326 | } |
| 327 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 328 | void StmtProfiler::VisitCallExpr(const CallExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 329 | VisitExpr(S); |
| 330 | } |
| 331 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 332 | void StmtProfiler::VisitMemberExpr(const MemberExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 333 | VisitExpr(S); |
| 334 | VisitDecl(S->getMemberDecl()); |
Douglas Gregor | 218f47f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 335 | if (!Canonical) |
| 336 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 337 | ID.AddBoolean(S->isArrow()); |
| 338 | } |
| 339 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 340 | void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 341 | VisitExpr(S); |
| 342 | ID.AddBoolean(S->isFileScope()); |
| 343 | } |
| 344 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 345 | void StmtProfiler::VisitCastExpr(const CastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 346 | VisitExpr(S); |
| 347 | } |
| 348 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 349 | void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 350 | VisitCastExpr(S); |
John McCall | 5baba9d | 2010-08-25 10:28:54 +0000 | [diff] [blame] | 351 | ID.AddInteger(S->getValueKind()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 352 | } |
| 353 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 354 | void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 355 | VisitCastExpr(S); |
| 356 | VisitType(S->getTypeAsWritten()); |
| 357 | } |
| 358 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 359 | void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 360 | VisitExplicitCastExpr(S); |
| 361 | } |
| 362 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 363 | void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 364 | VisitExpr(S); |
| 365 | ID.AddInteger(S->getOpcode()); |
| 366 | } |
| 367 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 368 | void |
| 369 | StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 370 | VisitBinaryOperator(S); |
| 371 | } |
| 372 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 373 | void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 374 | VisitExpr(S); |
| 375 | } |
| 376 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 377 | void StmtProfiler::VisitBinaryConditionalOperator( |
Chandler Carruth | 0894976 | 2011-06-21 23:26:32 +0000 | [diff] [blame] | 378 | const BinaryConditionalOperator *S) { |
John McCall | 56ca35d | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 379 | VisitExpr(S); |
| 380 | } |
| 381 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 382 | void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 383 | VisitExpr(S); |
Chris Lattner | ad8dcf4 | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 384 | VisitDecl(S->getLabel()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 385 | } |
| 386 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 387 | void StmtProfiler::VisitStmtExpr(const StmtExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 388 | VisitExpr(S); |
| 389 | } |
| 390 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 391 | void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 392 | VisitExpr(S); |
| 393 | } |
| 394 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 395 | void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 396 | VisitExpr(S); |
| 397 | } |
| 398 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 399 | void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 400 | VisitExpr(S); |
| 401 | } |
| 402 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 403 | void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) { |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 404 | VisitExpr(S); |
| 405 | } |
| 406 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 407 | void StmtProfiler::VisitInitListExpr(const InitListExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 408 | if (S->getSyntacticForm()) { |
| 409 | VisitInitListExpr(S->getSyntacticForm()); |
| 410 | return; |
| 411 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 412 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 413 | VisitExpr(S); |
| 414 | } |
| 415 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 416 | void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 417 | VisitExpr(S); |
| 418 | ID.AddBoolean(S->usesGNUSyntax()); |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 419 | for (DesignatedInitExpr::const_designators_iterator D = |
| 420 | S->designators_begin(), DEnd = S->designators_end(); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 421 | D != DEnd; ++D) { |
| 422 | if (D->isFieldDesignator()) { |
| 423 | ID.AddInteger(0); |
| 424 | VisitName(D->getFieldName()); |
| 425 | continue; |
| 426 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 427 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 428 | if (D->isArrayDesignator()) { |
| 429 | ID.AddInteger(1); |
| 430 | } else { |
| 431 | assert(D->isArrayRangeDesignator()); |
| 432 | ID.AddInteger(2); |
| 433 | } |
| 434 | ID.AddInteger(D->getFirstExprIndex()); |
| 435 | } |
| 436 | } |
| 437 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 438 | void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 439 | VisitExpr(S); |
| 440 | } |
| 441 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 442 | void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 443 | VisitExpr(S); |
| 444 | VisitName(&S->getAccessor()); |
| 445 | } |
| 446 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 447 | void StmtProfiler::VisitBlockExpr(const BlockExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 448 | VisitExpr(S); |
| 449 | VisitDecl(S->getBlockDecl()); |
| 450 | } |
| 451 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 452 | void StmtProfiler::VisitBlockDeclRefExpr(const BlockDeclRefExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 453 | VisitExpr(S); |
| 454 | VisitDecl(S->getDecl()); |
| 455 | ID.AddBoolean(S->isByRef()); |
| 456 | ID.AddBoolean(S->isConstQualAdded()); |
| 457 | } |
| 458 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 459 | void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) { |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 460 | VisitExpr(S); |
| 461 | for (unsigned i = 0; i != S->getNumAssocs(); ++i) { |
| 462 | QualType T = S->getAssocType(i); |
| 463 | if (T.isNull()) |
| 464 | ID.AddPointer(0); |
| 465 | else |
| 466 | VisitType(T); |
| 467 | VisitExpr(S->getAssocExpr(i)); |
| 468 | } |
| 469 | } |
| 470 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 471 | static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 472 | UnaryOperatorKind &UnaryOp, |
| 473 | BinaryOperatorKind &BinaryOp) { |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 474 | switch (S->getOperator()) { |
| 475 | case OO_None: |
| 476 | case OO_New: |
| 477 | case OO_Delete: |
| 478 | case OO_Array_New: |
| 479 | case OO_Array_Delete: |
| 480 | case OO_Arrow: |
| 481 | case OO_Call: |
| 482 | case OO_Conditional: |
| 483 | case NUM_OVERLOADED_OPERATORS: |
| 484 | llvm_unreachable("Invalid operator call kind"); |
| 485 | return Stmt::ArraySubscriptExprClass; |
| 486 | |
| 487 | case OO_Plus: |
| 488 | if (S->getNumArgs() == 1) { |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 489 | UnaryOp = UO_Plus; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 490 | return Stmt::UnaryOperatorClass; |
| 491 | } |
| 492 | |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 493 | BinaryOp = BO_Add; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 494 | return Stmt::BinaryOperatorClass; |
| 495 | |
| 496 | case OO_Minus: |
| 497 | if (S->getNumArgs() == 1) { |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 498 | UnaryOp = UO_Minus; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 499 | return Stmt::UnaryOperatorClass; |
| 500 | } |
| 501 | |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 502 | BinaryOp = BO_Sub; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 503 | return Stmt::BinaryOperatorClass; |
| 504 | |
| 505 | case OO_Star: |
| 506 | if (S->getNumArgs() == 1) { |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 507 | UnaryOp = UO_Minus; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 508 | return Stmt::UnaryOperatorClass; |
| 509 | } |
| 510 | |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 511 | BinaryOp = BO_Sub; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 512 | return Stmt::BinaryOperatorClass; |
| 513 | |
| 514 | case OO_Slash: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 515 | BinaryOp = BO_Div; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 516 | return Stmt::BinaryOperatorClass; |
| 517 | |
| 518 | case OO_Percent: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 519 | BinaryOp = BO_Rem; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 520 | return Stmt::BinaryOperatorClass; |
| 521 | |
| 522 | case OO_Caret: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 523 | BinaryOp = BO_Xor; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 524 | return Stmt::BinaryOperatorClass; |
| 525 | |
| 526 | case OO_Amp: |
| 527 | if (S->getNumArgs() == 1) { |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 528 | UnaryOp = UO_AddrOf; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 529 | return Stmt::UnaryOperatorClass; |
| 530 | } |
| 531 | |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 532 | BinaryOp = BO_And; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 533 | return Stmt::BinaryOperatorClass; |
| 534 | |
| 535 | case OO_Pipe: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 536 | BinaryOp = BO_Or; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 537 | return Stmt::BinaryOperatorClass; |
| 538 | |
| 539 | case OO_Tilde: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 540 | UnaryOp = UO_Not; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 541 | return Stmt::UnaryOperatorClass; |
| 542 | |
| 543 | case OO_Exclaim: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 544 | UnaryOp = UO_LNot; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 545 | return Stmt::UnaryOperatorClass; |
| 546 | |
| 547 | case OO_Equal: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 548 | BinaryOp = BO_Assign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 549 | return Stmt::BinaryOperatorClass; |
| 550 | |
| 551 | case OO_Less: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 552 | BinaryOp = BO_LT; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 553 | return Stmt::BinaryOperatorClass; |
| 554 | |
| 555 | case OO_Greater: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 556 | BinaryOp = BO_GT; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 557 | return Stmt::BinaryOperatorClass; |
| 558 | |
| 559 | case OO_PlusEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 560 | BinaryOp = BO_AddAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 561 | return Stmt::CompoundAssignOperatorClass; |
| 562 | |
| 563 | case OO_MinusEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 564 | BinaryOp = BO_SubAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 565 | return Stmt::CompoundAssignOperatorClass; |
| 566 | |
| 567 | case OO_StarEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 568 | BinaryOp = BO_MulAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 569 | return Stmt::CompoundAssignOperatorClass; |
| 570 | |
| 571 | case OO_SlashEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 572 | BinaryOp = BO_DivAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 573 | return Stmt::CompoundAssignOperatorClass; |
| 574 | |
| 575 | case OO_PercentEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 576 | BinaryOp = BO_RemAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 577 | return Stmt::CompoundAssignOperatorClass; |
| 578 | |
| 579 | case OO_CaretEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 580 | BinaryOp = BO_XorAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 581 | return Stmt::CompoundAssignOperatorClass; |
| 582 | |
| 583 | case OO_AmpEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 584 | BinaryOp = BO_AndAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 585 | return Stmt::CompoundAssignOperatorClass; |
| 586 | |
| 587 | case OO_PipeEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 588 | BinaryOp = BO_OrAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 589 | return Stmt::CompoundAssignOperatorClass; |
| 590 | |
| 591 | case OO_LessLess: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 592 | BinaryOp = BO_Shl; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 593 | return Stmt::BinaryOperatorClass; |
| 594 | |
| 595 | case OO_GreaterGreater: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 596 | BinaryOp = BO_Shr; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 597 | return Stmt::BinaryOperatorClass; |
| 598 | |
| 599 | case OO_LessLessEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 600 | BinaryOp = BO_ShlAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 601 | return Stmt::CompoundAssignOperatorClass; |
| 602 | |
| 603 | case OO_GreaterGreaterEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 604 | BinaryOp = BO_ShrAssign; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 605 | return Stmt::CompoundAssignOperatorClass; |
| 606 | |
| 607 | case OO_EqualEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 608 | BinaryOp = BO_EQ; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 609 | return Stmt::BinaryOperatorClass; |
| 610 | |
| 611 | case OO_ExclaimEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 612 | BinaryOp = BO_NE; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 613 | return Stmt::BinaryOperatorClass; |
| 614 | |
| 615 | case OO_LessEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 616 | BinaryOp = BO_LE; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 617 | return Stmt::BinaryOperatorClass; |
| 618 | |
| 619 | case OO_GreaterEqual: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 620 | BinaryOp = BO_GE; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 621 | return Stmt::BinaryOperatorClass; |
| 622 | |
| 623 | case OO_AmpAmp: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 624 | BinaryOp = BO_LAnd; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 625 | return Stmt::BinaryOperatorClass; |
| 626 | |
| 627 | case OO_PipePipe: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 628 | BinaryOp = BO_LOr; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 629 | return Stmt::BinaryOperatorClass; |
| 630 | |
| 631 | case OO_PlusPlus: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 632 | UnaryOp = S->getNumArgs() == 1? UO_PreInc |
| 633 | : UO_PostInc; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 634 | return Stmt::UnaryOperatorClass; |
| 635 | |
| 636 | case OO_MinusMinus: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 637 | UnaryOp = S->getNumArgs() == 1? UO_PreDec |
| 638 | : UO_PostDec; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 639 | return Stmt::UnaryOperatorClass; |
| 640 | |
| 641 | case OO_Comma: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 642 | BinaryOp = BO_Comma; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 643 | return Stmt::BinaryOperatorClass; |
| 644 | |
| 645 | |
| 646 | case OO_ArrowStar: |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 647 | BinaryOp = BO_PtrMemI; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 648 | return Stmt::BinaryOperatorClass; |
| 649 | |
| 650 | case OO_Subscript: |
| 651 | return Stmt::ArraySubscriptExprClass; |
| 652 | } |
| 653 | |
| 654 | llvm_unreachable("Invalid overloaded operator expression"); |
| 655 | } |
| 656 | |
| 657 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 658 | void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) { |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 659 | if (S->isTypeDependent()) { |
| 660 | // Type-dependent operator calls are profiled like their underlying |
| 661 | // syntactic operator. |
John McCall | 2de56d1 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 662 | UnaryOperatorKind UnaryOp = UO_Extension; |
| 663 | BinaryOperatorKind BinaryOp = BO_Comma; |
Douglas Gregor | a89064a | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 664 | Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp); |
| 665 | |
| 666 | ID.AddInteger(SC); |
| 667 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
| 668 | Visit(S->getArg(I)); |
| 669 | if (SC == Stmt::UnaryOperatorClass) |
| 670 | ID.AddInteger(UnaryOp); |
| 671 | else if (SC == Stmt::BinaryOperatorClass || |
| 672 | SC == Stmt::CompoundAssignOperatorClass) |
| 673 | ID.AddInteger(BinaryOp); |
| 674 | else |
| 675 | assert(SC == Stmt::ArraySubscriptExprClass); |
| 676 | |
| 677 | return; |
| 678 | } |
| 679 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 680 | VisitCallExpr(S); |
| 681 | ID.AddInteger(S->getOperator()); |
| 682 | } |
| 683 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 684 | void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 685 | VisitCallExpr(S); |
| 686 | } |
| 687 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 688 | void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) { |
Peter Collingbourne | e08ce65 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 689 | VisitCallExpr(S); |
| 690 | } |
| 691 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 692 | void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) { |
Tanya Lattner | 61eee0c | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 693 | VisitExpr(S); |
| 694 | } |
| 695 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 696 | void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 697 | VisitExplicitCastExpr(S); |
| 698 | } |
| 699 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 700 | void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 701 | VisitCXXNamedCastExpr(S); |
| 702 | } |
| 703 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 704 | void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 705 | VisitCXXNamedCastExpr(S); |
| 706 | } |
| 707 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 708 | void |
| 709 | StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 710 | VisitCXXNamedCastExpr(S); |
| 711 | } |
| 712 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 713 | void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 714 | VisitCXXNamedCastExpr(S); |
| 715 | } |
| 716 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 717 | void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 718 | VisitExpr(S); |
| 719 | ID.AddBoolean(S->getValue()); |
| 720 | } |
| 721 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 722 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) { |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 723 | VisitExpr(S); |
| 724 | } |
| 725 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 726 | void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 727 | VisitExpr(S); |
| 728 | if (S->isTypeOperand()) |
| 729 | VisitType(S->getTypeOperand()); |
| 730 | } |
| 731 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 732 | void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) { |
Francois Pichet | 01b7c30 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 733 | VisitExpr(S); |
| 734 | if (S->isTypeOperand()) |
| 735 | VisitType(S->getTypeOperand()); |
| 736 | } |
| 737 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 738 | void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 739 | VisitExpr(S); |
| 740 | } |
| 741 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 742 | void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 743 | VisitExpr(S); |
| 744 | } |
| 745 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 746 | void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 747 | VisitExpr(S); |
| 748 | VisitDecl(S->getParam()); |
| 749 | } |
| 750 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 751 | void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 752 | VisitExpr(S); |
| 753 | VisitDecl( |
| 754 | const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
| 755 | } |
| 756 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 757 | void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 758 | VisitExpr(S); |
| 759 | VisitDecl(S->getConstructor()); |
| 760 | ID.AddBoolean(S->isElidable()); |
| 761 | } |
| 762 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 763 | void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 764 | VisitExplicitCastExpr(S); |
| 765 | } |
| 766 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 767 | void |
| 768 | StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 769 | VisitCXXConstructExpr(S); |
| 770 | } |
| 771 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 772 | void |
| 773 | StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 774 | VisitExpr(S); |
| 775 | } |
| 776 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 777 | void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 778 | VisitExpr(S); |
| 779 | ID.AddBoolean(S->isGlobalDelete()); |
| 780 | ID.AddBoolean(S->isArrayForm()); |
| 781 | VisitDecl(S->getOperatorDelete()); |
| 782 | } |
| 783 | |
| 784 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 785 | void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 786 | VisitExpr(S); |
| 787 | VisitType(S->getAllocatedType()); |
| 788 | VisitDecl(S->getOperatorNew()); |
| 789 | VisitDecl(S->getOperatorDelete()); |
| 790 | VisitDecl(S->getConstructor()); |
| 791 | ID.AddBoolean(S->isArray()); |
| 792 | ID.AddInteger(S->getNumPlacementArgs()); |
| 793 | ID.AddBoolean(S->isGlobalNew()); |
| 794 | ID.AddBoolean(S->isParenTypeId()); |
| 795 | ID.AddBoolean(S->hasInitializer()); |
| 796 | ID.AddInteger(S->getNumConstructorArgs()); |
| 797 | } |
| 798 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 799 | void |
| 800 | StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { |
Douglas Gregor | a71d819 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 801 | VisitExpr(S); |
| 802 | ID.AddBoolean(S->isArrow()); |
| 803 | VisitNestedNameSpecifier(S->getQualifier()); |
| 804 | VisitType(S->getDestroyedType()); |
| 805 | } |
| 806 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 807 | void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { |
Argyrios Kyrtzidis | 7b3e3f6 | 2010-08-15 20:53:20 +0000 | [diff] [blame] | 808 | VisitExpr(S); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 809 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 810 | VisitName(S->getName()); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 811 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 812 | if (S->hasExplicitTemplateArgs()) |
Argyrios Kyrtzidis | c35919b | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 813 | VisitTemplateArguments(S->getExplicitTemplateArgs().getTemplateArgs(), |
| 814 | S->getExplicitTemplateArgs().NumTemplateArgs); |
| 815 | } |
| 816 | |
| 817 | void |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 818 | StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) { |
Argyrios Kyrtzidis | c35919b | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 819 | VisitOverloadExpr(S); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 820 | } |
| 821 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 822 | void StmtProfiler::VisitUnaryTypeTraitExpr(const UnaryTypeTraitExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 823 | VisitExpr(S); |
| 824 | ID.AddInteger(S->getTrait()); |
| 825 | VisitType(S->getQueriedType()); |
| 826 | } |
| 827 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 828 | void StmtProfiler::VisitBinaryTypeTraitExpr(const BinaryTypeTraitExpr *S) { |
Francois Pichet | 6ad6f28 | 2010-12-07 00:08:36 +0000 | [diff] [blame] | 829 | VisitExpr(S); |
| 830 | ID.AddInteger(S->getTrait()); |
| 831 | VisitType(S->getLhsType()); |
| 832 | VisitType(S->getRhsType()); |
| 833 | } |
| 834 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 835 | void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) { |
John Wiegley | 21ff2e5 | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 836 | VisitExpr(S); |
| 837 | ID.AddInteger(S->getTrait()); |
| 838 | VisitType(S->getQueriedType()); |
| 839 | } |
| 840 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 841 | void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) { |
John Wiegley | 5526220 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 842 | VisitExpr(S); |
| 843 | ID.AddInteger(S->getTrait()); |
| 844 | VisitExpr(S->getQueriedExpression()); |
| 845 | } |
| 846 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 847 | void StmtProfiler::VisitDependentScopeDeclRefExpr( |
| 848 | const DependentScopeDeclRefExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 849 | VisitExpr(S); |
| 850 | VisitName(S->getDeclName()); |
| 851 | VisitNestedNameSpecifier(S->getQualifier()); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 852 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 853 | if (S->hasExplicitTemplateArgs()) |
| 854 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 855 | } |
| 856 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 857 | void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 858 | VisitExpr(S); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 859 | } |
| 860 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 861 | void StmtProfiler::VisitCXXUnresolvedConstructExpr( |
| 862 | const CXXUnresolvedConstructExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 863 | VisitExpr(S); |
| 864 | VisitType(S->getTypeAsWritten()); |
| 865 | } |
| 866 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 867 | void StmtProfiler::VisitCXXDependentScopeMemberExpr( |
| 868 | const CXXDependentScopeMemberExpr *S) { |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 869 | ID.AddBoolean(S->isImplicitAccess()); |
| 870 | if (!S->isImplicitAccess()) { |
| 871 | VisitExpr(S); |
| 872 | ID.AddBoolean(S->isArrow()); |
| 873 | } |
Douglas Gregor | a38c687 | 2009-09-03 16:14:30 +0000 | [diff] [blame] | 874 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 875 | VisitName(S->getMember()); |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 876 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 877 | if (S->hasExplicitTemplateArgs()) |
John McCall | 129e2df | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 878 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
| 879 | } |
| 880 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 881 | void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) { |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 882 | ID.AddBoolean(S->isImplicitAccess()); |
| 883 | if (!S->isImplicitAccess()) { |
| 884 | VisitExpr(S); |
| 885 | ID.AddBoolean(S->isArrow()); |
| 886 | } |
John McCall | 129e2df | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 887 | VisitNestedNameSpecifier(S->getQualifier()); |
| 888 | VisitName(S->getMemberName()); |
| 889 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 890 | if (S->hasExplicitTemplateArgs()) |
| 891 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 892 | } |
| 893 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 894 | void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) { |
Sebastian Redl | 2e15622 | 2010-09-10 20:55:43 +0000 | [diff] [blame] | 895 | VisitExpr(S); |
| 896 | } |
| 897 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 898 | void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) { |
Douglas Gregor | be230c3 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 899 | VisitExpr(S); |
| 900 | } |
| 901 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 902 | void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) { |
Douglas Gregor | ee8aff0 | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 903 | VisitExpr(S); |
| 904 | VisitDecl(S->getPack()); |
| 905 | } |
| 906 | |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 907 | void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr( |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 908 | const SubstNonTypeTemplateParmPackExpr *S) { |
Douglas Gregor | c7793c7 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 909 | VisitExpr(S); |
| 910 | VisitDecl(S->getParameterPack()); |
| 911 | VisitTemplateArgument(S->getArgumentPack()); |
| 912 | } |
| 913 | |
John McCall | 91a5755 | 2011-07-15 05:09:51 +0000 | [diff] [blame] | 914 | void StmtProfiler::VisitSubstNonTypeTemplateParmExpr( |
| 915 | const SubstNonTypeTemplateParmExpr *E) { |
| 916 | // Profile exactly as the replacement expression. |
| 917 | Visit(E->getReplacement()); |
| 918 | } |
| 919 | |
Douglas Gregor | 03e8003 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 920 | void StmtProfiler::VisitMaterializeTemporaryExpr( |
| 921 | const MaterializeTemporaryExpr *S) { |
| 922 | VisitExpr(S); |
| 923 | } |
| 924 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 925 | void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { |
John McCall | 7cd7d1a | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 926 | VisitExpr(E); |
| 927 | } |
| 928 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 929 | void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 930 | VisitExpr(S); |
| 931 | } |
| 932 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 933 | void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 934 | VisitExpr(S); |
| 935 | VisitType(S->getEncodedType()); |
| 936 | } |
| 937 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 938 | void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 939 | VisitExpr(S); |
| 940 | VisitName(S->getSelector()); |
| 941 | } |
| 942 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 943 | void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 944 | VisitExpr(S); |
| 945 | VisitDecl(S->getProtocol()); |
| 946 | } |
| 947 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 948 | void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 949 | VisitExpr(S); |
| 950 | VisitDecl(S->getDecl()); |
| 951 | ID.AddBoolean(S->isArrow()); |
| 952 | ID.AddBoolean(S->isFreeIvar()); |
| 953 | } |
| 954 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 955 | void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 956 | VisitExpr(S); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 957 | if (S->isImplicitProperty()) { |
| 958 | VisitDecl(S->getImplicitPropertyGetter()); |
| 959 | VisitDecl(S->getImplicitPropertySetter()); |
| 960 | } else { |
| 961 | VisitDecl(S->getExplicitProperty()); |
Fariborz Jahanian | 8ac2d44 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 962 | } |
Fariborz Jahanian | 8ac2d44 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 963 | if (S->isSuperReceiver()) { |
| 964 | ID.AddBoolean(S->isSuperReceiver()); |
John McCall | 12f78a6 | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 965 | VisitType(S->getSuperReceiverType()); |
Fariborz Jahanian | 8ac2d44 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 966 | } |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 967 | } |
| 968 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 969 | void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 970 | VisitExpr(S); |
| 971 | VisitName(S->getSelector()); |
| 972 | VisitDecl(S->getMethodDecl()); |
| 973 | } |
| 974 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 975 | void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 976 | VisitExpr(S); |
| 977 | ID.AddBoolean(S->isArrow()); |
| 978 | } |
| 979 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 980 | void StmtProfiler::VisitObjCIndirectCopyRestoreExpr( |
| 981 | const ObjCIndirectCopyRestoreExpr *S) { |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 982 | VisitExpr(S); |
| 983 | ID.AddBoolean(S->shouldCopy()); |
| 984 | } |
| 985 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 986 | void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) { |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 987 | VisitExplicitCastExpr(S); |
| 988 | ID.AddBoolean(S->getBridgeKind()); |
| 989 | } |
| 990 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 991 | void StmtProfiler::VisitDecl(const Decl *D) { |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 992 | ID.AddInteger(D? D->getKind() : 0); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 993 | |
Douglas Gregor | b197572 | 2009-07-30 23:18:24 +0000 | [diff] [blame] | 994 | if (Canonical && D) { |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 995 | if (const NonTypeTemplateParmDecl *NTTP = |
| 996 | dyn_cast<NonTypeTemplateParmDecl>(D)) { |
Douglas Gregor | d584eb2 | 2009-07-28 15:32:17 +0000 | [diff] [blame] | 997 | ID.AddInteger(NTTP->getDepth()); |
| 998 | ID.AddInteger(NTTP->getIndex()); |
Douglas Gregor | 61c4d28 | 2011-01-05 15:48:55 +0000 | [diff] [blame] | 999 | ID.AddBoolean(NTTP->isParameterPack()); |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 1000 | VisitType(NTTP->getType()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1001 | return; |
| 1002 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1003 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1004 | if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { |
John McCall | fb44de9 | 2011-05-01 22:35:37 +0000 | [diff] [blame] | 1005 | // The Itanium C++ ABI uses the type, scope depth, and scope |
| 1006 | // index of a parameter when mangling expressions that involve |
| 1007 | // function parameters, so we will use the parameter's type for |
| 1008 | // establishing function parameter identity. That way, our |
| 1009 | // definition of "equivalent" (per C++ [temp.over.link]) is at |
| 1010 | // least as strong as the definition of "equivalent" used for |
| 1011 | // name mangling. |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 1012 | VisitType(Parm->getType()); |
John McCall | fb44de9 | 2011-05-01 22:35:37 +0000 | [diff] [blame] | 1013 | ID.AddInteger(Parm->getFunctionScopeDepth()); |
| 1014 | ID.AddInteger(Parm->getFunctionScopeIndex()); |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 1015 | return; |
| 1016 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1017 | |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1018 | if (const TemplateTemplateParmDecl *TTP = |
| 1019 | dyn_cast<TemplateTemplateParmDecl>(D)) { |
Douglas Gregor | a2ffb98 | 2009-07-31 15:46:56 +0000 | [diff] [blame] | 1020 | ID.AddInteger(TTP->getDepth()); |
| 1021 | ID.AddInteger(TTP->getIndex()); |
Douglas Gregor | 61c4d28 | 2011-01-05 15:48:55 +0000 | [diff] [blame] | 1022 | ID.AddBoolean(TTP->isParameterPack()); |
Douglas Gregor | a2ffb98 | 2009-07-31 15:46:56 +0000 | [diff] [blame] | 1023 | return; |
| 1024 | } |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1025 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1026 | |
Douglas Gregor | d584eb2 | 2009-07-28 15:32:17 +0000 | [diff] [blame] | 1027 | ID.AddPointer(D? D->getCanonicalDecl() : 0); |
| 1028 | } |
| 1029 | |
| 1030 | void StmtProfiler::VisitType(QualType T) { |
| 1031 | if (Canonical) |
| 1032 | T = Context.getCanonicalType(T); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1033 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1034 | ID.AddPointer(T.getAsOpaquePtr()); |
| 1035 | } |
| 1036 | |
| 1037 | void StmtProfiler::VisitName(DeclarationName Name) { |
| 1038 | ID.AddPointer(Name.getAsOpaquePtr()); |
| 1039 | } |
| 1040 | |
| 1041 | void StmtProfiler::VisitNestedNameSpecifier(NestedNameSpecifier *NNS) { |
| 1042 | if (Canonical) |
| 1043 | NNS = Context.getCanonicalNestedNameSpecifier(NNS); |
| 1044 | ID.AddPointer(NNS); |
| 1045 | } |
| 1046 | |
| 1047 | void StmtProfiler::VisitTemplateName(TemplateName Name) { |
| 1048 | if (Canonical) |
| 1049 | Name = Context.getCanonicalTemplateName(Name); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1050 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1051 | Name.Profile(ID); |
| 1052 | } |
| 1053 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1054 | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1055 | unsigned NumArgs) { |
| 1056 | ID.AddInteger(NumArgs); |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1057 | for (unsigned I = 0; I != NumArgs; ++I) |
| 1058 | VisitTemplateArgument(Args[I].getArgument()); |
| 1059 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1060 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1061 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
| 1062 | // Mostly repetitive with TemplateArgument::Profile! |
| 1063 | ID.AddInteger(Arg.getKind()); |
| 1064 | switch (Arg.getKind()) { |
| 1065 | case TemplateArgument::Null: |
| 1066 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1067 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1068 | case TemplateArgument::Type: |
| 1069 | VisitType(Arg.getAsType()); |
| 1070 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1071 | |
Douglas Gregor | 788cd06 | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1072 | case TemplateArgument::Template: |
Douglas Gregor | a7fc901 | 2011-01-05 18:58:31 +0000 | [diff] [blame] | 1073 | case TemplateArgument::TemplateExpansion: |
| 1074 | VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); |
Douglas Gregor | 788cd06 | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1075 | break; |
Sean Hunt | c302113 | 2010-05-05 15:23:54 +0000 | [diff] [blame] | 1076 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1077 | case TemplateArgument::Declaration: |
| 1078 | VisitDecl(Arg.getAsDecl()); |
| 1079 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1080 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1081 | case TemplateArgument::Integral: |
| 1082 | Arg.getAsIntegral()->Profile(ID); |
| 1083 | VisitType(Arg.getIntegralType()); |
| 1084 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1085 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1086 | case TemplateArgument::Expression: |
| 1087 | Visit(Arg.getAsExpr()); |
| 1088 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1089 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1090 | case TemplateArgument::Pack: |
| 1091 | const TemplateArgument *Pack = Arg.pack_begin(); |
| 1092 | for (unsigned i = 0, e = Arg.pack_size(); i != e; ++i) |
| 1093 | VisitTemplateArgument(Pack[i]); |
| 1094 | break; |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1095 | } |
| 1096 | } |
| 1097 | |
Jay Foad | 4ba2a17 | 2011-01-12 09:06:06 +0000 | [diff] [blame] | 1098 | void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
Chandler Carruth | b113824 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1099 | bool Canonical) const { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1100 | StmtProfiler Profiler(ID, Context, Canonical); |
| 1101 | Profiler.Visit(this); |
| 1102 | } |