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 { |
Benjamin Kramer | 770b4a8 | 2009-11-28 19:03:38 +0000 | [diff] [blame] | 26 | class StmtProfiler : public StmtVisitor<StmtProfiler> { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 27 | llvm::FoldingSetNodeID &ID; |
| 28 | ASTContext &Context; |
| 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: |
| 32 | StmtProfiler(llvm::FoldingSetNodeID &ID, 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 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 36 | void VisitStmt(Stmt *S); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 37 | |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 38 | #define STMT(Node, Base) void Visit##Node(Node *S); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 39 | #include "clang/AST/StmtNodes.def" |
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. |
| 43 | void VisitDecl(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. |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 62 | void VisitTemplateArguments(const TemplateArgumentLoc *Args, unsigned NumArgs); |
| 63 | |
| 64 | /// \brief Visit a single template argument. |
| 65 | void VisitTemplateArgument(const TemplateArgument &Arg); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 66 | }; |
| 67 | } |
| 68 | |
| 69 | void StmtProfiler::VisitStmt(Stmt *S) { |
| 70 | ID.AddInteger(S->getStmtClass()); |
| 71 | for (Stmt::child_iterator C = S->child_begin(), CEnd = S->child_end(); |
| 72 | C != CEnd; ++C) |
| 73 | Visit(*C); |
| 74 | } |
| 75 | |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 76 | void StmtProfiler::VisitDeclStmt(DeclStmt *S) { |
| 77 | VisitStmt(S); |
| 78 | for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end(); |
| 79 | D != DEnd; ++D) |
| 80 | VisitDecl(*D); |
| 81 | } |
| 82 | |
| 83 | void StmtProfiler::VisitNullStmt(NullStmt *S) { |
| 84 | VisitStmt(S); |
| 85 | } |
| 86 | |
| 87 | void StmtProfiler::VisitCompoundStmt(CompoundStmt *S) { |
| 88 | VisitStmt(S); |
| 89 | } |
| 90 | |
| 91 | void StmtProfiler::VisitSwitchCase(SwitchCase *S) { |
| 92 | VisitStmt(S); |
| 93 | } |
| 94 | |
| 95 | void StmtProfiler::VisitCaseStmt(CaseStmt *S) { |
| 96 | VisitStmt(S); |
| 97 | } |
| 98 | |
| 99 | void StmtProfiler::VisitDefaultStmt(DefaultStmt *S) { |
| 100 | VisitStmt(S); |
| 101 | } |
| 102 | |
| 103 | void StmtProfiler::VisitLabelStmt(LabelStmt *S) { |
| 104 | VisitStmt(S); |
| 105 | VisitName(S->getID()); |
| 106 | } |
| 107 | |
| 108 | void StmtProfiler::VisitIfStmt(IfStmt *S) { |
| 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 | |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 113 | void StmtProfiler::VisitSwitchStmt(SwitchStmt *S) { |
| 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 | |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 118 | void StmtProfiler::VisitWhileStmt(WhileStmt *S) { |
| 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 | |
| 123 | void StmtProfiler::VisitDoStmt(DoStmt *S) { |
| 124 | VisitStmt(S); |
| 125 | } |
| 126 | |
| 127 | void StmtProfiler::VisitForStmt(ForStmt *S) { |
| 128 | VisitStmt(S); |
| 129 | } |
| 130 | |
| 131 | void StmtProfiler::VisitGotoStmt(GotoStmt *S) { |
| 132 | VisitStmt(S); |
| 133 | VisitName(S->getLabel()->getID()); |
| 134 | } |
| 135 | |
| 136 | void StmtProfiler::VisitIndirectGotoStmt(IndirectGotoStmt *S) { |
| 137 | VisitStmt(S); |
| 138 | } |
| 139 | |
| 140 | void StmtProfiler::VisitContinueStmt(ContinueStmt *S) { |
| 141 | VisitStmt(S); |
| 142 | } |
| 143 | |
| 144 | void StmtProfiler::VisitBreakStmt(BreakStmt *S) { |
| 145 | VisitStmt(S); |
| 146 | } |
| 147 | |
| 148 | void StmtProfiler::VisitReturnStmt(ReturnStmt *S) { |
| 149 | VisitStmt(S); |
| 150 | } |
| 151 | |
| 152 | void StmtProfiler::VisitAsmStmt(AsmStmt *S) { |
| 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 | |
| 172 | void StmtProfiler::VisitCXXCatchStmt(CXXCatchStmt *S) { |
| 173 | VisitStmt(S); |
| 174 | VisitType(S->getCaughtType()); |
| 175 | } |
| 176 | |
| 177 | void StmtProfiler::VisitCXXTryStmt(CXXTryStmt *S) { |
| 178 | VisitStmt(S); |
| 179 | } |
| 180 | |
| 181 | void StmtProfiler::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) { |
| 182 | VisitStmt(S); |
| 183 | } |
| 184 | |
| 185 | void StmtProfiler::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) { |
| 186 | VisitStmt(S); |
| 187 | ID.AddBoolean(S->hasEllipsis()); |
| 188 | if (S->getCatchParamDecl()) |
| 189 | VisitType(S->getCatchParamDecl()->getType()); |
| 190 | } |
| 191 | |
| 192 | void StmtProfiler::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) { |
| 193 | VisitStmt(S); |
| 194 | } |
| 195 | |
| 196 | void StmtProfiler::VisitObjCAtTryStmt(ObjCAtTryStmt *S) { |
| 197 | VisitStmt(S); |
| 198 | } |
| 199 | |
| 200 | void StmtProfiler::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) { |
| 201 | VisitStmt(S); |
| 202 | } |
| 203 | |
| 204 | void StmtProfiler::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) { |
| 205 | VisitStmt(S); |
| 206 | } |
| 207 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 208 | void StmtProfiler::VisitExpr(Expr *S) { |
| 209 | VisitStmt(S); |
| 210 | } |
| 211 | |
| 212 | void StmtProfiler::VisitDeclRefExpr(DeclRefExpr *S) { |
| 213 | VisitExpr(S); |
Douglas Gregor | a2813ce | 2009-10-23 18:54:35 +0000 | [diff] [blame] | 214 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 215 | VisitDecl(S->getDecl()); |
Douglas Gregor | a2813ce | 2009-10-23 18:54:35 +0000 | [diff] [blame] | 216 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | void StmtProfiler::VisitPredefinedExpr(PredefinedExpr *S) { |
| 220 | VisitExpr(S); |
| 221 | ID.AddInteger(S->getIdentType()); |
| 222 | } |
| 223 | |
| 224 | void StmtProfiler::VisitIntegerLiteral(IntegerLiteral *S) { |
| 225 | VisitExpr(S); |
| 226 | S->getValue().Profile(ID); |
| 227 | } |
| 228 | |
| 229 | void StmtProfiler::VisitCharacterLiteral(CharacterLiteral *S) { |
| 230 | VisitExpr(S); |
| 231 | ID.AddBoolean(S->isWide()); |
| 232 | ID.AddInteger(S->getValue()); |
| 233 | } |
| 234 | |
| 235 | void StmtProfiler::VisitFloatingLiteral(FloatingLiteral *S) { |
| 236 | VisitExpr(S); |
| 237 | S->getValue().Profile(ID); |
| 238 | ID.AddBoolean(S->isExact()); |
| 239 | } |
| 240 | |
| 241 | void StmtProfiler::VisitImaginaryLiteral(ImaginaryLiteral *S) { |
| 242 | VisitExpr(S); |
| 243 | } |
| 244 | |
| 245 | void StmtProfiler::VisitStringLiteral(StringLiteral *S) { |
| 246 | VisitExpr(S); |
Daniel Dunbar | 932eb6d | 2009-09-22 10:06:21 +0000 | [diff] [blame] | 247 | ID.AddString(S->getString()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 248 | ID.AddBoolean(S->isWide()); |
| 249 | } |
| 250 | |
| 251 | void StmtProfiler::VisitParenExpr(ParenExpr *S) { |
| 252 | VisitExpr(S); |
| 253 | } |
| 254 | |
Nate Begeman | 2ef13e5 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 255 | void StmtProfiler::VisitParenListExpr(ParenListExpr *S) { |
| 256 | VisitExpr(S); |
| 257 | } |
| 258 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 259 | void StmtProfiler::VisitUnaryOperator(UnaryOperator *S) { |
| 260 | VisitExpr(S); |
| 261 | ID.AddInteger(S->getOpcode()); |
| 262 | } |
| 263 | |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame^] | 264 | void StmtProfiler::VisitOffsetOfExpr(OffsetOfExpr *S) { |
| 265 | VisitType(S->getTypeSourceInfo()->getType()); |
| 266 | unsigned n = S->getNumComponents(); |
| 267 | for (unsigned i = 0; i < n; ++i) { |
| 268 | const OffsetOfExpr::OffsetOfNode& ON = S->getComponent(i); |
| 269 | ID.AddInteger(ON.getKind()); |
| 270 | switch (ON.getKind()) { |
| 271 | case OffsetOfExpr::OffsetOfNode::Array: |
| 272 | // Expressions handled below. |
| 273 | break; |
| 274 | |
| 275 | case OffsetOfExpr::OffsetOfNode::Field: |
| 276 | VisitDecl(ON.getField()); |
| 277 | break; |
| 278 | |
| 279 | case OffsetOfExpr::OffsetOfNode::Identifier: |
| 280 | ID.AddPointer(ON.getFieldName()); |
| 281 | break; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | VisitExpr(S); |
| 286 | } |
| 287 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 288 | void StmtProfiler::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *S) { |
| 289 | VisitExpr(S); |
| 290 | ID.AddBoolean(S->isSizeOf()); |
| 291 | if (S->isArgumentType()) |
| 292 | VisitType(S->getArgumentType()); |
| 293 | } |
| 294 | |
| 295 | void StmtProfiler::VisitArraySubscriptExpr(ArraySubscriptExpr *S) { |
| 296 | VisitExpr(S); |
| 297 | } |
| 298 | |
| 299 | void StmtProfiler::VisitCallExpr(CallExpr *S) { |
| 300 | VisitExpr(S); |
| 301 | } |
| 302 | |
| 303 | void StmtProfiler::VisitMemberExpr(MemberExpr *S) { |
| 304 | VisitExpr(S); |
| 305 | VisitDecl(S->getMemberDecl()); |
Douglas Gregor | 83f6faf | 2009-08-31 23:41:50 +0000 | [diff] [blame] | 306 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 307 | ID.AddBoolean(S->isArrow()); |
| 308 | } |
| 309 | |
| 310 | void StmtProfiler::VisitCompoundLiteralExpr(CompoundLiteralExpr *S) { |
| 311 | VisitExpr(S); |
| 312 | ID.AddBoolean(S->isFileScope()); |
| 313 | } |
| 314 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 315 | void StmtProfiler::VisitCastExpr(CastExpr *S) { |
| 316 | VisitExpr(S); |
| 317 | } |
| 318 | |
| 319 | void StmtProfiler::VisitImplicitCastExpr(ImplicitCastExpr *S) { |
| 320 | VisitCastExpr(S); |
| 321 | ID.AddBoolean(S->isLvalueCast()); |
| 322 | } |
| 323 | |
| 324 | void StmtProfiler::VisitExplicitCastExpr(ExplicitCastExpr *S) { |
| 325 | VisitCastExpr(S); |
| 326 | VisitType(S->getTypeAsWritten()); |
| 327 | } |
| 328 | |
| 329 | void StmtProfiler::VisitCStyleCastExpr(CStyleCastExpr *S) { |
| 330 | VisitExplicitCastExpr(S); |
| 331 | } |
| 332 | |
| 333 | void StmtProfiler::VisitBinaryOperator(BinaryOperator *S) { |
| 334 | VisitExpr(S); |
| 335 | ID.AddInteger(S->getOpcode()); |
| 336 | } |
| 337 | |
| 338 | void StmtProfiler::VisitCompoundAssignOperator(CompoundAssignOperator *S) { |
| 339 | VisitBinaryOperator(S); |
| 340 | } |
| 341 | |
| 342 | void StmtProfiler::VisitConditionalOperator(ConditionalOperator *S) { |
| 343 | VisitExpr(S); |
| 344 | } |
| 345 | |
| 346 | void StmtProfiler::VisitAddrLabelExpr(AddrLabelExpr *S) { |
| 347 | VisitExpr(S); |
Douglas Gregor | 3fe81fc | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 348 | VisitName(S->getLabel()->getID()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | void StmtProfiler::VisitStmtExpr(StmtExpr *S) { |
| 352 | VisitExpr(S); |
| 353 | } |
| 354 | |
| 355 | void StmtProfiler::VisitTypesCompatibleExpr(TypesCompatibleExpr *S) { |
| 356 | VisitExpr(S); |
| 357 | VisitType(S->getArgType1()); |
| 358 | VisitType(S->getArgType2()); |
| 359 | } |
| 360 | |
| 361 | void StmtProfiler::VisitShuffleVectorExpr(ShuffleVectorExpr *S) { |
| 362 | VisitExpr(S); |
| 363 | } |
| 364 | |
| 365 | void StmtProfiler::VisitChooseExpr(ChooseExpr *S) { |
| 366 | VisitExpr(S); |
| 367 | } |
| 368 | |
| 369 | void StmtProfiler::VisitGNUNullExpr(GNUNullExpr *S) { |
| 370 | VisitExpr(S); |
| 371 | } |
| 372 | |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 373 | void StmtProfiler::VisitVAArgExpr(VAArgExpr *S) { |
| 374 | VisitExpr(S); |
| 375 | } |
| 376 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 377 | void StmtProfiler::VisitInitListExpr(InitListExpr *S) { |
| 378 | if (S->getSyntacticForm()) { |
| 379 | VisitInitListExpr(S->getSyntacticForm()); |
| 380 | return; |
| 381 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 382 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 383 | VisitExpr(S); |
| 384 | } |
| 385 | |
| 386 | void StmtProfiler::VisitDesignatedInitExpr(DesignatedInitExpr *S) { |
| 387 | VisitExpr(S); |
| 388 | ID.AddBoolean(S->usesGNUSyntax()); |
| 389 | for (DesignatedInitExpr::designators_iterator D = S->designators_begin(), |
| 390 | DEnd = S->designators_end(); |
| 391 | D != DEnd; ++D) { |
| 392 | if (D->isFieldDesignator()) { |
| 393 | ID.AddInteger(0); |
| 394 | VisitName(D->getFieldName()); |
| 395 | continue; |
| 396 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 397 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 398 | if (D->isArrayDesignator()) { |
| 399 | ID.AddInteger(1); |
| 400 | } else { |
| 401 | assert(D->isArrayRangeDesignator()); |
| 402 | ID.AddInteger(2); |
| 403 | } |
| 404 | ID.AddInteger(D->getFirstExprIndex()); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | void StmtProfiler::VisitImplicitValueInitExpr(ImplicitValueInitExpr *S) { |
| 409 | VisitExpr(S); |
| 410 | } |
| 411 | |
| 412 | void StmtProfiler::VisitExtVectorElementExpr(ExtVectorElementExpr *S) { |
| 413 | VisitExpr(S); |
| 414 | VisitName(&S->getAccessor()); |
| 415 | } |
| 416 | |
| 417 | void StmtProfiler::VisitBlockExpr(BlockExpr *S) { |
| 418 | VisitExpr(S); |
| 419 | VisitDecl(S->getBlockDecl()); |
| 420 | } |
| 421 | |
| 422 | void StmtProfiler::VisitBlockDeclRefExpr(BlockDeclRefExpr *S) { |
| 423 | VisitExpr(S); |
| 424 | VisitDecl(S->getDecl()); |
| 425 | ID.AddBoolean(S->isByRef()); |
| 426 | ID.AddBoolean(S->isConstQualAdded()); |
| 427 | } |
| 428 | |
| 429 | void StmtProfiler::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *S) { |
| 430 | VisitCallExpr(S); |
| 431 | ID.AddInteger(S->getOperator()); |
| 432 | } |
| 433 | |
| 434 | void StmtProfiler::VisitCXXMemberCallExpr(CXXMemberCallExpr *S) { |
| 435 | VisitCallExpr(S); |
| 436 | } |
| 437 | |
| 438 | void StmtProfiler::VisitCXXNamedCastExpr(CXXNamedCastExpr *S) { |
| 439 | VisitExplicitCastExpr(S); |
| 440 | } |
| 441 | |
| 442 | void StmtProfiler::VisitCXXStaticCastExpr(CXXStaticCastExpr *S) { |
| 443 | VisitCXXNamedCastExpr(S); |
| 444 | } |
| 445 | |
| 446 | void StmtProfiler::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *S) { |
| 447 | VisitCXXNamedCastExpr(S); |
| 448 | } |
| 449 | |
| 450 | void StmtProfiler::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *S) { |
| 451 | VisitCXXNamedCastExpr(S); |
| 452 | } |
| 453 | |
| 454 | void StmtProfiler::VisitCXXConstCastExpr(CXXConstCastExpr *S) { |
| 455 | VisitCXXNamedCastExpr(S); |
| 456 | } |
| 457 | |
| 458 | void StmtProfiler::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *S) { |
| 459 | VisitExpr(S); |
| 460 | ID.AddBoolean(S->getValue()); |
| 461 | } |
| 462 | |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 463 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *S) { |
| 464 | VisitExpr(S); |
| 465 | } |
| 466 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 467 | void StmtProfiler::VisitCXXTypeidExpr(CXXTypeidExpr *S) { |
| 468 | VisitExpr(S); |
| 469 | if (S->isTypeOperand()) |
| 470 | VisitType(S->getTypeOperand()); |
| 471 | } |
| 472 | |
| 473 | void StmtProfiler::VisitCXXThisExpr(CXXThisExpr *S) { |
| 474 | VisitExpr(S); |
| 475 | } |
| 476 | |
| 477 | void StmtProfiler::VisitCXXThrowExpr(CXXThrowExpr *S) { |
| 478 | VisitExpr(S); |
| 479 | } |
| 480 | |
| 481 | void StmtProfiler::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *S) { |
| 482 | VisitExpr(S); |
| 483 | VisitDecl(S->getParam()); |
| 484 | } |
| 485 | |
| 486 | void StmtProfiler::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *S) { |
| 487 | VisitExpr(S); |
| 488 | VisitDecl( |
| 489 | const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
| 490 | } |
| 491 | |
Anders Carlsson | eb60edf | 2010-01-29 02:39:32 +0000 | [diff] [blame] | 492 | void StmtProfiler::VisitCXXBindReferenceExpr(CXXBindReferenceExpr *S) { |
| 493 | VisitExpr(S); |
| 494 | } |
| 495 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 496 | void StmtProfiler::VisitCXXConstructExpr(CXXConstructExpr *S) { |
| 497 | VisitExpr(S); |
| 498 | VisitDecl(S->getConstructor()); |
| 499 | ID.AddBoolean(S->isElidable()); |
| 500 | } |
| 501 | |
| 502 | void StmtProfiler::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *S) { |
| 503 | VisitExplicitCastExpr(S); |
| 504 | } |
| 505 | |
| 506 | void StmtProfiler::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *S) { |
| 507 | VisitCXXConstructExpr(S); |
| 508 | } |
| 509 | |
| 510 | void StmtProfiler::VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *S) { |
| 511 | VisitExpr(S); |
| 512 | } |
| 513 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 514 | void StmtProfiler::VisitCXXDeleteExpr(CXXDeleteExpr *S) { |
| 515 | VisitExpr(S); |
| 516 | ID.AddBoolean(S->isGlobalDelete()); |
| 517 | ID.AddBoolean(S->isArrayForm()); |
| 518 | VisitDecl(S->getOperatorDelete()); |
| 519 | } |
| 520 | |
| 521 | |
| 522 | void StmtProfiler::VisitCXXNewExpr(CXXNewExpr *S) { |
| 523 | VisitExpr(S); |
| 524 | VisitType(S->getAllocatedType()); |
| 525 | VisitDecl(S->getOperatorNew()); |
| 526 | VisitDecl(S->getOperatorDelete()); |
| 527 | VisitDecl(S->getConstructor()); |
| 528 | ID.AddBoolean(S->isArray()); |
| 529 | ID.AddInteger(S->getNumPlacementArgs()); |
| 530 | ID.AddBoolean(S->isGlobalNew()); |
| 531 | ID.AddBoolean(S->isParenTypeId()); |
| 532 | ID.AddBoolean(S->hasInitializer()); |
| 533 | ID.AddInteger(S->getNumConstructorArgs()); |
| 534 | } |
| 535 | |
Douglas Gregor | a71d819 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 536 | void StmtProfiler::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *S) { |
| 537 | VisitExpr(S); |
| 538 | ID.AddBoolean(S->isArrow()); |
| 539 | VisitNestedNameSpecifier(S->getQualifier()); |
| 540 | VisitType(S->getDestroyedType()); |
| 541 | } |
| 542 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 543 | void |
John McCall | ba13543 | 2009-11-21 08:51:07 +0000 | [diff] [blame] | 544 | StmtProfiler::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 545 | VisitExpr(S); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 546 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 547 | VisitName(S->getName()); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 548 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 549 | if (S->hasExplicitTemplateArgs()) |
| 550 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | void StmtProfiler::VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *S) { |
| 554 | VisitExpr(S); |
| 555 | ID.AddInteger(S->getTrait()); |
| 556 | VisitType(S->getQueriedType()); |
| 557 | } |
| 558 | |
John McCall | 865d447 | 2009-11-19 22:55:06 +0000 | [diff] [blame] | 559 | void |
| 560 | StmtProfiler::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *S) { |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 561 | VisitExpr(S); |
| 562 | VisitName(S->getDeclName()); |
| 563 | VisitNestedNameSpecifier(S->getQualifier()); |
John McCall | f7a1a74 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 564 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 565 | if (S->hasExplicitTemplateArgs()) |
| 566 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 567 | } |
| 568 | |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 569 | void StmtProfiler::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *S) { |
| 570 | VisitExpr(S); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 571 | for (unsigned I = 0, N = S->getNumTemporaries(); I != N; ++I) |
| 572 | VisitDecl( |
| 573 | const_cast<CXXDestructorDecl *>(S->getTemporary(I)->getDestructor())); |
| 574 | } |
| 575 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 576 | void |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 577 | StmtProfiler::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *S) { |
| 578 | VisitExpr(S); |
| 579 | VisitType(S->getTypeAsWritten()); |
| 580 | } |
| 581 | |
John McCall | 865d447 | 2009-11-19 22:55:06 +0000 | [diff] [blame] | 582 | void |
| 583 | StmtProfiler::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *S) { |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 584 | ID.AddBoolean(S->isImplicitAccess()); |
| 585 | if (!S->isImplicitAccess()) { |
| 586 | VisitExpr(S); |
| 587 | ID.AddBoolean(S->isArrow()); |
| 588 | } |
Douglas Gregor | a38c687 | 2009-09-03 16:14:30 +0000 | [diff] [blame] | 589 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 590 | VisitName(S->getMember()); |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 591 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 592 | if (S->hasExplicitTemplateArgs()) |
John McCall | 129e2df | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 593 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
| 594 | } |
| 595 | |
| 596 | void StmtProfiler::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *S) { |
John McCall | aa81e16 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 597 | ID.AddBoolean(S->isImplicitAccess()); |
| 598 | if (!S->isImplicitAccess()) { |
| 599 | VisitExpr(S); |
| 600 | ID.AddBoolean(S->isArrow()); |
| 601 | } |
John McCall | 129e2df | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 602 | VisitNestedNameSpecifier(S->getQualifier()); |
| 603 | VisitName(S->getMemberName()); |
| 604 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 605 | if (S->hasExplicitTemplateArgs()) |
| 606 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | void StmtProfiler::VisitObjCStringLiteral(ObjCStringLiteral *S) { |
| 610 | VisitExpr(S); |
| 611 | } |
| 612 | |
| 613 | void StmtProfiler::VisitObjCEncodeExpr(ObjCEncodeExpr *S) { |
| 614 | VisitExpr(S); |
| 615 | VisitType(S->getEncodedType()); |
| 616 | } |
| 617 | |
| 618 | void StmtProfiler::VisitObjCSelectorExpr(ObjCSelectorExpr *S) { |
| 619 | VisitExpr(S); |
| 620 | VisitName(S->getSelector()); |
| 621 | } |
| 622 | |
| 623 | void StmtProfiler::VisitObjCProtocolExpr(ObjCProtocolExpr *S) { |
| 624 | VisitExpr(S); |
| 625 | VisitDecl(S->getProtocol()); |
| 626 | } |
| 627 | |
| 628 | void StmtProfiler::VisitObjCIvarRefExpr(ObjCIvarRefExpr *S) { |
| 629 | VisitExpr(S); |
| 630 | VisitDecl(S->getDecl()); |
| 631 | ID.AddBoolean(S->isArrow()); |
| 632 | ID.AddBoolean(S->isFreeIvar()); |
| 633 | } |
| 634 | |
| 635 | void StmtProfiler::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *S) { |
| 636 | VisitExpr(S); |
| 637 | VisitDecl(S->getProperty()); |
| 638 | } |
| 639 | |
Fariborz Jahanian | 09105f5 | 2009-08-20 17:02:02 +0000 | [diff] [blame] | 640 | void StmtProfiler::VisitObjCImplicitSetterGetterRefExpr( |
| 641 | ObjCImplicitSetterGetterRefExpr *S) { |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 642 | VisitExpr(S); |
| 643 | VisitDecl(S->getGetterMethod()); |
| 644 | VisitDecl(S->getSetterMethod()); |
Fariborz Jahanian | d2ae5aa | 2009-08-18 21:37:33 +0000 | [diff] [blame] | 645 | VisitDecl(S->getInterfaceDecl()); |
Douglas Gregor | 071f4eb | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | void StmtProfiler::VisitObjCMessageExpr(ObjCMessageExpr *S) { |
| 649 | VisitExpr(S); |
| 650 | VisitName(S->getSelector()); |
| 651 | VisitDecl(S->getMethodDecl()); |
| 652 | } |
| 653 | |
| 654 | void StmtProfiler::VisitObjCSuperExpr(ObjCSuperExpr *S) { |
| 655 | VisitExpr(S); |
| 656 | } |
| 657 | |
| 658 | void StmtProfiler::VisitObjCIsaExpr(ObjCIsaExpr *S) { |
| 659 | VisitExpr(S); |
| 660 | ID.AddBoolean(S->isArrow()); |
| 661 | } |
| 662 | |
Douglas Gregor | d584eb2 | 2009-07-28 15:32:17 +0000 | [diff] [blame] | 663 | void StmtProfiler::VisitDecl(Decl *D) { |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 664 | ID.AddInteger(D? D->getKind() : 0); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 665 | |
Douglas Gregor | b197572 | 2009-07-30 23:18:24 +0000 | [diff] [blame] | 666 | if (Canonical && D) { |
Douglas Gregor | 6ebd15e | 2009-07-31 05:24:01 +0000 | [diff] [blame] | 667 | if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) { |
Douglas Gregor | d584eb2 | 2009-07-28 15:32:17 +0000 | [diff] [blame] | 668 | ID.AddInteger(NTTP->getDepth()); |
| 669 | ID.AddInteger(NTTP->getIndex()); |
Douglas Gregor | 828e226 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 670 | VisitType(NTTP->getType()); |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 671 | return; |
| 672 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 673 | |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 674 | if (ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { |
| 675 | // The Itanium C++ ABI uses the type of a parameter when mangling |
| 676 | // expressions that involve function parameters, so we will use the |
| 677 | // parameter's type for establishing function parameter identity. That |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 678 | // way, our definition of "equivalent" (per C++ [temp.over.link]) |
Douglas Gregor | 4a3f780 | 2009-07-31 15:45:02 +0000 | [diff] [blame] | 679 | // matches the definition of "equivalent" used for name mangling. |
| 680 | VisitType(Parm->getType()); |
| 681 | return; |
| 682 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 683 | |
Douglas Gregor | a2ffb98 | 2009-07-31 15:46:56 +0000 | [diff] [blame] | 684 | if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) { |
| 685 | ID.AddInteger(TTP->getDepth()); |
| 686 | ID.AddInteger(TTP->getIndex()); |
| 687 | return; |
| 688 | } |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 689 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 690 | |
Douglas Gregor | d584eb2 | 2009-07-28 15:32:17 +0000 | [diff] [blame] | 691 | ID.AddPointer(D? D->getCanonicalDecl() : 0); |
| 692 | } |
| 693 | |
| 694 | void StmtProfiler::VisitType(QualType T) { |
| 695 | if (Canonical) |
| 696 | T = Context.getCanonicalType(T); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 697 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 698 | ID.AddPointer(T.getAsOpaquePtr()); |
| 699 | } |
| 700 | |
| 701 | void StmtProfiler::VisitName(DeclarationName Name) { |
| 702 | ID.AddPointer(Name.getAsOpaquePtr()); |
| 703 | } |
| 704 | |
| 705 | void StmtProfiler::VisitNestedNameSpecifier(NestedNameSpecifier *NNS) { |
| 706 | if (Canonical) |
| 707 | NNS = Context.getCanonicalNestedNameSpecifier(NNS); |
| 708 | ID.AddPointer(NNS); |
| 709 | } |
| 710 | |
| 711 | void StmtProfiler::VisitTemplateName(TemplateName Name) { |
| 712 | if (Canonical) |
| 713 | Name = Context.getCanonicalTemplateName(Name); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 714 | |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 715 | Name.Profile(ID); |
| 716 | } |
| 717 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 718 | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 719 | unsigned NumArgs) { |
| 720 | ID.AddInteger(NumArgs); |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 721 | for (unsigned I = 0; I != NumArgs; ++I) |
| 722 | VisitTemplateArgument(Args[I].getArgument()); |
| 723 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 724 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 725 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
| 726 | // Mostly repetitive with TemplateArgument::Profile! |
| 727 | ID.AddInteger(Arg.getKind()); |
| 728 | switch (Arg.getKind()) { |
| 729 | case TemplateArgument::Null: |
| 730 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 731 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 732 | case TemplateArgument::Type: |
| 733 | VisitType(Arg.getAsType()); |
| 734 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 735 | |
Douglas Gregor | 788cd06 | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 736 | case TemplateArgument::Template: |
| 737 | VisitTemplateName(Arg.getAsTemplate()); |
| 738 | break; |
| 739 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 740 | case TemplateArgument::Declaration: |
| 741 | VisitDecl(Arg.getAsDecl()); |
| 742 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 743 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 744 | case TemplateArgument::Integral: |
| 745 | Arg.getAsIntegral()->Profile(ID); |
| 746 | VisitType(Arg.getIntegralType()); |
| 747 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 748 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 749 | case TemplateArgument::Expression: |
| 750 | Visit(Arg.getAsExpr()); |
| 751 | break; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 752 | |
John McCall | 833ca99 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 753 | case TemplateArgument::Pack: |
| 754 | const TemplateArgument *Pack = Arg.pack_begin(); |
| 755 | for (unsigned i = 0, e = Arg.pack_size(); i != e; ++i) |
| 756 | VisitTemplateArgument(Pack[i]); |
| 757 | break; |
Douglas Gregor | 41ef0c3 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 758 | } |
| 759 | } |
| 760 | |
| 761 | void Stmt::Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context, |
| 762 | bool Canonical) { |
| 763 | StmtProfiler Profiler(ID, Context, Canonical); |
| 764 | Profiler.Visit(this); |
| 765 | } |