clang  3.7.0
StmtProfile.cpp
Go to the documentation of this file.
1 //===---- StmtProfile.cpp - Profile implementation for Stmt ASTs ----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Stmt::Profile method, which builds a unique bit
11 // representation that identifies a statement/expression.
12 //
13 //===----------------------------------------------------------------------===//
14 #include "clang/AST/ASTContext.h"
15 #include "clang/AST/DeclCXX.h"
16 #include "clang/AST/DeclObjC.h"
17 #include "clang/AST/DeclTemplate.h"
18 #include "clang/AST/Expr.h"
19 #include "clang/AST/ExprCXX.h"
20 #include "clang/AST/ExprObjC.h"
21 #include "clang/AST/StmtVisitor.h"
22 #include "llvm/ADT/FoldingSet.h"
23 using namespace clang;
24 
25 namespace {
26  class StmtProfiler : public ConstStmtVisitor<StmtProfiler> {
27  llvm::FoldingSetNodeID &ID;
28  const ASTContext &Context;
29  bool Canonical;
30 
31  public:
32  StmtProfiler(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
33  bool Canonical)
34  : ID(ID), Context(Context), Canonical(Canonical) { }
35 
36  void VisitStmt(const Stmt *S);
37 
38 #define STMT(Node, Base) void Visit##Node(const Node *S);
39 #include "clang/AST/StmtNodes.inc"
40 
41  /// \brief Visit a declaration that is referenced within an expression
42  /// or statement.
43  void VisitDecl(const Decl *D);
44 
45  /// \brief Visit a type that is referenced within an expression or
46  /// statement.
47  void VisitType(QualType T);
48 
49  /// \brief Visit a name that occurs within an expression or statement.
50  void VisitName(DeclarationName Name);
51 
52  /// \brief Visit a nested-name-specifier that occurs within an expression
53  /// or statement.
54  void VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
55 
56  /// \brief Visit a template name that occurs within an expression or
57  /// statement.
58  void VisitTemplateName(TemplateName Name);
59 
60  /// \brief Visit template arguments that occur within an expression or
61  /// statement.
62  void VisitTemplateArguments(const TemplateArgumentLoc *Args,
63  unsigned NumArgs);
64 
65  /// \brief Visit a single template argument.
66  void VisitTemplateArgument(const TemplateArgument &Arg);
67  };
68 }
69 
70 void StmtProfiler::VisitStmt(const Stmt *S) {
71  ID.AddInteger(S->getStmtClass());
72  for (const Stmt *SubStmt : S->children()) {
73  if (SubStmt)
74  Visit(SubStmt);
75  else
76  ID.AddInteger(0);
77  }
78 }
79 
80 void StmtProfiler::VisitDeclStmt(const DeclStmt *S) {
81  VisitStmt(S);
82  for (const auto *D : S->decls())
83  VisitDecl(D);
84 }
85 
86 void StmtProfiler::VisitNullStmt(const NullStmt *S) {
87  VisitStmt(S);
88 }
89 
90 void StmtProfiler::VisitCompoundStmt(const CompoundStmt *S) {
91  VisitStmt(S);
92 }
93 
94 void StmtProfiler::VisitSwitchCase(const SwitchCase *S) {
95  VisitStmt(S);
96 }
97 
98 void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
99  VisitStmt(S);
100 }
101 
102 void StmtProfiler::VisitDefaultStmt(const DefaultStmt *S) {
103  VisitStmt(S);
104 }
105 
106 void StmtProfiler::VisitLabelStmt(const LabelStmt *S) {
107  VisitStmt(S);
108  VisitDecl(S->getDecl());
109 }
110 
111 void StmtProfiler::VisitAttributedStmt(const AttributedStmt *S) {
112  VisitStmt(S);
113  // TODO: maybe visit attributes?
114 }
115 
116 void StmtProfiler::VisitIfStmt(const IfStmt *S) {
117  VisitStmt(S);
118  VisitDecl(S->getConditionVariable());
119 }
120 
121 void StmtProfiler::VisitSwitchStmt(const SwitchStmt *S) {
122  VisitStmt(S);
123  VisitDecl(S->getConditionVariable());
124 }
125 
126 void StmtProfiler::VisitWhileStmt(const WhileStmt *S) {
127  VisitStmt(S);
128  VisitDecl(S->getConditionVariable());
129 }
130 
131 void StmtProfiler::VisitDoStmt(const DoStmt *S) {
132  VisitStmt(S);
133 }
134 
135 void StmtProfiler::VisitForStmt(const ForStmt *S) {
136  VisitStmt(S);
137 }
138 
139 void StmtProfiler::VisitGotoStmt(const GotoStmt *S) {
140  VisitStmt(S);
141  VisitDecl(S->getLabel());
142 }
143 
144 void StmtProfiler::VisitIndirectGotoStmt(const IndirectGotoStmt *S) {
145  VisitStmt(S);
146 }
147 
148 void StmtProfiler::VisitContinueStmt(const ContinueStmt *S) {
149  VisitStmt(S);
150 }
151 
152 void StmtProfiler::VisitBreakStmt(const BreakStmt *S) {
153  VisitStmt(S);
154 }
155 
156 void StmtProfiler::VisitReturnStmt(const ReturnStmt *S) {
157  VisitStmt(S);
158 }
159 
160 void StmtProfiler::VisitGCCAsmStmt(const GCCAsmStmt *S) {
161  VisitStmt(S);
162  ID.AddBoolean(S->isVolatile());
163  ID.AddBoolean(S->isSimple());
164  VisitStringLiteral(S->getAsmString());
165  ID.AddInteger(S->getNumOutputs());
166  for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
167  ID.AddString(S->getOutputName(I));
168  VisitStringLiteral(S->getOutputConstraintLiteral(I));
169  }
170  ID.AddInteger(S->getNumInputs());
171  for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
172  ID.AddString(S->getInputName(I));
173  VisitStringLiteral(S->getInputConstraintLiteral(I));
174  }
175  ID.AddInteger(S->getNumClobbers());
176  for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
177  VisitStringLiteral(S->getClobberStringLiteral(I));
178 }
179 
180 void StmtProfiler::VisitMSAsmStmt(const MSAsmStmt *S) {
181  // FIXME: Implement MS style inline asm statement profiler.
182  VisitStmt(S);
183 }
184 
185 void StmtProfiler::VisitCXXCatchStmt(const CXXCatchStmt *S) {
186  VisitStmt(S);
187  VisitType(S->getCaughtType());
188 }
189 
190 void StmtProfiler::VisitCXXTryStmt(const CXXTryStmt *S) {
191  VisitStmt(S);
192 }
193 
194 void StmtProfiler::VisitCXXForRangeStmt(const CXXForRangeStmt *S) {
195  VisitStmt(S);
196 }
197 
198 void StmtProfiler::VisitMSDependentExistsStmt(const MSDependentExistsStmt *S) {
199  VisitStmt(S);
200  ID.AddBoolean(S->isIfExists());
201  VisitNestedNameSpecifier(S->getQualifierLoc().getNestedNameSpecifier());
202  VisitName(S->getNameInfo().getName());
203 }
204 
205 void StmtProfiler::VisitSEHTryStmt(const SEHTryStmt *S) {
206  VisitStmt(S);
207 }
208 
209 void StmtProfiler::VisitSEHFinallyStmt(const SEHFinallyStmt *S) {
210  VisitStmt(S);
211 }
212 
213 void StmtProfiler::VisitSEHExceptStmt(const SEHExceptStmt *S) {
214  VisitStmt(S);
215 }
216 
217 void StmtProfiler::VisitSEHLeaveStmt(const SEHLeaveStmt *S) {
218  VisitStmt(S);
219 }
220 
221 void StmtProfiler::VisitCapturedStmt(const CapturedStmt *S) {
222  VisitStmt(S);
223 }
224 
225 void StmtProfiler::VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S) {
226  VisitStmt(S);
227 }
228 
229 void StmtProfiler::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *S) {
230  VisitStmt(S);
231  ID.AddBoolean(S->hasEllipsis());
232  if (S->getCatchParamDecl())
233  VisitType(S->getCatchParamDecl()->getType());
234 }
235 
236 void StmtProfiler::VisitObjCAtFinallyStmt(const ObjCAtFinallyStmt *S) {
237  VisitStmt(S);
238 }
239 
240 void StmtProfiler::VisitObjCAtTryStmt(const ObjCAtTryStmt *S) {
241  VisitStmt(S);
242 }
243 
244 void
245 StmtProfiler::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S) {
246  VisitStmt(S);
247 }
248 
249 void StmtProfiler::VisitObjCAtThrowStmt(const ObjCAtThrowStmt *S) {
250  VisitStmt(S);
251 }
252 
253 void
254 StmtProfiler::VisitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt *S) {
255  VisitStmt(S);
256 }
257 
258 namespace {
259 class OMPClauseProfiler : public ConstOMPClauseVisitor<OMPClauseProfiler> {
260  StmtProfiler *Profiler;
261  /// \brief Process clauses with list of variables.
262  template <typename T>
263  void VisitOMPClauseList(T *Node);
264 public:
265  OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
266 #define OPENMP_CLAUSE(Name, Class) \
267  void Visit##Class(const Class *C);
268 #include "clang/Basic/OpenMPKinds.def"
269 };
270 
271 void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
272  if (C->getCondition())
273  Profiler->VisitStmt(C->getCondition());
274 }
275 
276 void OMPClauseProfiler::VisitOMPFinalClause(const OMPFinalClause *C) {
277  if (C->getCondition())
278  Profiler->VisitStmt(C->getCondition());
279 }
280 
281 void OMPClauseProfiler::VisitOMPNumThreadsClause(const OMPNumThreadsClause *C) {
282  if (C->getNumThreads())
283  Profiler->VisitStmt(C->getNumThreads());
284 }
285 
286 void OMPClauseProfiler::VisitOMPSafelenClause(const OMPSafelenClause *C) {
287  if (C->getSafelen())
288  Profiler->VisitStmt(C->getSafelen());
289 }
290 
291 void OMPClauseProfiler::VisitOMPCollapseClause(const OMPCollapseClause *C) {
292  if (C->getNumForLoops())
293  Profiler->VisitStmt(C->getNumForLoops());
294 }
295 
296 void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
297 
298 void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
299 
300 void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
301  if (C->getChunkSize()) {
302  Profiler->VisitStmt(C->getChunkSize());
303  if (C->getHelperChunkSize()) {
304  Profiler->VisitStmt(C->getChunkSize());
305  }
306  }
307 }
308 
309 void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *) {}
310 
311 void OMPClauseProfiler::VisitOMPNowaitClause(const OMPNowaitClause *) {}
312 
313 void OMPClauseProfiler::VisitOMPUntiedClause(const OMPUntiedClause *) {}
314 
315 void OMPClauseProfiler::VisitOMPMergeableClause(const OMPMergeableClause *) {}
316 
317 void OMPClauseProfiler::VisitOMPReadClause(const OMPReadClause *) {}
318 
319 void OMPClauseProfiler::VisitOMPWriteClause(const OMPWriteClause *) {}
320 
321 void OMPClauseProfiler::VisitOMPUpdateClause(const OMPUpdateClause *) {}
322 
323 void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
324 
325 void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
326 
327 template<typename T>
328 void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
329  for (auto *E : Node->varlists()) {
330  Profiler->VisitStmt(E);
331  }
332 }
333 
334 void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
335  VisitOMPClauseList(C);
336  for (auto *E : C->private_copies()) {
337  Profiler->VisitStmt(E);
338  }
339 }
340 void
341 OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
342  VisitOMPClauseList(C);
343  for (auto *E : C->private_copies()) {
344  Profiler->VisitStmt(E);
345  }
346  for (auto *E : C->inits()) {
347  Profiler->VisitStmt(E);
348  }
349 }
350 void
351 OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
352  VisitOMPClauseList(C);
353  for (auto *E : C->source_exprs()) {
354  Profiler->VisitStmt(E);
355  }
356  for (auto *E : C->destination_exprs()) {
357  Profiler->VisitStmt(E);
358  }
359  for (auto *E : C->assignment_ops()) {
360  Profiler->VisitStmt(E);
361  }
362 }
363 void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
364  VisitOMPClauseList(C);
365 }
366 void OMPClauseProfiler::VisitOMPReductionClause(
367  const OMPReductionClause *C) {
368  Profiler->VisitNestedNameSpecifier(
370  Profiler->VisitName(C->getNameInfo().getName());
371  VisitOMPClauseList(C);
372  for (auto *E : C->lhs_exprs()) {
373  Profiler->VisitStmt(E);
374  }
375  for (auto *E : C->rhs_exprs()) {
376  Profiler->VisitStmt(E);
377  }
378  for (auto *E : C->reduction_ops()) {
379  Profiler->VisitStmt(E);
380  }
381 }
382 void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
383  VisitOMPClauseList(C);
384  for (auto *E : C->inits()) {
385  Profiler->VisitStmt(E);
386  }
387  for (auto *E : C->updates()) {
388  Profiler->VisitStmt(E);
389  }
390  for (auto *E : C->finals()) {
391  Profiler->VisitStmt(E);
392  }
393  Profiler->VisitStmt(C->getStep());
394  Profiler->VisitStmt(C->getCalcStep());
395 }
396 void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
397  VisitOMPClauseList(C);
398  Profiler->VisitStmt(C->getAlignment());
399 }
400 void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
401  VisitOMPClauseList(C);
402  for (auto *E : C->source_exprs()) {
403  Profiler->VisitStmt(E);
404  }
405  for (auto *E : C->destination_exprs()) {
406  Profiler->VisitStmt(E);
407  }
408  for (auto *E : C->assignment_ops()) {
409  Profiler->VisitStmt(E);
410  }
411 }
412 void
413 OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
414  VisitOMPClauseList(C);
415  for (auto *E : C->source_exprs()) {
416  Profiler->VisitStmt(E);
417  }
418  for (auto *E : C->destination_exprs()) {
419  Profiler->VisitStmt(E);
420  }
421  for (auto *E : C->assignment_ops()) {
422  Profiler->VisitStmt(E);
423  }
424 }
425 void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
426  VisitOMPClauseList(C);
427 }
428 void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
429  VisitOMPClauseList(C);
430 }
431 }
432 
433 void
434 StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
435  VisitStmt(S);
436  OMPClauseProfiler P(this);
437  ArrayRef<OMPClause *> Clauses = S->clauses();
438  for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
439  I != E; ++I)
440  if (*I)
441  P.Visit(*I);
442 }
443 
444 void StmtProfiler::VisitOMPLoopDirective(const OMPLoopDirective *S) {
445  VisitOMPExecutableDirective(S);
446 }
447 
448 void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
449  VisitOMPExecutableDirective(S);
450 }
451 
452 void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *S) {
453  VisitOMPLoopDirective(S);
454 }
455 
456 void StmtProfiler::VisitOMPForDirective(const OMPForDirective *S) {
457  VisitOMPLoopDirective(S);
458 }
459 
460 void StmtProfiler::VisitOMPForSimdDirective(const OMPForSimdDirective *S) {
461  VisitOMPLoopDirective(S);
462 }
463 
464 void StmtProfiler::VisitOMPSectionsDirective(const OMPSectionsDirective *S) {
465  VisitOMPExecutableDirective(S);
466 }
467 
468 void StmtProfiler::VisitOMPSectionDirective(const OMPSectionDirective *S) {
469  VisitOMPExecutableDirective(S);
470 }
471 
472 void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) {
473  VisitOMPExecutableDirective(S);
474 }
475 
476 void StmtProfiler::VisitOMPMasterDirective(const OMPMasterDirective *S) {
477  VisitOMPExecutableDirective(S);
478 }
479 
480 void StmtProfiler::VisitOMPCriticalDirective(const OMPCriticalDirective *S) {
481  VisitOMPExecutableDirective(S);
482  VisitName(S->getDirectiveName().getName());
483 }
484 
485 void
486 StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
487  VisitOMPLoopDirective(S);
488 }
489 
490 void StmtProfiler::VisitOMPParallelForSimdDirective(
491  const OMPParallelForSimdDirective *S) {
492  VisitOMPLoopDirective(S);
493 }
494 
495 void StmtProfiler::VisitOMPParallelSectionsDirective(
496  const OMPParallelSectionsDirective *S) {
497  VisitOMPExecutableDirective(S);
498 }
499 
500 void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
501  VisitOMPExecutableDirective(S);
502 }
503 
504 void StmtProfiler::VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *S) {
505  VisitOMPExecutableDirective(S);
506 }
507 
508 void StmtProfiler::VisitOMPBarrierDirective(const OMPBarrierDirective *S) {
509  VisitOMPExecutableDirective(S);
510 }
511 
512 void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
513  VisitOMPExecutableDirective(S);
514 }
515 
516 void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
517  VisitOMPExecutableDirective(S);
518 }
519 
520 void StmtProfiler::VisitOMPFlushDirective(const OMPFlushDirective *S) {
521  VisitOMPExecutableDirective(S);
522 }
523 
524 void StmtProfiler::VisitOMPOrderedDirective(const OMPOrderedDirective *S) {
525  VisitOMPExecutableDirective(S);
526 }
527 
528 void StmtProfiler::VisitOMPAtomicDirective(const OMPAtomicDirective *S) {
529  VisitOMPExecutableDirective(S);
530 }
531 
532 void StmtProfiler::VisitOMPTargetDirective(const OMPTargetDirective *S) {
533  VisitOMPExecutableDirective(S);
534 }
535 
536 void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
537  VisitOMPExecutableDirective(S);
538 }
539 
540 void StmtProfiler::VisitOMPCancellationPointDirective(
542  VisitOMPExecutableDirective(S);
543 }
544 
545 void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
546  VisitOMPExecutableDirective(S);
547 }
548 
549 void StmtProfiler::VisitExpr(const Expr *S) {
550  VisitStmt(S);
551 }
552 
553 void StmtProfiler::VisitDeclRefExpr(const DeclRefExpr *S) {
554  VisitExpr(S);
555  if (!Canonical)
556  VisitNestedNameSpecifier(S->getQualifier());
557  VisitDecl(S->getDecl());
558  if (!Canonical)
559  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
560 }
561 
562 void StmtProfiler::VisitPredefinedExpr(const PredefinedExpr *S) {
563  VisitExpr(S);
564  ID.AddInteger(S->getIdentType());
565 }
566 
567 void StmtProfiler::VisitIntegerLiteral(const IntegerLiteral *S) {
568  VisitExpr(S);
569  S->getValue().Profile(ID);
570  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
571 }
572 
573 void StmtProfiler::VisitCharacterLiteral(const CharacterLiteral *S) {
574  VisitExpr(S);
575  ID.AddInteger(S->getKind());
576  ID.AddInteger(S->getValue());
577 }
578 
579 void StmtProfiler::VisitFloatingLiteral(const FloatingLiteral *S) {
580  VisitExpr(S);
581  S->getValue().Profile(ID);
582  ID.AddBoolean(S->isExact());
583  ID.AddInteger(S->getType()->castAs<BuiltinType>()->getKind());
584 }
585 
586 void StmtProfiler::VisitImaginaryLiteral(const ImaginaryLiteral *S) {
587  VisitExpr(S);
588 }
589 
590 void StmtProfiler::VisitStringLiteral(const StringLiteral *S) {
591  VisitExpr(S);
592  ID.AddString(S->getBytes());
593  ID.AddInteger(S->getKind());
594 }
595 
596 void StmtProfiler::VisitParenExpr(const ParenExpr *S) {
597  VisitExpr(S);
598 }
599 
600 void StmtProfiler::VisitParenListExpr(const ParenListExpr *S) {
601  VisitExpr(S);
602 }
603 
604 void StmtProfiler::VisitUnaryOperator(const UnaryOperator *S) {
605  VisitExpr(S);
606  ID.AddInteger(S->getOpcode());
607 }
608 
609 void StmtProfiler::VisitOffsetOfExpr(const OffsetOfExpr *S) {
610  VisitType(S->getTypeSourceInfo()->getType());
611  unsigned n = S->getNumComponents();
612  for (unsigned i = 0; i < n; ++i) {
613  const OffsetOfExpr::OffsetOfNode& ON = S->getComponent(i);
614  ID.AddInteger(ON.getKind());
615  switch (ON.getKind()) {
617  // Expressions handled below.
618  break;
619 
621  VisitDecl(ON.getField());
622  break;
623 
625  ID.AddPointer(ON.getFieldName());
626  break;
627 
629  // These nodes are implicit, and therefore don't need profiling.
630  break;
631  }
632  }
633 
634  VisitExpr(S);
635 }
636 
637 void
638 StmtProfiler::VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *S) {
639  VisitExpr(S);
640  ID.AddInteger(S->getKind());
641  if (S->isArgumentType())
642  VisitType(S->getArgumentType());
643 }
644 
645 void StmtProfiler::VisitArraySubscriptExpr(const ArraySubscriptExpr *S) {
646  VisitExpr(S);
647 }
648 
649 void StmtProfiler::VisitCallExpr(const CallExpr *S) {
650  VisitExpr(S);
651 }
652 
653 void StmtProfiler::VisitMemberExpr(const MemberExpr *S) {
654  VisitExpr(S);
655  VisitDecl(S->getMemberDecl());
656  if (!Canonical)
657  VisitNestedNameSpecifier(S->getQualifier());
658  ID.AddBoolean(S->isArrow());
659 }
660 
661 void StmtProfiler::VisitCompoundLiteralExpr(const CompoundLiteralExpr *S) {
662  VisitExpr(S);
663  ID.AddBoolean(S->isFileScope());
664 }
665 
666 void StmtProfiler::VisitCastExpr(const CastExpr *S) {
667  VisitExpr(S);
668 }
669 
670 void StmtProfiler::VisitImplicitCastExpr(const ImplicitCastExpr *S) {
671  VisitCastExpr(S);
672  ID.AddInteger(S->getValueKind());
673 }
674 
675 void StmtProfiler::VisitExplicitCastExpr(const ExplicitCastExpr *S) {
676  VisitCastExpr(S);
677  VisitType(S->getTypeAsWritten());
678 }
679 
680 void StmtProfiler::VisitCStyleCastExpr(const CStyleCastExpr *S) {
681  VisitExplicitCastExpr(S);
682 }
683 
684 void StmtProfiler::VisitBinaryOperator(const BinaryOperator *S) {
685  VisitExpr(S);
686  ID.AddInteger(S->getOpcode());
687 }
688 
689 void
690 StmtProfiler::VisitCompoundAssignOperator(const CompoundAssignOperator *S) {
691  VisitBinaryOperator(S);
692 }
693 
694 void StmtProfiler::VisitConditionalOperator(const ConditionalOperator *S) {
695  VisitExpr(S);
696 }
697 
698 void StmtProfiler::VisitBinaryConditionalOperator(
699  const BinaryConditionalOperator *S) {
700  VisitExpr(S);
701 }
702 
703 void StmtProfiler::VisitAddrLabelExpr(const AddrLabelExpr *S) {
704  VisitExpr(S);
705  VisitDecl(S->getLabel());
706 }
707 
708 void StmtProfiler::VisitStmtExpr(const StmtExpr *S) {
709  VisitExpr(S);
710 }
711 
712 void StmtProfiler::VisitShuffleVectorExpr(const ShuffleVectorExpr *S) {
713  VisitExpr(S);
714 }
715 
716 void StmtProfiler::VisitConvertVectorExpr(const ConvertVectorExpr *S) {
717  VisitExpr(S);
718 }
719 
720 void StmtProfiler::VisitChooseExpr(const ChooseExpr *S) {
721  VisitExpr(S);
722 }
723 
724 void StmtProfiler::VisitGNUNullExpr(const GNUNullExpr *S) {
725  VisitExpr(S);
726 }
727 
728 void StmtProfiler::VisitVAArgExpr(const VAArgExpr *S) {
729  VisitExpr(S);
730 }
731 
732 void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
733  if (S->getSyntacticForm()) {
734  VisitInitListExpr(S->getSyntacticForm());
735  return;
736  }
737 
738  VisitExpr(S);
739 }
740 
741 void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
742  VisitExpr(S);
743  ID.AddBoolean(S->usesGNUSyntax());
745  S->designators_begin(), DEnd = S->designators_end();
746  D != DEnd; ++D) {
747  if (D->isFieldDesignator()) {
748  ID.AddInteger(0);
749  VisitName(D->getFieldName());
750  continue;
751  }
752 
753  if (D->isArrayDesignator()) {
754  ID.AddInteger(1);
755  } else {
756  assert(D->isArrayRangeDesignator());
757  ID.AddInteger(2);
758  }
759  ID.AddInteger(D->getFirstExprIndex());
760  }
761 }
762 
763 // Seems that if VisitInitListExpr() only works on the syntactic form of an
764 // InitListExpr, then a DesignatedInitUpdateExpr is not encountered.
765 void StmtProfiler::VisitDesignatedInitUpdateExpr(
766  const DesignatedInitUpdateExpr *S) {
767  llvm_unreachable("Unexpected DesignatedInitUpdateExpr in syntactic form of "
768  "initializer");
769 }
770 
771 void StmtProfiler::VisitNoInitExpr(const NoInitExpr *S) {
772  llvm_unreachable("Unexpected NoInitExpr in syntactic form of initializer");
773 }
774 
775 void StmtProfiler::VisitImplicitValueInitExpr(const ImplicitValueInitExpr *S) {
776  VisitExpr(S);
777 }
778 
779 void StmtProfiler::VisitExtVectorElementExpr(const ExtVectorElementExpr *S) {
780  VisitExpr(S);
781  VisitName(&S->getAccessor());
782 }
783 
784 void StmtProfiler::VisitBlockExpr(const BlockExpr *S) {
785  VisitExpr(S);
786  VisitDecl(S->getBlockDecl());
787 }
788 
789 void StmtProfiler::VisitGenericSelectionExpr(const GenericSelectionExpr *S) {
790  VisitExpr(S);
791  for (unsigned i = 0; i != S->getNumAssocs(); ++i) {
792  QualType T = S->getAssocType(i);
793  if (T.isNull())
794  ID.AddPointer(nullptr);
795  else
796  VisitType(T);
797  VisitExpr(S->getAssocExpr(i));
798  }
799 }
800 
801 void StmtProfiler::VisitPseudoObjectExpr(const PseudoObjectExpr *S) {
802  VisitExpr(S);
804  i = S->semantics_begin(), e = S->semantics_end(); i != e; ++i)
805  // Normally, we would not profile the source expressions of OVEs.
806  if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
807  Visit(OVE->getSourceExpr());
808 }
809 
810 void StmtProfiler::VisitAtomicExpr(const AtomicExpr *S) {
811  VisitExpr(S);
812  ID.AddInteger(S->getOp());
813 }
814 
815 static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
816  UnaryOperatorKind &UnaryOp,
817  BinaryOperatorKind &BinaryOp) {
818  switch (S->getOperator()) {
819  case OO_None:
820  case OO_New:
821  case OO_Delete:
822  case OO_Array_New:
823  case OO_Array_Delete:
824  case OO_Arrow:
825  case OO_Call:
826  case OO_Conditional:
828  llvm_unreachable("Invalid operator call kind");
829 
830  case OO_Plus:
831  if (S->getNumArgs() == 1) {
832  UnaryOp = UO_Plus;
833  return Stmt::UnaryOperatorClass;
834  }
835 
836  BinaryOp = BO_Add;
837  return Stmt::BinaryOperatorClass;
838 
839  case OO_Minus:
840  if (S->getNumArgs() == 1) {
841  UnaryOp = UO_Minus;
842  return Stmt::UnaryOperatorClass;
843  }
844 
845  BinaryOp = BO_Sub;
846  return Stmt::BinaryOperatorClass;
847 
848  case OO_Star:
849  if (S->getNumArgs() == 1) {
850  UnaryOp = UO_Deref;
851  return Stmt::UnaryOperatorClass;
852  }
853 
854  BinaryOp = BO_Mul;
855  return Stmt::BinaryOperatorClass;
856 
857  case OO_Slash:
858  BinaryOp = BO_Div;
859  return Stmt::BinaryOperatorClass;
860 
861  case OO_Percent:
862  BinaryOp = BO_Rem;
863  return Stmt::BinaryOperatorClass;
864 
865  case OO_Caret:
866  BinaryOp = BO_Xor;
867  return Stmt::BinaryOperatorClass;
868 
869  case OO_Amp:
870  if (S->getNumArgs() == 1) {
871  UnaryOp = UO_AddrOf;
872  return Stmt::UnaryOperatorClass;
873  }
874 
875  BinaryOp = BO_And;
876  return Stmt::BinaryOperatorClass;
877 
878  case OO_Pipe:
879  BinaryOp = BO_Or;
880  return Stmt::BinaryOperatorClass;
881 
882  case OO_Tilde:
883  UnaryOp = UO_Not;
884  return Stmt::UnaryOperatorClass;
885 
886  case OO_Exclaim:
887  UnaryOp = UO_LNot;
888  return Stmt::UnaryOperatorClass;
889 
890  case OO_Equal:
891  BinaryOp = BO_Assign;
892  return Stmt::BinaryOperatorClass;
893 
894  case OO_Less:
895  BinaryOp = BO_LT;
896  return Stmt::BinaryOperatorClass;
897 
898  case OO_Greater:
899  BinaryOp = BO_GT;
900  return Stmt::BinaryOperatorClass;
901 
902  case OO_PlusEqual:
903  BinaryOp = BO_AddAssign;
904  return Stmt::CompoundAssignOperatorClass;
905 
906  case OO_MinusEqual:
907  BinaryOp = BO_SubAssign;
908  return Stmt::CompoundAssignOperatorClass;
909 
910  case OO_StarEqual:
911  BinaryOp = BO_MulAssign;
912  return Stmt::CompoundAssignOperatorClass;
913 
914  case OO_SlashEqual:
915  BinaryOp = BO_DivAssign;
916  return Stmt::CompoundAssignOperatorClass;
917 
918  case OO_PercentEqual:
919  BinaryOp = BO_RemAssign;
920  return Stmt::CompoundAssignOperatorClass;
921 
922  case OO_CaretEqual:
923  BinaryOp = BO_XorAssign;
924  return Stmt::CompoundAssignOperatorClass;
925 
926  case OO_AmpEqual:
927  BinaryOp = BO_AndAssign;
928  return Stmt::CompoundAssignOperatorClass;
929 
930  case OO_PipeEqual:
931  BinaryOp = BO_OrAssign;
932  return Stmt::CompoundAssignOperatorClass;
933 
934  case OO_LessLess:
935  BinaryOp = BO_Shl;
936  return Stmt::BinaryOperatorClass;
937 
938  case OO_GreaterGreater:
939  BinaryOp = BO_Shr;
940  return Stmt::BinaryOperatorClass;
941 
942  case OO_LessLessEqual:
943  BinaryOp = BO_ShlAssign;
944  return Stmt::CompoundAssignOperatorClass;
945 
946  case OO_GreaterGreaterEqual:
947  BinaryOp = BO_ShrAssign;
948  return Stmt::CompoundAssignOperatorClass;
949 
950  case OO_EqualEqual:
951  BinaryOp = BO_EQ;
952  return Stmt::BinaryOperatorClass;
953 
954  case OO_ExclaimEqual:
955  BinaryOp = BO_NE;
956  return Stmt::BinaryOperatorClass;
957 
958  case OO_LessEqual:
959  BinaryOp = BO_LE;
960  return Stmt::BinaryOperatorClass;
961 
962  case OO_GreaterEqual:
963  BinaryOp = BO_GE;
964  return Stmt::BinaryOperatorClass;
965 
966  case OO_AmpAmp:
967  BinaryOp = BO_LAnd;
968  return Stmt::BinaryOperatorClass;
969 
970  case OO_PipePipe:
971  BinaryOp = BO_LOr;
972  return Stmt::BinaryOperatorClass;
973 
974  case OO_PlusPlus:
975  UnaryOp = S->getNumArgs() == 1? UO_PreInc
976  : UO_PostInc;
977  return Stmt::UnaryOperatorClass;
978 
979  case OO_MinusMinus:
980  UnaryOp = S->getNumArgs() == 1? UO_PreDec
981  : UO_PostDec;
982  return Stmt::UnaryOperatorClass;
983 
984  case OO_Comma:
985  BinaryOp = BO_Comma;
986  return Stmt::BinaryOperatorClass;
987 
988 
989  case OO_ArrowStar:
990  BinaryOp = BO_PtrMemI;
991  return Stmt::BinaryOperatorClass;
992 
993  case OO_Subscript:
994  return Stmt::ArraySubscriptExprClass;
995  }
996 
997  llvm_unreachable("Invalid overloaded operator expression");
998 }
999 
1000 
1001 void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
1002  if (S->isTypeDependent()) {
1003  // Type-dependent operator calls are profiled like their underlying
1004  // syntactic operator.
1005  UnaryOperatorKind UnaryOp = UO_Extension;
1006  BinaryOperatorKind BinaryOp = BO_Comma;
1007  Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
1008 
1009  ID.AddInteger(SC);
1010  for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1011  Visit(S->getArg(I));
1012  if (SC == Stmt::UnaryOperatorClass)
1013  ID.AddInteger(UnaryOp);
1014  else if (SC == Stmt::BinaryOperatorClass ||
1015  SC == Stmt::CompoundAssignOperatorClass)
1016  ID.AddInteger(BinaryOp);
1017  else
1018  assert(SC == Stmt::ArraySubscriptExprClass);
1019 
1020  return;
1021  }
1022 
1023  VisitCallExpr(S);
1024  ID.AddInteger(S->getOperator());
1025 }
1026 
1027 void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
1028  VisitCallExpr(S);
1029 }
1030 
1031 void StmtProfiler::VisitCUDAKernelCallExpr(const CUDAKernelCallExpr *S) {
1032  VisitCallExpr(S);
1033 }
1034 
1035 void StmtProfiler::VisitAsTypeExpr(const AsTypeExpr *S) {
1036  VisitExpr(S);
1037 }
1038 
1039 void StmtProfiler::VisitCXXNamedCastExpr(const CXXNamedCastExpr *S) {
1040  VisitExplicitCastExpr(S);
1041 }
1042 
1043 void StmtProfiler::VisitCXXStaticCastExpr(const CXXStaticCastExpr *S) {
1044  VisitCXXNamedCastExpr(S);
1045 }
1046 
1047 void StmtProfiler::VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *S) {
1048  VisitCXXNamedCastExpr(S);
1049 }
1050 
1051 void
1052 StmtProfiler::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *S) {
1053  VisitCXXNamedCastExpr(S);
1054 }
1055 
1056 void StmtProfiler::VisitCXXConstCastExpr(const CXXConstCastExpr *S) {
1057  VisitCXXNamedCastExpr(S);
1058 }
1059 
1060 void StmtProfiler::VisitUserDefinedLiteral(const UserDefinedLiteral *S) {
1061  VisitCallExpr(S);
1062 }
1063 
1064 void StmtProfiler::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *S) {
1065  VisitExpr(S);
1066  ID.AddBoolean(S->getValue());
1067 }
1068 
1069 void StmtProfiler::VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *S) {
1070  VisitExpr(S);
1071 }
1072 
1073 void StmtProfiler::VisitCXXStdInitializerListExpr(
1074  const CXXStdInitializerListExpr *S) {
1075  VisitExpr(S);
1076 }
1077 
1078 void StmtProfiler::VisitCXXTypeidExpr(const CXXTypeidExpr *S) {
1079  VisitExpr(S);
1080  if (S->isTypeOperand())
1081  VisitType(S->getTypeOperandSourceInfo()->getType());
1082 }
1083 
1084 void StmtProfiler::VisitCXXUuidofExpr(const CXXUuidofExpr *S) {
1085  VisitExpr(S);
1086  if (S->isTypeOperand())
1087  VisitType(S->getTypeOperandSourceInfo()->getType());
1088 }
1089 
1090 void StmtProfiler::VisitMSPropertyRefExpr(const MSPropertyRefExpr *S) {
1091  VisitExpr(S);
1092  VisitDecl(S->getPropertyDecl());
1093 }
1094 
1095 void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
1096  VisitExpr(S);
1097  ID.AddBoolean(S->isImplicit());
1098 }
1099 
1100 void StmtProfiler::VisitCXXThrowExpr(const CXXThrowExpr *S) {
1101  VisitExpr(S);
1102 }
1103 
1104 void StmtProfiler::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *S) {
1105  VisitExpr(S);
1106  VisitDecl(S->getParam());
1107 }
1108 
1109 void StmtProfiler::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *S) {
1110  VisitExpr(S);
1111  VisitDecl(S->getField());
1112 }
1113 
1114 void StmtProfiler::VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *S) {
1115  VisitExpr(S);
1116  VisitDecl(
1117  const_cast<CXXDestructorDecl *>(S->getTemporary()->getDestructor()));
1118 }
1119 
1120 void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
1121  VisitExpr(S);
1122  VisitDecl(S->getConstructor());
1123  ID.AddBoolean(S->isElidable());
1124 }
1125 
1126 void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
1127  VisitExplicitCastExpr(S);
1128 }
1129 
1130 void
1131 StmtProfiler::VisitCXXTemporaryObjectExpr(const CXXTemporaryObjectExpr *S) {
1132  VisitCXXConstructExpr(S);
1133 }
1134 
1135 void
1136 StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
1137  VisitExpr(S);
1139  CEnd = S->explicit_capture_end();
1140  C != CEnd; ++C) {
1141  ID.AddInteger(C->getCaptureKind());
1142  switch (C->getCaptureKind()) {
1143  case LCK_This:
1144  break;
1145  case LCK_ByRef:
1146  case LCK_ByCopy:
1147  VisitDecl(C->getCapturedVar());
1148  ID.AddBoolean(C->isPackExpansion());
1149  break;
1150  case LCK_VLAType:
1151  llvm_unreachable("VLA type in explicit captures.");
1152  }
1153  }
1154  // Note: If we actually needed to be able to match lambda
1155  // expressions, we would have to consider parameters and return type
1156  // here, among other things.
1157  VisitStmt(S->getBody());
1158 }
1159 
1160 void
1161 StmtProfiler::VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *S) {
1162  VisitExpr(S);
1163 }
1164 
1165 void StmtProfiler::VisitCXXDeleteExpr(const CXXDeleteExpr *S) {
1166  VisitExpr(S);
1167  ID.AddBoolean(S->isGlobalDelete());
1168  ID.AddBoolean(S->isArrayForm());
1169  VisitDecl(S->getOperatorDelete());
1170 }
1171 
1172 
1173 void StmtProfiler::VisitCXXNewExpr(const CXXNewExpr *S) {
1174  VisitExpr(S);
1175  VisitType(S->getAllocatedType());
1176  VisitDecl(S->getOperatorNew());
1177  VisitDecl(S->getOperatorDelete());
1178  ID.AddBoolean(S->isArray());
1179  ID.AddInteger(S->getNumPlacementArgs());
1180  ID.AddBoolean(S->isGlobalNew());
1181  ID.AddBoolean(S->isParenTypeId());
1182  ID.AddInteger(S->getInitializationStyle());
1183 }
1184 
1185 void
1186 StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
1187  VisitExpr(S);
1188  ID.AddBoolean(S->isArrow());
1189  VisitNestedNameSpecifier(S->getQualifier());
1190  ID.AddBoolean(S->getScopeTypeInfo() != nullptr);
1191  if (S->getScopeTypeInfo())
1192  VisitType(S->getScopeTypeInfo()->getType());
1193  ID.AddBoolean(S->getDestroyedTypeInfo() != nullptr);
1194  if (S->getDestroyedTypeInfo())
1195  VisitType(S->getDestroyedType());
1196  else
1197  ID.AddPointer(S->getDestroyedTypeIdentifier());
1198 }
1199 
1200 void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
1201  VisitExpr(S);
1202  VisitNestedNameSpecifier(S->getQualifier());
1203  VisitName(S->getName());
1204  ID.AddBoolean(S->hasExplicitTemplateArgs());
1205  if (S->hasExplicitTemplateArgs())
1206  VisitTemplateArguments(S->getExplicitTemplateArgs().getTemplateArgs(),
1208 }
1209 
1210 void
1211 StmtProfiler::VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *S) {
1212  VisitOverloadExpr(S);
1213 }
1214 
1215 void StmtProfiler::VisitTypeTraitExpr(const TypeTraitExpr *S) {
1216  VisitExpr(S);
1217  ID.AddInteger(S->getTrait());
1218  ID.AddInteger(S->getNumArgs());
1219  for (unsigned I = 0, N = S->getNumArgs(); I != N; ++I)
1220  VisitType(S->getArg(I)->getType());
1221 }
1222 
1223 void StmtProfiler::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *S) {
1224  VisitExpr(S);
1225  ID.AddInteger(S->getTrait());
1226  VisitType(S->getQueriedType());
1227 }
1228 
1229 void StmtProfiler::VisitExpressionTraitExpr(const ExpressionTraitExpr *S) {
1230  VisitExpr(S);
1231  ID.AddInteger(S->getTrait());
1232  VisitExpr(S->getQueriedExpression());
1233 }
1234 
1235 void StmtProfiler::VisitDependentScopeDeclRefExpr(
1236  const DependentScopeDeclRefExpr *S) {
1237  VisitExpr(S);
1238  VisitName(S->getDeclName());
1239  VisitNestedNameSpecifier(S->getQualifier());
1240  ID.AddBoolean(S->hasExplicitTemplateArgs());
1241  if (S->hasExplicitTemplateArgs())
1242  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1243 }
1244 
1245 void StmtProfiler::VisitExprWithCleanups(const ExprWithCleanups *S) {
1246  VisitExpr(S);
1247 }
1248 
1249 void StmtProfiler::VisitCXXUnresolvedConstructExpr(
1250  const CXXUnresolvedConstructExpr *S) {
1251  VisitExpr(S);
1252  VisitType(S->getTypeAsWritten());
1253 }
1254 
1255 void StmtProfiler::VisitCXXDependentScopeMemberExpr(
1256  const CXXDependentScopeMemberExpr *S) {
1257  ID.AddBoolean(S->isImplicitAccess());
1258  if (!S->isImplicitAccess()) {
1259  VisitExpr(S);
1260  ID.AddBoolean(S->isArrow());
1261  }
1262  VisitNestedNameSpecifier(S->getQualifier());
1263  VisitName(S->getMember());
1264  ID.AddBoolean(S->hasExplicitTemplateArgs());
1265  if (S->hasExplicitTemplateArgs())
1266  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1267 }
1268 
1269 void StmtProfiler::VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *S) {
1270  ID.AddBoolean(S->isImplicitAccess());
1271  if (!S->isImplicitAccess()) {
1272  VisitExpr(S);
1273  ID.AddBoolean(S->isArrow());
1274  }
1275  VisitNestedNameSpecifier(S->getQualifier());
1276  VisitName(S->getMemberName());
1277  ID.AddBoolean(S->hasExplicitTemplateArgs());
1278  if (S->hasExplicitTemplateArgs())
1279  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
1280 }
1281 
1282 void StmtProfiler::VisitCXXNoexceptExpr(const CXXNoexceptExpr *S) {
1283  VisitExpr(S);
1284 }
1285 
1286 void StmtProfiler::VisitPackExpansionExpr(const PackExpansionExpr *S) {
1287  VisitExpr(S);
1288 }
1289 
1290 void StmtProfiler::VisitSizeOfPackExpr(const SizeOfPackExpr *S) {
1291  VisitExpr(S);
1292  VisitDecl(S->getPack());
1293 }
1294 
1295 void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
1297  VisitExpr(S);
1298  VisitDecl(S->getParameterPack());
1299  VisitTemplateArgument(S->getArgumentPack());
1300 }
1301 
1302 void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
1303  const SubstNonTypeTemplateParmExpr *E) {
1304  // Profile exactly as the replacement expression.
1305  Visit(E->getReplacement());
1306 }
1307 
1308 void StmtProfiler::VisitFunctionParmPackExpr(const FunctionParmPackExpr *S) {
1309  VisitExpr(S);
1310  VisitDecl(S->getParameterPack());
1311  ID.AddInteger(S->getNumExpansions());
1312  for (FunctionParmPackExpr::iterator I = S->begin(), E = S->end(); I != E; ++I)
1313  VisitDecl(*I);
1314 }
1315 
1316 void StmtProfiler::VisitMaterializeTemporaryExpr(
1317  const MaterializeTemporaryExpr *S) {
1318  VisitExpr(S);
1319 }
1320 
1321 void StmtProfiler::VisitCXXFoldExpr(const CXXFoldExpr *S) {
1322  VisitExpr(S);
1323  ID.AddInteger(S->getOperator());
1324 }
1325 
1326 void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
1327  VisitExpr(E);
1328 }
1329 
1330 void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
1331  VisitExpr(E);
1332 }
1333 
1334 void StmtProfiler::VisitObjCStringLiteral(const ObjCStringLiteral *S) {
1335  VisitExpr(S);
1336 }
1337 
1338 void StmtProfiler::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
1339  VisitExpr(E);
1340 }
1341 
1342 void StmtProfiler::VisitObjCArrayLiteral(const ObjCArrayLiteral *E) {
1343  VisitExpr(E);
1344 }
1345 
1346 void StmtProfiler::VisitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E) {
1347  VisitExpr(E);
1348 }
1349 
1350 void StmtProfiler::VisitObjCEncodeExpr(const ObjCEncodeExpr *S) {
1351  VisitExpr(S);
1352  VisitType(S->getEncodedType());
1353 }
1354 
1355 void StmtProfiler::VisitObjCSelectorExpr(const ObjCSelectorExpr *S) {
1356  VisitExpr(S);
1357  VisitName(S->getSelector());
1358 }
1359 
1360 void StmtProfiler::VisitObjCProtocolExpr(const ObjCProtocolExpr *S) {
1361  VisitExpr(S);
1362  VisitDecl(S->getProtocol());
1363 }
1364 
1365 void StmtProfiler::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *S) {
1366  VisitExpr(S);
1367  VisitDecl(S->getDecl());
1368  ID.AddBoolean(S->isArrow());
1369  ID.AddBoolean(S->isFreeIvar());
1370 }
1371 
1372 void StmtProfiler::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *S) {
1373  VisitExpr(S);
1374  if (S->isImplicitProperty()) {
1375  VisitDecl(S->getImplicitPropertyGetter());
1376  VisitDecl(S->getImplicitPropertySetter());
1377  } else {
1378  VisitDecl(S->getExplicitProperty());
1379  }
1380  if (S->isSuperReceiver()) {
1381  ID.AddBoolean(S->isSuperReceiver());
1382  VisitType(S->getSuperReceiverType());
1383  }
1384 }
1385 
1386 void StmtProfiler::VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *S) {
1387  VisitExpr(S);
1388  VisitDecl(S->getAtIndexMethodDecl());
1389  VisitDecl(S->setAtIndexMethodDecl());
1390 }
1391 
1392 void StmtProfiler::VisitObjCMessageExpr(const ObjCMessageExpr *S) {
1393  VisitExpr(S);
1394  VisitName(S->getSelector());
1395  VisitDecl(S->getMethodDecl());
1396 }
1397 
1398 void StmtProfiler::VisitObjCIsaExpr(const ObjCIsaExpr *S) {
1399  VisitExpr(S);
1400  ID.AddBoolean(S->isArrow());
1401 }
1402 
1403 void StmtProfiler::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *S) {
1404  VisitExpr(S);
1405  ID.AddBoolean(S->getValue());
1406 }
1407 
1408 void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
1409  const ObjCIndirectCopyRestoreExpr *S) {
1410  VisitExpr(S);
1411  ID.AddBoolean(S->shouldCopy());
1412 }
1413 
1414 void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
1415  VisitExplicitCastExpr(S);
1416  ID.AddBoolean(S->getBridgeKind());
1417 }
1418 
1419 void StmtProfiler::VisitDecl(const Decl *D) {
1420  ID.AddInteger(D? D->getKind() : 0);
1421 
1422  if (Canonical && D) {
1423  if (const NonTypeTemplateParmDecl *NTTP =
1424  dyn_cast<NonTypeTemplateParmDecl>(D)) {
1425  ID.AddInteger(NTTP->getDepth());
1426  ID.AddInteger(NTTP->getIndex());
1427  ID.AddBoolean(NTTP->isParameterPack());
1428  VisitType(NTTP->getType());
1429  return;
1430  }
1431 
1432  if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
1433  // The Itanium C++ ABI uses the type, scope depth, and scope
1434  // index of a parameter when mangling expressions that involve
1435  // function parameters, so we will use the parameter's type for
1436  // establishing function parameter identity. That way, our
1437  // definition of "equivalent" (per C++ [temp.over.link]) is at
1438  // least as strong as the definition of "equivalent" used for
1439  // name mangling.
1440  VisitType(Parm->getType());
1441  ID.AddInteger(Parm->getFunctionScopeDepth());
1442  ID.AddInteger(Parm->getFunctionScopeIndex());
1443  return;
1444  }
1445 
1446  if (const TemplateTypeParmDecl *TTP =
1447  dyn_cast<TemplateTypeParmDecl>(D)) {
1448  ID.AddInteger(TTP->getDepth());
1449  ID.AddInteger(TTP->getIndex());
1450  ID.AddBoolean(TTP->isParameterPack());
1451  return;
1452  }
1453 
1454  if (const TemplateTemplateParmDecl *TTP =
1455  dyn_cast<TemplateTemplateParmDecl>(D)) {
1456  ID.AddInteger(TTP->getDepth());
1457  ID.AddInteger(TTP->getIndex());
1458  ID.AddBoolean(TTP->isParameterPack());
1459  return;
1460  }
1461  }
1462 
1463  ID.AddPointer(D? D->getCanonicalDecl() : nullptr);
1464 }
1465 
1466 void StmtProfiler::VisitType(QualType T) {
1467  if (Canonical)
1468  T = Context.getCanonicalType(T);
1469 
1470  ID.AddPointer(T.getAsOpaquePtr());
1471 }
1472 
1473 void StmtProfiler::VisitName(DeclarationName Name) {
1474  ID.AddPointer(Name.getAsOpaquePtr());
1475 }
1476 
1477 void StmtProfiler::VisitNestedNameSpecifier(NestedNameSpecifier *NNS) {
1478  if (Canonical)
1480  ID.AddPointer(NNS);
1481 }
1482 
1483 void StmtProfiler::VisitTemplateName(TemplateName Name) {
1484  if (Canonical)
1485  Name = Context.getCanonicalTemplateName(Name);
1486 
1487  Name.Profile(ID);
1488 }
1489 
1490 void StmtProfiler::VisitTemplateArguments(const TemplateArgumentLoc *Args,
1491  unsigned NumArgs) {
1492  ID.AddInteger(NumArgs);
1493  for (unsigned I = 0; I != NumArgs; ++I)
1494  VisitTemplateArgument(Args[I].getArgument());
1495 }
1496 
1497 void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
1498  // Mostly repetitive with TemplateArgument::Profile!
1499  ID.AddInteger(Arg.getKind());
1500  switch (Arg.getKind()) {
1502  break;
1503 
1505  VisitType(Arg.getAsType());
1506  break;
1507 
1510  VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
1511  break;
1512 
1514  VisitDecl(Arg.getAsDecl());
1515  break;
1516 
1518  VisitType(Arg.getNullPtrType());
1519  break;
1520 
1522  Arg.getAsIntegral().Profile(ID);
1523  VisitType(Arg.getIntegralType());
1524  break;
1525 
1527  Visit(Arg.getAsExpr());
1528  break;
1529 
1531  for (const auto &P : Arg.pack_elements())
1532  VisitTemplateArgument(P);
1533  break;
1534  }
1535 }
1536 
1537 void Stmt::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
1538  bool Canonical) const {
1539  StmtProfiler Profiler(ID, Context, Canonical);
1540  Profiler.Visit(this);
1541 }
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:54
Represents a single C99 designator.
Definition: Expr.h:4035
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2411
Defines the clang::ASTContext interface.
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:989
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3086
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1137
ParmVarDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
Definition: ExprCXX.h:3706
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:466
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:1295
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Definition: ExprCXX.h:2034
unsigned getNumOutputs() const
Definition: Stmt.h:1447
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:331
This represents clause 'copyin' in the '#pragma omp ...' directives.
bool isFileScope() const
Definition: Expr.h:2621
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition: ExprCXX.h:2443
helper_expr_const_range source_exprs() const
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:203
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:284
bool getValue() const
Definition: ExprCXX.h:446
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2216
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1144
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2083
private_copies_range private_copies()
CharacterKind getKind() const
Definition: Expr.h:1342
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
Definition: ExprCXX.h:2018
bool isArgumentType() const
Definition: Expr.h:2013
bool isGlobalDelete() const
Definition: ExprCXX.h:1852
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:765
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:1918
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:2430
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:815
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2500
This represents 'if' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:154
Defines the C++ template declaration subclasses.
Represents an attribute applied to a statement.
Definition: Stmt.h:833
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2135
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:313
InitListExpr * getSyntacticForm() const
Definition: Expr.h:3891
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1075
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition: ExprCXX.h:2695
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2182
This represents 'update' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:866
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:1102
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:307
iterator begin() const
Definition: ExprCXX.h:3707
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:26
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:3746
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:2462
Expr * getAlignment()
Returns alignment.
IdentType getIdentType() const
Definition: Expr.h:1201
void * getAsOpaquePtr() const
Definition: Type.h:614
bool isImplicit() const
Definition: ExprCXX.h:792
This represents 'read' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:808
This represents clause 'private' in the '#pragma omp ...' directives.
Definition: OpenMPClause.h:956
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:261
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:45
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:492
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2008
An implicit indirection through a C++ base class, when the field found is in a base class...
Definition: Expr.h:1800
This represents implicit clause 'flush' for the '#pragma omp flush' directive. This clause does not e...
const ParmVarDecl * getParam() const
Definition: ExprCXX.h:907
unsigned getValue() const
Definition: Expr.h:1349
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:808
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1334
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isArrow() const
Definition: ExprObjC.h:1397
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2225
This represents 'safelen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:319
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:238
Represents a C99 designated initializer expression.
Definition: Expr.h:3961
Expr * getNumThreads() const
Returns number of threads.
Definition: OpenMPClause.h:297
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3299
DeclarationName getName() const
getName - Returns the embedded declaration name.
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:450
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:219
unsigned getNumInputs() const
Definition: Stmt.h:1469
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
unsigned getNumAssocs() const
Definition: Expr.h:4473
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4279
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1333
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Definition: StmtCXX.h:270
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3209
IdentifierInfo & getAccessor() const
Definition: Expr.h:4565
QualType getQueriedType() const
Definition: ExprCXX.h:2227
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:1395
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
Definition: StmtOpenMP.h:268
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:3613
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:1036
const Expr *const * const_semantics_iterator
Definition: Expr.h:4779
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:94
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:74
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
ASTTemplateArgumentListInfo & getExplicitTemplateArgs()
Definition: ExprCXX.h:2449
Describes an C or C++ initializer list.
Definition: Expr.h:3759
BinaryOperatorKind
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1529
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2041
Capturing by copy (a.k.a., by value)
Definition: Lambda.h:36
bool isSuperReceiver() const
Definition: ExprObjC.h:695
helper_expr_const_range source_exprs() const
semantics_iterator semantics_end()
Definition: Expr.h:4786
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:2918
Selector getSelector() const
Definition: Expr.cpp:3718
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:1744
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:2666
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:1885
This represents 'default' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:426
QualType getTypeAsWritten() const
Definition: Expr.h:2849
This represents 'final' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:207
This represents 'mergeable' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:779
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:1828
This represents clause 'reduction' in the '#pragma omp ...' directives.
FieldDecl * getField()
Get the field whose initializer will be used.
Definition: ExprCXX.h:973
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1032
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:1714
CompoundStmt * getBody() const
Retrieve the body of the lambda.
Definition: ExprCXX.cpp:1101
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1052
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1343
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:2954
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.').
Definition: ExprCXX.h:2004
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:819
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:862
QualType getType() const
Definition: Decl.h:538
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:733
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2286
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name. Otherwise, returns NULL.
Definition: Expr.h:1013
Represents the this expression in C++.
Definition: ExprCXX.h:770
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:667
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:500
AnnotatingParser & P
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:2883
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:1864
llvm::APInt getValue() const
Definition: Expr.h:1262
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:1940
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3054
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1128
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:1483
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2132
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
Definition: ExprCXX.h:3711
This represents clause 'aligned' in the '#pragma omp ...' directives.
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2288
ASTContext * Context
A field in a dependent type, known only by its name.
Definition: Expr.h:1797
VAArgExpr, used for the builtin function __builtin_va_arg.
Definition: Expr.h:3670
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:1710
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
This represents implicit clause 'depend' for the '#pragma omp task' directive.
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1248
designators_iterator designators_begin()
Definition: Expr.h:4165
LabelDecl * getDecl() const
Definition: Stmt.h:809
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:496
This represents 'capture' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:896
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3162
helper_expr_const_range assignment_ops() const
Declaration of a template type parameter.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
Definition: Stmt.cpp:985
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs. The actual template arguments (if any) are stored a...
Definition: TemplateBase.h:575
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:243
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1295
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:340
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3118
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:633
Kind getKind() const
Definition: DeclBase.h:375
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:218
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:262
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:396
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:1357
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3473
Represents a C++ template name within the type system.
Definition: TemplateName.h:175
This represents 'ordered' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:691
Selector getSelector() const
Definition: ExprObjC.h:408
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Definition: ExprCXX.h:3639
QualType getAllocatedType() const
Definition: ExprCXX.h:1682
StringRef getInputName(unsigned i) const
Definition: Stmt.h:1672
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:701
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:3849
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:271
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:858
unsigned getNumComponents() const
Definition: Expr.h:1935
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:621
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
Definition: TemplateBase.h:584
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:3558
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:1943
This represents 'collapse' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:374
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
ValueDecl * getDecl()
Definition: Expr.h:994
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: ExprCXX.h:1998
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
AtomicOp getOp() const
Definition: Expr.h:4893
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:1534
helper_expr_const_range destination_exprs() const
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:1169
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:926
This represents 'untied' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:749
LabelDecl * getLabel() const
Definition: Stmt.h:1226
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:2731
bool isArray() const
Definition: ExprCXX.h:1713
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: ExprCXX.h:3156
bool isArrayForm() const
Definition: ExprCXX.h:1853
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:269
const StringLiteral * getAsmString() const
Definition: Stmt.h:1577
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2305
This captures a statement into a function. For example, the following pragma annotated compound state...
Definition: Stmt.h:1989
bool getValue() const
Definition: ExprObjC.h:71
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:409
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:934
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2458
helper_expr_const_range reduction_ops() const
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
private_copies_range private_copies()
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:266
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1623
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:372
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:190
helper_expr_const_range lhs_exprs() const
This represents 'schedule' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:566
bool isFreeIvar() const
Definition: ExprObjC.h:509
This represents clause 'shared' in the '#pragma omp ...' directives.
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
Definition: ExprCXX.cpp:1441
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:1439
bool isImplicitAccess() const
True if this is an implicit access, i.e. one in which the member being accessed was not written in th...
Definition: ExprCXX.cpp:1303
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3533
void Profile(llvm::FoldingSetNodeID &ID)
Definition: TemplateName.h:319
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
Definition: Stmt.cpp:951
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition: ExprCXX.cpp:1051
QualType getAssocType(unsigned i) const
Definition: Expr.h:4489
ParmVarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:3699
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:1771
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition: ExprCXX.h:2122
bool isTypeDependent() const
Definition: Expr.h:166
const T * castAs() const
Definition: Type.h:5586
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:1644
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
Definition: ExprCXX.h:3285
An expression trait intrinsic.
Definition: ExprCXX.h:2252
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:579
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:1589
const BlockDecl * getBlockDecl() const
Definition: Expr.h:4616
iterator end() const
Definition: ExprCXX.h:3708
bool isParenTypeId() const
Definition: ExprCXX.h:1735
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:68
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:247
Opcode getOpcode() const
Definition: Expr.h:1696
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:234
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:1925
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2609
Represents a C11 generic selection.
Definition: Expr.h:4446
bool isArrow() const
Definition: Expr.h:2548
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:2653
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3357
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1506
ast_type_traits::DynTypedNode Node
QualType getType() const
Definition: Expr.h:125
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Definition: ExprCXX.h:3673
Represents a template argument.
Definition: TemplateBase.h:39
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:240
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
Definition: Stmt.cpp:894
bool isImplicitProperty() const
Definition: ExprObjC.h:625
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:4479
helper_expr_const_range rhs_exprs() const
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1174
Represents a delete expression for memory deallocation and destructor calls, e.g. "delete[] pArray"...
Definition: ExprCXX.h:1819
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:714
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2727
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:885
designators_iterator designators_end()
Definition: Expr.h:4166
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:306
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:636
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:1843
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1653
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:3392
QualType getCaughtType() const
Definition: Stmt.cpp:678
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:1721
StringRef getBytes() const
Definition: Expr.h:1529
This represents clause 'linear' in the '#pragma omp ...' directives.
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1086
StringKind getKind() const
Definition: Expr.h:1561
bool isTypeOperand() const
Definition: ExprCXX.h:707
bool hasEllipsis() const
Definition: StmtObjC.h:110
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
Definition: Expr.h:4221
semantics_iterator semantics_begin()
Definition: Expr.h:4780
unsigned getNumArgs() const
Definition: Expr.h:2205
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:1855
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:1637
llvm::APFloat getValue() const
Definition: Expr.h:1377
FieldDecl * getField() const
For a field offsetof node, returns the field.
Definition: Expr.h:1855
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3337
Capturing variable-length array type.
Definition: Lambda.h:38
Not an overloaded operator.
Definition: OperatorKinds.h:23
void * getAsOpaquePtr() const
Expr * getSafelen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:353
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:1708
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2066
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition: ExprCXX.cpp:1047
Represents Objective-C's collection statement.
Definition: StmtObjC.h:24
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:296
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:155
CXXConstructorDecl * getConstructor() const
Definition: ExprCXX.h:1137
decl_range decls()
Definition: Stmt.h:497
bool isVolatile() const
Definition: Stmt.h:1434
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:120
The template argument is a type.
Definition: TemplateBase.h:47
QualType getSuperReceiverType() const
Definition: ExprObjC.h:687
LabelDecl * getLabel() const
Definition: Expr.h:3379
An index into an array.
Definition: Expr.h:1793
Capturing the this pointer.
Definition: Lambda.h:35
This represents 'write' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:836
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:628
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:474
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:2848
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:952
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:258
helper_expr_const_range destination_exprs() const
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1681
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:80
This represents 'nowait' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:720
bool isGlobalNew() const
Definition: ExprCXX.h:1738
Opcode getOpcode() const
Definition: Expr.h:2961
QualType getEncodedType() const
Definition: ExprObjC.h:377
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1241
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Capturing by reference.
Definition: Lambda.h:37
helper_expr_const_range assignment_ops() const
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:154
bool isSimple() const
Definition: Stmt.h:1431
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2404
bool isExact() const
Definition: Expr.h:1403
Expr * getHelperChunkSize()
Get helper chunk size.
Definition: OpenMPClause.h:666
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:259
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:739
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:187
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:830
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
Definition: Expr.h:899
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Definition: Expr.h:404
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:658
BinaryOperatorKind getOperator() const
Definition: ExprCXX.h:3887
unsigned getNumClobbers() const
Definition: Stmt.h:1479
helper_expr_const_range destination_exprs() const
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:1351
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:434
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition: ExprCXX.h:2410
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:270
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:1237
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
Definition: Type.h:633
bool isTypeOperand() const
Definition: ExprCXX.h:572
Represents Objective-C's @autoreleasepool Statement.
Definition: StmtObjC.h:345
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
Definition: ExprCXX.h:3047
const CXXDestructorDecl * getDestructor() const
Definition: ExprCXX.h:1012
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:4352
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:638
helper_expr_const_range assignment_ops() const
bool isArrow() const
Definition: ExprObjC.h:508
helper_expr_const_range source_exprs() const
QualType getArgumentType() const
Definition: Expr.h:2014