clang  11.0.0git
StmtProfile.cpp
Go to the documentation of this file.
1 //===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the Stmt::Profile method, which builds a unique bit
10 // representation that identifies a statement/expression.
11 //
12 //===----------------------------------------------------------------------===//
13 #include "clang/AST/ASTContext.h"
14 #include "clang/AST/DeclCXX.h"
15 #include "clang/AST/DeclObjC.h"
16 #include "clang/AST/DeclTemplate.h"
17 #include "clang/AST/Expr.h"
18 #include "clang/AST/ExprCXX.h"
19 #include "clang/AST/ExprObjC.h"
20 #include "clang/AST/ExprOpenMP.h"
21 #include "clang/AST/ODRHash.h"
22 #include "clang/AST/OpenMPClause.h"
23 #include "clang/AST/StmtVisitor.h"
24 #include "llvm/ADT/FoldingSet.h"
25 using namespace clang;
26 
27 namespace {
28  class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
29  protected:
30  llvm::FoldingSetNodeID &ID;
31  bool Canonical;
32 
33  public:
34  StmtProfiler(llvm::FoldingSetNodeID &ID, bool Canonical)
35  : ID(ID), Canonical(Canonical) {}
36 
37  virtual ~StmtProfiler() {}
38 
39  void VisitStmt(const Stmt *S);
40 
41  virtual void HandleStmtClass(Stmt::StmtClass SC) = 0;
42 
43 #define STMT(Node, Base) void Visit##Node(const Node *S);
44 #include "clang/AST/StmtNodes.inc"
45 
46  /// Visit a declaration that is referenced within an expression
47  /// or statement.
48  virtual void VisitDecl(const Decl *D) = 0;
49 
50  /// Visit a type that is referenced within an expression or
51  /// statement.
52  virtual void VisitType(QualType T) = 0;
53 
54  /// Visit a name that occurs within an expression or statement.
55  virtual void VisitName(DeclarationName Name, bool TreatAsDecl = false) = 0;
56 
57  /// Visit identifiers that are not in Decl's or Type's.
58  virtual void VisitIdentifierInfo(IdentifierInfo *II) = 0;
59 
60  /// Visit a nested-name-specifier that occurs within an expression
61  /// or statement.
62  virtual void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) = 0;
63 
64  /// Visit a template name that occurs within an expression or
65  /// statement.
66  virtual void VisitTemplateName(TemplateName Name) = 0;
67 
68  /// Visit template arguments that occur within an expression or
69  /// statement.
70  void VisitTemplateArguments(const TemplateArgumentLoc *Args,
71  unsigned NumArgs);
72 
73  /// Visit a single template argument.
74  void VisitTemplateArgument(const TemplateArgument &Arg);
75  };
76 
77  class StmtProfilerWithPointers : public StmtProfiler {
78  const ASTContext &Context;
79 
80  public:
81  StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
82  const ASTContext &Context, bool Canonical)
83  : StmtProfiler(ID, Canonical), Context(Context) {}
84  private:
85  void HandleStmtClass(Stmt::StmtClass SC) override {
86  ID.AddInteger(SC);
87  }
88 
89  void VisitDecl(const Decl *D) override {
90  ID.AddInteger(D ? D->getKind() : 0);
91 
92  if (Canonical && D) {
93  if (const NonTypeTemplateParmDecl *NTTP =
94  dyn_cast<NonTypeTemplateParmDecl>(D)) {
95  ID.AddInteger(NTTP->getDepth());
96  ID.AddInteger(NTTP->getIndex());
97  ID.AddBoolean(NTTP->isParameterPack());
98  VisitType(NTTP->getType());
99  return;
100  }
101 
102  if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
103  // The Itanium C++ ABI uses the type, scope depth, and scope
104  // index of a parameter when mangling expressions that involve
105  // function parameters, so we will use the parameter's type for
106  // establishing function parameter identity. That way, our
107  // definition of "equivalent" (per C++ [temp.over.link]) is at
108  // least as strong as the definition of "equivalent" used for
109  // name mangling.
110  VisitType(Parm->getType());
111  ID.AddInteger(Parm->getFunctionScopeDepth());
112  ID.AddInteger(Parm->getFunctionScopeIndex());
113  return;
114  }
115 
116  if (const TemplateTypeParmDecl *TTP =
117  dyn_cast<TemplateTypeParmDecl>(D)) {
118  ID.AddInteger(TTP->getDepth());
119  ID.AddInteger(TTP->getIndex());
120  ID.AddBoolean(TTP->isParameterPack());
121  return;
122  }
123 
124  if (const TemplateTemplateParmDecl *TTP =
125  dyn_cast<TemplateTemplateParmDecl>(D)) {
126  ID.AddInteger(TTP->getDepth());
127  ID.AddInteger(TTP->getIndex());
128  ID.AddBoolean(TTP->isParameterPack());
129  return;
130  }
131  }
132 
133  ID.AddPointer(D ? D->getCanonicalDecl() : nullptr);
134  }
135 
136  void VisitType(QualType T) override {
137  if (Canonical && !T.isNull())
138  T = Context.getCanonicalType(T);
139 
140  ID.AddPointer(T.getAsOpaquePtr());
141  }
142 
143  void VisitName(DeclarationName Name, bool /*TreatAsDecl*/) override {
144  ID.AddPointer(Name.getAsOpaquePtr());
145  }
146 
147  void VisitIdentifierInfo(IdentifierInfo *II) override {
148  ID.AddPointer(II);
149  }
150 
151  void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
152  if (Canonical)
153  NNS = Context.getCanonicalNestedNameSpecifier(NNS);
154  ID.AddPointer(NNS);
155  }
156 
157  void VisitTemplateName(TemplateName Name) override {
158  if (Canonical)
159  Name = Context.getCanonicalTemplateName(Name);
160 
161  Name.Profile(ID);
162  }
163  };
164 
165  class StmtProfilerWithoutPointers : public StmtProfiler {
166  ODRHash &Hash;
167  public:
168  StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
169  : StmtProfiler(ID, false), Hash(Hash) {}
170 
171  private:
172  void HandleStmtClass(Stmt::StmtClass SC) override {
173  if (SC == Stmt::UnresolvedLookupExprClass) {
174  // Pretend that the name looked up is a Decl due to how templates
175  // handle some Decl lookups.
176  ID.AddInteger(Stmt::DeclRefExprClass);
177  } else {
178  ID.AddInteger(SC);
179  }
180  }
181 
182  void VisitType(QualType T) override {
183  Hash.AddQualType(T);
184  }
185 
186  void VisitName(DeclarationName Name, bool TreatAsDecl) override {
187  if (TreatAsDecl) {
188  // A Decl can be null, so each Decl is preceded by a boolean to
189  // store its nullness. Add a boolean here to match.
190  ID.AddBoolean(true);
191  }
192  Hash.AddDeclarationName(Name, TreatAsDecl);
193  }
194  void VisitIdentifierInfo(IdentifierInfo *II) override {
195  ID.AddBoolean(II);
196  if (II) {
197  Hash.AddIdentifierInfo(II);
198  }
199  }
200  void VisitDecl(const Decl *D) override {
201  ID.AddBoolean(D);
202  if (D) {
203  Hash.AddDecl(D);
204  }
205  }
206  void VisitTemplateName(TemplateName Name) override {
207  Hash.AddTemplateName(Name);
208  }
209  void VisitNestedNameSpecifier(NestedNameSpecifier *NNS) override {
210  ID.AddBoolean(NNS);
211  if (NNS) {
212  Hash.AddNestedNameSpecifier(NNS);
213  }
214  }
215  };
216 }
217 
218 void StmtProfiler::VisitStmt(const Stmt *S) {
219  assert(S && "Requires non-null Stmt pointer");
220 
221  HandleStmtClass(S->getStmtClass());
222 
223  for (const Stmt *SubStmt : S->children()) {
224  if (SubStmt)
225  Visit(SubStmt);
226  else
227  ID.AddInteger(0);
228  }
229 }
230 
231 void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
232  VisitStmt(S);
233  for (const auto *D : S->decls())
234  VisitDecl(D);
235 }
236 
237 void StmtProfiler::VisitNullStmt(const NullStmt *S) {
238  VisitStmt(S);
239 }
240 
241 void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
242  VisitStmt(S);
243 }
244 
245 void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
246  VisitStmt(S);
247 }
248 
249 void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
250  VisitStmt(S);
251 }
252 
253 void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
254  VisitStmt(S);
255  VisitDecl(S->getDecl());
256 }
257 
258 void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
259  VisitStmt(S);
260  // TODO: maybe visit attributes?
261 }
262 
263 void StmtProfiler::VisitIfStmt(const IfStmt *S) {
264  VisitStmt(S);
265  VisitDecl(S->getConditionVariable());
266 }
267 
268 void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
269  VisitStmt(S);
270  VisitDecl(S->getConditionVariable());
271 }
272 
273 void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
274  VisitStmt(S);
275  VisitDecl(S->getConditionVariable());
276 }
277 
278 void StmtProfiler::VisitDoStmt(const DoStmt *S) {
279  VisitStmt(S);
280 }
281 
282 void StmtProfiler::VisitForStmt(const ForStmt *S) {
283  VisitStmt(S);
284 }
285 
286 void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
287  VisitStmt(S);
288  VisitDecl(S->getLabel());
289 }
290 
291 void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
292  VisitStmt(S);
293 }
294 
295 void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
296  VisitStmt(S);
297 }
298 
299 void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
300  VisitStmt(S);
301 }
302 
303 void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
304  VisitStmt(S);
305 }
306 
307 void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
308  VisitStmt(S);
309  ID.AddBoolean(S->isVolatile());
310  ID.AddBoolean(S->isSimple());
311  VisitStringLiteral(S->getAsmString());
312  ID.AddInteger(S->getNumOutputs());
313  for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
314  ID.AddString(S->getOutputName(I));
315  VisitStringLiteral(S->getOutputConstraintLiteral(I));
316  }
317  ID.AddInteger(S->getNumInputs());
318  for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
319  ID.AddString(S->getInputName(I));
320  VisitStringLiteral(S->getInputConstraintLiteral(I));
321  }
322  ID.AddInteger(S->getNumClobbers());
323  for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
324  VisitStringLiteral(S->getClobberStringLiteral(I));
325  ID.AddInteger(S->getNumLabels());
326  for (auto *L : S->labels())
327  VisitDecl(L->getLabel());
328 }
329 
330 void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
331  // FIXME: Implement MS style inline asm statement profiler.
332  VisitStmt(S);
333 }
334 
335 void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
336  VisitStmt(S);
337  VisitType(S->getCaughtType());
338 }
339 
340 void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
341  VisitStmt(S);
342 }
343 
344 void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
345  VisitStmt(S);
346 }
347 
348 void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
349  VisitStmt(S);
350  ID.AddBoolean(S->isIfExists());
351  VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
352  VisitName(S->getNameInfo().getName());
353 }
354 
355 void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
356  VisitStmt(S);
357 }
358 
359 void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
360  VisitStmt(S);
361 }
362 
363 void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
364  VisitStmt(S);
365 }
366 
367 void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
368  VisitStmt(S);
369 }
370 
371 void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
372  VisitStmt(S);
373 }
374 
375 void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
376  VisitStmt(S);
377 }
378 
379 void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
380  VisitStmt(S);
381  ID.AddBoolean(S->hasEllipsis());
382  if (S->getCatchParamDecl())
383  VisitType(S->getCatchParamDecl()->getType());
384 }
385 
386 void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
387  VisitStmt(S);
388 }
389 
390 void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
391  VisitStmt(S);
392 }
393 
394 void
395 StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
396  VisitStmt(S);
397 }
398 
399 void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
400  VisitStmt(S);
401 }
402 
403 void
404 StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
405  VisitStmt(S);
406 }
407 
408 namespace {
409 class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
410  StmtProfiler *Profiler;
411  /// Process clauses with list of variables.
412  template <typename T>
413  void VisitOMPClauseList(T *Node);
414 
415 public:
416  OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
417 #define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
418 #include "llvm/Frontend/OpenMP/OMPKinds.def"
419  void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
420  void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
421 };
422 
423 void OMPClauseProfiler::VistOMPClauseWithPreInit(
424  const OMPClauseWithPreInit *C) {
425  if (auto *S = C->getPreInitStmt())
426  Profiler->VisitStmt(S);
427 }
428 
429 void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
430  const OMPClauseWithPostUpdate *C) {
431  VistOMPClauseWithPreInit(C);
432  if (auto *E = C->getPostUpdateExpr())
433  Profiler->VisitStmt(E);
434 }
435 
436 void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
437  VistOMPClauseWithPreInit(C);
438  if (C->getCondition())
439  Profiler->VisitStmt(C->getCondition());
440 }
441 
442 void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
443  VistOMPClauseWithPreInit(C);
444  if (C->getCondition())
445  Profiler->VisitStmt(C->getCondition());
446 }
447 
448 void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
449  VistOMPClauseWithPreInit(C);
450  if (C->getNumThreads())
451  Profiler->VisitStmt(C->getNumThreads());
452 }
453 
454 void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
455  if (C->getSafelen())
456  Profiler->VisitStmt(C->getSafelen());
457 }
458 
459 void OMPClauseProfiler::VisitOMPSimdlenClause(const OMPSimdlenClause *C) {
460  if (C->getSimdlen())
461  Profiler->VisitStmt(C->getSimdlen());
462 }
463 
464 void OMPClauseProfiler::VisitOMPAllocatorClause(const OMPAllocatorClause *C) {
465  if (C->getAllocator())
466  Profiler->VisitStmt(C->getAllocator());
467 }
468 
469 void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
470  if (C->getNumForLoops())
471  Profiler->VisitStmt(C->getNumForLoops());
472 }
473 
474 void OMPClauseProfiler::VisitOMPDetachClause(const OMPDetachClause *C) {
475  if (Expr *Evt = C->getEventHandler())
476  Profiler->VisitStmt(Evt);
477 }
478 
479 void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
480 
481 void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
482 
483 void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
484  const OMPUnifiedAddressClause *C) {}
485 
486 void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
487  const OMPUnifiedSharedMemoryClause *C) {}
488 
489 void OMPClauseProfiler::VisitOMPReverseOffloadClause(
490  const OMPReverseOffloadClause *C) {}
491 
492 void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
493  const OMPDynamicAllocatorsClause *C) {}
494 
495 void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
496  const OMPAtomicDefaultMemOrderClause *C) {}
497 
498 void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
499  VistOMPClauseWithPreInit(C);
500  if (auto *S = C->getChunkSize())
501  Profiler->VisitStmt(S);
502 }
503 
504 void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
505  if (auto *Num = C->getNumForLoops())
506  Profiler->VisitStmt(Num);
507 }
508 
509 void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
510 
511 void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
512 
513 void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
514 
515 void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
516 
517 void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
518 
519 void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
520 
521 void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
522 
523 void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
524 
525 void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
526 
527 void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {}
528 
529 void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {}
530 
531 void OMPClauseProfiler::VisitOMPRelaxedClause(const OMPRelaxedClause *) {}
532 
533 void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {}
534 
535 void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {}
536 
537 void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
538 
539 void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *) {}
540 
541 template<typename T>
542 void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
543  for (auto *E : Node->varlists()) {
544  if (E)
545  Profiler->VisitStmt(E);
546  }
547 }
548 
549 void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
550  VisitOMPClauseList(C);
551  for (auto *E : C->private_copies()) {
552  if (E)
553  Profiler->VisitStmt(E);
554  }
555 }
556 void
557 OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
558  VisitOMPClauseList(C);
559  VistOMPClauseWithPreInit(C);
560  for (auto *E : C->private_copies()) {
561  if (E)
562  Profiler->VisitStmt(E);
563  }
564  for (auto *E : C->inits()) {
565  if (E)
566  Profiler->VisitStmt(E);
567  }
568 }
569 void
570 OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
571  VisitOMPClauseList(C);
572  VistOMPClauseWithPostUpdate(C);
573  for (auto *E : C->source_exprs()) {
574  if (E)
575  Profiler->VisitStmt(E);
576  }
577  for (auto *E : C->destination_exprs()) {
578  if (E)
579  Profiler->VisitStmt(E);
580  }
581  for (auto *E : C->assignment_ops()) {
582  if (E)
583  Profiler->VisitStmt(E);
584  }
585 }
586 void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
587  VisitOMPClauseList(C);
588 }
589 void OMPClauseProfiler::VisitOMPReductionClause(
590  const OMPReductionClause *C) {
591  Profiler->VisitNestedNameSpecifier(
593  Profiler->VisitName(C->getNameInfo().getName());
594  VisitOMPClauseList(C);
595  VistOMPClauseWithPostUpdate(C);
596  for (auto *E : C->privates()) {
597  if (E)
598  Profiler->VisitStmt(E);
599  }
600  for (auto *E : C->lhs_exprs()) {
601  if (E)
602  Profiler->VisitStmt(E);
603  }
604  for (auto *E : C->rhs_exprs()) {
605  if (E)
606  Profiler->VisitStmt(E);
607  }
608  for (auto *E : C->reduction_ops()) {
609  if (E)
610  Profiler->VisitStmt(E);
611  }
612  if (C->getModifier() == clang::OMPC_REDUCTION_inscan) {
613  for (auto *E : C->copy_ops()) {
614  if (E)
615  Profiler->VisitStmt(E);
616  }
617  for (auto *E : C->copy_array_temps()) {
618  if (E)
619  Profiler->VisitStmt(E);
620  }
621  for (auto *E : C->copy_array_elems()) {
622  if (E)
623  Profiler->VisitStmt(E);
624  }
625  }
626 }
627 void OMPClauseProfiler::VisitOMPTaskReductionClause(
628  const OMPTaskReductionClause *C) {
629  Profiler->VisitNestedNameSpecifier(
631  Profiler->VisitName(C->getNameInfo().getName());
632  VisitOMPClauseList(C);
633  VistOMPClauseWithPostUpdate(C);
634  for (auto *E : C->privates()) {
635  if (E)
636  Profiler->VisitStmt(E);
637  }
638  for (auto *E : C->lhs_exprs()) {
639  if (E)
640  Profiler->VisitStmt(E);
641  }
642  for (auto *E : C->rhs_exprs()) {
643  if (E)
644  Profiler->VisitStmt(E);
645  }
646  for (auto *E : C->reduction_ops()) {
647  if (E)
648  Profiler->VisitStmt(E);
649  }
650 }
651 void OMPClauseProfiler::VisitOMPInReductionClause(
652  const OMPInReductionClause *C) {
653  Profiler->VisitNestedNameSpecifier(
655  Profiler->VisitName(C->getNameInfo().getName());
656  VisitOMPClauseList(C);
657  VistOMPClauseWithPostUpdate(C);
658  for (auto *E : C->privates()) {
659  if (E)
660  Profiler->VisitStmt(E);
661  }
662  for (auto *E : C->lhs_exprs()) {
663  if (E)
664  Profiler->VisitStmt(E);
665  }
666  for (auto *E : C->rhs_exprs()) {
667  if (E)
668  Profiler->VisitStmt(E);
669  }
670  for (auto *E : C->reduction_ops()) {
671  if (E)
672  Profiler->VisitStmt(E);
673  }
674  for (auto *E : C->taskgroup_descriptors()) {
675  if (E)
676  Profiler->VisitStmt(E);
677  }
678 }
679 void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
680  VisitOMPClauseList(C);
681  VistOMPClauseWithPostUpdate(C);
682  for (auto *E : C->privates()) {
683  if (E)
684  Profiler->VisitStmt(E);
685  }
686  for (auto *E : C->inits()) {
687  if (E)
688  Profiler->VisitStmt(E);
689  }
690  for (auto *E : C->updates()) {
691  if (E)
692  Profiler->VisitStmt(E);
693  }
694  for (auto *E : C->finals()) {
695  if (E)
696  Profiler->VisitStmt(E);
697  }
698  if (C->getStep())
699  Profiler->VisitStmt(C->getStep());
700  if (C->getCalcStep())
701  Profiler->VisitStmt(C->getCalcStep());
702 }
703 void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
704  VisitOMPClauseList(C);
705  if (C->getAlignment())
706  Profiler->VisitStmt(C->getAlignment());
707 }
708 void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
709  VisitOMPClauseList(C);
710  for (auto *E : C->source_exprs()) {
711  if (E)
712  Profiler->VisitStmt(E);
713  }
714  for (auto *E : C->destination_exprs()) {
715  if (E)
716  Profiler->VisitStmt(E);
717  }
718  for (auto *E : C->assignment_ops()) {
719  if (E)
720  Profiler->VisitStmt(E);
721  }
722 }
723 void
724 OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
725  VisitOMPClauseList(C);
726  for (auto *E : C->source_exprs()) {
727  if (E)
728  Profiler->VisitStmt(E);
729  }
730  for (auto *E : C->destination_exprs()) {
731  if (E)
732  Profiler->VisitStmt(E);
733  }
734  for (auto *E : C->assignment_ops()) {
735  if (E)
736  Profiler->VisitStmt(E);
737  }
738 }
739 void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
740  VisitOMPClauseList(C);
741 }
742 void OMPClauseProfiler::VisitOMPDepobjClause(const OMPDepobjClause *C) {
743  if (const Expr *Depobj = C->getDepobj())
744  Profiler->VisitStmt(Depobj);
745 }
746 void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
747  VisitOMPClauseList(C);
748 }
749 void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
750  if (C->getDevice())
751  Profiler->VisitStmt(C->getDevice());
752 }
753 void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
754  VisitOMPClauseList(C);
755 }
756 void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
757  if (Expr *Allocator = C->getAllocator())
758  Profiler->VisitStmt(Allocator);
759  VisitOMPClauseList(C);
760 }
761 void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
762  VistOMPClauseWithPreInit(C);
763  if (C->getNumTeams())
764  Profiler->VisitStmt(C->getNumTeams());
765 }
766 void OMPClauseProfiler::VisitOMPThreadLimitClause(
767  const OMPThreadLimitClause *C) {
768  VistOMPClauseWithPreInit(C);
769  if (C->getThreadLimit())
770  Profiler->VisitStmt(C->getThreadLimit());
771 }
772 void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
773  VistOMPClauseWithPreInit(C);
774  if (C->getPriority())
775  Profiler->VisitStmt(C->getPriority());
776 }
777 void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
778  VistOMPClauseWithPreInit(C);
779  if (C->getGrainsize())
780  Profiler->VisitStmt(C->getGrainsize());
781 }
782 void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
783  VistOMPClauseWithPreInit(C);
784  if (C->getNumTasks())
785  Profiler->VisitStmt(C->getNumTasks());
786 }
787 void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
788  if (C->getHint())
789  Profiler->VisitStmt(C->getHint());
790 }
791 void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
792  VisitOMPClauseList(C);
793 }
794 void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
795  VisitOMPClauseList(C);
796 }
797 void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
798  const OMPUseDevicePtrClause *C) {
799  VisitOMPClauseList(C);
800 }
801 void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
802  const OMPUseDeviceAddrClause *C) {
803  VisitOMPClauseList(C);
804 }
805 void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
806  const OMPIsDevicePtrClause *C) {
807  VisitOMPClauseList(C);
808 }
809 void OMPClauseProfiler::VisitOMPNontemporalClause(
810  const OMPNontemporalClause *C) {
811  VisitOMPClauseList(C);
812  for (auto *E : C->private_refs())
813  Profiler->VisitStmt(E);
814 }
815 void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
816  VisitOMPClauseList(C);
817 }
818 void OMPClauseProfiler::VisitOMPExclusiveClause(const OMPExclusiveClause *C) {
819  VisitOMPClauseList(C);
820 }
821 void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
822  const OMPUsesAllocatorsClause *C) {
823  for (unsigned I = 0, E = C->getNumberOfAllocators(); I < E; ++I) {
825  Profiler->VisitStmt(D.Allocator);
826  if (D.AllocatorTraits)
827  Profiler->VisitStmt(D.AllocatorTraits);
828  }
829 }
830 void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
831  if (const Expr *Modifier = C->getModifier())
832  Profiler->VisitStmt(Modifier);
833  for (const Expr *E : C->varlists())
834  Profiler->VisitStmt(E);
835 }
836 void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
837 } // namespace
838 
839 void
840 StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
841  VisitStmt(S);
842  OMPClauseProfiler P(this);
843  ArrayRef<OMPClause *> Clauses = S->clauses();
844  for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
845  I != E; ++I)
846  if (*I)
847  P.Visit(*I);
848 }
849 
850 void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
851  VisitOMPExecutableDirective(S);
852 }
853 
854 void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
855  VisitOMPExecutableDirective(S);
856 }
857 
858 void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
859  VisitOMPLoopDirective(S);
860 }
861 
862 void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
863  VisitOMPLoopDirective(S);
864 }
865 
866 void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
867  VisitOMPLoopDirective(S);
868 }
869 
870 void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
871  VisitOMPExecutableDirective(S);
872 }
873 
874 void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
875  VisitOMPExecutableDirective(S);
876 }
877 
878 void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
879  VisitOMPExecutableDirective(S);
880 }
881 
882 void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
883  VisitOMPExecutableDirective(S);
884 }
885 
886 void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
887  VisitOMPExecutableDirective(S);
888  VisitName(S->getDirectiveName().getName());
889 }
890 
891 void
892 StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
893  VisitOMPLoopDirective(S);
894 }
895 
896 void StmtProfiler::VisitOMPParallelForSimdDirective(
897  const OMPParallelForSimdDirective *S) {
898  VisitOMPLoopDirective(S);
899 }
900 
901 void StmtProfiler::VisitOMPParallelMasterDirective(
902  const OMPParallelMasterDirective *S) {
903  VisitOMPExecutableDirective(S);
904 }
905 
906 void StmtProfiler::VisitOMPParallelSectionsDirective(
907  const OMPParallelSectionsDirective *S) {
908  VisitOMPExecutableDirective(S);
909 }
910 
911 void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
912  VisitOMPExecutableDirective(S);
913 }
914 
915 void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
916  VisitOMPExecutableDirective(S);
917 }
918 
919 void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
920  VisitOMPExecutableDirective(S);
921 }
922 
923 void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
924  VisitOMPExecutableDirective(S);
925 }
926 
927 void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
928  VisitOMPExecutableDirective(S);
929  if (const Expr *E = S->getReductionRef())
930  VisitStmt(E);
931 }
932 
933 void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
934  VisitOMPExecutableDirective(S);
935 }
936 
937 void StmtProfiler::VisitOMPDepobjDirective(const OMPDepobjDirective *S) {
938  VisitOMPExecutableDirective(S);
939 }
940 
941 void StmtProfiler::VisitOMPScanDirective(const OMPScanDirective *S) {
942  VisitOMPExecutableDirective(S);
943 }
944 
945 void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
946  VisitOMPExecutableDirective(S);
947 }
948 
949 void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
950  VisitOMPExecutableDirective(S);
951 }
952 
953 void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
954  VisitOMPExecutableDirective(S);
955 }
956 
957 void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S) {
958  VisitOMPExecutableDirective(S);
959 }
960 
961 void StmtProfiler::VisitOMPTargetEnterDataDirective(
962  const OMPTargetEnterDataDirective *S) {
963  VisitOMPExecutableDirective(S);
964 }
965 
966 void StmtProfiler::VisitOMPTargetExitDataDirective(
967  const OMPTargetExitDataDirective *S) {
968  VisitOMPExecutableDirective(S);
969 }
970 
971 void StmtProfiler::VisitOMPTargetParallelDirective(
972  const OMPTargetParallelDirective *S) {
973  VisitOMPExecutableDirective(S);
974 }
975 
976 void StmtProfiler::VisitOMPTargetParallelForDirective(
978  VisitOMPExecutableDirective(S);
979 }
980 
981 void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
982  VisitOMPExecutableDirective(S);
983 }
984 
985 void StmtProfiler::VisitOMPCancellationPointDirective(
987  VisitOMPExecutableDirective(S);
988 }
989 
990 void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
991  VisitOMPExecutableDirective(S);
992 }
993 
994 void StmtProfiler::VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *S) {
995  VisitOMPLoopDirective(S);
996 }
997 
998 void StmtProfiler::VisitOMPTaskLoopSimdDirective(
999  const OMPTaskLoopSimdDirective *S) {
1000  VisitOMPLoopDirective(S);
1001 }
1002 
1003 void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1004  const OMPMasterTaskLoopDirective *S) {
1005  VisitOMPLoopDirective(S);
1006 }
1007 
1008 void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1009  const OMPMasterTaskLoopSimdDirective *S) {
1010  VisitOMPLoopDirective(S);
1011 }
1012 
1013 void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1015  VisitOMPLoopDirective(S);
1016 }
1017 
1018 void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1020  VisitOMPLoopDirective(S);
1021 }
1022 
1023 void StmtProfiler::VisitOMPDistributeDirective(
1024  const OMPDistributeDirective *S) {
1025  VisitOMPLoopDirective(S);
1026 }
1027 
1028 void OMPClauseProfiler::VisitOMPDistScheduleClause(
1029  const OMPDistScheduleClause *C) {
1030  VistOMPClauseWithPreInit(C);
1031  if (auto *S = C->getChunkSize())
1032  Profiler->VisitStmt(S);
1033 }
1034 
1035 void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
1036 
1037 void StmtProfiler::VisitOMPTargetUpdateDirective(
1038  const OMPTargetUpdateDirective *S) {
1039  VisitOMPExecutableDirective(S);
1040 }
1041 
1042 void StmtProfiler::VisitOMPDistributeParallelForDirective(
1044  VisitOMPLoopDirective(S);
1045 }
1046 
1047 void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1049  VisitOMPLoopDirective(S);
1050 }
1051 
1052 void StmtProfiler::VisitOMPDistributeSimdDirective(
1053  const OMPDistributeSimdDirective *S) {
1054  VisitOMPLoopDirective(S);
1055 }
1056 
1057 void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1059  VisitOMPLoopDirective(S);
1060 }
1061 
1062 void StmtProfiler::VisitOMPTargetSimdDirective(
1063  const OMPTargetSimdDirective *S) {
1064  VisitOMPLoopDirective(S);
1065 }
1066 
1067 void StmtProfiler::VisitOMPTeamsDistributeDirective(
1068  const OMPTeamsDistributeDirective *S) {
1069  VisitOMPLoopDirective(S);
1070 }
1071 
1072 void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1074  VisitOMPLoopDirective(S);
1075 }
1076 
1077 void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1079  VisitOMPLoopDirective(S);
1080 }
1081 
1082 void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1084  VisitOMPLoopDirective(S);
1085 }
1086 
1087 void StmtProfiler::VisitOMPTargetTeamsDirective(
1088  const OMPTargetTeamsDirective *S) {
1089  VisitOMPExecutableDirective(S);
1090 }
1091 
1092 void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1094  VisitOMPLoopDirective(S);
1095 }
1096 
1097 void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1099  VisitOMPLoopDirective(S);
1100 }
1101 
1102 void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1104  VisitOMPLoopDirective(S);
1105 }
1106 
1107 void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1109  VisitOMPLoopDirective(S);
1110 }
1111 
1112 void StmtProfiler::VisitExpr(const Expr *S) {
1113  VisitStmt(S);
1114 }
1115 
1116 void StmtProfiler::VisitConstantExpr(const ConstantExpr *S) {
1117  VisitExpr(S);
1118 }
1119 
1120 void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
1121  VisitExpr(S);
1122  if (!Canonical)
1123  VisitNestedNameSpecifier(S->getQualifier());
1124  VisitDecl(S->getDecl());
1125  if (!Canonical) {
1126  ID.AddBoolean(S->hasExplicitTemplateArgs());
1127  if (S->hasExplicitTemplateArgs())
1128  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1129  }
1130 }
1131 
1132 void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
1133  VisitExpr(S);
1134  ID.AddInteger(S->getIdentKind());
1135 }
1136 
1137 void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
1138  VisitExpr(S);
1139  S->getValue().Profile(ID);
1140  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1141 }
1142 
1143 void StmtProfiler::VisitFixedPointLiteral(const FixedPointLiteral *S) {
1144  VisitExpr(S);
1145  S->getValue().Profile(ID);
1146  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1147 }
1148 
1149 void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
1150  VisitExpr(S);
1151  ID.AddInteger(S->getKind());
1152  ID.AddInteger(S->getValue());
1153 }
1154 
1155 void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
1156  VisitExpr(S);
1157  S->getValue().Profile(ID);
1158  ID.AddBoolean(S->isExact());
1159  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
1160 }
1161 
1162 void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
1163  VisitExpr(S);
1164 }
1165 
1166 void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
1167  VisitExpr(S);
1168  ID.AddString(S->getBytes());
1169  ID.AddInteger(S->getKind());
1170 }
1171 
1172 void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
1173  VisitExpr(S);
1174 }
1175 
1176 void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
1177  VisitExpr(S);
1178 }
1179 
1180 void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
1181  VisitExpr(S);
1182  ID.AddInteger(S->getOpcode());
1183 }
1184 
1185 void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
1186  VisitType(S->getTypeSourceInfo()->getType());
1187  unsigned n = S->getNumComponents();
1188  for (unsigned i = 0; i < n; ++i) {
1189  const OffsetOfNode &ON = S->getComponent(i);
1190  ID.AddInteger(ON.getKind());
1191  switch (ON.getKind()) {
1192  case OffsetOfNode::Array:
1193  // Expressions handled below.
1194  break;
1195 
1196  case OffsetOfNode::Field:
1197  VisitDecl(ON.getField());
1198  break;
1199 
1201  VisitIdentifierInfo(ON.getFieldName());
1202  break;
1203 
1204  case OffsetOfNode::Base:
1205  // These nodes are implicit, and therefore don't need profiling.
1206  break;
1207  }
1208  }
1209 
1210  VisitExpr(S);
1211 }
1212 
1213 void
1214 StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
1215  VisitExpr(S);
1216  ID.AddInteger(S->getKind());
1217  if (S->isArgumentType())
1218  VisitType(S->getArgumentType());
1219 }
1220 
1221 void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
1222  VisitExpr(S);
1223 }
1224 
1225 void StmtProfiler::VisitMatrixSubscriptExpr(const MatrixSubscriptExpr *S) {
1226  VisitExpr(S);
1227 }
1228 
1229 void StmtProfiler::VisitOMPArraySectionExpr(const OMPArraySectionExpr *S) {
1230  VisitExpr(S);
1231 }
1232 
1233 void StmtProfiler::VisitOMPArrayShapingExpr(const OMPArrayShapingExpr *S) {
1234  VisitExpr(S);
1235 }
1236 
1237 void StmtProfiler::VisitOMPIteratorExpr(const OMPIteratorExpr *S) {
1238  VisitExpr(S);
1239  for (unsigned I = 0, E = S->numOfIterators(); I < E; ++I)
1240  VisitDecl(S->getIteratorDecl(I));
1241 }
1242 
1243 void StmtProfiler::VisitCallExpr(const CallExpr *S) {
1244  VisitExpr(S);
1245 }
1246 
1247 void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
1248  VisitExpr(S);
1249  VisitDecl(S->getMemberDecl());
1250  if (!Canonical)
1251  VisitNestedNameSpecifier(S->getQualifier());
1252  ID.AddBoolean(S->isArrow());
1253 }
1254 
1255 void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
1256  VisitExpr(S);
1257  ID.AddBoolean(S->isFileScope());
1258 }
1259 
1260 void StmtProfiler::VisitCastExpr(const CastExpr *S) {
1261  VisitExpr(S);
1262 }
1263 
1264 void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
1265  VisitCastExpr(S);
1266  ID.AddInteger(S->getValueKind());
1267 }
1268 
1269 void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
1270  VisitCastExpr(S);
1271  VisitType(S->getTypeAsWritten());
1272 }
1273 
1274 void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
1275  VisitExplicitCastExpr(S);
1276 }
1277 
1278 void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
1279  VisitExpr(S);
1280  ID.AddInteger(S->getOpcode());
1281 }
1282 
1283 void
1284 StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
1285  VisitBinaryOperator(S);
1286 }
1287 
1288 void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
1289  VisitExpr(S);
1290 }
1291 
1292 void StmtProfiler::VisitBinaryConditionalOperator(
1293  const BinaryConditionalOperator *S) {
1294  VisitExpr(S);
1295 }
1296 
1297 void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
1298  VisitExpr(S);
1299  VisitDecl(S->getLabel());
1300 }
1301 
1302 void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
1303  VisitExpr(S);
1304 }
1305 
1306 void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
1307  VisitExpr(S);
1308 }
1309 
1310 void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
1311  VisitExpr(S);
1312 }
1313 
1314 void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
1315  VisitExpr(S);
1316 }
1317 
1318 void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
1319  VisitExpr(S);
1320 }
1321 
1322 void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
1323  VisitExpr(S);
1324 }
1325 
1326 void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
1327  if (S->getSyntacticForm()) {
1328  VisitInitListExpr(S->getSyntacticForm());
1329  return;
1330  }
1331 
1332  VisitExpr(S);
1333 }
1334 
1335 void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
1336  VisitExpr(S);
1337  ID.AddBoolean(S->usesGNUSyntax());
1338  for (const DesignatedInitExpr::Designator &D : S->designators()) {
1339  if (D.isFieldDesignator()) {
1340  ID.AddInteger(0);
1341  VisitName(D.getFieldName());
1342  continue;
1343  }
1344 
1345  if (D.isArrayDesignator()) {
1346  ID.AddInteger(1);
1347  } else {
1348  assert(D.isArrayRangeDesignator());
1349  ID.AddInteger(2);
1350  }
1351  ID.AddInteger(D.getFirstExprIndex());
1352  }
1353 }
1354 
1355 // Seems that if VisitInitListExpr() only works on the syntactic form of an
1356 // InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
1357 void StmtProfiler::VisitDesignatedInitUpdateExpr(
1358  const DesignatedInitUpdateExpr *S) {
1359  llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
1360  "initializer");
1361 }
1362 
1363 void StmtProfiler::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *S) {
1364  VisitExpr(S);
1365 }
1366 
1367 void StmtProfiler::VisitArrayInitIndexExpr(const ArrayInitIndexExpr *S) {
1368  VisitExpr(S);
1369 }
1370 
1371 void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
1372  llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
1373 }
1374 
1375 void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
1376  VisitExpr(S);
1377 }
1378 
1379 void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
1380  VisitExpr(S);
1381  VisitName(&S->getAccessor());
1382 }
1383 
1384 void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
1385  VisitExpr(S);
1386  VisitDecl(S->getBlockDecl());
1387 }
1388 
1389 void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
1390  VisitExpr(S);
1391  for (const GenericSelectionExpr::ConstAssociation Assoc :
1392  S->associations()) {
1393  QualType T = Assoc.getType();
1394  if (T.isNull())
1395  ID.AddPointer(nullptr);
1396  else
1397  VisitType(T);
1398  VisitExpr(Assoc.getAssociationExpr());
1399  }
1400 }
1401 
1402 void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
1403  VisitExpr(S);
1405  i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
1406  // Normally, we would not profile the source expressions of OVEs.
1407  if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1408  Visit(OVE->getSourceExpr());
1409 }
1410 
1411 void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
1412  VisitExpr(S);
1413  ID.AddInteger(S->getOp());
1414 }
1415 
1416 void StmtProfiler::VisitConceptSpecializationExpr(
1417  const ConceptSpecializationExpr *S) {
1418  VisitExpr(S);
1419  VisitDecl(S->getNamedConcept());
1420  for (const TemplateArgument &Arg : S->getTemplateArguments())
1421  VisitTemplateArgument(Arg);
1422 }
1423 
1424 void StmtProfiler::VisitRequiresExpr(const RequiresExpr *S) {
1425  VisitExpr(S);
1426  ID.AddInteger(S->getLocalParameters().size());
1427  for (ParmVarDecl *LocalParam : S->getLocalParameters())
1428  VisitDecl(LocalParam);
1429  ID.AddInteger(S->getRequirements().size());
1430  for (concepts::Requirement *Req : S->getRequirements()) {
1431  if (auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1432  ID.AddInteger(concepts::Requirement::RK_Type);
1433  ID.AddBoolean(TypeReq->isSubstitutionFailure());
1434  if (!TypeReq->isSubstitutionFailure())
1435  VisitType(TypeReq->getType()->getType());
1436  } else if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1438  ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1439  if (!ExprReq->isExprSubstitutionFailure())
1440  Visit(ExprReq->getExpr());
1441  // C++2a [expr.prim.req.compound]p1 Example:
1442  // [...] The compound-requirement in C1 requires that x++ is a valid
1443  // expression. It is equivalent to the simple-requirement x++; [...]
1444  // We therefore do not profile isSimple() here.
1445  ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1447  ExprReq->getReturnTypeRequirement();
1448  if (RetReq.isEmpty()) {
1449  ID.AddInteger(0);
1450  } else if (RetReq.isTypeConstraint()) {
1451  ID.AddInteger(1);
1453  } else {
1454  assert(RetReq.isSubstitutionFailure());
1455  ID.AddInteger(2);
1456  }
1457  } else {
1459  auto *NestedReq = cast<concepts::NestedRequirement>(Req);
1460  ID.AddBoolean(NestedReq->isSubstitutionFailure());
1461  if (!NestedReq->isSubstitutionFailure())
1462  Visit(NestedReq->getConstraintExpr());
1463  }
1464  }
1465 }
1466 
1468  UnaryOperatorKind &UnaryOp,
1469  BinaryOperatorKind &BinaryOp) {
1470  switch (S->getOperator()) {
1471  case OO_None:
1472  case OO_New:
1473  case OO_Delete:
1474  case OO_Array_New:
1475  case OO_Array_Delete:
1476  case OO_Arrow:
1477  case OO_Conditional:
1479  llvm_unreachable("Invalid operator call kind");
1480 
1481  case OO_Plus:
1482  if (S->getNumArgs() == 1) {
1483  UnaryOp = UO_Plus;
1484  return Stmt::UnaryOperatorClass;
1485  }
1486 
1487  BinaryOp = BO_Add;
1488  return Stmt::BinaryOperatorClass;
1489 
1490  case OO_Minus:
1491  if (S->getNumArgs() == 1) {
1492  UnaryOp = UO_Minus;
1493  return Stmt::UnaryOperatorClass;
1494  }
1495 
1496  BinaryOp = BO_Sub;
1497  return Stmt::BinaryOperatorClass;
1498 
1499  case OO_Star:
1500  if (S->getNumArgs() == 1) {
1501  UnaryOp = UO_Deref;
1502  return Stmt::UnaryOperatorClass;
1503  }
1504 
1505  BinaryOp = BO_Mul;
1506  return Stmt::BinaryOperatorClass;
1507 
1508  case OO_Slash:
1509  BinaryOp = BO_Div;
1510  return Stmt::BinaryOperatorClass;
1511 
1512  case OO_Percent:
1513  BinaryOp = BO_Rem;
1514  return Stmt::BinaryOperatorClass;
1515 
1516  case OO_Caret:
1517  BinaryOp = BO_Xor;
1518  return Stmt::BinaryOperatorClass;
1519 
1520  case OO_Amp:
1521  if (S->getNumArgs() == 1) {
1522  UnaryOp = UO_AddrOf;
1523  return Stmt::UnaryOperatorClass;
1524  }
1525 
1526  BinaryOp = BO_And;
1527  return Stmt::BinaryOperatorClass;
1528 
1529  case OO_Pipe:
1530  BinaryOp = BO_Or;
1531  return Stmt::BinaryOperatorClass;
1532 
1533  case OO_Tilde:
1534  UnaryOp = UO_Not;
1535  return Stmt::UnaryOperatorClass;
1536 
1537  case OO_Exclaim:
1538  UnaryOp = UO_LNot;
1539  return Stmt::UnaryOperatorClass;
1540 
1541  case OO_Equal:
1542  BinaryOp = BO_Assign;
1543  return Stmt::BinaryOperatorClass;
1544 
1545  case OO_Less:
1546  BinaryOp = BO_LT;
1547  return Stmt::BinaryOperatorClass;
1548 
1549  case OO_Greater:
1550  BinaryOp = BO_GT;
1551  return Stmt::BinaryOperatorClass;
1552 
1553  case OO_PlusEqual:
1554  BinaryOp = BO_AddAssign;
1555  return Stmt::CompoundAssignOperatorClass;
1556 
1557  case OO_MinusEqual:
1558  BinaryOp = BO_SubAssign;
1559  return Stmt::CompoundAssignOperatorClass;
1560 
1561  case OO_StarEqual:
1562  BinaryOp = BO_MulAssign;
1563  return Stmt::CompoundAssignOperatorClass;
1564 
1565  case OO_SlashEqual:
1566  BinaryOp = BO_DivAssign;
1567  return Stmt::CompoundAssignOperatorClass;
1568 
1569  case OO_PercentEqual:
1570  BinaryOp = BO_RemAssign;
1571  return Stmt::CompoundAssignOperatorClass;
1572 
1573  case OO_CaretEqual:
1574  BinaryOp = BO_XorAssign;
1575  return Stmt::CompoundAssignOperatorClass;
1576 
1577  case OO_AmpEqual:
1578  BinaryOp = BO_AndAssign;
1579  return Stmt::CompoundAssignOperatorClass;
1580 
1581  case OO_PipeEqual:
1582  BinaryOp = BO_OrAssign;
1583  return Stmt::CompoundAssignOperatorClass;
1584 
1585  case OO_LessLess:
1586  BinaryOp = BO_Shl;
1587  return Stmt::BinaryOperatorClass;
1588 
1589  case OO_GreaterGreater:
1590  BinaryOp = BO_Shr;
1591  return Stmt::BinaryOperatorClass;
1592 
1593  case OO_LessLessEqual:
1594  BinaryOp = BO_ShlAssign;
1595  return Stmt::CompoundAssignOperatorClass;
1596 
1597  case OO_GreaterGreaterEqual:
1598  BinaryOp = BO_ShrAssign;
1599  return Stmt::CompoundAssignOperatorClass;
1600 
1601  case OO_EqualEqual:
1602  BinaryOp = BO_EQ;
1603  return Stmt::BinaryOperatorClass;
1604 
1605  case OO_ExclaimEqual:
1606  BinaryOp = BO_NE;
1607  return Stmt::BinaryOperatorClass;
1608 
1609  case OO_LessEqual:
1610  BinaryOp = BO_LE;
1611  return Stmt::BinaryOperatorClass;
1612 
1613  case OO_GreaterEqual:
1614  BinaryOp = BO_GE;
1615  return Stmt::BinaryOperatorClass;
1616 
1617  case OO_Spaceship:
1618  BinaryOp = BO_Cmp;
1619  return Stmt::BinaryOperatorClass;
1620 
1621  case OO_AmpAmp:
1622  BinaryOp = BO_LAnd;
1623  return Stmt::BinaryOperatorClass;
1624 
1625  case OO_PipePipe:
1626  BinaryOp = BO_LOr;
1627  return Stmt::BinaryOperatorClass;
1628 
1629  case OO_PlusPlus:
1630  UnaryOp = S->getNumArgs() == 1? UO_PreInc
1631  : UO_PostInc;
1632  return Stmt::UnaryOperatorClass;
1633 
1634  case OO_MinusMinus:
1635  UnaryOp = S->getNumArgs() == 1? UO_PreDec
1636  : UO_PostDec;
1637  return Stmt::UnaryOperatorClass;
1638 
1639  case OO_Comma:
1640  BinaryOp = BO_Comma;
1641  return Stmt::BinaryOperatorClass;
1642 
1643  case OO_ArrowStar:
1644  BinaryOp = BO_PtrMemI;
1645  return Stmt::BinaryOperatorClass;
1646 
1647  case OO_Subscript:
1648  return Stmt::ArraySubscriptExprClass;
1649 
1650  case OO_Call:
1651  return Stmt::CallExprClass;
1652 
1653  case OO_Coawait:
1654  UnaryOp = UO_Coawait;
1655  return Stmt::UnaryOperatorClass;
1656  }
1657 
1658  llvm_unreachable("Invalid overloaded operator expression");
1659 }
1660 
1661 #if defined(_MSC_VER) && !defined(__clang__)
1662 #if _MSC_VER == 1911
1663 // Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
1664 // MSVC 2017 update 3 miscompiles this function, and a clang built with it
1665 // will crash in stage 2 of a bootstrap build.
1666 #pragma optimize("", off)
1667 #endif
1668 #endif
1669 
1670 void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1671  if (S->isTypeDependent()) {
1672  // Type-dependent operator calls are profiled like their underlying
1673  // syntactic operator.
1674  //
1675  // An operator call to operator-> is always implicit, so just skip it. The
1676  // enclosing MemberExpr will profile the actual member access.
1677  if (S->getOperator() == OO_Arrow)
1678  return Visit(S->getArg(0));
1679 
1680  UnaryOperatorKind UnaryOp = UO_Extension;
1681  BinaryOperatorKind BinaryOp = BO_Comma;
1682  Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
1683 
1684  ID.AddInteger(SC);
1685  for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1686  Visit(S->getArg(I));
1687  if (SC == Stmt::UnaryOperatorClass)
1688  ID.AddInteger(UnaryOp);
1689  else if (SC == Stmt::BinaryOperatorClass ||
1690  SC == Stmt::CompoundAssignOperatorClass)
1691  ID.AddInteger(BinaryOp);
1692  else
1693  assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
1694 
1695  return;
1696  }
1697 
1698  VisitCallExpr(S);
1699  ID.AddInteger(S->getOperator());
1700 }
1701 
1702 void StmtProfiler::VisitCXXRewrittenBinaryOperator(
1703  const CXXRewrittenBinaryOperator *S) {
1704  // If a rewritten operator were ever to be type-dependent, we should profile
1705  // it following its syntactic operator.
1706  assert(!S->isTypeDependent() &&
1707  "resolved rewritten operator should never be type-dependent");
1708  ID.AddBoolean(S->isReversed());
1709  VisitExpr(S->getSemanticForm());
1710 }
1711 
1712 #if defined(_MSC_VER) && !defined(__clang__)
1713 #if _MSC_VER == 1911
1714 #pragma optimize("", on)
1715 #endif
1716 #endif
1717 
1718 void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1719  VisitCallExpr(S);
1720 }
1721 
1722 void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1723  VisitCallExpr(S);
1724 }
1725 
1726 void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1727  VisitExpr(S);
1728 }
1729 
1730 void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1731  VisitExplicitCastExpr(S);
1732 }
1733 
1734 void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1735  VisitCXXNamedCastExpr(S);
1736 }
1737 
1738 void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1739  VisitCXXNamedCastExpr(S);
1740 }
1741 
1742 void
1743 StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1744  VisitCXXNamedCastExpr(S);
1745 }
1746 
1747 void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1748  VisitCXXNamedCastExpr(S);
1749 }
1750 
1751 void StmtProfiler::VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *S) {
1752  VisitExpr(S);
1753  VisitType(S->getTypeInfoAsWritten()->getType());
1754 }
1755 
1756 void StmtProfiler::VisitCXXAddrspaceCastExpr(const CXXAddrspaceCastExpr *S) {
1757  VisitCXXNamedCastExpr(S);
1758 }
1759 
1760 void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1761  VisitCallExpr(S);
1762 }
1763 
1764 void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1765  VisitExpr(S);
1766  ID.AddBoolean(S->getValue());
1767 }
1768 
1769 void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1770  VisitExpr(S);
1771 }
1772 
1773 void StmtProfiler::VisitCXXStdInitializerListExpr(
1774  const CXXStdInitializerListExpr *S) {
1775  VisitExpr(S);
1776 }
1777 
1778 void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1779  VisitExpr(S);
1780  if (S->isTypeOperand())
1781  VisitType(S->getTypeOperandSourceInfo()->getType());
1782 }
1783 
1784 void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1785  VisitExpr(S);
1786  if (S->isTypeOperand())
1787  VisitType(S->getTypeOperandSourceInfo()->getType());
1788 }
1789 
1790 void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1791  VisitExpr(S);
1792  VisitDecl(S->getPropertyDecl());
1793 }
1794 
1795 void StmtProfiler::VisitMSPropertySubscriptExpr(
1796  const MSPropertySubscriptExpr *S) {
1797  VisitExpr(S);
1798 }
1799 
1800 void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1801  VisitExpr(S);
1802  ID.AddBoolean(S->isImplicit());
1803 }
1804 
1805 void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1806  VisitExpr(S);
1807 }
1808 
1809 void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1810  VisitExpr(S);
1811  VisitDecl(S->getParam());
1812 }
1813 
1814 void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1815  VisitExpr(S);
1816  VisitDecl(S->getField());
1817 }
1818 
1819 void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
1820  VisitExpr(S);
1821  VisitDecl(
1822  const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1823 }
1824 
1825 void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
1826  VisitExpr(S);
1827  VisitDecl(S->getConstructor());
1828  ID.AddBoolean(S->isElidable());
1829 }
1830 
1831 void StmtProfiler::VisitCXXInheritedCtorInitExpr(
1832  const CXXInheritedCtorInitExpr *S) {
1833  VisitExpr(S);
1834  VisitDecl(S->getConstructor());
1835 }
1836 
1837 void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
1838  VisitExplicitCastExpr(S);
1839 }
1840 
1841 void
1842 StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
1843  VisitCXXConstructExpr(S);
1844 }
1845 
1846 void
1847 StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1848  VisitExpr(S);
1850  CEnd = S->explicit_capture_end();
1851  C != CEnd; ++C) {
1852  if (C->capturesVLAType())
1853  continue;
1854 
1855  ID.AddInteger(C->getCaptureKind());
1856  switch (C->getCaptureKind()) {
1857  case LCK_StarThis:
1858  case LCK_This:
1859  break;
1860  case LCK_ByRef:
1861  case LCK_ByCopy:
1862  VisitDecl(C->getCapturedVar());
1863  ID.AddBoolean(C->isPackExpansion());
1864  break;
1865  case LCK_VLAType:
1866  llvm_unreachable("VLA type in explicit captures.");
1867  }
1868  }
1869  // Note: If we actually needed to be able to match lambda
1870  // expressions, we would have to consider parameters and return type
1871  // here, among other things.
1872  VisitStmt(S->getBody());
1873 }
1874 
1875 void
1876 StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
1877  VisitExpr(S);
1878 }
1879 
1880 void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
1881  VisitExpr(S);
1882  ID.AddBoolean(S->isGlobalDelete());
1883  ID.AddBoolean(S->isArrayForm());
1884  VisitDecl(S->getOperatorDelete());
1885 }
1886 
1887 void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
1888  VisitExpr(S);
1889  VisitType(S->getAllocatedType());
1890  VisitDecl(S->getOperatorNew());
1891  VisitDecl(S->getOperatorDelete());
1892  ID.AddBoolean(S->isArray());
1893  ID.AddInteger(S->getNumPlacementArgs());
1894  ID.AddBoolean(S->isGlobalNew());
1895  ID.AddBoolean(S->isParenTypeId());
1896  ID.AddInteger(S->getInitializationStyle());
1897 }
1898 
1899 void
1900 StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
1901  VisitExpr(S);
1902  ID.AddBoolean(S->isArrow());
1903  VisitNestedNameSpecifier(S->getQualifier());
1904  ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
1905  if (S->getScopeTypeInfo())
1906  VisitType(S->getScopeTypeInfo()->getType());
1907  ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
1908  if (S->getDestroyedTypeInfo())
1909  VisitType(S->getDestroyedType());
1910  else
1911  VisitIdentifierInfo(S->getDestroyedTypeIdentifier());
1912 }
1913 
1914 void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
1915  VisitExpr(S);
1916  VisitNestedNameSpecifier(S->getQualifier());
1917  VisitName(S->getName(), /*TreatAsDecl*/ true);
1918  ID.AddBoolean(S->hasExplicitTemplateArgs());
1919  if (S->hasExplicitTemplateArgs())
1920  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1921 }
1922 
1923 void
1924 StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
1925  VisitOverloadExpr(S);
1926 }
1927 
1928 void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
1929  VisitExpr(S);
1930  ID.AddInteger(S->getTrait());
1931  ID.AddInteger(S->getNumArgs());
1932  for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1933  VisitType(S->getArg(I)->getType());
1934 }
1935 
1936 void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
1937  VisitExpr(S);
1938  ID.AddInteger(S->getTrait());
1939  VisitType(S->getQueriedType());
1940 }
1941 
1942 void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
1943  VisitExpr(S);
1944  ID.AddInteger(S->getTrait());
1945  VisitExpr(S->getQueriedExpression());
1946 }
1947 
1948 void StmtProfiler::VisitDependentScopeDeclRefExpr(
1949  const DependentScopeDeclRefExpr *S) {
1950  VisitExpr(S);
1951  VisitName(S->getDeclName());
1952  VisitNestedNameSpecifier(S->getQualifier());
1953  ID.AddBoolean(S->hasExplicitTemplateArgs());
1954  if (S->hasExplicitTemplateArgs())
1955  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1956 }
1957 
1958 void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
1959  VisitExpr(S);
1960 }
1961 
1962 void StmtProfiler::VisitCXXUnresolvedConstructExpr(
1963  const CXXUnresolvedConstructExpr *S) {
1964  VisitExpr(S);
1965  VisitType(S->getTypeAsWritten());
1966  ID.AddInteger(S->isListInitialization());
1967 }
1968 
1969 void StmtProfiler::VisitCXXDependentScopeMemberExpr(
1970  const CXXDependentScopeMemberExpr *S) {
1971  ID.AddBoolean(S->isImplicitAccess());
1972  if (!S->isImplicitAccess()) {
1973  VisitExpr(S);
1974  ID.AddBoolean(S->isArrow());
1975  }
1976  VisitNestedNameSpecifier(S->getQualifier());
1977  VisitName(S->getMember());
1978  ID.AddBoolean(S->hasExplicitTemplateArgs());
1979  if (S->hasExplicitTemplateArgs())
1980  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1981 }
1982 
1983 void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
1984  ID.AddBoolean(S->isImplicitAccess());
1985  if (!S->isImplicitAccess()) {
1986  VisitExpr(S);
1987  ID.AddBoolean(S->isArrow());
1988  }
1989  VisitNestedNameSpecifier(S->getQualifier());
1990  VisitName(S->getMemberName());
1991  ID.AddBoolean(S->hasExplicitTemplateArgs());
1992  if (S->hasExplicitTemplateArgs())
1993  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1994 }
1995 
1996 void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
1997  VisitExpr(S);
1998 }
1999 
2000 void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
2001  VisitExpr(S);
2002 }
2003 
2004 void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
2005  VisitExpr(S);
2006  VisitDecl(S->getPack());
2007  if (S->isPartiallySubstituted()) {
2008  auto Args = S->getPartialArguments();
2009  ID.AddInteger(Args.size());
2010  for (const auto &TA : Args)
2011  VisitTemplateArgument(TA);
2012  } else {
2013  ID.AddInteger(0);
2014  }
2015 }
2016 
2017 void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2019  VisitExpr(S);
2020  VisitDecl(S->getParameterPack());
2021  VisitTemplateArgument(S->getArgumentPack());
2022 }
2023 
2024 void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2025  const SubstNonTypeTemplateParmExpr *E) {
2026  // Profile exactly as the replacement expression.
2027  Visit(E->getReplacement());
2028 }
2029 
2030 void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
2031  VisitExpr(S);
2032  VisitDecl(S->getParameterPack());
2033  ID.AddInteger(S->getNumExpansions());
2034  for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
2035  VisitDecl(*I);
2036 }
2037 
2038 void StmtProfiler::VisitMaterializeTemporaryExpr(
2039  const MaterializeTemporaryExpr *S) {
2040  VisitExpr(S);
2041 }
2042 
2043 void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
2044  VisitExpr(S);
2045  ID.AddInteger(S->getOperator());
2046 }
2047 
2048 void StmtProfiler::VisitCoroutineBodyStmt(const CoroutineBodyStmt *S) {
2049  VisitStmt(S);
2050 }
2051 
2052 void StmtProfiler::VisitCoreturnStmt(const CoreturnStmt *S) {
2053  VisitStmt(S);
2054 }
2055 
2056 void StmtProfiler::VisitCoawaitExpr(const CoawaitExpr *S) {
2057  VisitExpr(S);
2058 }
2059 
2060 void StmtProfiler::VisitDependentCoawaitExpr(const DependentCoawaitExpr *S) {
2061  VisitExpr(S);
2062 }
2063 
2064 void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
2065  VisitExpr(S);
2066 }
2067 
2068 void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
2069  VisitExpr(E);
2070 }
2071 
2072 void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
2073  VisitExpr(E);
2074 }
2075 
2076 void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
2077  VisitExpr(E);
2078 }
2079 
2080 void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
2081 
2082 void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
2083  VisitExpr(S);
2084 }
2085 
2086 void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2087  VisitExpr(E);
2088 }
2089 
2090 void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
2091  VisitExpr(E);
2092 }
2093 
2094 void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
2095  VisitExpr(E);
2096 }
2097 
2098 void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
2099  VisitExpr(S);
2100  VisitType(S->getEncodedType());
2101 }
2102 
2103 void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
2104  VisitExpr(S);
2105  VisitName(S->getSelector());
2106 }
2107 
2108 void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
2109  VisitExpr(S);
2110  VisitDecl(S->getProtocol());
2111 }
2112 
2113 void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
2114  VisitExpr(S);
2115  VisitDecl(S->getDecl());
2116  ID.AddBoolean(S->isArrow());
2117  ID.AddBoolean(S->isFreeIvar());
2118 }
2119 
2120 void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
2121  VisitExpr(S);
2122  if (S->isImplicitProperty()) {
2123  VisitDecl(S->getImplicitPropertyGetter());
2124  VisitDecl(S->getImplicitPropertySetter());
2125  } else {
2126  VisitDecl(S->getExplicitProperty());
2127  }
2128  if (S->isSuperReceiver()) {
2129  ID.AddBoolean(S->isSuperReceiver());
2130  VisitType(S->getSuperReceiverType());
2131  }
2132 }
2133 
2134 void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
2135  VisitExpr(S);
2136  VisitDecl(S->getAtIndexMethodDecl());
2137  VisitDecl(S->setAtIndexMethodDecl());
2138 }
2139 
2140 void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
2141  VisitExpr(S);
2142  VisitName(S->getSelector());
2143  VisitDecl(S->getMethodDecl());
2144 }
2145 
2146 void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
2147  VisitExpr(S);
2148  ID.AddBoolean(S->isArrow());
2149 }
2150 
2151 void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
2152  VisitExpr(S);
2153  ID.AddBoolean(S->getValue());
2154 }
2155 
2156 void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2157  const ObjCIndirectCopyRestoreExpr *S) {
2158  VisitExpr(S);
2159  ID.AddBoolean(S->shouldCopy());
2160 }
2161 
2162 void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
2163  VisitExplicitCastExpr(S);
2164  ID.AddBoolean(S->getBridgeKind());
2165 }
2166 
2167 void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2168  const ObjCAvailabilityCheckExpr *S) {
2169  VisitExpr(S);
2170 }
2171 
2172 void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
2173  unsigned NumArgs) {
2174  ID.AddInteger(NumArgs);
2175  for (unsigned I = 0; I != NumArgs; ++I)
2176  VisitTemplateArgument(Args[I].getArgument());
2177 }
2178 
2179 void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
2180  // Mostly repetitive with TemplateArgument::Profile!
2181  ID.AddInteger(Arg.getKind());
2182  switch (Arg.getKind()) {
2184  break;
2185 
2187  VisitType(Arg.getAsType());
2188  break;
2189 
2192  VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
2193  break;
2194 
2196  VisitDecl(Arg.getAsDecl());
2197  break;
2198 
2200  VisitType(Arg.getNullPtrType());
2201  break;
2202 
2204  Arg.getAsIntegral().Profile(ID);
2205  VisitType(Arg.getIntegralType());
2206  break;
2207 
2209  Visit(Arg.getAsExpr());
2210  break;
2211 
2213  for (const auto &P : Arg.pack_elements())
2214  VisitTemplateArgument(P);
2215  break;
2216  }
2217 }
2218 
2219 void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
2220  bool Canonical) const {
2221  StmtProfilerWithPointers Profiler(ID, Context, Canonical);
2222  Profiler.Visit(this);
2223 }
2224 
2225 void Stmt::ProcessODRHash(llvm::FoldingSetNodeID &ID,
2226  class ODRHash &Hash) const {
2227  StmtProfilerWithoutPointers Profiler(ID, Hash);
2228  Profiler.Visit(this);
2229 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1566
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:82
Represents a single C99 designator.
Definition: Expr.h:4921
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1351
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint, that is - the constraint expression that is added to the associated constraints of the enclosing declaration in practice.
Definition: ASTConcept.h:187
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5796
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3975
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1628
helper_expr_const_range copy_array_elems() const
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:1059
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:729
const CXXDestructorDecl * getDestructor() const
Definition: ExprCXX.h:1357
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition: ExprCXX.cpp:1171
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:2062
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:2912
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4727
helper_expr_const_range reduction_ops() const
This represents &#39;thread_limit&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents clause &#39;affinity&#39; in the &#39;#pragma omp task&#39;-based directives.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition: ExprCXX.h:2993
unsigned getNumInputs() const
Definition: Stmt.h:2824
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1343
helper_expr_const_range lhs_exprs() const
This represents clause &#39;copyin&#39; in the &#39;#pragma omp ...&#39; directives.
A (possibly-)qualified type.
Definition: Type.h:655
StringKind getKind() const
Definition: Expr.h:1835
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:3133
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:325
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2910
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:886
static const TemplateArgument & getArgument(const TemplateArgument &A)
Selector getSelector() const
Definition: ExprObjC.cpp:306
void AddDeclarationName(DeclarationName Name, bool TreatAsDecl=false)
Definition: ODRHash.cpp:34
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:193
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes...
OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const
Returns data for the specified allocator.
bool isSuperReceiver() const
Definition: ExprObjC.h:772
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2627
ArrayRef< ParmVarDecl * > getLocalParameters() const
Definition: ExprConcepts.h:508
VarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:4361
This represents clause &#39;use_device_addr&#39; in the &#39;#pragma omp ...&#39; directives.
This represents &#39;atomic_default_mem_order&#39; clause in the &#39;#pragma omp requires&#39; directive.
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3444
helper_expr_const_range rhs_exprs() const
private_copies_range private_copies()
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:521
Represents a &#39;co_return&#39; statement in the C++ Coroutines TS.
Definition: StmtCXX.h:456
Stmt - This represents one statement.
Definition: Stmt.h:68
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2897
This represents clause &#39;in_reduction&#39; in the &#39;#pragma omp task&#39; directives.
void AddQualType(QualType T)
Definition: ODRHash.cpp:1124
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1868
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:3251
Class that handles pre-initialization statement for some clauses, like &#39;shedule&#39;, &#39;firstprivate&#39; etc...
Definition: OpenMPClause.h:109
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:890
unsigned getNumOutputs() const
Definition: Stmt.h:2802
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1361
The template argument is an expression, and we&#39;ve not resolved it to one of the other forms yet...
Definition: TemplateBase.h:86
Expr * getAllocator() const
Returns allocator.
Definition: OpenMPClause.h:303
const StringLiteral * getAsmString() const
Definition: Stmt.h:2940
helper_expr_const_range rhs_exprs() const
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
This represents &#39;grainsize&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:4389
llvm::APFloat getValue() const
Definition: Expr.h:1606
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:713
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Definition: Expr.h:5288
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2219
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3035
This represents &#39;if&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:427
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we&#39;re testing for, along with location information.
Definition: StmtCXX.h:288
Defines the C++ template declaration subclasses.
Opcode getOpcode() const
Definition: Expr.h:3676
StringRef P
This represents &#39;#pragma omp parallel master&#39; directive.
Definition: StmtOpenMP.h:1913
Represents an attribute applied to a statement.
Definition: Stmt.h:1810
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2068
This represents implicit clause &#39;depobj&#39; for the &#39;#pragma omp depobj&#39; directive.
helper_expr_const_range assignment_ops() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:284
This represents &#39;priority&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:4541
helper_expr_const_range lhs_exprs() const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:3209
Represents Objective-C&#39;s @throw statement.
Definition: StmtObjC.h:332
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Definition: Expr.h:1331
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:64
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1426
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:841
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
Definition: Expr.h:3553
unsigned getNumberOfAllocators() const
Returns number of allocators associated with the clause.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2715
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:570
This represents &#39;update&#39; clause in the &#39;#pragma omp atomic&#39; directive.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: ExprCXX.h:2536
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:496
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1752
MS property subscript expression.
Definition: ExprCXX.h:960
IdentKind getIdentKind() const
Definition: Expr.h:1999
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:4610
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:25
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4414
Expr * getAlignment()
Returns alignment.
Expr * getNumForLoops() const
Return the number of associated for-loops.
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2824
This represents &#39;read&#39; clause in the &#39;#pragma omp atomic&#39; directive.
helper_expr_const_range assignment_ops() const
This represents clause &#39;private&#39; in the &#39;#pragma omp ...&#39; directives.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1482
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:3291
This represents &#39;num_threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:597
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2676
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:57
This represents &#39;defaultmap&#39; clause in the &#39;#pragma omp ...&#39; directive.
Expr * getEventHandler() const
Returns event-handler expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
bool isArrow() const
Definition: ExprObjC.h:1509
void * getAsOpaquePtr() const
Get the representation of this declaration name as an opaque pointer.
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2951
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:761
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2237
This represents implicit clause &#39;flush&#39; for the &#39;#pragma omp flush&#39; directive.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition: ExprCXX.h:1652
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1147
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3304
This represents &#39;reverse_offload&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2679
Represents a parameter to a function.
Definition: Decl.h:1595
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:316
StringRef getInputName(unsigned i) const
Definition: Stmt.h:3032
iterator begin() const
Definition: ExprCXX.h:4369
Expr * getGrainsize() const
Return safe iteration space distance.
This represents &#39;nogroup&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;allocator&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:267
This represents &#39;safelen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:674
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:703
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:420
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1766
Represents a C99 designated initializer expression.
Definition: Expr.h:4846
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
Definition: ExprCXX.h:302
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2556
One of these records is kept for each identifier that is lexed.
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:2360
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
Definition: Expr.h:4507
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:471
This represents &#39;#pragma omp parallel&#39; directive.
Definition: StmtOpenMP.h:357
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:4222
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:331
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:174
QualType getCaughtType() const
Definition: StmtCXX.cpp:19
This represents &#39;simd&#39; clause in the &#39;#pragma omp ...&#39; directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:72
bool isFileScope() const
Definition: Expr.h:3318
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
Definition: Expr.h:6228
This represents clause &#39;lastprivate&#39; in the &#39;#pragma omp ...&#39; directives.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]...[sn])expr.
Definition: ExprOpenMP.h:122
This represents clause &#39;allocate&#39; in the &#39;#pragma omp ...&#39; directives.
Definition: OpenMPClause.h:330
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:5144
Expr * getChunkSize()
Get chunk size.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4424
This represents clause &#39;map&#39; in the &#39;#pragma omp ...&#39; directives.
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:321
This represents clause &#39;to&#39; in the &#39;#pragma omp ...&#39; directives.
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:4113
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3771
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5724
Expr * getSafelen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:709
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:2177
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:190
This is a common base class for loop directives (&#39;omp simd&#39;, &#39;omp for&#39;, &#39;omp for simd&#39; etc...
Definition: StmtOpenMP.h:433
Expr * getNumTeams()
Return NumTeams number.
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:4264
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1677
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition: ExprCXX.h:3241
Selector getSelector() const
Definition: ExprObjC.h:468
const Expr *const * const_semantics_iterator
Definition: Expr.h:5981
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:77
This represents clause &#39;copyprivate&#39; in the &#39;#pragma omp ...&#39; directives.
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2554
Describes an C or C++ initializer list.
Definition: Expr.h:4615
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:809
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3811
bool isArrow() const
Definition: ExprObjC.h:584
This represents &#39;#pragma omp teams distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:4318
BinaryOperatorKind
AssociationTy< true > ConstAssociation
Definition: Expr.h:5600
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition: ExprCXX.h:4373
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:2444
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2399
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition: ExprCXX.cpp:1509
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1504
void AddDecl(const Decl *D)
Definition: ODRHash.cpp:630
< Capturing the *this object by copy
Definition: Lambda.h:36
bool isGlobalNew() const
Definition: ExprCXX.h:2260
LabelDecl * getDecl() const
Definition: Stmt.h:1783
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:276
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:417
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
Definition: OpenMPClause.h:133
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
Definition: ExprOpenMP.h:248
child_range children()
Definition: Stmt.cpp:224
This represents &#39;destroy&#39; clause in the &#39;#pragma omp depobj&#39; directive.
semantics_iterator semantics_end()
Definition: Expr.h:5988
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3713
static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, UnaryOperatorKind &UnaryOp, BinaryOperatorKind &BinaryOp)
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3632
This represents &#39;order&#39; clause in the &#39;#pragma omp ...&#39; directive.
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:3041
CXXForRangeStmt - This represents C++0x [stmt.ranged]&#39;s ranged for statement, represented as &#39;for (ra...
Definition: StmtCXX.h:134
bool isArrow() const
Definition: Expr.h:3234
ConceptDecl * getNamedConcept() const
Definition: ASTConcept.h:154
Class that handles post-update expression for some clauses, like &#39;lastprivate&#39;, &#39;reduction&#39; etc...
Definition: OpenMPClause.h:147
labels_range labels()
Definition: Stmt.h:3084
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:3115
This represents &#39;default&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:869
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:52
CaseStmt - Represent a case statement.
Definition: Stmt.h:1534
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6177
This represents &#39;final&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:528
This represents &#39;mergeable&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents clause &#39;inclusive&#39; in the &#39;#pragma omp scan&#39; directive.
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:3057
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition: ExprCXX.h:2957
Expr * getModifier()
Gets affinity modifier.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3361
This represents clause &#39;reduction&#39; in the &#39;#pragma omp ...&#39; directives.
FieldDecl * getField()
Get the field whose initializer will be used.
Definition: ExprCXX.h:1308
Helper class for OffsetOfExpr.
Definition: Expr.h:2296
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4247
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1378
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:3121
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:3004
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1396
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1822
Expr * AllocatorTraits
Allocator traits.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Definition: Expr.h:182
helper_expr_const_range source_exprs() const
void * getAsOpaquePtr() const
Definition: Type.h:700
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:3196
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
This represents &#39;#pragma omp scan&#39; directive.
Definition: StmtOpenMP.h:4848
This represents clause &#39;is_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
StmtClass
Definition: Stmt.h:70
helper_expr_const_range source_exprs() const
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1207
bool isExact() const
Definition: Expr.h:1639
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:897
bool isTypeOperand() const
Definition: ExprCXX.h:1052
helper_expr_const_range privates() const
This represents clause &#39;from&#39; in the &#39;#pragma omp ...&#39; directives.
Represents the this expression in C++.
Definition: ExprCXX.h:1108
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3883
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:576
void AddTemplateName(TemplateName Name)
Definition: ODRHash.cpp:138
bool isArrayForm() const
Definition: ExprCXX.h:2386
This represents clause &#39;uses_allocators&#39; in the &#39;#pragma omp target&#39;-based directives.
helper_expr_const_range reduction_ops() const
This represents &#39;#pragma omp target parallel for simd&#39; directive.
Definition: StmtOpenMP.h:4043
This represents &#39;acq_rel&#39; clause in the &#39;#pragma omp atomic|flush&#39; directives.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:3558
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:45
This represents &#39;dynamic_allocators&#39; clause in the &#39;#pragma omp requires&#39; directive.
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3970
This represents &#39;#pragma omp depobj&#39; directive.
Definition: StmtOpenMP.h:2400
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2479
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1366
QualType getQueriedType() const
Definition: ExprCXX.h:2756
This represents &#39;threads&#39; clause in the &#39;#pragma omp ...&#39; directive.
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:2269
helper_expr_const_range destination_exprs() const
Expr * getSimdlen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:775
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1498
helper_expr_const_range source_exprs() const
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:3161
This represents clause &#39;aligned&#39; in the &#39;#pragma omp ...&#39; directives.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: ExprCXX.h:3704
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2505
This represents clause &#39;task_reduction&#39; in the &#39;#pragma omp taskgroup&#39; directives.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:987
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4458
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:265
helper_expr_const_range destination_exprs() const
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.h:3601
unsigned getValue() const
Definition: Expr.h:1573
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:3685
This represents implicit clause &#39;depend&#39; for the &#39;#pragma omp task&#39; directive.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:2055
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:5049
This represents &#39;proc_bind&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:950
This represents &#39;capture&#39; clause in the &#39;#pragma omp atomic&#39; directive.
This represents one expression.
Definition: Expr.h:110
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2995
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1527
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3867
This represents &#39;simdlen&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:740
Declaration of a template type parameter.
Expr * getNumTasks() const
Return safe iteration space distance.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Definition: ExprCXX.cpp:1415
DynTypedNode Node
This represents &#39;#pragma omp master taskloop&#39; directive.
Definition: StmtOpenMP.h:3385
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7218
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1754
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:68
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:538
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5784
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2579
Stmt * getBody() const
Retrieve the body of the lambda.
Definition: ExprCXX.h:2003
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:4707
QualType getArgumentType() const
Definition: Expr.h:2547
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an &#39;->&#39; (otherwise, it used a &#39;.
Definition: ExprCXX.h:2542
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
Definition: OpenMPClause.h:387
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:3001
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:306
Represents Objective-C&#39;s @synchronized statement.
Definition: StmtObjC.h:277
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:454
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:2442
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:4088
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:68
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:5845
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
IdentifierInfo & getAccessor() const
Definition: Expr.h:5745
Represents a C++ template name within the type system.
Definition: TemplateName.h:192
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4780
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2754
helper_expr_const_range rhs_exprs() const
This represents &#39;ordered&#39; clause in the &#39;#pragma omp ...&#39; directive.
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2350
QualType getType() const
Definition: Expr.h:142
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1272
This represents &#39;relaxed&#39; clause in the &#39;#pragma omp atomic&#39; directives.
LabelDecl * getLabel() const
Definition: Stmt.h:2528
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4524
QualType getEncodedType() const
Definition: ExprObjC.h:428
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2670
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:4482
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3135
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:708
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2119
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:5080
AtomicOp getOp() const
Definition: Expr.h:6112
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:889
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4206
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2449
Expr * getDevice()
Return device number.
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:3174
This represents &#39;collapse&#39; clause in the &#39;#pragma omp ...&#39; directive.
Definition: OpenMPClause.h:806
This represents clause &#39;firstprivate&#39; in the &#39;#pragma omp ...&#39; directives.
ValueDecl * getDecl()
Definition: Expr.h:1250
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1652
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
Definition: Expr.h:3569
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:720
bool getValue() const
Definition: ExprCXX.h:703
This file defines OpenMP AST classes for clauses.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1671
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:2343
ArrayRef< concepts::Requirement * > getRequirements() const
Definition: ExprConcepts.h:514
This represents &#39;#pragma omp parallel for simd&#39; directive.
Definition: StmtOpenMP.h:1846
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:2388
This represents &#39;seq_cst&#39; clause in the &#39;#pragma omp atomic&#39; directive.
helper_expr_const_range assignment_ops() const
This represents &#39;untied&#39; clause in the &#39;#pragma omp ...&#39; directive.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3626
This represents &#39;#pragma omp parallel master taskloop&#39; directive.
Definition: StmtOpenMP.h:3533
This represents &#39;unified_address&#39; clause in the &#39;#pragma omp requires&#39; directive. ...
This represents &#39;#pragma omp target enter data&#39; directive.
Definition: StmtOpenMP.h:2765
This represents &#39;#pragma omp master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3465
This represents &#39;num_teams&#39; clause in the &#39;#pragma omp ...&#39; directive.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:456
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:1090
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:4290
#define false
Definition: stdbool.h:17
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2842
A field in a dependent type, known only by its name.
Definition: Expr.h:2305
This captures a statement into a function.
Definition: Stmt.h:3410
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1617
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2820
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5914
bool isImplicitProperty() const
Definition: ExprObjC.h:700
helper_expr_const_range taskgroup_descriptors() const
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1572
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition: ExprCXX.cpp:1167
This represents &#39;hint&#39; clause in the &#39;#pragma omp ...&#39; directive.
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
Definition: Expr.cpp:4890
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3692
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
This represents &#39;release&#39; clause in the &#39;#pragma omp atomic|flush&#39; directives.
private_copies_range private_copies()
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2101
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:610
DeclarationName getName() const
getName - Returns the embedded declaration name.
Represents a C++2a __builtin_bit_cast(T, v) expression.
Definition: ExprCXX.h:4802
This represents &#39;schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:182
void AddIdentifierInfo(const IdentifierInfo *II)
Definition: ODRHash.cpp:29
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1259
This represents clause &#39;shared&#39; in the &#39;#pragma omp ...&#39; directives.
helper_expr_const_range copy_array_temps() const
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1736
Expr * getPriority()
Return Priority number.
OpenMPLinearClauseKind Modifier
Modifier of &#39;linear&#39; clause.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents &#39;#pragma omp taskwait&#39; directive.
Definition: StmtOpenMP.h:2223
QualType getAllocatedType() const
Definition: ExprCXX.h:2194
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:6048
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2536
bool isArray() const
Definition: ExprCXX.h:2224
void Profile(llvm::FoldingSetNodeID &ID)
Definition: TemplateName.h:330
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:504
This represents &#39;detach&#39; clause in the &#39;#pragma omp task&#39; directive.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:3013
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3472
CharacterKind getKind() const
Definition: Expr.h:1566
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2648
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:842
bool isParenTypeId() const
Definition: ExprCXX.h:2254
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS)
Definition: ODRHash.cpp:109
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:302
An expression trait intrinsic.
Definition: ExprCXX.h:2785
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1346
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:145
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Definition: Stmt.cpp:993
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2457
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:4174
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:3752
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:128
bool isArgumentType() const
Definition: Expr.h:2546
unsigned numOfIterators() const
Returns number of iterator definitions.
Definition: ExprOpenMP.h:375
helper_expr_const_range lhs_exprs() const
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2221
This represents &#39;#pragma omp parallel master taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3616
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:252
OpenMPReductionClauseModifier getModifier() const
Returns modifier.
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3153
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:2268
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:355
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3879
Represents a C11 generic selection.
Definition: Expr.h:5442
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Definition: ExprCXX.h:4181
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
Definition: ExprCXX.h:320
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4129
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1625
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4332
Represents a template argument.
Definition: TemplateBase.h:51
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition: ExprCXX.h:2572
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1331
bool isTypeOperand() const
Definition: ExprCXX.h:841
Dataflow Directional Tag Classes.
This represents &#39;device&#39; clause in the &#39;#pragma omp ...&#39; directive.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isVolatile() const
Definition: Stmt.h:2789
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
Definition: Stmt.cpp:1049
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1912
UnaryOperatorKind
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2360
bool isSimple() const
Definition: Stmt.h:2786
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:112
helper_expr_const_range privates() const
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Definition: ExprCXX.h:4292
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:943
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:80
bool isImplicit() const
Definition: ExprCXX.h:1125
This represents &#39;#pragma omp section&#39; directive.
Definition: StmtOpenMP.h:1509
This represents &#39;#pragma omp teams distribute&#39; directive.
Definition: StmtOpenMP.h:4179
A runtime availability query.
Definition: ExprObjC.h:1686
VarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:4368
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:498
This represents &#39;#pragma omp simd&#39; directive.
Definition: StmtOpenMP.h:1207
Represents a &#39;co_yield&#39; expression.
Definition: ExprCXX.h:4776
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3657
The name of a declaration.
StmtClass getStmtClass() const
Definition: Stmt.h:1148
Kind getKind() const
Definition: DeclBase.h:433
const Expr * getReductionRef() const
Returns reference to the task_reduction return variable.
Definition: StmtOpenMP.h:2321
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Definition: ExprCXX.h:574
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:4012
This represents &#39;unified_shared_memory&#39; clause in the &#39;#pragma omp requires&#39; directive.
This represents clause &#39;linear&#39; in the &#39;#pragma omp ...&#39; directives.
semantics_iterator semantics_begin()
Definition: Expr.h:5982
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:277
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3535
This represents &#39;#pragma omp atomic&#39; directive.
Definition: StmtOpenMP.h:2513
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:848
llvm::APInt getValue() const
Definition: Expr.h:1433
Represents a __leave statement.
Definition: Stmt.h:3371
LabelDecl * getLabel() const
Definition: Expr.h:4152
helper_expr_const_range privates() const
iterator end() const
Definition: ExprCXX.h:4370
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3958
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2077
Capturing variable-length array type.
Definition: Lambda.h:38
Not an overloaded operator.
Definition: OperatorKinds.h:22
Represents the body of a coroutine.
Definition: StmtCXX.h:317
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:451
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2600
Represents Objective-C&#39;s collection statement.
Definition: StmtObjC.h:23
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:409
bool hasEllipsis() const
Definition: StmtObjC.h:113
helper_expr_const_range destination_exprs() const
An implicit indirection through a C++ base class, when the field found is in a base class...
Definition: Expr.h:2308
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:235
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4691
Opcode getOpcode() const
Definition: Expr.h:2161
decl_range decls()
Definition: Stmt.h:1307
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Definition: Expr.h:1811
Represents Objective-C&#39;s @finally statement.
Definition: StmtObjC.h:127
The template argument is a type.
Definition: TemplateBase.h:60
child_range private_refs()
The template argument is actually a parameter pack.
Definition: TemplateBase.h:90
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3618
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
Capturing the *this object by reference.
Definition: Lambda.h:34
This represents &#39;write&#39; clause in the &#39;#pragma omp atomic&#39; directive.
Expr * getDepobj()
Returns depobj expression associated with the clause.
unsigned getNumClobbers() const
Definition: Stmt.h:2834
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Definition: ExprCXX.h:4176
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2259
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2515
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1284
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:234
bool isFreeIvar() const
Definition: ExprObjC.h:585
QualType getSuperReceiverType() const
Definition: ExprObjC.h:763
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
Definition: Stmt.cpp:886
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3050
This represents &#39;#pragma omp target parallel&#39; directive.
Definition: StmtOpenMP.h:2882
This represents &#39;nowait&#39; clause in the &#39;#pragma omp ...&#39; directive.
ArrayRef< TemplateArgument > getTemplateArguments() const
Definition: ExprConcepts.h:94
ContinueStmt - This represents a continue.
Definition: Stmt.h:2603
Represents a loop initializing the elements of an array.
Definition: Expr.h:5235
This represents &#39;num_tasks&#39; clause in the &#39;#pragma omp ...&#39; directive.
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:76
helper_expr_const_range copy_ops() const
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:4349
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:4032
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
An index into an array.
Definition: Expr.h:2301
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1692
This represents clause &#39;exclusive&#39; in the &#39;#pragma omp scan&#39; directive.
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2260
Capturing by reference.
Definition: Lambda.h:37
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
Definition: ExprConcepts.h:40
helper_expr_const_range reduction_ops() const
Expr * getThreadLimit()
Return ThreadLimit number.
This class is used for builtin types like &#39;int&#39;.
Definition: Type.h:2504
bool shouldCopy() const
shouldCopy - True if we should do the &#39;copy&#39; part of the copy-restore.
Definition: ExprObjC.h:1594
This represents &#39;acquire&#39; clause in the &#39;#pragma omp atomic|flush&#39; directives.
Represents Objective-C&#39;s @try ... @catch ... @finally statement.
Definition: StmtObjC.h:165
bool isGlobalDelete() const
Definition: ExprCXX.h:2385
This represents &#39;#pragma omp taskloop simd&#39; directive.
Definition: StmtOpenMP.h:3318
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1720
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2756
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Definition: Expr.h:2678
This represents &#39;dist_schedule&#39; clause in the &#39;#pragma omp ...&#39; directive.
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:994
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:363
This represents &#39;#pragma omp sections&#39; directive.
Definition: StmtOpenMP.h:1427
Expr * getHint() const
Returns number of threads.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:88
unsigned getNumComponents() const
Definition: Expr.h:2459
This represents &#39;#pragma omp target data&#39; directive.
Definition: StmtOpenMP.h:2707
const ParmVarDecl * getParam() const
Definition: ExprCXX.h:1242
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:258
Data for list of allocators.
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:284
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1178
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
BreakStmt - This represents a break.
Definition: Stmt.h:2633
Expr * getChunkSize()
Get chunk size.
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:97
unsigned getNumLabels() const
Definition: Stmt.h:3061
Expr * getNumThreads() const
Returns number of threads.
Definition: OpenMPClause.h:642
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:3425
QualType getType() const
Definition: Decl.h:630
This represents &#39;#pragma omp taskyield&#39; directive.
Definition: StmtOpenMP.h:2131
This represents &#39;#pragma omp distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3906
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:691
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition: Expr.h:1277
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2400
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2822
This represents &#39;#pragma omp parallel sections&#39; directive.
Definition: StmtOpenMP.h:1977
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:1022
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:3258
const Expr * getPostUpdateExpr() const
Get post-update expression for the clause.
Definition: OpenMPClause.h:163
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:289
BinaryOperatorKind getOperator() const
Definition: ExprCXX.h:4569
This represents clause &#39;nontemporal&#39; in the &#39;#pragma omp ...&#39; directives.
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:4159
Represents Objective-C&#39;s @autoreleasepool Statement.
Definition: StmtObjC.h:368
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4769
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:5324
This represents &#39;#pragma omp target parallel for&#39; directive.
Definition: StmtOpenMP.h:2964
This represents clause &#39;use_device_ptr&#39; in the &#39;#pragma omp ...&#39; directives.
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6384
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition: ExprCXX.h:2666
association_range associations()
Definition: Expr.h:5669
This represents &#39;#pragma omp taskloop&#39; directive.
Definition: StmtOpenMP.h:3240