Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1 | //===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the Stmt::Profile method, which builds a unique bit |
Douglas Gregor | 32615a1 | 2009-07-28 16:39:25 +0000 | [diff] [blame] | 11 | // representation that identifies a statement/expression. |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | #include "clang/AST/ASTContext.h" |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 15 | #include "clang/AST/DeclCXX.h" |
| 16 | #include "clang/AST/DeclObjC.h" |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 17 | #include "clang/AST/DeclTemplate.h" |
| 18 | #include "clang/AST/Expr.h" |
| 19 | #include "clang/AST/ExprCXX.h" |
| 20 | #include "clang/AST/ExprObjC.h" |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 21 | #include "clang/AST/ExprOpenMP.h" |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 22 | #include "clang/AST/ODRHash.h" |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 23 | #include "clang/AST/StmtVisitor.h" |
| 24 | #include "llvm/ADT/FoldingSet.h" |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 25 | using namespace clang; |
| 26 | |
| 27 | namespace { |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 28 | class StmtProfiler : public ConstStmtVisitor<StmtProfiler> { |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 29 | protected: |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 30 | llvm::FoldingSetNodeID &ID; |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 31 | bool Canonical; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 32 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 33 | public: |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 34 | StmtProfiler(llvm::FoldingSetNodeID &ID, bool Canonical) |
| 35 | : ID(ID), Canonical(Canonical) {} |
| 36 | |
| 37 | virtual ~StmtProfiler() {} |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 38 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 39 | void VisitStmt(const Stmt *S); |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 40 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 41 | #define STMT(Node, Base) void Visit##Node(const Node *S); |
Alexis Hunt | 656bb31 | 2010-05-05 15:24:00 +0000 | [diff] [blame] | 42 | #include "clang/AST/StmtNodes.inc" |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 43 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 44 | /// \brief Visit a declaration that is referenced within an expression |
| 45 | /// or statement. |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 46 | virtual void VisitDecl(const Decl *D) = 0; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 47 | |
| 48 | /// \brief Visit a type that is referenced within an expression or |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 49 | /// statement. |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 50 | virtual void VisitType(QualType T) = 0; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 51 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 52 | /// \brief Visit a name that occurs within an expression or statement. |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 53 | virtual void VisitName(DeclarationName Name) = 0; |
| 54 | |
| 55 | /// \brief Visit identifiers that are not in Decl's or Type's. |
| 56 | virtual void VisitIdentifierInfo(IdentifierInfo *II) = 0; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 57 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 58 | /// \brief Visit a nested-name-specifier that occurs within an expression |
| 59 | /// or statement. |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 60 | virtual void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) = 0; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 61 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 62 | /// \brief Visit a template name that occurs within an expression or |
| 63 | /// statement. |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 64 | virtual void VisitTemplateName(TemplateName Name) = 0; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 65 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 66 | /// \brief Visit template arguments that occur within an expression or |
| 67 | /// statement. |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 68 | void VisitTemplateArguments(const TemplateArgumentLoc *Args, |
| 69 | unsigned NumArgs); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 70 | |
| 71 | /// \brief Visit a single template argument. |
| 72 | void VisitTemplateArgument(const TemplateArgument &Arg); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 73 | }; |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 74 | |
| 75 | class StmtProfilerWithPointers : public StmtProfiler { |
| 76 | const ASTContext &Context; |
| 77 | |
| 78 | public: |
| 79 | StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID, |
| 80 | const ASTContext &Context, bool Canonical) |
| 81 | : StmtProfiler(ID, Canonical), Context(Context) {} |
| 82 | private: |
| 83 | void VisitDecl(const Decl *D) override { |
| 84 | ID.AddInteger(D ? D->getKind() : 0); |
| 85 | |
| 86 | if (Canonical && D) { |
| 87 | if (const NonTypeTemplateParmDecl *NTTP = |
| 88 | dyn_cast<NonTypeTemplateParmDecl>(D)) { |
| 89 | ID.AddInteger(NTTP->getDepth()); |
| 90 | ID.AddInteger(NTTP->getIndex()); |
| 91 | ID.AddBoolean(NTTP->isParameterPack()); |
| 92 | VisitType(NTTP->getType()); |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) { |
| 97 | // The Itanium C++ ABI uses the type, scope depth, and scope |
| 98 | // index of a parameter when mangling expressions that involve |
| 99 | // function parameters, so we will use the parameter's type for |
| 100 | // establishing function parameter identity. That way, our |
| 101 | // definition of "equivalent" (per C++ [temp.over.link]) is at |
| 102 | // least as strong as the definition of "equivalent" used for |
| 103 | // name mangling. |
| 104 | VisitType(Parm->getType()); |
| 105 | ID.AddInteger(Parm->getFunctionScopeDepth()); |
| 106 | ID.AddInteger(Parm->getFunctionScopeIndex()); |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | if (const TemplateTypeParmDecl *TTP = |
| 111 | dyn_cast<TemplateTypeParmDecl>(D)) { |
| 112 | ID.AddInteger(TTP->getDepth()); |
| 113 | ID.AddInteger(TTP->getIndex()); |
| 114 | ID.AddBoolean(TTP->isParameterPack()); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | if (const TemplateTemplateParmDecl *TTP = |
| 119 | dyn_cast<TemplateTemplateParmDecl>(D)) { |
| 120 | ID.AddInteger(TTP->getDepth()); |
| 121 | ID.AddInteger(TTP->getIndex()); |
| 122 | ID.AddBoolean(TTP->isParameterPack()); |
| 123 | return; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | ID.AddPointer(D ? D->getCanonicalDecl() : nullptr); |
| 128 | } |
| 129 | |
| 130 | void VisitType(QualType T) override { |
Richard Trieu | a5f4ade | 2017-03-04 02:42:41 +0000 | [diff] [blame] | 131 | if (Canonical && !T.isNull()) |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 132 | T = Context.getCanonicalType(T); |
| 133 | |
| 134 | ID.AddPointer(T.getAsOpaquePtr()); |
| 135 | } |
| 136 | |
| 137 | void VisitName(DeclarationName Name) override { |
| 138 | ID.AddPointer(Name.getAsOpaquePtr()); |
| 139 | } |
| 140 | |
| 141 | void VisitIdentifierInfo(IdentifierInfo *II) override { |
| 142 | ID.AddPointer(II); |
| 143 | } |
| 144 | |
| 145 | void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { |
| 146 | if (Canonical) |
| 147 | NNS = Context.getCanonicalNestedNameSpecifier(NNS); |
| 148 | ID.AddPointer(NNS); |
| 149 | } |
| 150 | |
| 151 | void VisitTemplateName(TemplateName Name) override { |
| 152 | if (Canonical) |
| 153 | Name = Context.getCanonicalTemplateName(Name); |
| 154 | |
| 155 | Name.Profile(ID); |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | class StmtProfilerWithoutPointers : public StmtProfiler { |
| 160 | ODRHash &Hash; |
| 161 | public: |
| 162 | StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash) |
| 163 | : StmtProfiler(ID, false), Hash(Hash) {} |
| 164 | |
| 165 | private: |
| 166 | void VisitType(QualType T) override { |
| 167 | Hash.AddQualType(T); |
| 168 | } |
| 169 | |
| 170 | void VisitName(DeclarationName Name) override { |
| 171 | Hash.AddDeclarationName(Name); |
| 172 | } |
| 173 | void VisitIdentifierInfo(IdentifierInfo *II) override { |
| 174 | ID.AddBoolean(II); |
| 175 | if (II) { |
| 176 | Hash.AddIdentifierInfo(II); |
| 177 | } |
| 178 | } |
| 179 | void VisitDecl(const Decl *D) override { |
| 180 | ID.AddBoolean(D); |
| 181 | if (D) { |
| 182 | Hash.AddDecl(D); |
| 183 | } |
| 184 | } |
| 185 | void VisitTemplateName(TemplateName Name) override { |
| 186 | Hash.AddTemplateName(Name); |
| 187 | } |
| 188 | void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override { |
Richard Trieu | 96b4164 | 2017-07-01 02:00:05 +0000 | [diff] [blame] | 189 | ID.AddBoolean(NNS); |
| 190 | if (NNS) { |
| 191 | Hash.AddNestedNameSpecifier(NNS); |
| 192 | } |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 193 | } |
| 194 | }; |
Alexander Kornienko | ab9db51 | 2015-06-22 23:07:51 +0000 | [diff] [blame] | 195 | } |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 196 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 197 | void StmtProfiler::VisitStmt(const Stmt *S) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 198 | assert(S && "Requires non-null Stmt pointer"); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 199 | ID.AddInteger(S->getStmtClass()); |
Benjamin Kramer | 642f173 | 2015-07-02 21:03:14 +0000 | [diff] [blame] | 200 | for (const Stmt *SubStmt : S->children()) { |
| 201 | if (SubStmt) |
| 202 | Visit(SubStmt); |
Peter Collingbourne | cdb9f30 | 2012-03-01 16:34:31 +0000 | [diff] [blame] | 203 | else |
| 204 | ID.AddInteger(0); |
| 205 | } |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 206 | } |
| 207 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 208 | void StmtProfiler::VisitDeclStmt(const DeclStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 209 | VisitStmt(S); |
Aaron Ballman | 535bbcc | 2014-03-14 17:01:24 +0000 | [diff] [blame] | 210 | for (const auto *D : S->decls()) |
| 211 | VisitDecl(D); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 214 | void StmtProfiler::VisitNullStmt(const NullStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 215 | VisitStmt(S); |
| 216 | } |
| 217 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 218 | void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 219 | VisitStmt(S); |
| 220 | } |
| 221 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 222 | void StmtProfiler::VisitCaseStmt(const CaseStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 223 | VisitStmt(S); |
| 224 | } |
| 225 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 226 | void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 227 | VisitStmt(S); |
| 228 | } |
| 229 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 230 | void StmtProfiler::VisitLabelStmt(const LabelStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 231 | VisitStmt(S); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 232 | VisitDecl(S->getDecl()); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Richard Smith | c202b28 | 2012-04-14 00:33:13 +0000 | [diff] [blame] | 235 | void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) { |
| 236 | VisitStmt(S); |
| 237 | // TODO: maybe visit attributes? |
| 238 | } |
| 239 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 240 | void StmtProfiler::VisitIfStmt(const IfStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 241 | VisitStmt(S); |
Douglas Gregor | 7bab5ff | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 242 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 243 | } |
| 244 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 245 | void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) { |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 246 | VisitStmt(S); |
Douglas Gregor | 7bab5ff | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 247 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 248 | } |
| 249 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 250 | void StmtProfiler::VisitWhileStmt(const WhileStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 251 | VisitStmt(S); |
Douglas Gregor | 7bab5ff | 2009-11-25 00:27:52 +0000 | [diff] [blame] | 252 | VisitDecl(S->getConditionVariable()); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 253 | } |
| 254 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 255 | void StmtProfiler::VisitDoStmt(const DoStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 256 | VisitStmt(S); |
| 257 | } |
| 258 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 259 | void StmtProfiler::VisitForStmt(const ForStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 260 | VisitStmt(S); |
| 261 | } |
| 262 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 263 | void StmtProfiler::VisitGotoStmt(const GotoStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 264 | VisitStmt(S); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 265 | VisitDecl(S->getLabel()); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 266 | } |
| 267 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 268 | void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 269 | VisitStmt(S); |
| 270 | } |
| 271 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 272 | void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 273 | VisitStmt(S); |
| 274 | } |
| 275 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 276 | void StmtProfiler::VisitBreakStmt(const BreakStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 277 | VisitStmt(S); |
| 278 | } |
| 279 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 280 | void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 281 | VisitStmt(S); |
| 282 | } |
| 283 | |
Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 284 | void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 285 | VisitStmt(S); |
| 286 | ID.AddBoolean(S->isVolatile()); |
| 287 | ID.AddBoolean(S->isSimple()); |
| 288 | VisitStringLiteral(S->getAsmString()); |
| 289 | ID.AddInteger(S->getNumOutputs()); |
| 290 | for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) { |
| 291 | ID.AddString(S->getOutputName(I)); |
| 292 | VisitStringLiteral(S->getOutputConstraintLiteral(I)); |
| 293 | } |
| 294 | ID.AddInteger(S->getNumInputs()); |
| 295 | for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) { |
| 296 | ID.AddString(S->getInputName(I)); |
| 297 | VisitStringLiteral(S->getInputConstraintLiteral(I)); |
| 298 | } |
| 299 | ID.AddInteger(S->getNumClobbers()); |
| 300 | for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I) |
Chad Rosier | d9fb09a | 2012-08-27 23:28:41 +0000 | [diff] [blame] | 301 | VisitStringLiteral(S->getClobberStringLiteral(I)); |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 302 | } |
| 303 | |
Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 304 | void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) { |
| 305 | // FIXME: Implement MS style inline asm statement profiler. |
| 306 | VisitStmt(S); |
| 307 | } |
| 308 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 309 | void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 310 | VisitStmt(S); |
| 311 | VisitType(S->getCaughtType()); |
| 312 | } |
| 313 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 314 | void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 315 | VisitStmt(S); |
| 316 | } |
| 317 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 318 | void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) { |
Richard Smith | 02e85f3 | 2011-04-14 22:09:26 +0000 | [diff] [blame] | 319 | VisitStmt(S); |
| 320 | } |
| 321 | |
Douglas Gregor | deb4a2be | 2011-10-25 01:33:02 +0000 | [diff] [blame] | 322 | void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) { |
| 323 | VisitStmt(S); |
| 324 | ID.AddBoolean(S->isIfExists()); |
| 325 | VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier()); |
| 326 | VisitName(S->getNameInfo().getName()); |
| 327 | } |
| 328 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 329 | void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) { |
John Wiegley | 1c0675e | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 330 | VisitStmt(S); |
| 331 | } |
| 332 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 333 | void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) { |
John Wiegley | 1c0675e | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 334 | VisitStmt(S); |
| 335 | } |
| 336 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 337 | void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) { |
John Wiegley | 1c0675e | 2011-04-28 01:08:34 +0000 | [diff] [blame] | 338 | VisitStmt(S); |
| 339 | } |
| 340 | |
Nico Weber | 9b98207 | 2014-07-07 00:12:30 +0000 | [diff] [blame] | 341 | void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) { |
| 342 | VisitStmt(S); |
| 343 | } |
| 344 | |
Tareq A. Siraj | 24110cc | 2013-04-16 18:53:08 +0000 | [diff] [blame] | 345 | void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) { |
| 346 | VisitStmt(S); |
| 347 | } |
| 348 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 349 | void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 350 | VisitStmt(S); |
| 351 | } |
| 352 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 353 | void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 354 | VisitStmt(S); |
| 355 | ID.AddBoolean(S->hasEllipsis()); |
| 356 | if (S->getCatchParamDecl()) |
| 357 | VisitType(S->getCatchParamDecl()->getType()); |
| 358 | } |
| 359 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 360 | void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 361 | VisitStmt(S); |
| 362 | } |
| 363 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 364 | void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 365 | VisitStmt(S); |
| 366 | } |
| 367 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 368 | void |
| 369 | StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 370 | VisitStmt(S); |
| 371 | } |
| 372 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 373 | void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) { |
Douglas Gregor | 4488259 | 2009-07-28 15:27:13 +0000 | [diff] [blame] | 374 | VisitStmt(S); |
| 375 | } |
| 376 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 377 | void |
| 378 | StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) { |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 379 | VisitStmt(S); |
| 380 | } |
| 381 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 382 | namespace { |
| 383 | class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> { |
| 384 | StmtProfiler *Profiler; |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 385 | /// \brief Process clauses with list of variables. |
| 386 | template <typename T> |
| 387 | void VisitOMPClauseList(T *Node); |
NAKAMURA Takumi | aa13f94 | 2015-12-09 07:52:46 +0000 | [diff] [blame] | 388 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 389 | public: |
| 390 | OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { } |
| 391 | #define OPENMP_CLAUSE(Name, Class) \ |
| 392 | void Visit##Class(const Class *C); |
| 393 | #include "clang/Basic/OpenMPKinds.def" |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 394 | void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 395 | void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C); |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 396 | }; |
| 397 | |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 398 | void OMPClauseProfiler::VistOMPClauseWithPreInit( |
| 399 | const OMPClauseWithPreInit *C) { |
| 400 | if (auto *S = C->getPreInitStmt()) |
| 401 | Profiler->VisitStmt(S); |
| 402 | } |
| 403 | |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 404 | void OMPClauseProfiler::VistOMPClauseWithPostUpdate( |
| 405 | const OMPClauseWithPostUpdate *C) { |
Alexey Bataev | 37e594c | 2016-03-04 07:21:16 +0000 | [diff] [blame] | 406 | VistOMPClauseWithPreInit(C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 407 | if (auto *E = C->getPostUpdateExpr()) |
| 408 | Profiler->VisitStmt(E); |
| 409 | } |
| 410 | |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 411 | void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) { |
Arpith Chacko Jacob | fe4890a | 2017-01-18 20:40:48 +0000 | [diff] [blame] | 412 | VistOMPClauseWithPreInit(C); |
Alexey Bataev | aadd52e | 2014-02-13 05:29:23 +0000 | [diff] [blame] | 413 | if (C->getCondition()) |
| 414 | Profiler->VisitStmt(C->getCondition()); |
| 415 | } |
| 416 | |
Alexey Bataev | 3778b60 | 2014-07-17 07:32:53 +0000 | [diff] [blame] | 417 | void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) { |
| 418 | if (C->getCondition()) |
| 419 | Profiler->VisitStmt(C->getCondition()); |
| 420 | } |
| 421 | |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 422 | void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) { |
Arpith Chacko Jacob | 33c849a | 2017-01-25 00:57:16 +0000 | [diff] [blame] | 423 | VistOMPClauseWithPreInit(C); |
Alexey Bataev | 568a833 | 2014-03-06 06:15:19 +0000 | [diff] [blame] | 424 | if (C->getNumThreads()) |
| 425 | Profiler->VisitStmt(C->getNumThreads()); |
| 426 | } |
| 427 | |
Alexey Bataev | 62c87d2 | 2014-03-21 04:51:18 +0000 | [diff] [blame] | 428 | void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) { |
| 429 | if (C->getSafelen()) |
| 430 | Profiler->VisitStmt(C->getSafelen()); |
| 431 | } |
| 432 | |
Alexey Bataev | 66b15b5 | 2015-08-21 11:14:16 +0000 | [diff] [blame] | 433 | void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) { |
| 434 | if (C->getSimdlen()) |
| 435 | Profiler->VisitStmt(C->getSimdlen()); |
| 436 | } |
| 437 | |
Alexander Musman | 8bd31e6 | 2014-05-27 15:12:19 +0000 | [diff] [blame] | 438 | void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) { |
| 439 | if (C->getNumForLoops()) |
| 440 | Profiler->VisitStmt(C->getNumForLoops()); |
| 441 | } |
| 442 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 443 | void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { } |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 444 | |
Alexey Bataev | bcbadb6 | 2014-05-06 06:04:14 +0000 | [diff] [blame] | 445 | void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { } |
| 446 | |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 447 | void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 448 | VistOMPClauseWithPreInit(C); |
| 449 | if (auto *S = C->getChunkSize()) |
| 450 | Profiler->VisitStmt(S); |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 451 | } |
| 452 | |
Alexey Bataev | 10e775f | 2015-07-30 11:36:16 +0000 | [diff] [blame] | 453 | void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) { |
| 454 | if (auto *Num = C->getNumForLoops()) |
| 455 | Profiler->VisitStmt(Num); |
| 456 | } |
Alexey Bataev | 142e1fc | 2014-06-20 09:44:06 +0000 | [diff] [blame] | 457 | |
Alexey Bataev | 236070f | 2014-06-20 11:19:47 +0000 | [diff] [blame] | 458 | void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {} |
| 459 | |
Alexey Bataev | 7aea99a | 2014-07-17 12:19:31 +0000 | [diff] [blame] | 460 | void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {} |
| 461 | |
Alexey Bataev | 74ba3a5 | 2014-07-17 12:47:03 +0000 | [diff] [blame] | 462 | void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {} |
| 463 | |
Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 464 | void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {} |
| 465 | |
Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 466 | void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {} |
| 467 | |
Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 468 | void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {} |
| 469 | |
Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 470 | void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {} |
| 471 | |
Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 472 | void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} |
| 473 | |
Alexey Bataev | 346265e | 2015-09-25 10:37:12 +0000 | [diff] [blame] | 474 | void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {} |
| 475 | |
Alexey Bataev | d14d1e6 | 2015-09-28 06:39:35 +0000 | [diff] [blame] | 476 | void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {} |
| 477 | |
Alexey Bataev | b825de1 | 2015-12-07 10:51:44 +0000 | [diff] [blame] | 478 | void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {} |
| 479 | |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 480 | template<typename T> |
| 481 | void OMPClauseProfiler::VisitOMPClauseList(T *Node) { |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 482 | for (auto *E : Node->varlists()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 483 | if (E) |
| 484 | Profiler->VisitStmt(E); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 485 | } |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 486 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 487 | |
| 488 | void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) { |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 489 | VisitOMPClauseList(C); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 490 | for (auto *E : C->private_copies()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 491 | if (E) |
| 492 | Profiler->VisitStmt(E); |
Alexey Bataev | 03b340a | 2014-10-21 03:16:40 +0000 | [diff] [blame] | 493 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 494 | } |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 495 | void |
| 496 | OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) { |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 497 | VisitOMPClauseList(C); |
Alexey Bataev | 417089f | 2016-02-17 13:19:37 +0000 | [diff] [blame] | 498 | VistOMPClauseWithPreInit(C); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 499 | for (auto *E : C->private_copies()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 500 | if (E) |
| 501 | Profiler->VisitStmt(E); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 502 | } |
| 503 | for (auto *E : C->inits()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 504 | if (E) |
| 505 | Profiler->VisitStmt(E); |
Alexey Bataev | 4a5bb77 | 2014-10-08 14:01:46 +0000 | [diff] [blame] | 506 | } |
Alexey Bataev | d5af8e4 | 2013-10-01 05:32:34 +0000 | [diff] [blame] | 507 | } |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 508 | void |
| 509 | OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) { |
| 510 | VisitOMPClauseList(C); |
Alexey Bataev | 005248a | 2016-02-25 05:25:57 +0000 | [diff] [blame] | 511 | VistOMPClauseWithPostUpdate(C); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 512 | for (auto *E : C->source_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 513 | if (E) |
| 514 | Profiler->VisitStmt(E); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 515 | } |
| 516 | for (auto *E : C->destination_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 517 | if (E) |
| 518 | Profiler->VisitStmt(E); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 519 | } |
| 520 | for (auto *E : C->assignment_ops()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 521 | if (E) |
| 522 | Profiler->VisitStmt(E); |
Alexey Bataev | 38e8953 | 2015-04-16 04:54:05 +0000 | [diff] [blame] | 523 | } |
Alexander Musman | 1bb328c | 2014-06-04 13:06:39 +0000 | [diff] [blame] | 524 | } |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 525 | void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) { |
Alexey Bataev | 756c196 | 2013-09-24 03:17:45 +0000 | [diff] [blame] | 526 | VisitOMPClauseList(C); |
Alexey Bataev | 758e55e | 2013-09-06 18:03:48 +0000 | [diff] [blame] | 527 | } |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 528 | void OMPClauseProfiler::VisitOMPReductionClause( |
| 529 | const OMPReductionClause *C) { |
| 530 | Profiler->VisitNestedNameSpecifier( |
| 531 | C->getQualifierLoc().getNestedNameSpecifier()); |
| 532 | Profiler->VisitName(C->getNameInfo().getName()); |
| 533 | VisitOMPClauseList(C); |
Alexey Bataev | 6120507 | 2016-03-02 04:57:40 +0000 | [diff] [blame] | 534 | VistOMPClauseWithPostUpdate(C); |
Alexey Bataev | f24e7b1 | 2015-10-08 09:10:53 +0000 | [diff] [blame] | 535 | for (auto *E : C->privates()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 536 | if (E) |
| 537 | Profiler->VisitStmt(E); |
Alexey Bataev | f24e7b1 | 2015-10-08 09:10:53 +0000 | [diff] [blame] | 538 | } |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 539 | for (auto *E : C->lhs_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 540 | if (E) |
| 541 | Profiler->VisitStmt(E); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 542 | } |
| 543 | for (auto *E : C->rhs_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 544 | if (E) |
| 545 | Profiler->VisitStmt(E); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 546 | } |
| 547 | for (auto *E : C->reduction_ops()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 548 | if (E) |
| 549 | Profiler->VisitStmt(E); |
Alexey Bataev | 794ba0d | 2015-04-10 10:43:45 +0000 | [diff] [blame] | 550 | } |
Alexey Bataev | c5e0258 | 2014-06-16 07:08:35 +0000 | [diff] [blame] | 551 | } |
Alexey Bataev | 169d96a | 2017-07-18 20:17:46 +0000 | [diff] [blame] | 552 | void OMPClauseProfiler::VisitOMPTaskReductionClause( |
| 553 | const OMPTaskReductionClause *C) { |
| 554 | Profiler->VisitNestedNameSpecifier( |
| 555 | C->getQualifierLoc().getNestedNameSpecifier()); |
| 556 | Profiler->VisitName(C->getNameInfo().getName()); |
| 557 | VisitOMPClauseList(C); |
| 558 | VistOMPClauseWithPostUpdate(C); |
| 559 | for (auto *E : C->privates()) { |
| 560 | if (E) |
| 561 | Profiler->VisitStmt(E); |
| 562 | } |
| 563 | for (auto *E : C->lhs_exprs()) { |
| 564 | if (E) |
| 565 | Profiler->VisitStmt(E); |
| 566 | } |
| 567 | for (auto *E : C->rhs_exprs()) { |
| 568 | if (E) |
| 569 | Profiler->VisitStmt(E); |
| 570 | } |
| 571 | for (auto *E : C->reduction_ops()) { |
| 572 | if (E) |
| 573 | Profiler->VisitStmt(E); |
| 574 | } |
| 575 | } |
Alexey Bataev | fa312f3 | 2017-07-21 18:48:21 +0000 | [diff] [blame^] | 576 | void OMPClauseProfiler::VisitOMPInReductionClause( |
| 577 | const OMPInReductionClause *C) { |
| 578 | Profiler->VisitNestedNameSpecifier( |
| 579 | C->getQualifierLoc().getNestedNameSpecifier()); |
| 580 | Profiler->VisitName(C->getNameInfo().getName()); |
| 581 | VisitOMPClauseList(C); |
| 582 | VistOMPClauseWithPostUpdate(C); |
| 583 | for (auto *E : C->privates()) { |
| 584 | if (E) |
| 585 | Profiler->VisitStmt(E); |
| 586 | } |
| 587 | for (auto *E : C->lhs_exprs()) { |
| 588 | if (E) |
| 589 | Profiler->VisitStmt(E); |
| 590 | } |
| 591 | for (auto *E : C->rhs_exprs()) { |
| 592 | if (E) |
| 593 | Profiler->VisitStmt(E); |
| 594 | } |
| 595 | for (auto *E : C->reduction_ops()) { |
| 596 | if (E) |
| 597 | Profiler->VisitStmt(E); |
| 598 | } |
| 599 | } |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 600 | void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) { |
| 601 | VisitOMPClauseList(C); |
Alexey Bataev | 78849fb | 2016-03-09 09:49:00 +0000 | [diff] [blame] | 602 | VistOMPClauseWithPostUpdate(C); |
Alexey Bataev | bd9fec1 | 2015-08-18 06:47:21 +0000 | [diff] [blame] | 603 | for (auto *E : C->privates()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 604 | if (E) |
| 605 | Profiler->VisitStmt(E); |
Alexey Bataev | bd9fec1 | 2015-08-18 06:47:21 +0000 | [diff] [blame] | 606 | } |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 607 | for (auto *E : C->inits()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 608 | if (E) |
| 609 | Profiler->VisitStmt(E); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 610 | } |
| 611 | for (auto *E : C->updates()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 612 | if (E) |
| 613 | Profiler->VisitStmt(E); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 614 | } |
| 615 | for (auto *E : C->finals()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 616 | if (E) |
| 617 | Profiler->VisitStmt(E); |
Alexander Musman | 3276a27 | 2015-03-21 10:12:56 +0000 | [diff] [blame] | 618 | } |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 619 | if (C->getStep()) |
| 620 | Profiler->VisitStmt(C->getStep()); |
| 621 | if (C->getCalcStep()) |
| 622 | Profiler->VisitStmt(C->getCalcStep()); |
Alexander Musman | 8dba664 | 2014-04-22 13:09:42 +0000 | [diff] [blame] | 623 | } |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 624 | void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) { |
| 625 | VisitOMPClauseList(C); |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 626 | if (C->getAlignment()) |
| 627 | Profiler->VisitStmt(C->getAlignment()); |
Alexander Musman | f0d76e7 | 2014-05-29 14:36:25 +0000 | [diff] [blame] | 628 | } |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 629 | void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) { |
| 630 | VisitOMPClauseList(C); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 631 | for (auto *E : C->source_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 632 | if (E) |
| 633 | Profiler->VisitStmt(E); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 634 | } |
| 635 | for (auto *E : C->destination_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 636 | if (E) |
| 637 | Profiler->VisitStmt(E); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 638 | } |
| 639 | for (auto *E : C->assignment_ops()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 640 | if (E) |
| 641 | Profiler->VisitStmt(E); |
Alexey Bataev | f56f98c | 2015-04-16 05:39:01 +0000 | [diff] [blame] | 642 | } |
Alexey Bataev | d48bcd8 | 2014-03-31 03:36:38 +0000 | [diff] [blame] | 643 | } |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 644 | void |
| 645 | OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) { |
| 646 | VisitOMPClauseList(C); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 647 | for (auto *E : C->source_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 648 | if (E) |
| 649 | Profiler->VisitStmt(E); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 650 | } |
| 651 | for (auto *E : C->destination_exprs()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 652 | if (E) |
| 653 | Profiler->VisitStmt(E); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 654 | } |
| 655 | for (auto *E : C->assignment_ops()) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 656 | if (E) |
| 657 | Profiler->VisitStmt(E); |
Alexey Bataev | a63048e | 2015-03-23 06:18:07 +0000 | [diff] [blame] | 658 | } |
Alexey Bataev | bae9a79 | 2014-06-27 10:37:06 +0000 | [diff] [blame] | 659 | } |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 660 | void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) { |
| 661 | VisitOMPClauseList(C); |
| 662 | } |
Alexey Bataev | 1c2cfbc | 2015-06-23 14:25:19 +0000 | [diff] [blame] | 663 | void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) { |
| 664 | VisitOMPClauseList(C); |
| 665 | } |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 666 | void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 667 | if (C->getDevice()) |
| 668 | Profiler->VisitStmt(C->getDevice()); |
Michael Wong | e710d54 | 2015-08-07 16:16:36 +0000 | [diff] [blame] | 669 | } |
Kelvin Li | 0bff7af | 2015-11-23 05:32:03 +0000 | [diff] [blame] | 670 | void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) { |
| 671 | VisitOMPClauseList(C); |
| 672 | } |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 673 | void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) { |
Arpith Chacko Jacob | bc12634 | 2017-01-25 11:28:18 +0000 | [diff] [blame] | 674 | VistOMPClauseWithPreInit(C); |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 675 | if (C->getNumTeams()) |
| 676 | Profiler->VisitStmt(C->getNumTeams()); |
Kelvin Li | 099bb8c | 2015-11-24 20:50:12 +0000 | [diff] [blame] | 677 | } |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 678 | void OMPClauseProfiler::VisitOMPThreadLimitClause( |
| 679 | const OMPThreadLimitClause *C) { |
Arpith Chacko Jacob | 7ecc0b7 | 2017-01-25 11:44:35 +0000 | [diff] [blame] | 680 | VistOMPClauseWithPreInit(C); |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 681 | if (C->getThreadLimit()) |
| 682 | Profiler->VisitStmt(C->getThreadLimit()); |
Kelvin Li | a15fb1a | 2015-11-27 18:47:36 +0000 | [diff] [blame] | 683 | } |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 684 | void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 685 | if (C->getPriority()) |
| 686 | Profiler->VisitStmt(C->getPriority()); |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 687 | } |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 688 | void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 689 | if (C->getGrainsize()) |
| 690 | Profiler->VisitStmt(C->getGrainsize()); |
Alexey Bataev | 1fd4aed | 2015-12-07 12:52:51 +0000 | [diff] [blame] | 691 | } |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 692 | void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 693 | if (C->getNumTasks()) |
| 694 | Profiler->VisitStmt(C->getNumTasks()); |
Alexey Bataev | 382967a | 2015-12-08 12:06:20 +0000 | [diff] [blame] | 695 | } |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 696 | void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) { |
Richard Trieu | 6a77a1c | 2016-06-10 04:52:09 +0000 | [diff] [blame] | 697 | if (C->getHint()) |
| 698 | Profiler->VisitStmt(C->getHint()); |
Alexey Bataev | 28c7541 | 2015-12-15 08:19:24 +0000 | [diff] [blame] | 699 | } |
Samuel Antao | 661c090 | 2016-05-26 17:39:58 +0000 | [diff] [blame] | 700 | void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) { |
| 701 | VisitOMPClauseList(C); |
| 702 | } |
Samuel Antao | ec172c6 | 2016-05-26 17:49:04 +0000 | [diff] [blame] | 703 | void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) { |
| 704 | VisitOMPClauseList(C); |
| 705 | } |
Carlo Bertolli | 2404b17 | 2016-07-13 15:37:16 +0000 | [diff] [blame] | 706 | void OMPClauseProfiler::VisitOMPUseDevicePtrClause( |
| 707 | const OMPUseDevicePtrClause *C) { |
| 708 | VisitOMPClauseList(C); |
| 709 | } |
Carlo Bertolli | 70594e9 | 2016-07-13 17:16:49 +0000 | [diff] [blame] | 710 | void OMPClauseProfiler::VisitOMPIsDevicePtrClause( |
| 711 | const OMPIsDevicePtrClause *C) { |
| 712 | VisitOMPClauseList(C); |
| 713 | } |
Alexander Kornienko | ab9db51 | 2015-06-22 23:07:51 +0000 | [diff] [blame] | 714 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 715 | |
| 716 | void |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 717 | StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) { |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 718 | VisitStmt(S); |
| 719 | OMPClauseProfiler P(this); |
| 720 | ArrayRef<OMPClause *> Clauses = S->clauses(); |
| 721 | for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end(); |
| 722 | I != E; ++I) |
| 723 | if (*I) |
| 724 | P.Visit(*I); |
| 725 | } |
| 726 | |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 727 | void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) { |
| 728 | VisitOMPExecutableDirective(S); |
| 729 | } |
| 730 | |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 731 | void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) { |
| 732 | VisitOMPExecutableDirective(S); |
| 733 | } |
| 734 | |
| 735 | void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 736 | VisitOMPLoopDirective(S); |
Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 737 | } |
| 738 | |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 739 | void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 740 | VisitOMPLoopDirective(S); |
Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 741 | } |
| 742 | |
Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 743 | void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) { |
| 744 | VisitOMPLoopDirective(S); |
| 745 | } |
| 746 | |
Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 747 | void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) { |
| 748 | VisitOMPExecutableDirective(S); |
| 749 | } |
| 750 | |
Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 751 | void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) { |
| 752 | VisitOMPExecutableDirective(S); |
| 753 | } |
| 754 | |
Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 755 | void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) { |
| 756 | VisitOMPExecutableDirective(S); |
| 757 | } |
| 758 | |
Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 759 | void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) { |
| 760 | VisitOMPExecutableDirective(S); |
| 761 | } |
| 762 | |
Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 763 | void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) { |
| 764 | VisitOMPExecutableDirective(S); |
| 765 | VisitName(S->getDirectiveName().getName()); |
| 766 | } |
| 767 | |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 768 | void |
| 769 | StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) { |
Alexander Musman | 3aaab66 | 2014-08-19 11:27:13 +0000 | [diff] [blame] | 770 | VisitOMPLoopDirective(S); |
Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 771 | } |
| 772 | |
Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 773 | void StmtProfiler::VisitOMPParallelForSimdDirective( |
| 774 | const OMPParallelForSimdDirective *S) { |
| 775 | VisitOMPLoopDirective(S); |
| 776 | } |
| 777 | |
Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 778 | void StmtProfiler::VisitOMPParallelSectionsDirective( |
| 779 | const OMPParallelSectionsDirective *S) { |
| 780 | VisitOMPExecutableDirective(S); |
| 781 | } |
| 782 | |
Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 783 | void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) { |
| 784 | VisitOMPExecutableDirective(S); |
| 785 | } |
| 786 | |
Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 787 | void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) { |
| 788 | VisitOMPExecutableDirective(S); |
| 789 | } |
| 790 | |
Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 791 | void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) { |
| 792 | VisitOMPExecutableDirective(S); |
| 793 | } |
| 794 | |
Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 795 | void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) { |
| 796 | VisitOMPExecutableDirective(S); |
| 797 | } |
| 798 | |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 799 | void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) { |
| 800 | VisitOMPExecutableDirective(S); |
| 801 | } |
| 802 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 803 | void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) { |
| 804 | VisitOMPExecutableDirective(S); |
| 805 | } |
| 806 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 807 | void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) { |
| 808 | VisitOMPExecutableDirective(S); |
| 809 | } |
| 810 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 811 | void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) { |
| 812 | VisitOMPExecutableDirective(S); |
| 813 | } |
| 814 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 815 | void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) { |
| 816 | VisitOMPExecutableDirective(S); |
| 817 | } |
| 818 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 819 | void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) { |
| 820 | VisitOMPExecutableDirective(S); |
| 821 | } |
| 822 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 823 | void StmtProfiler::VisitOMPTargetEnterDataDirective( |
| 824 | const OMPTargetEnterDataDirective *S) { |
| 825 | VisitOMPExecutableDirective(S); |
| 826 | } |
| 827 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 828 | void StmtProfiler::VisitOMPTargetExitDataDirective( |
| 829 | const OMPTargetExitDataDirective *S) { |
| 830 | VisitOMPExecutableDirective(S); |
| 831 | } |
| 832 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 833 | void StmtProfiler::VisitOMPTargetParallelDirective( |
| 834 | const OMPTargetParallelDirective *S) { |
| 835 | VisitOMPExecutableDirective(S); |
| 836 | } |
| 837 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 838 | void StmtProfiler::VisitOMPTargetParallelForDirective( |
| 839 | const OMPTargetParallelForDirective *S) { |
| 840 | VisitOMPExecutableDirective(S); |
| 841 | } |
| 842 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 843 | void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) { |
| 844 | VisitOMPExecutableDirective(S); |
| 845 | } |
| 846 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 847 | void StmtProfiler::VisitOMPCancellationPointDirective( |
| 848 | const OMPCancellationPointDirective *S) { |
| 849 | VisitOMPExecutableDirective(S); |
| 850 | } |
| 851 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 852 | void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) { |
| 853 | VisitOMPExecutableDirective(S); |
| 854 | } |
| 855 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 856 | void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) { |
| 857 | VisitOMPLoopDirective(S); |
| 858 | } |
| 859 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 860 | void StmtProfiler::VisitOMPTaskLoopSimdDirective( |
| 861 | const OMPTaskLoopSimdDirective *S) { |
| 862 | VisitOMPLoopDirective(S); |
| 863 | } |
| 864 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 865 | void StmtProfiler::VisitOMPDistributeDirective( |
| 866 | const OMPDistributeDirective *S) { |
| 867 | VisitOMPLoopDirective(S); |
| 868 | } |
| 869 | |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 870 | void OMPClauseProfiler::VisitOMPDistScheduleClause( |
| 871 | const OMPDistScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 872 | VistOMPClauseWithPreInit(C); |
| 873 | if (auto *S = C->getChunkSize()) |
| 874 | Profiler->VisitStmt(S); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 875 | } |
| 876 | |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 877 | void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {} |
| 878 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 879 | void StmtProfiler::VisitOMPTargetUpdateDirective( |
| 880 | const OMPTargetUpdateDirective *S) { |
| 881 | VisitOMPExecutableDirective(S); |
| 882 | } |
| 883 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 884 | void StmtProfiler::VisitOMPDistributeParallelForDirective( |
| 885 | const OMPDistributeParallelForDirective *S) { |
| 886 | VisitOMPLoopDirective(S); |
| 887 | } |
| 888 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 889 | void StmtProfiler::VisitOMPDistributeParallelForSimdDirective( |
| 890 | const OMPDistributeParallelForSimdDirective *S) { |
| 891 | VisitOMPLoopDirective(S); |
| 892 | } |
| 893 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 894 | void StmtProfiler::VisitOMPDistributeSimdDirective( |
| 895 | const OMPDistributeSimdDirective *S) { |
| 896 | VisitOMPLoopDirective(S); |
| 897 | } |
| 898 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 899 | void StmtProfiler::VisitOMPTargetParallelForSimdDirective( |
| 900 | const OMPTargetParallelForSimdDirective *S) { |
| 901 | VisitOMPLoopDirective(S); |
| 902 | } |
| 903 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 904 | void StmtProfiler::VisitOMPTargetSimdDirective( |
| 905 | const OMPTargetSimdDirective *S) { |
| 906 | VisitOMPLoopDirective(S); |
| 907 | } |
| 908 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 909 | void StmtProfiler::VisitOMPTeamsDistributeDirective( |
| 910 | const OMPTeamsDistributeDirective *S) { |
| 911 | VisitOMPLoopDirective(S); |
| 912 | } |
| 913 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 914 | void StmtProfiler::VisitOMPTeamsDistributeSimdDirective( |
| 915 | const OMPTeamsDistributeSimdDirective *S) { |
| 916 | VisitOMPLoopDirective(S); |
| 917 | } |
| 918 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 919 | void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective( |
| 920 | const OMPTeamsDistributeParallelForSimdDirective *S) { |
| 921 | VisitOMPLoopDirective(S); |
| 922 | } |
| 923 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 924 | void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective( |
| 925 | const OMPTeamsDistributeParallelForDirective *S) { |
| 926 | VisitOMPLoopDirective(S); |
| 927 | } |
| 928 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 929 | void StmtProfiler::VisitOMPTargetTeamsDirective( |
| 930 | const OMPTargetTeamsDirective *S) { |
| 931 | VisitOMPExecutableDirective(S); |
| 932 | } |
| 933 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 934 | void StmtProfiler::VisitOMPTargetTeamsDistributeDirective( |
| 935 | const OMPTargetTeamsDistributeDirective *S) { |
| 936 | VisitOMPLoopDirective(S); |
| 937 | } |
| 938 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 939 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective( |
| 940 | const OMPTargetTeamsDistributeParallelForDirective *S) { |
| 941 | VisitOMPLoopDirective(S); |
| 942 | } |
| 943 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 944 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
| 945 | const OMPTargetTeamsDistributeParallelForSimdDirective *S) { |
| 946 | VisitOMPLoopDirective(S); |
| 947 | } |
| 948 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 949 | void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective( |
| 950 | const OMPTargetTeamsDistributeSimdDirective *S) { |
| 951 | VisitOMPLoopDirective(S); |
| 952 | } |
| 953 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 954 | void StmtProfiler::VisitExpr(const Expr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 955 | VisitStmt(S); |
| 956 | } |
| 957 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 958 | void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 959 | VisitExpr(S); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 960 | if (!Canonical) |
| 961 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 962 | VisitDecl(S->getDecl()); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 963 | if (!Canonical) |
| 964 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 965 | } |
| 966 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 967 | void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 968 | VisitExpr(S); |
| 969 | ID.AddInteger(S->getIdentType()); |
| 970 | } |
| 971 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 972 | void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 973 | VisitExpr(S); |
| 974 | S->getValue().Profile(ID); |
Richard Smith | e9f130c | 2014-11-20 03:37:32 +0000 | [diff] [blame] | 975 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 976 | } |
| 977 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 978 | void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 979 | VisitExpr(S); |
Douglas Gregor | fb65e59 | 2011-07-27 05:40:30 +0000 | [diff] [blame] | 980 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 981 | ID.AddInteger(S->getValue()); |
| 982 | } |
| 983 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 984 | void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 985 | VisitExpr(S); |
| 986 | S->getValue().Profile(ID); |
| 987 | ID.AddBoolean(S->isExact()); |
Richard Smith | e9f130c | 2014-11-20 03:37:32 +0000 | [diff] [blame] | 988 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 989 | } |
| 990 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 991 | void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 992 | VisitExpr(S); |
| 993 | } |
| 994 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 995 | void StmtProfiler::VisitStringLiteral(const StringLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 996 | VisitExpr(S); |
Douglas Gregor | 9d0eb8f | 2011-11-02 17:26:05 +0000 | [diff] [blame] | 997 | ID.AddString(S->getBytes()); |
Douglas Gregor | fb65e59 | 2011-07-27 05:40:30 +0000 | [diff] [blame] | 998 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1001 | void StmtProfiler::VisitParenExpr(const ParenExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1002 | VisitExpr(S); |
| 1003 | } |
| 1004 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1005 | void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) { |
Nate Begeman | 5ec4b31 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 1006 | VisitExpr(S); |
| 1007 | } |
| 1008 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1009 | void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1010 | VisitExpr(S); |
| 1011 | ID.AddInteger(S->getOpcode()); |
| 1012 | } |
| 1013 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1014 | void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) { |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1015 | VisitType(S->getTypeSourceInfo()->getType()); |
| 1016 | unsigned n = S->getNumComponents(); |
| 1017 | for (unsigned i = 0; i < n; ++i) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1018 | const OffsetOfNode &ON = S->getComponent(i); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1019 | ID.AddInteger(ON.getKind()); |
| 1020 | switch (ON.getKind()) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1021 | case OffsetOfNode::Array: |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1022 | // Expressions handled below. |
| 1023 | break; |
| 1024 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1025 | case OffsetOfNode::Field: |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1026 | VisitDecl(ON.getField()); |
| 1027 | break; |
| 1028 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1029 | case OffsetOfNode::Identifier: |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1030 | VisitIdentifierInfo(ON.getFieldName()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1031 | break; |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1032 | |
| 1033 | case OffsetOfNode::Base: |
Douglas Gregor | d170206 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 1034 | // These nodes are implicit, and therefore don't need profiling. |
| 1035 | break; |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1036 | } |
| 1037 | } |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1038 | |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1039 | VisitExpr(S); |
| 1040 | } |
| 1041 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1042 | void |
| 1043 | StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1044 | VisitExpr(S); |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 1045 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1046 | if (S->isArgumentType()) |
| 1047 | VisitType(S->getArgumentType()); |
| 1048 | } |
| 1049 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1050 | void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1051 | VisitExpr(S); |
| 1052 | } |
| 1053 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 1054 | void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) { |
| 1055 | VisitExpr(S); |
| 1056 | } |
| 1057 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1058 | void StmtProfiler::VisitCallExpr(const CallExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1059 | VisitExpr(S); |
| 1060 | } |
| 1061 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1062 | void StmtProfiler::VisitMemberExpr(const MemberExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1063 | VisitExpr(S); |
| 1064 | VisitDecl(S->getMemberDecl()); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 1065 | if (!Canonical) |
| 1066 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1067 | ID.AddBoolean(S->isArrow()); |
| 1068 | } |
| 1069 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1070 | void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1071 | VisitExpr(S); |
| 1072 | ID.AddBoolean(S->isFileScope()); |
| 1073 | } |
| 1074 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1075 | void StmtProfiler::VisitCastExpr(const CastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1076 | VisitExpr(S); |
| 1077 | } |
| 1078 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1079 | void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1080 | VisitCastExpr(S); |
John McCall | 2536c6d | 2010-08-25 10:28:54 +0000 | [diff] [blame] | 1081 | ID.AddInteger(S->getValueKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1082 | } |
| 1083 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1084 | void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1085 | VisitCastExpr(S); |
| 1086 | VisitType(S->getTypeAsWritten()); |
| 1087 | } |
| 1088 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1089 | void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1090 | VisitExplicitCastExpr(S); |
| 1091 | } |
| 1092 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1093 | void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1094 | VisitExpr(S); |
| 1095 | ID.AddInteger(S->getOpcode()); |
| 1096 | } |
| 1097 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1098 | void |
| 1099 | StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1100 | VisitBinaryOperator(S); |
| 1101 | } |
| 1102 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1103 | void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1104 | VisitExpr(S); |
| 1105 | } |
| 1106 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1107 | void StmtProfiler::VisitBinaryConditionalOperator( |
Chandler Carruth | cf5f43c | 2011-06-21 23:26:32 +0000 | [diff] [blame] | 1108 | const BinaryConditionalOperator *S) { |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 1109 | VisitExpr(S); |
| 1110 | } |
| 1111 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1112 | void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1113 | VisitExpr(S); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 1114 | VisitDecl(S->getLabel()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1115 | } |
| 1116 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1117 | void StmtProfiler::VisitStmtExpr(const StmtExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1118 | VisitExpr(S); |
| 1119 | } |
| 1120 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1121 | void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1122 | VisitExpr(S); |
| 1123 | } |
| 1124 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 1125 | void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) { |
| 1126 | VisitExpr(S); |
| 1127 | } |
| 1128 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1129 | void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1130 | VisitExpr(S); |
| 1131 | } |
| 1132 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1133 | void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1134 | VisitExpr(S); |
| 1135 | } |
| 1136 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1137 | void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) { |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 1138 | VisitExpr(S); |
| 1139 | } |
| 1140 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1141 | void StmtProfiler::VisitInitListExpr(const InitListExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1142 | if (S->getSyntacticForm()) { |
| 1143 | VisitInitListExpr(S->getSyntacticForm()); |
| 1144 | return; |
| 1145 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1146 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1147 | VisitExpr(S); |
| 1148 | } |
| 1149 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1150 | void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1151 | VisitExpr(S); |
| 1152 | ID.AddBoolean(S->usesGNUSyntax()); |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1153 | for (const DesignatedInitExpr::Designator &D : S->designators()) { |
| 1154 | if (D.isFieldDesignator()) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1155 | ID.AddInteger(0); |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1156 | VisitName(D.getFieldName()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1157 | continue; |
| 1158 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1159 | |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1160 | if (D.isArrayDesignator()) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1161 | ID.AddInteger(1); |
| 1162 | } else { |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1163 | assert(D.isArrayRangeDesignator()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1164 | ID.AddInteger(2); |
| 1165 | } |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1166 | ID.AddInteger(D.getFirstExprIndex()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1167 | } |
| 1168 | } |
| 1169 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 1170 | // Seems that if VisitInitListExpr() only works on the syntactic form of an |
| 1171 | // InitListExpr, then a DesignatedInitUpdateExpr is not encountered. |
| 1172 | void StmtProfiler::VisitDesignatedInitUpdateExpr( |
| 1173 | const DesignatedInitUpdateExpr *S) { |
| 1174 | llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of " |
| 1175 | "initializer"); |
| 1176 | } |
| 1177 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 1178 | void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) { |
| 1179 | VisitExpr(S); |
| 1180 | } |
| 1181 | |
| 1182 | void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) { |
| 1183 | VisitExpr(S); |
| 1184 | } |
| 1185 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 1186 | void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) { |
| 1187 | llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer"); |
| 1188 | } |
| 1189 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1190 | void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1191 | VisitExpr(S); |
| 1192 | } |
| 1193 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1194 | void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1195 | VisitExpr(S); |
| 1196 | VisitName(&S->getAccessor()); |
| 1197 | } |
| 1198 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1199 | void StmtProfiler::VisitBlockExpr(const BlockExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1200 | VisitExpr(S); |
| 1201 | VisitDecl(S->getBlockDecl()); |
| 1202 | } |
| 1203 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1204 | void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) { |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 1205 | VisitExpr(S); |
| 1206 | for (unsigned i = 0; i != S->getNumAssocs(); ++i) { |
| 1207 | QualType T = S->getAssocType(i); |
| 1208 | if (T.isNull()) |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1209 | ID.AddPointer(nullptr); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 1210 | else |
| 1211 | VisitType(T); |
| 1212 | VisitExpr(S->getAssocExpr(i)); |
| 1213 | } |
| 1214 | } |
| 1215 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 1216 | void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) { |
| 1217 | VisitExpr(S); |
| 1218 | for (PseudoObjectExpr::const_semantics_iterator |
| 1219 | i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i) |
| 1220 | // Normally, we would not profile the source expressions of OVEs. |
| 1221 | if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i)) |
| 1222 | Visit(OVE->getSourceExpr()); |
| 1223 | } |
| 1224 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1225 | void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) { |
| 1226 | VisitExpr(S); |
Eli Friedman | 4b72fdd | 2011-10-14 20:59:01 +0000 | [diff] [blame] | 1227 | ID.AddInteger(S->getOp()); |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1228 | } |
| 1229 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1230 | static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1231 | UnaryOperatorKind &UnaryOp, |
| 1232 | BinaryOperatorKind &BinaryOp) { |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1233 | switch (S->getOperator()) { |
| 1234 | case OO_None: |
| 1235 | case OO_New: |
| 1236 | case OO_Delete: |
| 1237 | case OO_Array_New: |
| 1238 | case OO_Array_Delete: |
| 1239 | case OO_Arrow: |
| 1240 | case OO_Call: |
| 1241 | case OO_Conditional: |
Richard Smith | 9be594e | 2015-10-22 05:12:22 +0000 | [diff] [blame] | 1242 | case OO_Coawait: |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1243 | case NUM_OVERLOADED_OPERATORS: |
| 1244 | llvm_unreachable("Invalid operator call kind"); |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1245 | |
| 1246 | case OO_Plus: |
| 1247 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1248 | UnaryOp = UO_Plus; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1249 | return Stmt::UnaryOperatorClass; |
| 1250 | } |
| 1251 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1252 | BinaryOp = BO_Add; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1253 | return Stmt::BinaryOperatorClass; |
| 1254 | |
| 1255 | case OO_Minus: |
| 1256 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1257 | UnaryOp = UO_Minus; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1258 | return Stmt::UnaryOperatorClass; |
| 1259 | } |
| 1260 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1261 | BinaryOp = BO_Sub; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1262 | return Stmt::BinaryOperatorClass; |
| 1263 | |
| 1264 | case OO_Star: |
| 1265 | if (S->getNumArgs() == 1) { |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1266 | UnaryOp = UO_Deref; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1267 | return Stmt::UnaryOperatorClass; |
| 1268 | } |
| 1269 | |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1270 | BinaryOp = BO_Mul; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1271 | return Stmt::BinaryOperatorClass; |
| 1272 | |
| 1273 | case OO_Slash: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1274 | BinaryOp = BO_Div; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1275 | return Stmt::BinaryOperatorClass; |
| 1276 | |
| 1277 | case OO_Percent: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1278 | BinaryOp = BO_Rem; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1279 | return Stmt::BinaryOperatorClass; |
| 1280 | |
| 1281 | case OO_Caret: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1282 | BinaryOp = BO_Xor; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1283 | return Stmt::BinaryOperatorClass; |
| 1284 | |
| 1285 | case OO_Amp: |
| 1286 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1287 | UnaryOp = UO_AddrOf; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1288 | return Stmt::UnaryOperatorClass; |
| 1289 | } |
| 1290 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1291 | BinaryOp = BO_And; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1292 | return Stmt::BinaryOperatorClass; |
| 1293 | |
| 1294 | case OO_Pipe: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1295 | BinaryOp = BO_Or; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1296 | return Stmt::BinaryOperatorClass; |
| 1297 | |
| 1298 | case OO_Tilde: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1299 | UnaryOp = UO_Not; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1300 | return Stmt::UnaryOperatorClass; |
| 1301 | |
| 1302 | case OO_Exclaim: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1303 | UnaryOp = UO_LNot; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1304 | return Stmt::UnaryOperatorClass; |
| 1305 | |
| 1306 | case OO_Equal: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1307 | BinaryOp = BO_Assign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1308 | return Stmt::BinaryOperatorClass; |
| 1309 | |
| 1310 | case OO_Less: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1311 | BinaryOp = BO_LT; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1312 | return Stmt::BinaryOperatorClass; |
| 1313 | |
| 1314 | case OO_Greater: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1315 | BinaryOp = BO_GT; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1316 | return Stmt::BinaryOperatorClass; |
| 1317 | |
| 1318 | case OO_PlusEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1319 | BinaryOp = BO_AddAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1320 | return Stmt::CompoundAssignOperatorClass; |
| 1321 | |
| 1322 | case OO_MinusEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1323 | BinaryOp = BO_SubAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1324 | return Stmt::CompoundAssignOperatorClass; |
| 1325 | |
| 1326 | case OO_StarEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1327 | BinaryOp = BO_MulAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1328 | return Stmt::CompoundAssignOperatorClass; |
| 1329 | |
| 1330 | case OO_SlashEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1331 | BinaryOp = BO_DivAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1332 | return Stmt::CompoundAssignOperatorClass; |
| 1333 | |
| 1334 | case OO_PercentEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1335 | BinaryOp = BO_RemAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1336 | return Stmt::CompoundAssignOperatorClass; |
| 1337 | |
| 1338 | case OO_CaretEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1339 | BinaryOp = BO_XorAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1340 | return Stmt::CompoundAssignOperatorClass; |
| 1341 | |
| 1342 | case OO_AmpEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1343 | BinaryOp = BO_AndAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1344 | return Stmt::CompoundAssignOperatorClass; |
| 1345 | |
| 1346 | case OO_PipeEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1347 | BinaryOp = BO_OrAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1348 | return Stmt::CompoundAssignOperatorClass; |
| 1349 | |
| 1350 | case OO_LessLess: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1351 | BinaryOp = BO_Shl; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1352 | return Stmt::BinaryOperatorClass; |
| 1353 | |
| 1354 | case OO_GreaterGreater: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1355 | BinaryOp = BO_Shr; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1356 | return Stmt::BinaryOperatorClass; |
| 1357 | |
| 1358 | case OO_LessLessEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1359 | BinaryOp = BO_ShlAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1360 | return Stmt::CompoundAssignOperatorClass; |
| 1361 | |
| 1362 | case OO_GreaterGreaterEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1363 | BinaryOp = BO_ShrAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1364 | return Stmt::CompoundAssignOperatorClass; |
| 1365 | |
| 1366 | case OO_EqualEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1367 | BinaryOp = BO_EQ; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1368 | return Stmt::BinaryOperatorClass; |
| 1369 | |
| 1370 | case OO_ExclaimEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1371 | BinaryOp = BO_NE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1372 | return Stmt::BinaryOperatorClass; |
| 1373 | |
| 1374 | case OO_LessEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1375 | BinaryOp = BO_LE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1376 | return Stmt::BinaryOperatorClass; |
| 1377 | |
| 1378 | case OO_GreaterEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1379 | BinaryOp = BO_GE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1380 | return Stmt::BinaryOperatorClass; |
| 1381 | |
| 1382 | case OO_AmpAmp: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1383 | BinaryOp = BO_LAnd; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1384 | return Stmt::BinaryOperatorClass; |
| 1385 | |
| 1386 | case OO_PipePipe: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1387 | BinaryOp = BO_LOr; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1388 | return Stmt::BinaryOperatorClass; |
| 1389 | |
| 1390 | case OO_PlusPlus: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1391 | UnaryOp = S->getNumArgs() == 1? UO_PreInc |
| 1392 | : UO_PostInc; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1393 | return Stmt::UnaryOperatorClass; |
| 1394 | |
| 1395 | case OO_MinusMinus: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1396 | UnaryOp = S->getNumArgs() == 1? UO_PreDec |
| 1397 | : UO_PostDec; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1398 | return Stmt::UnaryOperatorClass; |
| 1399 | |
| 1400 | case OO_Comma: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1401 | BinaryOp = BO_Comma; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1402 | return Stmt::BinaryOperatorClass; |
| 1403 | |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1404 | case OO_ArrowStar: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1405 | BinaryOp = BO_PtrMemI; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1406 | return Stmt::BinaryOperatorClass; |
| 1407 | |
| 1408 | case OO_Subscript: |
| 1409 | return Stmt::ArraySubscriptExprClass; |
| 1410 | } |
| 1411 | |
| 1412 | llvm_unreachable("Invalid overloaded operator expression"); |
| 1413 | } |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1414 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1415 | void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) { |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1416 | if (S->isTypeDependent()) { |
| 1417 | // Type-dependent operator calls are profiled like their underlying |
| 1418 | // syntactic operator. |
Richard Smith | bac0a0d | 2016-10-24 18:47:04 +0000 | [diff] [blame] | 1419 | // |
| 1420 | // An operator call to operator-> is always implicit, so just skip it. The |
| 1421 | // enclosing MemberExpr will profile the actual member access. |
| 1422 | if (S->getOperator() == OO_Arrow) |
| 1423 | return Visit(S->getArg(0)); |
| 1424 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1425 | UnaryOperatorKind UnaryOp = UO_Extension; |
| 1426 | BinaryOperatorKind BinaryOp = BO_Comma; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1427 | Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp); |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1428 | |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1429 | ID.AddInteger(SC); |
| 1430 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
| 1431 | Visit(S->getArg(I)); |
| 1432 | if (SC == Stmt::UnaryOperatorClass) |
| 1433 | ID.AddInteger(UnaryOp); |
| 1434 | else if (SC == Stmt::BinaryOperatorClass || |
| 1435 | SC == Stmt::CompoundAssignOperatorClass) |
| 1436 | ID.AddInteger(BinaryOp); |
| 1437 | else |
| 1438 | assert(SC == Stmt::ArraySubscriptExprClass); |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1439 | |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1440 | return; |
| 1441 | } |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1442 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1443 | VisitCallExpr(S); |
| 1444 | ID.AddInteger(S->getOperator()); |
| 1445 | } |
| 1446 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1447 | void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1448 | VisitCallExpr(S); |
| 1449 | } |
| 1450 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1451 | void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) { |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1452 | VisitCallExpr(S); |
| 1453 | } |
| 1454 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1455 | void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) { |
Tanya Lattner | 55808c1 | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 1456 | VisitExpr(S); |
| 1457 | } |
| 1458 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1459 | void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1460 | VisitExplicitCastExpr(S); |
| 1461 | } |
| 1462 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1463 | void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1464 | VisitCXXNamedCastExpr(S); |
| 1465 | } |
| 1466 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1467 | void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1468 | VisitCXXNamedCastExpr(S); |
| 1469 | } |
| 1470 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1471 | void |
| 1472 | StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1473 | VisitCXXNamedCastExpr(S); |
| 1474 | } |
| 1475 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1476 | void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1477 | VisitCXXNamedCastExpr(S); |
| 1478 | } |
| 1479 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1480 | void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) { |
| 1481 | VisitCallExpr(S); |
| 1482 | } |
| 1483 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1484 | void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1485 | VisitExpr(S); |
| 1486 | ID.AddBoolean(S->getValue()); |
| 1487 | } |
| 1488 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1489 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) { |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 1490 | VisitExpr(S); |
| 1491 | } |
| 1492 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1493 | void StmtProfiler::VisitCXXStdInitializerListExpr( |
| 1494 | const CXXStdInitializerListExpr *S) { |
| 1495 | VisitExpr(S); |
| 1496 | } |
| 1497 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1498 | void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1499 | VisitExpr(S); |
| 1500 | if (S->isTypeOperand()) |
David Majnemer | 143c55e | 2013-09-27 07:04:31 +0000 | [diff] [blame] | 1501 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1502 | } |
| 1503 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1504 | void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) { |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 1505 | VisitExpr(S); |
| 1506 | if (S->isTypeOperand()) |
David Majnemer | 143c55e | 2013-09-27 07:04:31 +0000 | [diff] [blame] | 1507 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 1508 | } |
| 1509 | |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1510 | void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) { |
| 1511 | VisitExpr(S); |
| 1512 | VisitDecl(S->getPropertyDecl()); |
| 1513 | } |
| 1514 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1515 | void StmtProfiler::VisitMSPropertySubscriptExpr( |
| 1516 | const MSPropertySubscriptExpr *S) { |
| 1517 | VisitExpr(S); |
| 1518 | } |
| 1519 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1520 | void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1521 | VisitExpr(S); |
Douglas Gregor | 3024f07 | 2012-04-16 07:05:22 +0000 | [diff] [blame] | 1522 | ID.AddBoolean(S->isImplicit()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1523 | } |
| 1524 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1525 | void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1526 | VisitExpr(S); |
| 1527 | } |
| 1528 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1529 | void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1530 | VisitExpr(S); |
| 1531 | VisitDecl(S->getParam()); |
| 1532 | } |
| 1533 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1534 | void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) { |
| 1535 | VisitExpr(S); |
| 1536 | VisitDecl(S->getField()); |
| 1537 | } |
| 1538 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1539 | void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1540 | VisitExpr(S); |
| 1541 | VisitDecl( |
| 1542 | const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
| 1543 | } |
| 1544 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1545 | void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1546 | VisitExpr(S); |
| 1547 | VisitDecl(S->getConstructor()); |
| 1548 | ID.AddBoolean(S->isElidable()); |
| 1549 | } |
| 1550 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1551 | void StmtProfiler::VisitCXXInheritedCtorInitExpr( |
| 1552 | const CXXInheritedCtorInitExpr *S) { |
| 1553 | VisitExpr(S); |
| 1554 | VisitDecl(S->getConstructor()); |
| 1555 | } |
| 1556 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1557 | void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1558 | VisitExplicitCastExpr(S); |
| 1559 | } |
| 1560 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1561 | void |
| 1562 | StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1563 | VisitCXXConstructExpr(S); |
| 1564 | } |
| 1565 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1566 | void |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1567 | StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) { |
| 1568 | VisitExpr(S); |
| 1569 | for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(), |
| 1570 | CEnd = S->explicit_capture_end(); |
| 1571 | C != CEnd; ++C) { |
| 1572 | ID.AddInteger(C->getCaptureKind()); |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1573 | switch (C->getCaptureKind()) { |
Faisal Vali | dc6b596 | 2016-03-21 09:25:37 +0000 | [diff] [blame] | 1574 | case LCK_StarThis: |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1575 | case LCK_This: |
| 1576 | break; |
| 1577 | case LCK_ByRef: |
| 1578 | case LCK_ByCopy: |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1579 | VisitDecl(C->getCapturedVar()); |
| 1580 | ID.AddBoolean(C->isPackExpansion()); |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1581 | break; |
Alexey Bataev | 39c81e2 | 2014-08-28 04:28:19 +0000 | [diff] [blame] | 1582 | case LCK_VLAType: |
| 1583 | llvm_unreachable("VLA type in explicit captures."); |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1584 | } |
| 1585 | } |
| 1586 | // Note: If we actually needed to be able to match lambda |
| 1587 | // expressions, we would have to consider parameters and return type |
| 1588 | // here, among other things. |
| 1589 | VisitStmt(S->getBody()); |
| 1590 | } |
| 1591 | |
| 1592 | void |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1593 | StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1594 | VisitExpr(S); |
| 1595 | } |
| 1596 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1597 | void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1598 | VisitExpr(S); |
| 1599 | ID.AddBoolean(S->isGlobalDelete()); |
| 1600 | ID.AddBoolean(S->isArrayForm()); |
| 1601 | VisitDecl(S->getOperatorDelete()); |
| 1602 | } |
| 1603 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1604 | void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1605 | VisitExpr(S); |
| 1606 | VisitType(S->getAllocatedType()); |
| 1607 | VisitDecl(S->getOperatorNew()); |
| 1608 | VisitDecl(S->getOperatorDelete()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1609 | ID.AddBoolean(S->isArray()); |
| 1610 | ID.AddInteger(S->getNumPlacementArgs()); |
| 1611 | ID.AddBoolean(S->isGlobalNew()); |
| 1612 | ID.AddBoolean(S->isParenTypeId()); |
Sebastian Redl | 6047f07 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1613 | ID.AddInteger(S->getInitializationStyle()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1614 | } |
| 1615 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1616 | void |
| 1617 | StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { |
Douglas Gregor | ad8a336 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 1618 | VisitExpr(S); |
| 1619 | ID.AddBoolean(S->isArrow()); |
| 1620 | VisitNestedNameSpecifier(S->getQualifier()); |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1621 | ID.AddBoolean(S->getScopeTypeInfo() != nullptr); |
Eli Friedman | 8564139 | 2013-08-09 23:37:05 +0000 | [diff] [blame] | 1622 | if (S->getScopeTypeInfo()) |
| 1623 | VisitType(S->getScopeTypeInfo()->getType()); |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1624 | ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr); |
Eli Friedman | 8564139 | 2013-08-09 23:37:05 +0000 | [diff] [blame] | 1625 | if (S->getDestroyedTypeInfo()) |
| 1626 | VisitType(S->getDestroyedType()); |
| 1627 | else |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1628 | VisitIdentifierInfo(S->getDestroyedTypeIdentifier()); |
Douglas Gregor | ad8a336 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 1629 | } |
| 1630 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1631 | void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { |
Argyrios Kyrtzidis | b482eb8 | 2010-08-15 20:53:20 +0000 | [diff] [blame] | 1632 | VisitExpr(S); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1633 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1634 | VisitName(S->getName()); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1635 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1636 | if (S->hasExplicitTemplateArgs()) |
James Y Knight | 04ec5bf | 2015-12-24 02:59:37 +0000 | [diff] [blame] | 1637 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Argyrios Kyrtzidis | f450545 | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 1638 | } |
| 1639 | |
| 1640 | void |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1641 | StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) { |
Argyrios Kyrtzidis | f450545 | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 1642 | VisitOverloadExpr(S); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1643 | } |
| 1644 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1645 | void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) { |
| 1646 | VisitExpr(S); |
| 1647 | ID.AddInteger(S->getTrait()); |
| 1648 | ID.AddInteger(S->getNumArgs()); |
| 1649 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
| 1650 | VisitType(S->getArg(I)->getType()); |
| 1651 | } |
| 1652 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1653 | void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) { |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1654 | VisitExpr(S); |
| 1655 | ID.AddInteger(S->getTrait()); |
| 1656 | VisitType(S->getQueriedType()); |
| 1657 | } |
| 1658 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1659 | void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) { |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1660 | VisitExpr(S); |
| 1661 | ID.AddInteger(S->getTrait()); |
| 1662 | VisitExpr(S->getQueriedExpression()); |
| 1663 | } |
| 1664 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1665 | void StmtProfiler::VisitDependentScopeDeclRefExpr( |
| 1666 | const DependentScopeDeclRefExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1667 | VisitExpr(S); |
| 1668 | VisitName(S->getDeclName()); |
| 1669 | VisitNestedNameSpecifier(S->getQualifier()); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1670 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1671 | if (S->hasExplicitTemplateArgs()) |
| 1672 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1673 | } |
| 1674 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1675 | void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1676 | VisitExpr(S); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1677 | } |
| 1678 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1679 | void StmtProfiler::VisitCXXUnresolvedConstructExpr( |
| 1680 | const CXXUnresolvedConstructExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1681 | VisitExpr(S); |
| 1682 | VisitType(S->getTypeAsWritten()); |
| 1683 | } |
| 1684 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1685 | void StmtProfiler::VisitCXXDependentScopeMemberExpr( |
| 1686 | const CXXDependentScopeMemberExpr *S) { |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1687 | ID.AddBoolean(S->isImplicitAccess()); |
| 1688 | if (!S->isImplicitAccess()) { |
| 1689 | VisitExpr(S); |
| 1690 | ID.AddBoolean(S->isArrow()); |
| 1691 | } |
Douglas Gregor | c26e0f6 | 2009-09-03 16:14:30 +0000 | [diff] [blame] | 1692 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1693 | VisitName(S->getMember()); |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1694 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1695 | if (S->hasExplicitTemplateArgs()) |
John McCall | 10eae18 | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 1696 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
| 1697 | } |
| 1698 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1699 | void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) { |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1700 | ID.AddBoolean(S->isImplicitAccess()); |
| 1701 | if (!S->isImplicitAccess()) { |
| 1702 | VisitExpr(S); |
| 1703 | ID.AddBoolean(S->isArrow()); |
| 1704 | } |
John McCall | 10eae18 | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 1705 | VisitNestedNameSpecifier(S->getQualifier()); |
| 1706 | VisitName(S->getMemberName()); |
| 1707 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1708 | if (S->hasExplicitTemplateArgs()) |
| 1709 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1710 | } |
| 1711 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1712 | void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) { |
Sebastian Redl | 4202c0f | 2010-09-10 20:55:43 +0000 | [diff] [blame] | 1713 | VisitExpr(S); |
| 1714 | } |
| 1715 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1716 | void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) { |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1717 | VisitExpr(S); |
| 1718 | } |
| 1719 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1720 | void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) { |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1721 | VisitExpr(S); |
| 1722 | VisitDecl(S->getPack()); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1723 | if (S->isPartiallySubstituted()) { |
| 1724 | auto Args = S->getPartialArguments(); |
| 1725 | ID.AddInteger(Args.size()); |
| 1726 | for (const auto &TA : Args) |
| 1727 | VisitTemplateArgument(TA); |
| 1728 | } else { |
| 1729 | ID.AddInteger(0); |
| 1730 | } |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1731 | } |
| 1732 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1733 | void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr( |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1734 | const SubstNonTypeTemplateParmPackExpr *S) { |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1735 | VisitExpr(S); |
| 1736 | VisitDecl(S->getParameterPack()); |
| 1737 | VisitTemplateArgument(S->getArgumentPack()); |
| 1738 | } |
| 1739 | |
John McCall | 7c454bb | 2011-07-15 05:09:51 +0000 | [diff] [blame] | 1740 | void StmtProfiler::VisitSubstNonTypeTemplateParmExpr( |
| 1741 | const SubstNonTypeTemplateParmExpr *E) { |
| 1742 | // Profile exactly as the replacement expression. |
| 1743 | Visit(E->getReplacement()); |
| 1744 | } |
| 1745 | |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1746 | void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) { |
| 1747 | VisitExpr(S); |
| 1748 | VisitDecl(S->getParameterPack()); |
| 1749 | ID.AddInteger(S->getNumExpansions()); |
| 1750 | for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I) |
| 1751 | VisitDecl(*I); |
| 1752 | } |
| 1753 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1754 | void StmtProfiler::VisitMaterializeTemporaryExpr( |
| 1755 | const MaterializeTemporaryExpr *S) { |
| 1756 | VisitExpr(S); |
| 1757 | } |
| 1758 | |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1759 | void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) { |
| 1760 | VisitExpr(S); |
| 1761 | ID.AddInteger(S->getOperator()); |
| 1762 | } |
| 1763 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 1764 | void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) { |
| 1765 | VisitStmt(S); |
| 1766 | } |
| 1767 | |
| 1768 | void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) { |
| 1769 | VisitStmt(S); |
| 1770 | } |
| 1771 | |
| 1772 | void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) { |
| 1773 | VisitExpr(S); |
| 1774 | } |
| 1775 | |
Eric Fiselier | 20f25cb | 2017-03-06 23:38:15 +0000 | [diff] [blame] | 1776 | void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) { |
| 1777 | VisitExpr(S); |
| 1778 | } |
| 1779 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 1780 | void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) { |
| 1781 | VisitExpr(S); |
| 1782 | } |
| 1783 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1784 | void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1785 | VisitExpr(E); |
| 1786 | } |
| 1787 | |
Kaelyn Takata | e1f49d5 | 2014-10-27 18:07:20 +0000 | [diff] [blame] | 1788 | void StmtProfiler::VisitTypoExpr(const TypoExpr *E) { |
| 1789 | VisitExpr(E); |
| 1790 | } |
| 1791 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1792 | void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1793 | VisitExpr(S); |
| 1794 | } |
| 1795 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 1796 | void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1797 | VisitExpr(E); |
| 1798 | } |
| 1799 | |
| 1800 | void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) { |
| 1801 | VisitExpr(E); |
| 1802 | } |
| 1803 | |
| 1804 | void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) { |
| 1805 | VisitExpr(E); |
| 1806 | } |
| 1807 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1808 | void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1809 | VisitExpr(S); |
| 1810 | VisitType(S->getEncodedType()); |
| 1811 | } |
| 1812 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1813 | void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1814 | VisitExpr(S); |
| 1815 | VisitName(S->getSelector()); |
| 1816 | } |
| 1817 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1818 | void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1819 | VisitExpr(S); |
| 1820 | VisitDecl(S->getProtocol()); |
| 1821 | } |
| 1822 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1823 | void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1824 | VisitExpr(S); |
| 1825 | VisitDecl(S->getDecl()); |
| 1826 | ID.AddBoolean(S->isArrow()); |
| 1827 | ID.AddBoolean(S->isFreeIvar()); |
| 1828 | } |
| 1829 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1830 | void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1831 | VisitExpr(S); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1832 | if (S->isImplicitProperty()) { |
| 1833 | VisitDecl(S->getImplicitPropertyGetter()); |
| 1834 | VisitDecl(S->getImplicitPropertySetter()); |
| 1835 | } else { |
| 1836 | VisitDecl(S->getExplicitProperty()); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1837 | } |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1838 | if (S->isSuperReceiver()) { |
| 1839 | ID.AddBoolean(S->isSuperReceiver()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1840 | VisitType(S->getSuperReceiverType()); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1841 | } |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1842 | } |
| 1843 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1844 | void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) { |
| 1845 | VisitExpr(S); |
| 1846 | VisitDecl(S->getAtIndexMethodDecl()); |
| 1847 | VisitDecl(S->setAtIndexMethodDecl()); |
| 1848 | } |
| 1849 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1850 | void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1851 | VisitExpr(S); |
| 1852 | VisitName(S->getSelector()); |
| 1853 | VisitDecl(S->getMethodDecl()); |
| 1854 | } |
| 1855 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1856 | void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1857 | VisitExpr(S); |
| 1858 | ID.AddBoolean(S->isArrow()); |
| 1859 | } |
| 1860 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1861 | void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) { |
| 1862 | VisitExpr(S); |
| 1863 | ID.AddBoolean(S->getValue()); |
| 1864 | } |
| 1865 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1866 | void StmtProfiler::VisitObjCIndirectCopyRestoreExpr( |
| 1867 | const ObjCIndirectCopyRestoreExpr *S) { |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1868 | VisitExpr(S); |
| 1869 | ID.AddBoolean(S->shouldCopy()); |
| 1870 | } |
| 1871 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1872 | void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) { |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1873 | VisitExplicitCastExpr(S); |
| 1874 | ID.AddBoolean(S->getBridgeKind()); |
| 1875 | } |
| 1876 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1877 | void StmtProfiler::VisitObjCAvailabilityCheckExpr( |
| 1878 | const ObjCAvailabilityCheckExpr *S) { |
| 1879 | VisitExpr(S); |
| 1880 | } |
| 1881 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1882 | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1883 | unsigned NumArgs) { |
| 1884 | ID.AddInteger(NumArgs); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1885 | for (unsigned I = 0; I != NumArgs; ++I) |
| 1886 | VisitTemplateArgument(Args[I].getArgument()); |
| 1887 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1888 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1889 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
| 1890 | // Mostly repetitive with TemplateArgument::Profile! |
| 1891 | ID.AddInteger(Arg.getKind()); |
| 1892 | switch (Arg.getKind()) { |
| 1893 | case TemplateArgument::Null: |
| 1894 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1895 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1896 | case TemplateArgument::Type: |
| 1897 | VisitType(Arg.getAsType()); |
| 1898 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1899 | |
Douglas Gregor | 9167f8b | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1900 | case TemplateArgument::Template: |
Douglas Gregor | e4ff4b5 | 2011-01-05 18:58:31 +0000 | [diff] [blame] | 1901 | case TemplateArgument::TemplateExpansion: |
| 1902 | VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); |
Douglas Gregor | 9167f8b | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1903 | break; |
Alexis Hunt | a8136cc | 2010-05-05 15:23:54 +0000 | [diff] [blame] | 1904 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1905 | case TemplateArgument::Declaration: |
| 1906 | VisitDecl(Arg.getAsDecl()); |
| 1907 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1908 | |
Eli Friedman | b826a00 | 2012-09-26 02:36:12 +0000 | [diff] [blame] | 1909 | case TemplateArgument::NullPtr: |
| 1910 | VisitType(Arg.getNullPtrType()); |
| 1911 | break; |
| 1912 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1913 | case TemplateArgument::Integral: |
Benjamin Kramer | 6003ad5 | 2012-06-07 15:09:51 +0000 | [diff] [blame] | 1914 | Arg.getAsIntegral().Profile(ID); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1915 | VisitType(Arg.getIntegralType()); |
| 1916 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1917 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1918 | case TemplateArgument::Expression: |
| 1919 | Visit(Arg.getAsExpr()); |
| 1920 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1921 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1922 | case TemplateArgument::Pack: |
Aaron Ballman | 2a89e85 | 2014-07-15 21:32:31 +0000 | [diff] [blame] | 1923 | for (const auto &P : Arg.pack_elements()) |
| 1924 | VisitTemplateArgument(P); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1925 | break; |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1926 | } |
| 1927 | } |
| 1928 | |
Jay Foad | 39c7980 | 2011-01-12 09:06:06 +0000 | [diff] [blame] | 1929 | void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1930 | bool Canonical) const { |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1931 | StmtProfilerWithPointers Profiler(ID, Context, Canonical); |
| 1932 | Profiler.Visit(this); |
| 1933 | } |
| 1934 | |
| 1935 | void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID, |
| 1936 | class ODRHash &Hash) const { |
| 1937 | StmtProfilerWithoutPointers Profiler(ID, Hash); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1938 | Profiler.Visit(this); |
| 1939 | } |