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); |
Alexey Bataev | 3b1b895 | 2017-07-25 15:53:26 +0000 | [diff] [blame] | 801 | if (const Expr *E = S->getReductionRef()) |
| 802 | VisitStmt(E); |
Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 803 | } |
| 804 | |
Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 805 | void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) { |
| 806 | VisitOMPExecutableDirective(S); |
| 807 | } |
| 808 | |
Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 809 | void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) { |
| 810 | VisitOMPExecutableDirective(S); |
| 811 | } |
| 812 | |
Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 813 | void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) { |
| 814 | VisitOMPExecutableDirective(S); |
| 815 | } |
| 816 | |
Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 817 | void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) { |
| 818 | VisitOMPExecutableDirective(S); |
| 819 | } |
| 820 | |
Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 821 | void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) { |
| 822 | VisitOMPExecutableDirective(S); |
| 823 | } |
| 824 | |
Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 825 | void StmtProfiler::VisitOMPTargetEnterDataDirective( |
| 826 | const OMPTargetEnterDataDirective *S) { |
| 827 | VisitOMPExecutableDirective(S); |
| 828 | } |
| 829 | |
Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 830 | void StmtProfiler::VisitOMPTargetExitDataDirective( |
| 831 | const OMPTargetExitDataDirective *S) { |
| 832 | VisitOMPExecutableDirective(S); |
| 833 | } |
| 834 | |
Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 835 | void StmtProfiler::VisitOMPTargetParallelDirective( |
| 836 | const OMPTargetParallelDirective *S) { |
| 837 | VisitOMPExecutableDirective(S); |
| 838 | } |
| 839 | |
Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 840 | void StmtProfiler::VisitOMPTargetParallelForDirective( |
| 841 | const OMPTargetParallelForDirective *S) { |
| 842 | VisitOMPExecutableDirective(S); |
| 843 | } |
| 844 | |
Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 845 | void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) { |
| 846 | VisitOMPExecutableDirective(S); |
| 847 | } |
| 848 | |
Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 849 | void StmtProfiler::VisitOMPCancellationPointDirective( |
| 850 | const OMPCancellationPointDirective *S) { |
| 851 | VisitOMPExecutableDirective(S); |
| 852 | } |
| 853 | |
Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 854 | void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) { |
| 855 | VisitOMPExecutableDirective(S); |
| 856 | } |
| 857 | |
Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 858 | void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) { |
| 859 | VisitOMPLoopDirective(S); |
| 860 | } |
| 861 | |
Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 862 | void StmtProfiler::VisitOMPTaskLoopSimdDirective( |
| 863 | const OMPTaskLoopSimdDirective *S) { |
| 864 | VisitOMPLoopDirective(S); |
| 865 | } |
| 866 | |
Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 867 | void StmtProfiler::VisitOMPDistributeDirective( |
| 868 | const OMPDistributeDirective *S) { |
| 869 | VisitOMPLoopDirective(S); |
| 870 | } |
| 871 | |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 872 | void OMPClauseProfiler::VisitOMPDistScheduleClause( |
| 873 | const OMPDistScheduleClause *C) { |
Alexey Bataev | 3392d76 | 2016-02-16 11:18:12 +0000 | [diff] [blame] | 874 | VistOMPClauseWithPreInit(C); |
| 875 | if (auto *S = C->getChunkSize()) |
| 876 | Profiler->VisitStmt(S); |
Carlo Bertolli | b4adf55 | 2016-01-15 18:50:31 +0000 | [diff] [blame] | 877 | } |
| 878 | |
Arpith Chacko Jacob | 3cf8904 | 2016-01-26 16:37:23 +0000 | [diff] [blame] | 879 | void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {} |
| 880 | |
Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 881 | void StmtProfiler::VisitOMPTargetUpdateDirective( |
| 882 | const OMPTargetUpdateDirective *S) { |
| 883 | VisitOMPExecutableDirective(S); |
| 884 | } |
| 885 | |
Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 886 | void StmtProfiler::VisitOMPDistributeParallelForDirective( |
| 887 | const OMPDistributeParallelForDirective *S) { |
| 888 | VisitOMPLoopDirective(S); |
| 889 | } |
| 890 | |
Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 891 | void StmtProfiler::VisitOMPDistributeParallelForSimdDirective( |
| 892 | const OMPDistributeParallelForSimdDirective *S) { |
| 893 | VisitOMPLoopDirective(S); |
| 894 | } |
| 895 | |
Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 896 | void StmtProfiler::VisitOMPDistributeSimdDirective( |
| 897 | const OMPDistributeSimdDirective *S) { |
| 898 | VisitOMPLoopDirective(S); |
| 899 | } |
| 900 | |
Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 901 | void StmtProfiler::VisitOMPTargetParallelForSimdDirective( |
| 902 | const OMPTargetParallelForSimdDirective *S) { |
| 903 | VisitOMPLoopDirective(S); |
| 904 | } |
| 905 | |
Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 906 | void StmtProfiler::VisitOMPTargetSimdDirective( |
| 907 | const OMPTargetSimdDirective *S) { |
| 908 | VisitOMPLoopDirective(S); |
| 909 | } |
| 910 | |
Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 911 | void StmtProfiler::VisitOMPTeamsDistributeDirective( |
| 912 | const OMPTeamsDistributeDirective *S) { |
| 913 | VisitOMPLoopDirective(S); |
| 914 | } |
| 915 | |
Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 916 | void StmtProfiler::VisitOMPTeamsDistributeSimdDirective( |
| 917 | const OMPTeamsDistributeSimdDirective *S) { |
| 918 | VisitOMPLoopDirective(S); |
| 919 | } |
| 920 | |
Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 921 | void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective( |
| 922 | const OMPTeamsDistributeParallelForSimdDirective *S) { |
| 923 | VisitOMPLoopDirective(S); |
| 924 | } |
| 925 | |
Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 926 | void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective( |
| 927 | const OMPTeamsDistributeParallelForDirective *S) { |
| 928 | VisitOMPLoopDirective(S); |
| 929 | } |
| 930 | |
Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 931 | void StmtProfiler::VisitOMPTargetTeamsDirective( |
| 932 | const OMPTargetTeamsDirective *S) { |
| 933 | VisitOMPExecutableDirective(S); |
| 934 | } |
| 935 | |
Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 936 | void StmtProfiler::VisitOMPTargetTeamsDistributeDirective( |
| 937 | const OMPTargetTeamsDistributeDirective *S) { |
| 938 | VisitOMPLoopDirective(S); |
| 939 | } |
| 940 | |
Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 941 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective( |
| 942 | const OMPTargetTeamsDistributeParallelForDirective *S) { |
| 943 | VisitOMPLoopDirective(S); |
| 944 | } |
| 945 | |
Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 946 | void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective( |
| 947 | const OMPTargetTeamsDistributeParallelForSimdDirective *S) { |
| 948 | VisitOMPLoopDirective(S); |
| 949 | } |
| 950 | |
Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 951 | void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective( |
| 952 | const OMPTargetTeamsDistributeSimdDirective *S) { |
| 953 | VisitOMPLoopDirective(S); |
| 954 | } |
| 955 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 956 | void StmtProfiler::VisitExpr(const Expr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 957 | VisitStmt(S); |
| 958 | } |
| 959 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 960 | void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 961 | VisitExpr(S); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 962 | if (!Canonical) |
| 963 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 964 | VisitDecl(S->getDecl()); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 965 | if (!Canonical) |
| 966 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 967 | } |
| 968 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 969 | void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 970 | VisitExpr(S); |
| 971 | ID.AddInteger(S->getIdentType()); |
| 972 | } |
| 973 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 974 | void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 975 | VisitExpr(S); |
| 976 | S->getValue().Profile(ID); |
Richard Smith | e9f130c | 2014-11-20 03:37:32 +0000 | [diff] [blame] | 977 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 978 | } |
| 979 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 980 | void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 981 | VisitExpr(S); |
Douglas Gregor | fb65e59 | 2011-07-27 05:40:30 +0000 | [diff] [blame] | 982 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 983 | ID.AddInteger(S->getValue()); |
| 984 | } |
| 985 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 986 | void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 987 | VisitExpr(S); |
| 988 | S->getValue().Profile(ID); |
| 989 | ID.AddBoolean(S->isExact()); |
Richard Smith | e9f130c | 2014-11-20 03:37:32 +0000 | [diff] [blame] | 990 | ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 991 | } |
| 992 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 993 | void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 994 | VisitExpr(S); |
| 995 | } |
| 996 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 997 | void StmtProfiler::VisitStringLiteral(const StringLiteral *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 998 | VisitExpr(S); |
Douglas Gregor | 9d0eb8f | 2011-11-02 17:26:05 +0000 | [diff] [blame] | 999 | ID.AddString(S->getBytes()); |
Douglas Gregor | fb65e59 | 2011-07-27 05:40:30 +0000 | [diff] [blame] | 1000 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1001 | } |
| 1002 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1003 | void StmtProfiler::VisitParenExpr(const ParenExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1004 | VisitExpr(S); |
| 1005 | } |
| 1006 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1007 | void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) { |
Nate Begeman | 5ec4b31 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 1008 | VisitExpr(S); |
| 1009 | } |
| 1010 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1011 | void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1012 | VisitExpr(S); |
| 1013 | ID.AddInteger(S->getOpcode()); |
| 1014 | } |
| 1015 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1016 | void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) { |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1017 | VisitType(S->getTypeSourceInfo()->getType()); |
| 1018 | unsigned n = S->getNumComponents(); |
| 1019 | for (unsigned i = 0; i < n; ++i) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1020 | const OffsetOfNode &ON = S->getComponent(i); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1021 | ID.AddInteger(ON.getKind()); |
| 1022 | switch (ON.getKind()) { |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1023 | case OffsetOfNode::Array: |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1024 | // Expressions handled below. |
| 1025 | break; |
| 1026 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1027 | case OffsetOfNode::Field: |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1028 | VisitDecl(ON.getField()); |
| 1029 | break; |
| 1030 | |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1031 | case OffsetOfNode::Identifier: |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1032 | VisitIdentifierInfo(ON.getFieldName()); |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1033 | break; |
James Y Knight | 7281c35 | 2015-12-29 22:31:18 +0000 | [diff] [blame] | 1034 | |
| 1035 | case OffsetOfNode::Base: |
Douglas Gregor | d170206 | 2010-04-29 00:18:15 +0000 | [diff] [blame] | 1036 | // These nodes are implicit, and therefore don't need profiling. |
| 1037 | break; |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1038 | } |
| 1039 | } |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1040 | |
Douglas Gregor | 882211c | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 1041 | VisitExpr(S); |
| 1042 | } |
| 1043 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1044 | void |
| 1045 | StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1046 | VisitExpr(S); |
Peter Collingbourne | e190dee | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 1047 | ID.AddInteger(S->getKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1048 | if (S->isArgumentType()) |
| 1049 | VisitType(S->getArgumentType()); |
| 1050 | } |
| 1051 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1052 | void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1053 | VisitExpr(S); |
| 1054 | } |
| 1055 | |
Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 1056 | void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) { |
| 1057 | VisitExpr(S); |
| 1058 | } |
| 1059 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1060 | void StmtProfiler::VisitCallExpr(const CallExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1061 | VisitExpr(S); |
| 1062 | } |
| 1063 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1064 | void StmtProfiler::VisitMemberExpr(const MemberExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1065 | VisitExpr(S); |
| 1066 | VisitDecl(S->getMemberDecl()); |
Douglas Gregor | f5b160f | 2010-07-13 08:37:11 +0000 | [diff] [blame] | 1067 | if (!Canonical) |
| 1068 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1069 | ID.AddBoolean(S->isArrow()); |
| 1070 | } |
| 1071 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1072 | void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1073 | VisitExpr(S); |
| 1074 | ID.AddBoolean(S->isFileScope()); |
| 1075 | } |
| 1076 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1077 | void StmtProfiler::VisitCastExpr(const CastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1078 | VisitExpr(S); |
| 1079 | } |
| 1080 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1081 | void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1082 | VisitCastExpr(S); |
John McCall | 2536c6d | 2010-08-25 10:28:54 +0000 | [diff] [blame] | 1083 | ID.AddInteger(S->getValueKind()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1084 | } |
| 1085 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1086 | void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1087 | VisitCastExpr(S); |
| 1088 | VisitType(S->getTypeAsWritten()); |
| 1089 | } |
| 1090 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1091 | void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1092 | VisitExplicitCastExpr(S); |
| 1093 | } |
| 1094 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1095 | void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1096 | VisitExpr(S); |
| 1097 | ID.AddInteger(S->getOpcode()); |
| 1098 | } |
| 1099 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1100 | void |
| 1101 | StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1102 | VisitBinaryOperator(S); |
| 1103 | } |
| 1104 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1105 | void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1106 | VisitExpr(S); |
| 1107 | } |
| 1108 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1109 | void StmtProfiler::VisitBinaryConditionalOperator( |
Chandler Carruth | cf5f43c | 2011-06-21 23:26:32 +0000 | [diff] [blame] | 1110 | const BinaryConditionalOperator *S) { |
John McCall | c07a0c7 | 2011-02-17 10:25:35 +0000 | [diff] [blame] | 1111 | VisitExpr(S); |
| 1112 | } |
| 1113 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1114 | void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1115 | VisitExpr(S); |
Chris Lattner | c8e630e | 2011-02-17 07:39:24 +0000 | [diff] [blame] | 1116 | VisitDecl(S->getLabel()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1117 | } |
| 1118 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1119 | void StmtProfiler::VisitStmtExpr(const StmtExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1120 | VisitExpr(S); |
| 1121 | } |
| 1122 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1123 | void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1124 | VisitExpr(S); |
| 1125 | } |
| 1126 | |
Hal Finkel | c4d7c82 | 2013-09-18 03:29:45 +0000 | [diff] [blame] | 1127 | void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) { |
| 1128 | VisitExpr(S); |
| 1129 | } |
| 1130 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1131 | void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1132 | VisitExpr(S); |
| 1133 | } |
| 1134 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1135 | void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1136 | VisitExpr(S); |
| 1137 | } |
| 1138 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1139 | void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) { |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 1140 | VisitExpr(S); |
| 1141 | } |
| 1142 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1143 | void StmtProfiler::VisitInitListExpr(const InitListExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1144 | if (S->getSyntacticForm()) { |
| 1145 | VisitInitListExpr(S->getSyntacticForm()); |
| 1146 | return; |
| 1147 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1148 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1149 | VisitExpr(S); |
| 1150 | } |
| 1151 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1152 | void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1153 | VisitExpr(S); |
| 1154 | ID.AddBoolean(S->usesGNUSyntax()); |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1155 | for (const DesignatedInitExpr::Designator &D : S->designators()) { |
| 1156 | if (D.isFieldDesignator()) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1157 | ID.AddInteger(0); |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1158 | VisitName(D.getFieldName()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1159 | continue; |
| 1160 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1161 | |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1162 | if (D.isArrayDesignator()) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1163 | ID.AddInteger(1); |
| 1164 | } else { |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1165 | assert(D.isArrayRangeDesignator()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1166 | ID.AddInteger(2); |
| 1167 | } |
David Majnemer | f7e3609 | 2016-06-23 00:15:04 +0000 | [diff] [blame] | 1168 | ID.AddInteger(D.getFirstExprIndex()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1169 | } |
| 1170 | } |
| 1171 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 1172 | // Seems that if VisitInitListExpr() only works on the syntactic form of an |
| 1173 | // InitListExpr, then a DesignatedInitUpdateExpr is not encountered. |
| 1174 | void StmtProfiler::VisitDesignatedInitUpdateExpr( |
| 1175 | const DesignatedInitUpdateExpr *S) { |
| 1176 | llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of " |
| 1177 | "initializer"); |
| 1178 | } |
| 1179 | |
Richard Smith | 410306b | 2016-12-12 02:53:20 +0000 | [diff] [blame] | 1180 | void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) { |
| 1181 | VisitExpr(S); |
| 1182 | } |
| 1183 | |
| 1184 | void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) { |
| 1185 | VisitExpr(S); |
| 1186 | } |
| 1187 | |
Yunzhong Gao | cb77930 | 2015-06-10 00:27:52 +0000 | [diff] [blame] | 1188 | void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) { |
| 1189 | llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer"); |
| 1190 | } |
| 1191 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1192 | void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1193 | VisitExpr(S); |
| 1194 | } |
| 1195 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1196 | void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1197 | VisitExpr(S); |
| 1198 | VisitName(&S->getAccessor()); |
| 1199 | } |
| 1200 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1201 | void StmtProfiler::VisitBlockExpr(const BlockExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1202 | VisitExpr(S); |
| 1203 | VisitDecl(S->getBlockDecl()); |
| 1204 | } |
| 1205 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1206 | void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) { |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 1207 | VisitExpr(S); |
| 1208 | for (unsigned i = 0; i != S->getNumAssocs(); ++i) { |
| 1209 | QualType T = S->getAssocType(i); |
| 1210 | if (T.isNull()) |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1211 | ID.AddPointer(nullptr); |
Peter Collingbourne | 9114759 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 1212 | else |
| 1213 | VisitType(T); |
| 1214 | VisitExpr(S->getAssocExpr(i)); |
| 1215 | } |
| 1216 | } |
| 1217 | |
John McCall | fe96e0b | 2011-11-06 09:01:30 +0000 | [diff] [blame] | 1218 | void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) { |
| 1219 | VisitExpr(S); |
| 1220 | for (PseudoObjectExpr::const_semantics_iterator |
| 1221 | i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i) |
| 1222 | // Normally, we would not profile the source expressions of OVEs. |
| 1223 | if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i)) |
| 1224 | Visit(OVE->getSourceExpr()); |
| 1225 | } |
| 1226 | |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1227 | void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) { |
| 1228 | VisitExpr(S); |
Eli Friedman | 4b72fdd | 2011-10-14 20:59:01 +0000 | [diff] [blame] | 1229 | ID.AddInteger(S->getOp()); |
Eli Friedman | df14b3a | 2011-10-11 02:20:01 +0000 | [diff] [blame] | 1230 | } |
| 1231 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1232 | static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1233 | UnaryOperatorKind &UnaryOp, |
| 1234 | BinaryOperatorKind &BinaryOp) { |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1235 | switch (S->getOperator()) { |
| 1236 | case OO_None: |
| 1237 | case OO_New: |
| 1238 | case OO_Delete: |
| 1239 | case OO_Array_New: |
| 1240 | case OO_Array_Delete: |
| 1241 | case OO_Arrow: |
| 1242 | case OO_Call: |
| 1243 | case OO_Conditional: |
Richard Smith | 9be594e | 2015-10-22 05:12:22 +0000 | [diff] [blame] | 1244 | case OO_Coawait: |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1245 | case NUM_OVERLOADED_OPERATORS: |
| 1246 | llvm_unreachable("Invalid operator call kind"); |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1247 | |
| 1248 | case OO_Plus: |
| 1249 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1250 | UnaryOp = UO_Plus; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1251 | return Stmt::UnaryOperatorClass; |
| 1252 | } |
| 1253 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1254 | BinaryOp = BO_Add; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1255 | return Stmt::BinaryOperatorClass; |
| 1256 | |
| 1257 | case OO_Minus: |
| 1258 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1259 | UnaryOp = UO_Minus; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1260 | return Stmt::UnaryOperatorClass; |
| 1261 | } |
| 1262 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1263 | BinaryOp = BO_Sub; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1264 | return Stmt::BinaryOperatorClass; |
| 1265 | |
| 1266 | case OO_Star: |
| 1267 | if (S->getNumArgs() == 1) { |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1268 | UnaryOp = UO_Deref; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1269 | return Stmt::UnaryOperatorClass; |
| 1270 | } |
| 1271 | |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1272 | BinaryOp = BO_Mul; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1273 | return Stmt::BinaryOperatorClass; |
| 1274 | |
| 1275 | case OO_Slash: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1276 | BinaryOp = BO_Div; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1277 | return Stmt::BinaryOperatorClass; |
| 1278 | |
| 1279 | case OO_Percent: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1280 | BinaryOp = BO_Rem; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1281 | return Stmt::BinaryOperatorClass; |
| 1282 | |
| 1283 | case OO_Caret: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1284 | BinaryOp = BO_Xor; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1285 | return Stmt::BinaryOperatorClass; |
| 1286 | |
| 1287 | case OO_Amp: |
| 1288 | if (S->getNumArgs() == 1) { |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1289 | UnaryOp = UO_AddrOf; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1290 | return Stmt::UnaryOperatorClass; |
| 1291 | } |
| 1292 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1293 | BinaryOp = BO_And; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1294 | return Stmt::BinaryOperatorClass; |
| 1295 | |
| 1296 | case OO_Pipe: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1297 | BinaryOp = BO_Or; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1298 | return Stmt::BinaryOperatorClass; |
| 1299 | |
| 1300 | case OO_Tilde: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1301 | UnaryOp = UO_Not; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1302 | return Stmt::UnaryOperatorClass; |
| 1303 | |
| 1304 | case OO_Exclaim: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1305 | UnaryOp = UO_LNot; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1306 | return Stmt::UnaryOperatorClass; |
| 1307 | |
| 1308 | case OO_Equal: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1309 | BinaryOp = BO_Assign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1310 | return Stmt::BinaryOperatorClass; |
| 1311 | |
| 1312 | case OO_Less: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1313 | BinaryOp = BO_LT; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1314 | return Stmt::BinaryOperatorClass; |
| 1315 | |
| 1316 | case OO_Greater: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1317 | BinaryOp = BO_GT; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1318 | return Stmt::BinaryOperatorClass; |
| 1319 | |
| 1320 | case OO_PlusEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1321 | BinaryOp = BO_AddAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1322 | return Stmt::CompoundAssignOperatorClass; |
| 1323 | |
| 1324 | case OO_MinusEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1325 | BinaryOp = BO_SubAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1326 | return Stmt::CompoundAssignOperatorClass; |
| 1327 | |
| 1328 | case OO_StarEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1329 | BinaryOp = BO_MulAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1330 | return Stmt::CompoundAssignOperatorClass; |
| 1331 | |
| 1332 | case OO_SlashEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1333 | BinaryOp = BO_DivAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1334 | return Stmt::CompoundAssignOperatorClass; |
| 1335 | |
| 1336 | case OO_PercentEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1337 | BinaryOp = BO_RemAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1338 | return Stmt::CompoundAssignOperatorClass; |
| 1339 | |
| 1340 | case OO_CaretEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1341 | BinaryOp = BO_XorAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1342 | return Stmt::CompoundAssignOperatorClass; |
| 1343 | |
| 1344 | case OO_AmpEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1345 | BinaryOp = BO_AndAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1346 | return Stmt::CompoundAssignOperatorClass; |
| 1347 | |
| 1348 | case OO_PipeEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1349 | BinaryOp = BO_OrAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1350 | return Stmt::CompoundAssignOperatorClass; |
| 1351 | |
| 1352 | case OO_LessLess: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1353 | BinaryOp = BO_Shl; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1354 | return Stmt::BinaryOperatorClass; |
| 1355 | |
| 1356 | case OO_GreaterGreater: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1357 | BinaryOp = BO_Shr; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1358 | return Stmt::BinaryOperatorClass; |
| 1359 | |
| 1360 | case OO_LessLessEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1361 | BinaryOp = BO_ShlAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1362 | return Stmt::CompoundAssignOperatorClass; |
| 1363 | |
| 1364 | case OO_GreaterGreaterEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1365 | BinaryOp = BO_ShrAssign; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1366 | return Stmt::CompoundAssignOperatorClass; |
| 1367 | |
| 1368 | case OO_EqualEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1369 | BinaryOp = BO_EQ; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1370 | return Stmt::BinaryOperatorClass; |
| 1371 | |
| 1372 | case OO_ExclaimEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1373 | BinaryOp = BO_NE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1374 | return Stmt::BinaryOperatorClass; |
| 1375 | |
| 1376 | case OO_LessEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1377 | BinaryOp = BO_LE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1378 | return Stmt::BinaryOperatorClass; |
| 1379 | |
| 1380 | case OO_GreaterEqual: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1381 | BinaryOp = BO_GE; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1382 | return Stmt::BinaryOperatorClass; |
| 1383 | |
| 1384 | case OO_AmpAmp: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1385 | BinaryOp = BO_LAnd; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1386 | return Stmt::BinaryOperatorClass; |
| 1387 | |
| 1388 | case OO_PipePipe: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1389 | BinaryOp = BO_LOr; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1390 | return Stmt::BinaryOperatorClass; |
| 1391 | |
| 1392 | case OO_PlusPlus: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1393 | UnaryOp = S->getNumArgs() == 1? UO_PreInc |
| 1394 | : UO_PostInc; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1395 | return Stmt::UnaryOperatorClass; |
| 1396 | |
| 1397 | case OO_MinusMinus: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1398 | UnaryOp = S->getNumArgs() == 1? UO_PreDec |
| 1399 | : UO_PostDec; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1400 | return Stmt::UnaryOperatorClass; |
| 1401 | |
| 1402 | case OO_Comma: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1403 | BinaryOp = BO_Comma; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1404 | return Stmt::BinaryOperatorClass; |
| 1405 | |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1406 | case OO_ArrowStar: |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1407 | BinaryOp = BO_PtrMemI; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1408 | return Stmt::BinaryOperatorClass; |
| 1409 | |
| 1410 | case OO_Subscript: |
| 1411 | return Stmt::ArraySubscriptExprClass; |
| 1412 | } |
| 1413 | |
| 1414 | llvm_unreachable("Invalid overloaded operator expression"); |
| 1415 | } |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1416 | |
Nico Weber | f56f446 | 2017-07-24 16:54:11 +0000 | [diff] [blame] | 1417 | #if defined(_MSC_VER) |
| 1418 | #if _MSC_VER == 1911 |
| 1419 | // Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html |
| 1420 | // MSVC 2017 update 3 miscompiles this function, and a clang built with it |
| 1421 | // will crash in stage 2 of a bootstrap build. |
| 1422 | #pragma optimize("", off) |
| 1423 | #endif |
| 1424 | #endif |
| 1425 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1426 | void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) { |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1427 | if (S->isTypeDependent()) { |
| 1428 | // Type-dependent operator calls are profiled like their underlying |
| 1429 | // syntactic operator. |
Richard Smith | bac0a0d | 2016-10-24 18:47:04 +0000 | [diff] [blame] | 1430 | // |
| 1431 | // An operator call to operator-> is always implicit, so just skip it. The |
| 1432 | // enclosing MemberExpr will profile the actual member access. |
| 1433 | if (S->getOperator() == OO_Arrow) |
| 1434 | return Visit(S->getArg(0)); |
| 1435 | |
John McCall | e302792 | 2010-08-25 11:45:40 +0000 | [diff] [blame] | 1436 | UnaryOperatorKind UnaryOp = UO_Extension; |
| 1437 | BinaryOperatorKind BinaryOp = BO_Comma; |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1438 | Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp); |
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 | ID.AddInteger(SC); |
| 1441 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
| 1442 | Visit(S->getArg(I)); |
| 1443 | if (SC == Stmt::UnaryOperatorClass) |
| 1444 | ID.AddInteger(UnaryOp); |
| 1445 | else if (SC == Stmt::BinaryOperatorClass || |
| 1446 | SC == Stmt::CompoundAssignOperatorClass) |
| 1447 | ID.AddInteger(BinaryOp); |
| 1448 | else |
| 1449 | assert(SC == Stmt::ArraySubscriptExprClass); |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1450 | |
Douglas Gregor | e9ceb31 | 2010-05-19 04:13:23 +0000 | [diff] [blame] | 1451 | return; |
| 1452 | } |
Richard Smith | f15acc5 | 2014-06-05 22:43:40 +0000 | [diff] [blame] | 1453 | |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1454 | VisitCallExpr(S); |
| 1455 | ID.AddInteger(S->getOperator()); |
| 1456 | } |
| 1457 | |
Nico Weber | f56f446 | 2017-07-24 16:54:11 +0000 | [diff] [blame] | 1458 | #if defined(_MSC_VER) |
| 1459 | #if _MSC_VER == 1911 |
| 1460 | #pragma optimize("", on) |
| 1461 | #endif |
| 1462 | #endif |
| 1463 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1464 | void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1465 | VisitCallExpr(S); |
| 1466 | } |
| 1467 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1468 | void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) { |
Peter Collingbourne | 41f8546 | 2011-02-09 21:07:24 +0000 | [diff] [blame] | 1469 | VisitCallExpr(S); |
| 1470 | } |
| 1471 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1472 | void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) { |
Tanya Lattner | 55808c1 | 2011-06-04 00:47:47 +0000 | [diff] [blame] | 1473 | VisitExpr(S); |
| 1474 | } |
| 1475 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1476 | void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1477 | VisitExplicitCastExpr(S); |
| 1478 | } |
| 1479 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1480 | void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1481 | VisitCXXNamedCastExpr(S); |
| 1482 | } |
| 1483 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1484 | void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1485 | VisitCXXNamedCastExpr(S); |
| 1486 | } |
| 1487 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1488 | void |
| 1489 | StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1490 | VisitCXXNamedCastExpr(S); |
| 1491 | } |
| 1492 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1493 | void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1494 | VisitCXXNamedCastExpr(S); |
| 1495 | } |
| 1496 | |
Richard Smith | c67fdd4 | 2012-03-07 08:35:16 +0000 | [diff] [blame] | 1497 | void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) { |
| 1498 | VisitCallExpr(S); |
| 1499 | } |
| 1500 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1501 | void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1502 | VisitExpr(S); |
| 1503 | ID.AddBoolean(S->getValue()); |
| 1504 | } |
| 1505 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1506 | void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) { |
Douglas Gregor | 0004417 | 2009-07-29 16:09:57 +0000 | [diff] [blame] | 1507 | VisitExpr(S); |
| 1508 | } |
| 1509 | |
Richard Smith | cc1b96d | 2013-06-12 22:31:48 +0000 | [diff] [blame] | 1510 | void StmtProfiler::VisitCXXStdInitializerListExpr( |
| 1511 | const CXXStdInitializerListExpr *S) { |
| 1512 | VisitExpr(S); |
| 1513 | } |
| 1514 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1515 | void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1516 | VisitExpr(S); |
| 1517 | if (S->isTypeOperand()) |
David Majnemer | 143c55e | 2013-09-27 07:04:31 +0000 | [diff] [blame] | 1518 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1519 | } |
| 1520 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1521 | void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) { |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 1522 | VisitExpr(S); |
| 1523 | if (S->isTypeOperand()) |
David Majnemer | 143c55e | 2013-09-27 07:04:31 +0000 | [diff] [blame] | 1524 | VisitType(S->getTypeOperandSourceInfo()->getType()); |
Francois Pichet | 9f4f207 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 1525 | } |
| 1526 | |
John McCall | 5e77d76 | 2013-04-16 07:28:30 +0000 | [diff] [blame] | 1527 | void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) { |
| 1528 | VisitExpr(S); |
| 1529 | VisitDecl(S->getPropertyDecl()); |
| 1530 | } |
| 1531 | |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 1532 | void StmtProfiler::VisitMSPropertySubscriptExpr( |
| 1533 | const MSPropertySubscriptExpr *S) { |
| 1534 | VisitExpr(S); |
| 1535 | } |
| 1536 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1537 | void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1538 | VisitExpr(S); |
Douglas Gregor | 3024f07 | 2012-04-16 07:05:22 +0000 | [diff] [blame] | 1539 | ID.AddBoolean(S->isImplicit()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1540 | } |
| 1541 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1542 | void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1543 | VisitExpr(S); |
| 1544 | } |
| 1545 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1546 | void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1547 | VisitExpr(S); |
| 1548 | VisitDecl(S->getParam()); |
| 1549 | } |
| 1550 | |
Richard Smith | 852c9db | 2013-04-20 22:23:05 +0000 | [diff] [blame] | 1551 | void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) { |
| 1552 | VisitExpr(S); |
| 1553 | VisitDecl(S->getField()); |
| 1554 | } |
| 1555 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1556 | void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1557 | VisitExpr(S); |
| 1558 | VisitDecl( |
| 1559 | const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor())); |
| 1560 | } |
| 1561 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1562 | void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1563 | VisitExpr(S); |
| 1564 | VisitDecl(S->getConstructor()); |
| 1565 | ID.AddBoolean(S->isElidable()); |
| 1566 | } |
| 1567 | |
Richard Smith | 5179eb7 | 2016-06-28 19:03:57 +0000 | [diff] [blame] | 1568 | void StmtProfiler::VisitCXXInheritedCtorInitExpr( |
| 1569 | const CXXInheritedCtorInitExpr *S) { |
| 1570 | VisitExpr(S); |
| 1571 | VisitDecl(S->getConstructor()); |
| 1572 | } |
| 1573 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1574 | void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1575 | VisitExplicitCastExpr(S); |
| 1576 | } |
| 1577 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1578 | void |
| 1579 | StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1580 | VisitCXXConstructExpr(S); |
| 1581 | } |
| 1582 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1583 | void |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1584 | StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) { |
| 1585 | VisitExpr(S); |
| 1586 | for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(), |
| 1587 | CEnd = S->explicit_capture_end(); |
| 1588 | C != CEnd; ++C) { |
| 1589 | ID.AddInteger(C->getCaptureKind()); |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1590 | switch (C->getCaptureKind()) { |
Faisal Vali | dc6b596 | 2016-03-21 09:25:37 +0000 | [diff] [blame] | 1591 | case LCK_StarThis: |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1592 | case LCK_This: |
| 1593 | break; |
| 1594 | case LCK_ByRef: |
| 1595 | case LCK_ByCopy: |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1596 | VisitDecl(C->getCapturedVar()); |
| 1597 | ID.AddBoolean(C->isPackExpansion()); |
Richard Smith | ba71c08 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 1598 | break; |
Alexey Bataev | 39c81e2 | 2014-08-28 04:28:19 +0000 | [diff] [blame] | 1599 | case LCK_VLAType: |
| 1600 | llvm_unreachable("VLA type in explicit captures."); |
Douglas Gregor | e31e606 | 2012-02-07 10:09:13 +0000 | [diff] [blame] | 1601 | } |
| 1602 | } |
| 1603 | // Note: If we actually needed to be able to match lambda |
| 1604 | // expressions, we would have to consider parameters and return type |
| 1605 | // here, among other things. |
| 1606 | VisitStmt(S->getBody()); |
| 1607 | } |
| 1608 | |
| 1609 | void |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1610 | StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1611 | VisitExpr(S); |
| 1612 | } |
| 1613 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1614 | void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1615 | VisitExpr(S); |
| 1616 | ID.AddBoolean(S->isGlobalDelete()); |
| 1617 | ID.AddBoolean(S->isArrayForm()); |
| 1618 | VisitDecl(S->getOperatorDelete()); |
| 1619 | } |
| 1620 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1621 | void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1622 | VisitExpr(S); |
| 1623 | VisitType(S->getAllocatedType()); |
| 1624 | VisitDecl(S->getOperatorNew()); |
| 1625 | VisitDecl(S->getOperatorDelete()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1626 | ID.AddBoolean(S->isArray()); |
| 1627 | ID.AddInteger(S->getNumPlacementArgs()); |
| 1628 | ID.AddBoolean(S->isGlobalNew()); |
| 1629 | ID.AddBoolean(S->isParenTypeId()); |
Sebastian Redl | 6047f07 | 2012-02-16 12:22:20 +0000 | [diff] [blame] | 1630 | ID.AddInteger(S->getInitializationStyle()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1631 | } |
| 1632 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1633 | void |
| 1634 | StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { |
Douglas Gregor | ad8a336 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 1635 | VisitExpr(S); |
| 1636 | ID.AddBoolean(S->isArrow()); |
| 1637 | VisitNestedNameSpecifier(S->getQualifier()); |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1638 | ID.AddBoolean(S->getScopeTypeInfo() != nullptr); |
Eli Friedman | 8564139 | 2013-08-09 23:37:05 +0000 | [diff] [blame] | 1639 | if (S->getScopeTypeInfo()) |
| 1640 | VisitType(S->getScopeTypeInfo()->getType()); |
Craig Topper | 36250ad | 2014-05-12 05:36:57 +0000 | [diff] [blame] | 1641 | ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr); |
Eli Friedman | 8564139 | 2013-08-09 23:37:05 +0000 | [diff] [blame] | 1642 | if (S->getDestroyedTypeInfo()) |
| 1643 | VisitType(S->getDestroyedType()); |
| 1644 | else |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1645 | VisitIdentifierInfo(S->getDestroyedTypeIdentifier()); |
Douglas Gregor | ad8a336 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 1646 | } |
| 1647 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1648 | void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { |
Argyrios Kyrtzidis | b482eb8 | 2010-08-15 20:53:20 +0000 | [diff] [blame] | 1649 | VisitExpr(S); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1650 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1651 | VisitName(S->getName()); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1652 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1653 | if (S->hasExplicitTemplateArgs()) |
James Y Knight | 04ec5bf | 2015-12-24 02:59:37 +0000 | [diff] [blame] | 1654 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Argyrios Kyrtzidis | f450545 | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 1655 | } |
| 1656 | |
| 1657 | void |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1658 | StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) { |
Argyrios Kyrtzidis | f450545 | 2010-08-15 01:15:38 +0000 | [diff] [blame] | 1659 | VisitOverloadExpr(S); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1660 | } |
| 1661 | |
Douglas Gregor | 29c42f2 | 2012-02-24 07:38:34 +0000 | [diff] [blame] | 1662 | void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) { |
| 1663 | VisitExpr(S); |
| 1664 | ID.AddInteger(S->getTrait()); |
| 1665 | ID.AddInteger(S->getNumArgs()); |
| 1666 | for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I) |
| 1667 | VisitType(S->getArg(I)->getType()); |
| 1668 | } |
| 1669 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1670 | void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) { |
John Wiegley | 6242b6a | 2011-04-28 00:16:57 +0000 | [diff] [blame] | 1671 | VisitExpr(S); |
| 1672 | ID.AddInteger(S->getTrait()); |
| 1673 | VisitType(S->getQueriedType()); |
| 1674 | } |
| 1675 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1676 | void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) { |
John Wiegley | f9f6584 | 2011-04-25 06:54:41 +0000 | [diff] [blame] | 1677 | VisitExpr(S); |
| 1678 | ID.AddInteger(S->getTrait()); |
| 1679 | VisitExpr(S->getQueriedExpression()); |
| 1680 | } |
| 1681 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1682 | void StmtProfiler::VisitDependentScopeDeclRefExpr( |
| 1683 | const DependentScopeDeclRefExpr *S) { |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1684 | VisitExpr(S); |
| 1685 | VisitName(S->getDeclName()); |
| 1686 | VisitNestedNameSpecifier(S->getQualifier()); |
John McCall | e66edc1 | 2009-11-24 19:00:30 +0000 | [diff] [blame] | 1687 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1688 | if (S->hasExplicitTemplateArgs()) |
| 1689 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1690 | } |
| 1691 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1692 | void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1693 | VisitExpr(S); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1694 | } |
| 1695 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1696 | void StmtProfiler::VisitCXXUnresolvedConstructExpr( |
| 1697 | const CXXUnresolvedConstructExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1698 | VisitExpr(S); |
| 1699 | VisitType(S->getTypeAsWritten()); |
| 1700 | } |
| 1701 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1702 | void StmtProfiler::VisitCXXDependentScopeMemberExpr( |
| 1703 | const CXXDependentScopeMemberExpr *S) { |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1704 | ID.AddBoolean(S->isImplicitAccess()); |
| 1705 | if (!S->isImplicitAccess()) { |
| 1706 | VisitExpr(S); |
| 1707 | ID.AddBoolean(S->isArrow()); |
| 1708 | } |
Douglas Gregor | c26e0f6 | 2009-09-03 16:14:30 +0000 | [diff] [blame] | 1709 | VisitNestedNameSpecifier(S->getQualifier()); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1710 | VisitName(S->getMember()); |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1711 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1712 | if (S->hasExplicitTemplateArgs()) |
John McCall | 10eae18 | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 1713 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
| 1714 | } |
| 1715 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1716 | void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) { |
John McCall | 2d74de9 | 2009-12-01 22:10:20 +0000 | [diff] [blame] | 1717 | ID.AddBoolean(S->isImplicitAccess()); |
| 1718 | if (!S->isImplicitAccess()) { |
| 1719 | VisitExpr(S); |
| 1720 | ID.AddBoolean(S->isArrow()); |
| 1721 | } |
John McCall | 10eae18 | 2009-11-30 22:42:35 +0000 | [diff] [blame] | 1722 | VisitNestedNameSpecifier(S->getQualifier()); |
| 1723 | VisitName(S->getMemberName()); |
| 1724 | ID.AddBoolean(S->hasExplicitTemplateArgs()); |
| 1725 | if (S->hasExplicitTemplateArgs()) |
| 1726 | VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1727 | } |
| 1728 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1729 | void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) { |
Sebastian Redl | 4202c0f | 2010-09-10 20:55:43 +0000 | [diff] [blame] | 1730 | VisitExpr(S); |
| 1731 | } |
| 1732 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1733 | void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) { |
Douglas Gregor | e8e9dd6 | 2011-01-03 17:17:50 +0000 | [diff] [blame] | 1734 | VisitExpr(S); |
| 1735 | } |
| 1736 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1737 | void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) { |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1738 | VisitExpr(S); |
| 1739 | VisitDecl(S->getPack()); |
Richard Smith | d784e68 | 2015-09-23 21:41:42 +0000 | [diff] [blame] | 1740 | if (S->isPartiallySubstituted()) { |
| 1741 | auto Args = S->getPartialArguments(); |
| 1742 | ID.AddInteger(Args.size()); |
| 1743 | for (const auto &TA : Args) |
| 1744 | VisitTemplateArgument(TA); |
| 1745 | } else { |
| 1746 | ID.AddInteger(0); |
| 1747 | } |
Douglas Gregor | 820ba7b | 2011-01-04 17:33:58 +0000 | [diff] [blame] | 1748 | } |
| 1749 | |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1750 | void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr( |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1751 | const SubstNonTypeTemplateParmPackExpr *S) { |
Douglas Gregor | cdbc539 | 2011-01-15 01:15:58 +0000 | [diff] [blame] | 1752 | VisitExpr(S); |
| 1753 | VisitDecl(S->getParameterPack()); |
| 1754 | VisitTemplateArgument(S->getArgumentPack()); |
| 1755 | } |
| 1756 | |
John McCall | 7c454bb | 2011-07-15 05:09:51 +0000 | [diff] [blame] | 1757 | void StmtProfiler::VisitSubstNonTypeTemplateParmExpr( |
| 1758 | const SubstNonTypeTemplateParmExpr *E) { |
| 1759 | // Profile exactly as the replacement expression. |
| 1760 | Visit(E->getReplacement()); |
| 1761 | } |
| 1762 | |
Richard Smith | b15fe3a | 2012-09-12 00:56:43 +0000 | [diff] [blame] | 1763 | void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) { |
| 1764 | VisitExpr(S); |
| 1765 | VisitDecl(S->getParameterPack()); |
| 1766 | ID.AddInteger(S->getNumExpansions()); |
| 1767 | for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I) |
| 1768 | VisitDecl(*I); |
| 1769 | } |
| 1770 | |
Douglas Gregor | fe31481 | 2011-06-21 17:03:29 +0000 | [diff] [blame] | 1771 | void StmtProfiler::VisitMaterializeTemporaryExpr( |
| 1772 | const MaterializeTemporaryExpr *S) { |
| 1773 | VisitExpr(S); |
| 1774 | } |
| 1775 | |
Richard Smith | 0f0af19 | 2014-11-08 05:07:16 +0000 | [diff] [blame] | 1776 | void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) { |
| 1777 | VisitExpr(S); |
| 1778 | ID.AddInteger(S->getOperator()); |
| 1779 | } |
| 1780 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 1781 | void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) { |
| 1782 | VisitStmt(S); |
| 1783 | } |
| 1784 | |
| 1785 | void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) { |
| 1786 | VisitStmt(S); |
| 1787 | } |
| 1788 | |
| 1789 | void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) { |
| 1790 | VisitExpr(S); |
| 1791 | } |
| 1792 | |
Eric Fiselier | 20f25cb | 2017-03-06 23:38:15 +0000 | [diff] [blame] | 1793 | void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) { |
| 1794 | VisitExpr(S); |
| 1795 | } |
| 1796 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 1797 | void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) { |
| 1798 | VisitExpr(S); |
| 1799 | } |
| 1800 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1801 | void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { |
John McCall | 8d69a21 | 2010-11-15 23:31:06 +0000 | [diff] [blame] | 1802 | VisitExpr(E); |
| 1803 | } |
| 1804 | |
Kaelyn Takata | e1f49d5 | 2014-10-27 18:07:20 +0000 | [diff] [blame] | 1805 | void StmtProfiler::VisitTypoExpr(const TypoExpr *E) { |
| 1806 | VisitExpr(E); |
| 1807 | } |
| 1808 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1809 | void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1810 | VisitExpr(S); |
| 1811 | } |
| 1812 | |
Patrick Beard | 0caa394 | 2012-04-19 00:25:12 +0000 | [diff] [blame] | 1813 | void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1814 | VisitExpr(E); |
| 1815 | } |
| 1816 | |
| 1817 | void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) { |
| 1818 | VisitExpr(E); |
| 1819 | } |
| 1820 | |
| 1821 | void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) { |
| 1822 | VisitExpr(E); |
| 1823 | } |
| 1824 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1825 | void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1826 | VisitExpr(S); |
| 1827 | VisitType(S->getEncodedType()); |
| 1828 | } |
| 1829 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1830 | void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1831 | VisitExpr(S); |
| 1832 | VisitName(S->getSelector()); |
| 1833 | } |
| 1834 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1835 | void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1836 | VisitExpr(S); |
| 1837 | VisitDecl(S->getProtocol()); |
| 1838 | } |
| 1839 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1840 | void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1841 | VisitExpr(S); |
| 1842 | VisitDecl(S->getDecl()); |
| 1843 | ID.AddBoolean(S->isArrow()); |
| 1844 | ID.AddBoolean(S->isFreeIvar()); |
| 1845 | } |
| 1846 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1847 | void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1848 | VisitExpr(S); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1849 | if (S->isImplicitProperty()) { |
| 1850 | VisitDecl(S->getImplicitPropertyGetter()); |
| 1851 | VisitDecl(S->getImplicitPropertySetter()); |
| 1852 | } else { |
| 1853 | VisitDecl(S->getExplicitProperty()); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1854 | } |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1855 | if (S->isSuperReceiver()) { |
| 1856 | ID.AddBoolean(S->isSuperReceiver()); |
John McCall | b7bd14f | 2010-12-02 01:19:52 +0000 | [diff] [blame] | 1857 | VisitType(S->getSuperReceiverType()); |
Fariborz Jahanian | 681c075 | 2010-10-14 16:04:05 +0000 | [diff] [blame] | 1858 | } |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1859 | } |
| 1860 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1861 | void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) { |
| 1862 | VisitExpr(S); |
| 1863 | VisitDecl(S->getAtIndexMethodDecl()); |
| 1864 | VisitDecl(S->setAtIndexMethodDecl()); |
| 1865 | } |
| 1866 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1867 | void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1868 | VisitExpr(S); |
| 1869 | VisitName(S->getSelector()); |
| 1870 | VisitDecl(S->getMethodDecl()); |
| 1871 | } |
| 1872 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1873 | void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) { |
Douglas Gregor | a709509 | 2009-07-28 14:44:31 +0000 | [diff] [blame] | 1874 | VisitExpr(S); |
| 1875 | ID.AddBoolean(S->isArrow()); |
| 1876 | } |
| 1877 | |
Ted Kremenek | e65b086 | 2012-03-06 20:05:56 +0000 | [diff] [blame] | 1878 | void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) { |
| 1879 | VisitExpr(S); |
| 1880 | ID.AddBoolean(S->getValue()); |
| 1881 | } |
| 1882 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1883 | void StmtProfiler::VisitObjCIndirectCopyRestoreExpr( |
| 1884 | const ObjCIndirectCopyRestoreExpr *S) { |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1885 | VisitExpr(S); |
| 1886 | ID.AddBoolean(S->shouldCopy()); |
| 1887 | } |
| 1888 | |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1889 | void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) { |
John McCall | 31168b0 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1890 | VisitExplicitCastExpr(S); |
| 1891 | ID.AddBoolean(S->getBridgeKind()); |
| 1892 | } |
| 1893 | |
Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 1894 | void StmtProfiler::VisitObjCAvailabilityCheckExpr( |
| 1895 | const ObjCAvailabilityCheckExpr *S) { |
| 1896 | VisitExpr(S); |
| 1897 | } |
| 1898 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1899 | void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args, |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1900 | unsigned NumArgs) { |
| 1901 | ID.AddInteger(NumArgs); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1902 | for (unsigned I = 0; I != NumArgs; ++I) |
| 1903 | VisitTemplateArgument(Args[I].getArgument()); |
| 1904 | } |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1905 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1906 | void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) { |
| 1907 | // Mostly repetitive with TemplateArgument::Profile! |
| 1908 | ID.AddInteger(Arg.getKind()); |
| 1909 | switch (Arg.getKind()) { |
| 1910 | case TemplateArgument::Null: |
| 1911 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1912 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1913 | case TemplateArgument::Type: |
| 1914 | VisitType(Arg.getAsType()); |
| 1915 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1916 | |
Douglas Gregor | 9167f8b | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1917 | case TemplateArgument::Template: |
Douglas Gregor | e4ff4b5 | 2011-01-05 18:58:31 +0000 | [diff] [blame] | 1918 | case TemplateArgument::TemplateExpansion: |
| 1919 | VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); |
Douglas Gregor | 9167f8b | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 1920 | break; |
Alexis Hunt | a8136cc | 2010-05-05 15:23:54 +0000 | [diff] [blame] | 1921 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1922 | case TemplateArgument::Declaration: |
| 1923 | VisitDecl(Arg.getAsDecl()); |
| 1924 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1925 | |
Eli Friedman | b826a00 | 2012-09-26 02:36:12 +0000 | [diff] [blame] | 1926 | case TemplateArgument::NullPtr: |
| 1927 | VisitType(Arg.getNullPtrType()); |
| 1928 | break; |
| 1929 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1930 | case TemplateArgument::Integral: |
Benjamin Kramer | 6003ad5 | 2012-06-07 15:09:51 +0000 | [diff] [blame] | 1931 | Arg.getAsIntegral().Profile(ID); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1932 | VisitType(Arg.getIntegralType()); |
| 1933 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1934 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1935 | case TemplateArgument::Expression: |
| 1936 | Visit(Arg.getAsExpr()); |
| 1937 | break; |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 1938 | |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1939 | case TemplateArgument::Pack: |
Aaron Ballman | 2a89e85 | 2014-07-15 21:32:31 +0000 | [diff] [blame] | 1940 | for (const auto &P : Arg.pack_elements()) |
| 1941 | VisitTemplateArgument(P); |
John McCall | 0ad1666 | 2009-10-29 08:12:44 +0000 | [diff] [blame] | 1942 | break; |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1943 | } |
| 1944 | } |
| 1945 | |
Jay Foad | 39c7980 | 2011-01-12 09:06:06 +0000 | [diff] [blame] | 1946 | void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, |
Chandler Carruth | 631abd9 | 2011-06-16 06:47:06 +0000 | [diff] [blame] | 1947 | bool Canonical) const { |
Richard Trieu | 639d7b6 | 2017-02-22 22:22:42 +0000 | [diff] [blame] | 1948 | StmtProfilerWithPointers Profiler(ID, Context, Canonical); |
| 1949 | Profiler.Visit(this); |
| 1950 | } |
| 1951 | |
| 1952 | void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID, |
| 1953 | class ODRHash &Hash) const { |
| 1954 | StmtProfilerWithoutPointers Profiler(ID, Hash); |
Douglas Gregor | 5c193b9 | 2009-07-28 00:33:38 +0000 | [diff] [blame] | 1955 | Profiler.Visit(this); |
| 1956 | } |