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