clang  3.8.0
StmtPrinter.cpp
Go to the documentation of this file.
1 //===--- StmtPrinter.cpp - Printing 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::dumpPretty/Stmt::printPretty methods, which
11 // pretty print the AST back out to C code.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/Attr.h"
17 #include "clang/AST/DeclCXX.h"
18 #include "clang/AST/DeclObjC.h"
19 #include "clang/AST/DeclTemplate.h"
20 #include "clang/AST/Expr.h"
21 #include "clang/AST/ExprCXX.h"
22 #include "clang/AST/ExprOpenMP.h"
24 #include "clang/AST/StmtVisitor.h"
25 #include "clang/Basic/CharInfo.h"
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/Support/Format.h"
28 using namespace clang;
29 
30 //===----------------------------------------------------------------------===//
31 // StmtPrinter Visitor
32 //===----------------------------------------------------------------------===//
33 
34 namespace {
35  class StmtPrinter : public StmtVisitor<StmtPrinter> {
36  raw_ostream &OS;
37  unsigned IndentLevel;
38  clang::PrinterHelper* Helper;
39  PrintingPolicy Policy;
40 
41  public:
42  StmtPrinter(raw_ostream &os, PrinterHelper* helper,
43  const PrintingPolicy &Policy,
44  unsigned Indentation = 0)
45  : OS(os), IndentLevel(Indentation), Helper(helper), Policy(Policy) {}
46 
47  void PrintStmt(Stmt *S) {
48  PrintStmt(S, Policy.Indentation);
49  }
50 
51  void PrintStmt(Stmt *S, int SubIndent) {
52  IndentLevel += SubIndent;
53  if (S && isa<Expr>(S)) {
54  // If this is an expr used in a stmt context, indent and newline it.
55  Indent();
56  Visit(S);
57  OS << ";\n";
58  } else if (S) {
59  Visit(S);
60  } else {
61  Indent() << "<<<NULL STATEMENT>>>\n";
62  }
63  IndentLevel -= SubIndent;
64  }
65 
66  void PrintRawCompoundStmt(CompoundStmt *S);
67  void PrintRawDecl(Decl *D);
68  void PrintRawDeclStmt(const DeclStmt *S);
69  void PrintRawIfStmt(IfStmt *If);
70  void PrintRawCXXCatchStmt(CXXCatchStmt *Catch);
71  void PrintCallArgs(CallExpr *E);
72  void PrintRawSEHExceptHandler(SEHExceptStmt *S);
73  void PrintRawSEHFinallyStmt(SEHFinallyStmt *S);
74  void PrintOMPExecutableDirective(OMPExecutableDirective *S);
75 
76  void PrintExpr(Expr *E) {
77  if (E)
78  Visit(E);
79  else
80  OS << "<null expr>";
81  }
82 
83  raw_ostream &Indent(int Delta = 0) {
84  for (int i = 0, e = IndentLevel+Delta; i < e; ++i)
85  OS << " ";
86  return OS;
87  }
88 
89  void Visit(Stmt* S) {
90  if (Helper && Helper->handledStmt(S,OS))
91  return;
93  }
94 
95  void VisitStmt(Stmt *Node) LLVM_ATTRIBUTE_UNUSED {
96  Indent() << "<<unknown stmt type>>\n";
97  }
98  void VisitExpr(Expr *Node) LLVM_ATTRIBUTE_UNUSED {
99  OS << "<<unknown expr type>>";
100  }
101  void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
102 
103 #define ABSTRACT_STMT(CLASS)
104 #define STMT(CLASS, PARENT) \
105  void Visit##CLASS(CLASS *Node);
106 #include "clang/AST/StmtNodes.inc"
107  };
108 }
109 
110 //===----------------------------------------------------------------------===//
111 // Stmt printing methods.
112 //===----------------------------------------------------------------------===//
113 
114 /// PrintRawCompoundStmt - Print a compound stmt without indenting the {, and
115 /// with no newline after the }.
116 void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
117  OS << "{\n";
118  for (auto *I : Node->body())
119  PrintStmt(I);
120 
121  Indent() << "}";
122 }
123 
124 void StmtPrinter::PrintRawDecl(Decl *D) {
125  D->print(OS, Policy, IndentLevel);
126 }
127 
128 void StmtPrinter::PrintRawDeclStmt(const DeclStmt *S) {
129  SmallVector<Decl*, 2> Decls(S->decls());
130  Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
131 }
132 
133 void StmtPrinter::VisitNullStmt(NullStmt *Node) {
134  Indent() << ";\n";
135 }
136 
137 void StmtPrinter::VisitDeclStmt(DeclStmt *Node) {
138  Indent();
139  PrintRawDeclStmt(Node);
140  OS << ";\n";
141 }
142 
143 void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {
144  Indent();
145  PrintRawCompoundStmt(Node);
146  OS << "\n";
147 }
148 
149 void StmtPrinter::VisitCaseStmt(CaseStmt *Node) {
150  Indent(-1) << "case ";
151  PrintExpr(Node->getLHS());
152  if (Node->getRHS()) {
153  OS << " ... ";
154  PrintExpr(Node->getRHS());
155  }
156  OS << ":\n";
157 
158  PrintStmt(Node->getSubStmt(), 0);
159 }
160 
161 void StmtPrinter::VisitDefaultStmt(DefaultStmt *Node) {
162  Indent(-1) << "default:\n";
163  PrintStmt(Node->getSubStmt(), 0);
164 }
165 
166 void StmtPrinter::VisitLabelStmt(LabelStmt *Node) {
167  Indent(-1) << Node->getName() << ":\n";
168  PrintStmt(Node->getSubStmt(), 0);
169 }
170 
171 void StmtPrinter::VisitAttributedStmt(AttributedStmt *Node) {
172  for (const auto *Attr : Node->getAttrs()) {
173  Attr->printPretty(OS, Policy);
174  }
175 
176  PrintStmt(Node->getSubStmt(), 0);
177 }
178 
179 void StmtPrinter::PrintRawIfStmt(IfStmt *If) {
180  OS << "if (";
181  if (const DeclStmt *DS = If->getConditionVariableDeclStmt())
182  PrintRawDeclStmt(DS);
183  else
184  PrintExpr(If->getCond());
185  OS << ')';
186 
187  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(If->getThen())) {
188  OS << ' ';
189  PrintRawCompoundStmt(CS);
190  OS << (If->getElse() ? ' ' : '\n');
191  } else {
192  OS << '\n';
193  PrintStmt(If->getThen());
194  if (If->getElse()) Indent();
195  }
196 
197  if (Stmt *Else = If->getElse()) {
198  OS << "else";
199 
200  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Else)) {
201  OS << ' ';
202  PrintRawCompoundStmt(CS);
203  OS << '\n';
204  } else if (IfStmt *ElseIf = dyn_cast<IfStmt>(Else)) {
205  OS << ' ';
206  PrintRawIfStmt(ElseIf);
207  } else {
208  OS << '\n';
209  PrintStmt(If->getElse());
210  }
211  }
212 }
213 
214 void StmtPrinter::VisitIfStmt(IfStmt *If) {
215  Indent();
216  PrintRawIfStmt(If);
217 }
218 
219 void StmtPrinter::VisitSwitchStmt(SwitchStmt *Node) {
220  Indent() << "switch (";
221  if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
222  PrintRawDeclStmt(DS);
223  else
224  PrintExpr(Node->getCond());
225  OS << ")";
226 
227  // Pretty print compoundstmt bodies (very common).
228  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
229  OS << " ";
230  PrintRawCompoundStmt(CS);
231  OS << "\n";
232  } else {
233  OS << "\n";
234  PrintStmt(Node->getBody());
235  }
236 }
237 
238 void StmtPrinter::VisitWhileStmt(WhileStmt *Node) {
239  Indent() << "while (";
240  if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
241  PrintRawDeclStmt(DS);
242  else
243  PrintExpr(Node->getCond());
244  OS << ")\n";
245  PrintStmt(Node->getBody());
246 }
247 
248 void StmtPrinter::VisitDoStmt(DoStmt *Node) {
249  Indent() << "do ";
250  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
251  PrintRawCompoundStmt(CS);
252  OS << " ";
253  } else {
254  OS << "\n";
255  PrintStmt(Node->getBody());
256  Indent();
257  }
258 
259  OS << "while (";
260  PrintExpr(Node->getCond());
261  OS << ");\n";
262 }
263 
264 void StmtPrinter::VisitForStmt(ForStmt *Node) {
265  Indent() << "for (";
266  if (Node->getInit()) {
267  if (DeclStmt *DS = dyn_cast<DeclStmt>(Node->getInit()))
268  PrintRawDeclStmt(DS);
269  else
270  PrintExpr(cast<Expr>(Node->getInit()));
271  }
272  OS << ";";
273  if (Node->getCond()) {
274  OS << " ";
275  PrintExpr(Node->getCond());
276  }
277  OS << ";";
278  if (Node->getInc()) {
279  OS << " ";
280  PrintExpr(Node->getInc());
281  }
282  OS << ") ";
283 
284  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
285  PrintRawCompoundStmt(CS);
286  OS << "\n";
287  } else {
288  OS << "\n";
289  PrintStmt(Node->getBody());
290  }
291 }
292 
293 void StmtPrinter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *Node) {
294  Indent() << "for (";
295  if (DeclStmt *DS = dyn_cast<DeclStmt>(Node->getElement()))
296  PrintRawDeclStmt(DS);
297  else
298  PrintExpr(cast<Expr>(Node->getElement()));
299  OS << " in ";
300  PrintExpr(Node->getCollection());
301  OS << ") ";
302 
303  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
304  PrintRawCompoundStmt(CS);
305  OS << "\n";
306  } else {
307  OS << "\n";
308  PrintStmt(Node->getBody());
309  }
310 }
311 
312 void StmtPrinter::VisitCXXForRangeStmt(CXXForRangeStmt *Node) {
313  Indent() << "for (";
314  PrintingPolicy SubPolicy(Policy);
315  SubPolicy.SuppressInitializers = true;
316  Node->getLoopVariable()->print(OS, SubPolicy, IndentLevel);
317  OS << " : ";
318  PrintExpr(Node->getRangeInit());
319  OS << ") {\n";
320  PrintStmt(Node->getBody());
321  Indent() << "}";
322  if (Policy.IncludeNewlines) OS << "\n";
323 }
324 
325 void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) {
326  Indent();
327  if (Node->isIfExists())
328  OS << "__if_exists (";
329  else
330  OS << "__if_not_exists (";
331 
332  if (NestedNameSpecifier *Qualifier
334  Qualifier->print(OS, Policy);
335 
336  OS << Node->getNameInfo() << ") ";
337 
338  PrintRawCompoundStmt(Node->getSubStmt());
339 }
340 
341 void StmtPrinter::VisitGotoStmt(GotoStmt *Node) {
342  Indent() << "goto " << Node->getLabel()->getName() << ";";
343  if (Policy.IncludeNewlines) OS << "\n";
344 }
345 
346 void StmtPrinter::VisitIndirectGotoStmt(IndirectGotoStmt *Node) {
347  Indent() << "goto *";
348  PrintExpr(Node->getTarget());
349  OS << ";";
350  if (Policy.IncludeNewlines) OS << "\n";
351 }
352 
353 void StmtPrinter::VisitContinueStmt(ContinueStmt *Node) {
354  Indent() << "continue;";
355  if (Policy.IncludeNewlines) OS << "\n";
356 }
357 
358 void StmtPrinter::VisitBreakStmt(BreakStmt *Node) {
359  Indent() << "break;";
360  if (Policy.IncludeNewlines) OS << "\n";
361 }
362 
363 
364 void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) {
365  Indent() << "return";
366  if (Node->getRetValue()) {
367  OS << " ";
368  PrintExpr(Node->getRetValue());
369  }
370  OS << ";";
371  if (Policy.IncludeNewlines) OS << "\n";
372 }
373 
374 
375 void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
376  Indent() << "asm ";
377 
378  if (Node->isVolatile())
379  OS << "volatile ";
380 
381  OS << "(";
382  VisitStringLiteral(Node->getAsmString());
383 
384  // Outputs
385  if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
386  Node->getNumClobbers() != 0)
387  OS << " : ";
388 
389  for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
390  if (i != 0)
391  OS << ", ";
392 
393  if (!Node->getOutputName(i).empty()) {
394  OS << '[';
395  OS << Node->getOutputName(i);
396  OS << "] ";
397  }
398 
399  VisitStringLiteral(Node->getOutputConstraintLiteral(i));
400  OS << " (";
401  Visit(Node->getOutputExpr(i));
402  OS << ")";
403  }
404 
405  // Inputs
406  if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0)
407  OS << " : ";
408 
409  for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
410  if (i != 0)
411  OS << ", ";
412 
413  if (!Node->getInputName(i).empty()) {
414  OS << '[';
415  OS << Node->getInputName(i);
416  OS << "] ";
417  }
418 
419  VisitStringLiteral(Node->getInputConstraintLiteral(i));
420  OS << " (";
421  Visit(Node->getInputExpr(i));
422  OS << ")";
423  }
424 
425  // Clobbers
426  if (Node->getNumClobbers() != 0)
427  OS << " : ";
428 
429  for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
430  if (i != 0)
431  OS << ", ";
432 
433  VisitStringLiteral(Node->getClobberStringLiteral(i));
434  }
435 
436  OS << ");";
437  if (Policy.IncludeNewlines) OS << "\n";
438 }
439 
440 void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) {
441  // FIXME: Implement MS style inline asm statement printer.
442  Indent() << "__asm ";
443  if (Node->hasBraces())
444  OS << "{\n";
445  OS << Node->getAsmString() << "\n";
446  if (Node->hasBraces())
447  Indent() << "}\n";
448 }
449 
450 void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) {
451  PrintStmt(Node->getCapturedDecl()->getBody());
452 }
453 
454 void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) {
455  Indent() << "@try";
456  if (CompoundStmt *TS = dyn_cast<CompoundStmt>(Node->getTryBody())) {
457  PrintRawCompoundStmt(TS);
458  OS << "\n";
459  }
460 
461  for (unsigned I = 0, N = Node->getNumCatchStmts(); I != N; ++I) {
462  ObjCAtCatchStmt *catchStmt = Node->getCatchStmt(I);
463  Indent() << "@catch(";
464  if (catchStmt->getCatchParamDecl()) {
465  if (Decl *DS = catchStmt->getCatchParamDecl())
466  PrintRawDecl(DS);
467  }
468  OS << ")";
469  if (CompoundStmt *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
470  PrintRawCompoundStmt(CS);
471  OS << "\n";
472  }
473  }
474 
475  if (ObjCAtFinallyStmt *FS = static_cast<ObjCAtFinallyStmt *>(
476  Node->getFinallyStmt())) {
477  Indent() << "@finally";
478  PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
479  OS << "\n";
480  }
481 }
482 
483 void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
484 }
485 
486 void StmtPrinter::VisitObjCAtCatchStmt (ObjCAtCatchStmt *Node) {
487  Indent() << "@catch (...) { /* todo */ } \n";
488 }
489 
490 void StmtPrinter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *Node) {
491  Indent() << "@throw";
492  if (Node->getThrowExpr()) {
493  OS << " ";
494  PrintExpr(Node->getThrowExpr());
495  }
496  OS << ";\n";
497 }
498 
499 void StmtPrinter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *Node) {
500  Indent() << "@synchronized (";
501  PrintExpr(Node->getSynchExpr());
502  OS << ")";
503  PrintRawCompoundStmt(Node->getSynchBody());
504  OS << "\n";
505 }
506 
507 void StmtPrinter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *Node) {
508  Indent() << "@autoreleasepool";
509  PrintRawCompoundStmt(dyn_cast<CompoundStmt>(Node->getSubStmt()));
510  OS << "\n";
511 }
512 
513 void StmtPrinter::PrintRawCXXCatchStmt(CXXCatchStmt *Node) {
514  OS << "catch (";
515  if (Decl *ExDecl = Node->getExceptionDecl())
516  PrintRawDecl(ExDecl);
517  else
518  OS << "...";
519  OS << ") ";
520  PrintRawCompoundStmt(cast<CompoundStmt>(Node->getHandlerBlock()));
521 }
522 
523 void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
524  Indent();
525  PrintRawCXXCatchStmt(Node);
526  OS << "\n";
527 }
528 
529 void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
530  Indent() << "try ";
531  PrintRawCompoundStmt(Node->getTryBlock());
532  for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
533  OS << " ";
534  PrintRawCXXCatchStmt(Node->getHandler(i));
535  }
536  OS << "\n";
537 }
538 
539 void StmtPrinter::VisitSEHTryStmt(SEHTryStmt *Node) {
540  Indent() << (Node->getIsCXXTry() ? "try " : "__try ");
541  PrintRawCompoundStmt(Node->getTryBlock());
542  SEHExceptStmt *E = Node->getExceptHandler();
543  SEHFinallyStmt *F = Node->getFinallyHandler();
544  if(E)
545  PrintRawSEHExceptHandler(E);
546  else {
547  assert(F && "Must have a finally block...");
548  PrintRawSEHFinallyStmt(F);
549  }
550  OS << "\n";
551 }
552 
553 void StmtPrinter::PrintRawSEHFinallyStmt(SEHFinallyStmt *Node) {
554  OS << "__finally ";
555  PrintRawCompoundStmt(Node->getBlock());
556  OS << "\n";
557 }
558 
559 void StmtPrinter::PrintRawSEHExceptHandler(SEHExceptStmt *Node) {
560  OS << "__except (";
561  VisitExpr(Node->getFilterExpr());
562  OS << ")\n";
563  PrintRawCompoundStmt(Node->getBlock());
564  OS << "\n";
565 }
566 
567 void StmtPrinter::VisitSEHExceptStmt(SEHExceptStmt *Node) {
568  Indent();
569  PrintRawSEHExceptHandler(Node);
570  OS << "\n";
571 }
572 
573 void StmtPrinter::VisitSEHFinallyStmt(SEHFinallyStmt *Node) {
574  Indent();
575  PrintRawSEHFinallyStmt(Node);
576  OS << "\n";
577 }
578 
579 void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {
580  Indent() << "__leave;";
581  if (Policy.IncludeNewlines) OS << "\n";
582 }
583 
584 //===----------------------------------------------------------------------===//
585 // OpenMP clauses printing methods
586 //===----------------------------------------------------------------------===//
587 
588 namespace {
589 class OMPClausePrinter : public OMPClauseVisitor<OMPClausePrinter> {
590  raw_ostream &OS;
591  const PrintingPolicy &Policy;
592  /// \brief Process clauses with list of variables.
593  template <typename T>
594  void VisitOMPClauseList(T *Node, char StartSym);
595 public:
596  OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy)
597  : OS(OS), Policy(Policy) { }
598 #define OPENMP_CLAUSE(Name, Class) \
599  void Visit##Class(Class *S);
600 #include "clang/Basic/OpenMPKinds.def"
601 };
602 
603 void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {
604  OS << "if(";
605  if (Node->getNameModifier() != OMPD_unknown)
606  OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";
607  Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
608  OS << ")";
609 }
610 
611 void OMPClausePrinter::VisitOMPFinalClause(OMPFinalClause *Node) {
612  OS << "final(";
613  Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
614  OS << ")";
615 }
616 
617 void OMPClausePrinter::VisitOMPNumThreadsClause(OMPNumThreadsClause *Node) {
618  OS << "num_threads(";
619  Node->getNumThreads()->printPretty(OS, nullptr, Policy, 0);
620  OS << ")";
621 }
622 
623 void OMPClausePrinter::VisitOMPSafelenClause(OMPSafelenClause *Node) {
624  OS << "safelen(";
625  Node->getSafelen()->printPretty(OS, nullptr, Policy, 0);
626  OS << ")";
627 }
628 
629 void OMPClausePrinter::VisitOMPSimdlenClause(OMPSimdlenClause *Node) {
630  OS << "simdlen(";
631  Node->getSimdlen()->printPretty(OS, nullptr, Policy, 0);
632  OS << ")";
633 }
634 
635 void OMPClausePrinter::VisitOMPCollapseClause(OMPCollapseClause *Node) {
636  OS << "collapse(";
637  Node->getNumForLoops()->printPretty(OS, nullptr, Policy, 0);
638  OS << ")";
639 }
640 
641 void OMPClausePrinter::VisitOMPDefaultClause(OMPDefaultClause *Node) {
642  OS << "default("
643  << getOpenMPSimpleClauseTypeName(OMPC_default, Node->getDefaultKind())
644  << ")";
645 }
646 
647 void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
648  OS << "proc_bind("
649  << getOpenMPSimpleClauseTypeName(OMPC_proc_bind, Node->getProcBindKind())
650  << ")";
651 }
652 
653 void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
654  OS << "schedule(";
656  OS << getOpenMPSimpleClauseTypeName(OMPC_schedule,
657  Node->getFirstScheduleModifier());
659  OS << ", ";
660  OS << getOpenMPSimpleClauseTypeName(OMPC_schedule,
661  Node->getSecondScheduleModifier());
662  }
663  OS << ": ";
664  }
665  OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, Node->getScheduleKind());
666  if (Node->getChunkSize()) {
667  OS << ", ";
668  Node->getChunkSize()->printPretty(OS, nullptr, Policy);
669  }
670  OS << ")";
671 }
672 
673 void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
674  OS << "ordered";
675  if (auto *Num = Node->getNumForLoops()) {
676  OS << "(";
677  Num->printPretty(OS, nullptr, Policy, 0);
678  OS << ")";
679  }
680 }
681 
682 void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *) {
683  OS << "nowait";
684 }
685 
686 void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {
687  OS << "untied";
688 }
689 
690 void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {
691  OS << "nogroup";
692 }
693 
694 void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {
695  OS << "mergeable";
696 }
697 
698 void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) { OS << "read"; }
699 
700 void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) { OS << "write"; }
701 
702 void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *) {
703  OS << "update";
704 }
705 
706 void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {
707  OS << "capture";
708 }
709 
710 void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
711  OS << "seq_cst";
712 }
713 
714 void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {
715  OS << "threads";
716 }
717 
718 void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) { OS << "simd"; }
719 
720 void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
721  OS << "device(";
722  Node->getDevice()->printPretty(OS, nullptr, Policy, 0);
723  OS << ")";
724 }
725 
726 void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
727  OS << "num_teams(";
728  Node->getNumTeams()->printPretty(OS, nullptr, Policy, 0);
729  OS << ")";
730 }
731 
732 void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
733  OS << "thread_limit(";
734  Node->getThreadLimit()->printPretty(OS, nullptr, Policy, 0);
735  OS << ")";
736 }
737 
738 void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
739  OS << "priority(";
740  Node->getPriority()->printPretty(OS, nullptr, Policy, 0);
741  OS << ")";
742 }
743 
744 void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
745  OS << "grainsize(";
746  Node->getGrainsize()->printPretty(OS, nullptr, Policy, 0);
747  OS << ")";
748 }
749 
750 void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
751  OS << "num_tasks(";
752  Node->getNumTasks()->printPretty(OS, nullptr, Policy, 0);
753  OS << ")";
754 }
755 
756 void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
757  OS << "hint(";
758  Node->getHint()->printPretty(OS, nullptr, Policy, 0);
759  OS << ")";
760 }
761 
762 template<typename T>
763 void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {
764  for (typename T::varlist_iterator I = Node->varlist_begin(),
765  E = Node->varlist_end();
766  I != E; ++I) {
767  assert(*I && "Expected non-null Stmt");
768  if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(*I)) {
769  OS << (I == Node->varlist_begin() ? StartSym : ',');
770  cast<NamedDecl>(DRE->getDecl())->printQualifiedName(OS);
771  } else {
772  OS << (I == Node->varlist_begin() ? StartSym : ',');
773  (*I)->printPretty(OS, nullptr, Policy, 0);
774  }
775  }
776 }
777 
778 void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
779  if (!Node->varlist_empty()) {
780  OS << "private";
781  VisitOMPClauseList(Node, '(');
782  OS << ")";
783  }
784 }
785 
786 void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
787  if (!Node->varlist_empty()) {
788  OS << "firstprivate";
789  VisitOMPClauseList(Node, '(');
790  OS << ")";
791  }
792 }
793 
794 void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
795  if (!Node->varlist_empty()) {
796  OS << "lastprivate";
797  VisitOMPClauseList(Node, '(');
798  OS << ")";
799  }
800 }
801 
802 void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
803  if (!Node->varlist_empty()) {
804  OS << "shared";
805  VisitOMPClauseList(Node, '(');
806  OS << ")";
807  }
808 }
809 
810 void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
811  if (!Node->varlist_empty()) {
812  OS << "reduction(";
813  NestedNameSpecifier *QualifierLoc =
817  if (QualifierLoc == nullptr && OOK != OO_None) {
818  // Print reduction identifier in C format
819  OS << getOperatorSpelling(OOK);
820  } else {
821  // Use C++ format
822  if (QualifierLoc != nullptr)
823  QualifierLoc->print(OS, Policy);
824  OS << Node->getNameInfo();
825  }
826  OS << ":";
827  VisitOMPClauseList(Node, ' ');
828  OS << ")";
829  }
830 }
831 
832 void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
833  if (!Node->varlist_empty()) {
834  OS << "linear";
835  if (Node->getModifierLoc().isValid()) {
836  OS << '('
837  << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier());
838  }
839  VisitOMPClauseList(Node, '(');
840  if (Node->getModifierLoc().isValid())
841  OS << ')';
842  if (Node->getStep() != nullptr) {
843  OS << ": ";
844  Node->getStep()->printPretty(OS, nullptr, Policy, 0);
845  }
846  OS << ")";
847  }
848 }
849 
850 void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
851  if (!Node->varlist_empty()) {
852  OS << "aligned";
853  VisitOMPClauseList(Node, '(');
854  if (Node->getAlignment() != nullptr) {
855  OS << ": ";
856  Node->getAlignment()->printPretty(OS, nullptr, Policy, 0);
857  }
858  OS << ")";
859  }
860 }
861 
862 void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
863  if (!Node->varlist_empty()) {
864  OS << "copyin";
865  VisitOMPClauseList(Node, '(');
866  OS << ")";
867  }
868 }
869 
870 void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
871  if (!Node->varlist_empty()) {
872  OS << "copyprivate";
873  VisitOMPClauseList(Node, '(');
874  OS << ")";
875  }
876 }
877 
878 void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
879  if (!Node->varlist_empty()) {
880  VisitOMPClauseList(Node, '(');
881  OS << ")";
882  }
883 }
884 
885 void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
886  OS << "depend(";
887  OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
888  Node->getDependencyKind());
889  if (!Node->varlist_empty()) {
890  OS << " :";
891  VisitOMPClauseList(Node, ' ');
892  }
893  OS << ")";
894 }
895 
896 void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
897  if (!Node->varlist_empty()) {
898  OS << "map(";
899  if (Node->getMapType() != OMPC_MAP_unknown) {
900  if (Node->getMapTypeModifier() != OMPC_MAP_unknown) {
901  OS << getOpenMPSimpleClauseTypeName(OMPC_map,
902  Node->getMapTypeModifier());
903  OS << ',';
904  }
905  OS << getOpenMPSimpleClauseTypeName(OMPC_map, Node->getMapType());
906  OS << ':';
907  }
908  VisitOMPClauseList(Node, ' ');
909  OS << ")";
910  }
911 }
912 }
913 
914 //===----------------------------------------------------------------------===//
915 // OpenMP directives printing methods
916 //===----------------------------------------------------------------------===//
917 
918 void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S) {
919  OMPClausePrinter Printer(OS, Policy);
920  ArrayRef<OMPClause *> Clauses = S->clauses();
921  for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
922  I != E; ++I)
923  if (*I && !(*I)->isImplicit()) {
924  Printer.Visit(*I);
925  OS << ' ';
926  }
927  OS << "\n";
928  if (S->hasAssociatedStmt() && S->getAssociatedStmt()) {
929  assert(isa<CapturedStmt>(S->getAssociatedStmt()) &&
930  "Expected captured statement!");
931  Stmt *CS = cast<CapturedStmt>(S->getAssociatedStmt())->getCapturedStmt();
932  PrintStmt(CS);
933  }
934 }
935 
936 void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
937  Indent() << "#pragma omp parallel ";
938  PrintOMPExecutableDirective(Node);
939 }
940 
941 void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) {
942  Indent() << "#pragma omp simd ";
943  PrintOMPExecutableDirective(Node);
944 }
945 
946 void StmtPrinter::VisitOMPForDirective(OMPForDirective *Node) {
947  Indent() << "#pragma omp for ";
948  PrintOMPExecutableDirective(Node);
949 }
950 
951 void StmtPrinter::VisitOMPForSimdDirective(OMPForSimdDirective *Node) {
952  Indent() << "#pragma omp for simd ";
953  PrintOMPExecutableDirective(Node);
954 }
955 
956 void StmtPrinter::VisitOMPSectionsDirective(OMPSectionsDirective *Node) {
957  Indent() << "#pragma omp sections ";
958  PrintOMPExecutableDirective(Node);
959 }
960 
961 void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) {
962  Indent() << "#pragma omp section";
963  PrintOMPExecutableDirective(Node);
964 }
965 
966 void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) {
967  Indent() << "#pragma omp single ";
968  PrintOMPExecutableDirective(Node);
969 }
970 
971 void StmtPrinter::VisitOMPMasterDirective(OMPMasterDirective *Node) {
972  Indent() << "#pragma omp master";
973  PrintOMPExecutableDirective(Node);
974 }
975 
976 void StmtPrinter::VisitOMPCriticalDirective(OMPCriticalDirective *Node) {
977  Indent() << "#pragma omp critical";
978  if (Node->getDirectiveName().getName()) {
979  OS << " (";
980  Node->getDirectiveName().printName(OS);
981  OS << ")";
982  }
983  OS << " ";
984  PrintOMPExecutableDirective(Node);
985 }
986 
987 void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) {
988  Indent() << "#pragma omp parallel for ";
989  PrintOMPExecutableDirective(Node);
990 }
991 
992 void StmtPrinter::VisitOMPParallelForSimdDirective(
994  Indent() << "#pragma omp parallel for simd ";
995  PrintOMPExecutableDirective(Node);
996 }
997 
998 void StmtPrinter::VisitOMPParallelSectionsDirective(
1000  Indent() << "#pragma omp parallel sections ";
1001  PrintOMPExecutableDirective(Node);
1002 }
1003 
1004 void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) {
1005  Indent() << "#pragma omp task ";
1006  PrintOMPExecutableDirective(Node);
1007 }
1008 
1009 void StmtPrinter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *Node) {
1010  Indent() << "#pragma omp taskyield";
1011  PrintOMPExecutableDirective(Node);
1012 }
1013 
1014 void StmtPrinter::VisitOMPBarrierDirective(OMPBarrierDirective *Node) {
1015  Indent() << "#pragma omp barrier";
1016  PrintOMPExecutableDirective(Node);
1017 }
1018 
1019 void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
1020  Indent() << "#pragma omp taskwait";
1021  PrintOMPExecutableDirective(Node);
1022 }
1023 
1024 void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) {
1025  Indent() << "#pragma omp taskgroup";
1026  PrintOMPExecutableDirective(Node);
1027 }
1028 
1029 void StmtPrinter::VisitOMPFlushDirective(OMPFlushDirective *Node) {
1030  Indent() << "#pragma omp flush ";
1031  PrintOMPExecutableDirective(Node);
1032 }
1033 
1034 void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
1035  Indent() << "#pragma omp ordered ";
1036  PrintOMPExecutableDirective(Node);
1037 }
1038 
1039 void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
1040  Indent() << "#pragma omp atomic ";
1041  PrintOMPExecutableDirective(Node);
1042 }
1043 
1044 void StmtPrinter::VisitOMPTargetDirective(OMPTargetDirective *Node) {
1045  Indent() << "#pragma omp target ";
1046  PrintOMPExecutableDirective(Node);
1047 }
1048 
1049 void StmtPrinter::VisitOMPTargetDataDirective(OMPTargetDataDirective *Node) {
1050  Indent() << "#pragma omp target data ";
1051  PrintOMPExecutableDirective(Node);
1052 }
1053 
1054 void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
1055  Indent() << "#pragma omp teams ";
1056  PrintOMPExecutableDirective(Node);
1057 }
1058 
1059 void StmtPrinter::VisitOMPCancellationPointDirective(
1061  Indent() << "#pragma omp cancellation point "
1063  PrintOMPExecutableDirective(Node);
1064 }
1065 
1066 void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
1067  Indent() << "#pragma omp cancel "
1068  << getOpenMPDirectiveName(Node->getCancelRegion()) << " ";
1069  PrintOMPExecutableDirective(Node);
1070 }
1071 
1072 void StmtPrinter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *Node) {
1073  Indent() << "#pragma omp taskloop ";
1074  PrintOMPExecutableDirective(Node);
1075 }
1076 
1077 void StmtPrinter::VisitOMPTaskLoopSimdDirective(
1078  OMPTaskLoopSimdDirective *Node) {
1079  Indent() << "#pragma omp taskloop simd ";
1080  PrintOMPExecutableDirective(Node);
1081 }
1082 
1083 void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
1084  Indent() << "#pragma omp distribute ";
1085  PrintOMPExecutableDirective(Node);
1086 }
1087 
1088 //===----------------------------------------------------------------------===//
1089 // Expr printing methods.
1090 //===----------------------------------------------------------------------===//
1091 
1092 void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
1093  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1094  Qualifier->print(OS, Policy);
1095  if (Node->hasTemplateKeyword())
1096  OS << "template ";
1097  OS << Node->getNameInfo();
1098  if (Node->hasExplicitTemplateArgs())
1100  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
1101 }
1102 
1103 void StmtPrinter::VisitDependentScopeDeclRefExpr(
1104  DependentScopeDeclRefExpr *Node) {
1105  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1106  Qualifier->print(OS, Policy);
1107  if (Node->hasTemplateKeyword())
1108  OS << "template ";
1109  OS << Node->getNameInfo();
1110  if (Node->hasExplicitTemplateArgs())
1112  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
1113 }
1114 
1115 void StmtPrinter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
1116  if (Node->getQualifier())
1117  Node->getQualifier()->print(OS, Policy);
1118  if (Node->hasTemplateKeyword())
1119  OS << "template ";
1120  OS << Node->getNameInfo();
1121  if (Node->hasExplicitTemplateArgs())
1123  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
1124 }
1125 
1126 void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
1127  if (Node->getBase()) {
1128  PrintExpr(Node->getBase());
1129  OS << (Node->isArrow() ? "->" : ".");
1130  }
1131  OS << *Node->getDecl();
1132 }
1133 
1134 void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
1135  if (Node->isSuperReceiver())
1136  OS << "super.";
1137  else if (Node->isObjectReceiver() && Node->getBase()) {
1138  PrintExpr(Node->getBase());
1139  OS << ".";
1140  } else if (Node->isClassReceiver() && Node->getClassReceiver()) {
1141  OS << Node->getClassReceiver()->getName() << ".";
1142  }
1143 
1144  if (Node->isImplicitProperty())
1146  else
1147  OS << Node->getExplicitProperty()->getName();
1148 }
1149 
1150 void StmtPrinter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node) {
1151 
1152  PrintExpr(Node->getBaseExpr());
1153  OS << "[";
1154  PrintExpr(Node->getKeyExpr());
1155  OS << "]";
1156 }
1157 
1158 void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
1160 }
1161 
1162 void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
1163  unsigned value = Node->getValue();
1164 
1165  switch (Node->getKind()) {
1166  case CharacterLiteral::Ascii: break; // no prefix.
1167  case CharacterLiteral::Wide: OS << 'L'; break;
1168  case CharacterLiteral::UTF8: OS << "u8"; break;
1169  case CharacterLiteral::UTF16: OS << 'u'; break;
1170  case CharacterLiteral::UTF32: OS << 'U'; break;
1171  }
1172 
1173  switch (value) {
1174  case '\\':
1175  OS << "'\\\\'";
1176  break;
1177  case '\'':
1178  OS << "'\\''";
1179  break;
1180  case '\a':
1181  // TODO: K&R: the meaning of '\\a' is different in traditional C
1182  OS << "'\\a'";
1183  break;
1184  case '\b':
1185  OS << "'\\b'";
1186  break;
1187  // Nonstandard escape sequence.
1188  /*case '\e':
1189  OS << "'\\e'";
1190  break;*/
1191  case '\f':
1192  OS << "'\\f'";
1193  break;
1194  case '\n':
1195  OS << "'\\n'";
1196  break;
1197  case '\r':
1198  OS << "'\\r'";
1199  break;
1200  case '\t':
1201  OS << "'\\t'";
1202  break;
1203  case '\v':
1204  OS << "'\\v'";
1205  break;
1206  default:
1207  if (value < 256 && isPrintable((unsigned char)value))
1208  OS << "'" << (char)value << "'";
1209  else if (value < 256)
1210  OS << "'\\x" << llvm::format("%02x", value) << "'";
1211  else if (value <= 0xFFFF)
1212  OS << "'\\u" << llvm::format("%04x", value) << "'";
1213  else
1214  OS << "'\\U" << llvm::format("%08x", value) << "'";
1215  }
1216 }
1217 
1218 void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
1219  bool isSigned = Node->getType()->isSignedIntegerType();
1220  OS << Node->getValue().toString(10, isSigned);
1221 
1222  // Emit suffixes. Integer literals are always a builtin integer type.
1223  switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1224  default: llvm_unreachable("Unexpected type for integer literal!");
1225  case BuiltinType::Char_S:
1226  case BuiltinType::Char_U: OS << "i8"; break;
1227  case BuiltinType::UChar: OS << "Ui8"; break;
1228  case BuiltinType::Short: OS << "i16"; break;
1229  case BuiltinType::UShort: OS << "Ui16"; break;
1230  case BuiltinType::Int: break; // no suffix.
1231  case BuiltinType::UInt: OS << 'U'; break;
1232  case BuiltinType::Long: OS << 'L'; break;
1233  case BuiltinType::ULong: OS << "UL"; break;
1234  case BuiltinType::LongLong: OS << "LL"; break;
1235  case BuiltinType::ULongLong: OS << "ULL"; break;
1236  }
1237 }
1238 
1239 static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
1240  bool PrintSuffix) {
1241  SmallString<16> Str;
1242  Node->getValue().toString(Str);
1243  OS << Str;
1244  if (Str.find_first_not_of("-0123456789") == StringRef::npos)
1245  OS << '.'; // Trailing dot in order to separate from ints.
1246 
1247  if (!PrintSuffix)
1248  return;
1249 
1250  // Emit suffixes. Float literals are always a builtin float type.
1251  switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1252  default: llvm_unreachable("Unexpected type for float literal!");
1253  case BuiltinType::Half: break; // FIXME: suffix?
1254  case BuiltinType::Double: break; // no suffix.
1255  case BuiltinType::Float: OS << 'F'; break;
1256  case BuiltinType::LongDouble: OS << 'L'; break;
1257  }
1258 }
1259 
1260 void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) {
1261  PrintFloatingLiteral(OS, Node, /*PrintSuffix=*/true);
1262 }
1263 
1264 void StmtPrinter::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
1265  PrintExpr(Node->getSubExpr());
1266  OS << "i";
1267 }
1268 
1269 void StmtPrinter::VisitStringLiteral(StringLiteral *Str) {
1270  Str->outputString(OS);
1271 }
1272 void StmtPrinter::VisitParenExpr(ParenExpr *Node) {
1273  OS << "(";
1274  PrintExpr(Node->getSubExpr());
1275  OS << ")";
1276 }
1277 void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
1278  if (!Node->isPostfix()) {
1279  OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1280 
1281  // Print a space if this is an "identifier operator" like __real, or if
1282  // it might be concatenated incorrectly like '+'.
1283  switch (Node->getOpcode()) {
1284  default: break;
1285  case UO_Real:
1286  case UO_Imag:
1287  case UO_Extension:
1288  OS << ' ';
1289  break;
1290  case UO_Plus:
1291  case UO_Minus:
1292  if (isa<UnaryOperator>(Node->getSubExpr()))
1293  OS << ' ';
1294  break;
1295  }
1296  }
1297  PrintExpr(Node->getSubExpr());
1298 
1299  if (Node->isPostfix())
1300  OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1301 }
1302 
1303 void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) {
1304  OS << "__builtin_offsetof(";
1305  Node->getTypeSourceInfo()->getType().print(OS, Policy);
1306  OS << ", ";
1307  bool PrintedSomething = false;
1308  for (unsigned i = 0, n = Node->getNumComponents(); i < n; ++i) {
1309  OffsetOfNode ON = Node->getComponent(i);
1310  if (ON.getKind() == OffsetOfNode::Array) {
1311  // Array node
1312  OS << "[";
1313  PrintExpr(Node->getIndexExpr(ON.getArrayExprIndex()));
1314  OS << "]";
1315  PrintedSomething = true;
1316  continue;
1317  }
1318 
1319  // Skip implicit base indirections.
1320  if (ON.getKind() == OffsetOfNode::Base)
1321  continue;
1322 
1323  // Field or identifier node.
1324  IdentifierInfo *Id = ON.getFieldName();
1325  if (!Id)
1326  continue;
1327 
1328  if (PrintedSomething)
1329  OS << ".";
1330  else
1331  PrintedSomething = true;
1332  OS << Id->getName();
1333  }
1334  OS << ")";
1335 }
1336 
1337 void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node){
1338  switch(Node->getKind()) {
1339  case UETT_SizeOf:
1340  OS << "sizeof";
1341  break;
1342  case UETT_AlignOf:
1343  if (Policy.LangOpts.CPlusPlus)
1344  OS << "alignof";
1345  else if (Policy.LangOpts.C11)
1346  OS << "_Alignof";
1347  else
1348  OS << "__alignof";
1349  break;
1350  case UETT_VecStep:
1351  OS << "vec_step";
1352  break;
1354  OS << "__builtin_omp_required_simd_align";
1355  break;
1356  }
1357  if (Node->isArgumentType()) {
1358  OS << '(';
1359  Node->getArgumentType().print(OS, Policy);
1360  OS << ')';
1361  } else {
1362  OS << " ";
1363  PrintExpr(Node->getArgumentExpr());
1364  }
1365 }
1366 
1367 void StmtPrinter::VisitGenericSelectionExpr(GenericSelectionExpr *Node) {
1368  OS << "_Generic(";
1369  PrintExpr(Node->getControllingExpr());
1370  for (unsigned i = 0; i != Node->getNumAssocs(); ++i) {
1371  OS << ", ";
1372  QualType T = Node->getAssocType(i);
1373  if (T.isNull())
1374  OS << "default";
1375  else
1376  T.print(OS, Policy);
1377  OS << ": ";
1378  PrintExpr(Node->getAssocExpr(i));
1379  }
1380  OS << ")";
1381 }
1382 
1383 void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
1384  PrintExpr(Node->getLHS());
1385  OS << "[";
1386  PrintExpr(Node->getRHS());
1387  OS << "]";
1388 }
1389 
1390 void StmtPrinter::VisitOMPArraySectionExpr(OMPArraySectionExpr *Node) {
1391  PrintExpr(Node->getBase());
1392  OS << "[";
1393  if (Node->getLowerBound())
1394  PrintExpr(Node->getLowerBound());
1395  if (Node->getColonLoc().isValid()) {
1396  OS << ":";
1397  if (Node->getLength())
1398  PrintExpr(Node->getLength());
1399  }
1400  OS << "]";
1401 }
1402 
1403 void StmtPrinter::PrintCallArgs(CallExpr *Call) {
1404  for (unsigned i = 0, e = Call->getNumArgs(); i != e; ++i) {
1405  if (isa<CXXDefaultArgExpr>(Call->getArg(i))) {
1406  // Don't print any defaulted arguments
1407  break;
1408  }
1409 
1410  if (i) OS << ", ";
1411  PrintExpr(Call->getArg(i));
1412  }
1413 }
1414 
1415 void StmtPrinter::VisitCallExpr(CallExpr *Call) {
1416  PrintExpr(Call->getCallee());
1417  OS << "(";
1418  PrintCallArgs(Call);
1419  OS << ")";
1420 }
1421 void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
1422  // FIXME: Suppress printing implicit bases (like "this")
1423  PrintExpr(Node->getBase());
1424 
1425  MemberExpr *ParentMember = dyn_cast<MemberExpr>(Node->getBase());
1426  FieldDecl *ParentDecl = ParentMember
1427  ? dyn_cast<FieldDecl>(ParentMember->getMemberDecl()) : nullptr;
1428 
1429  if (!ParentDecl || !ParentDecl->isAnonymousStructOrUnion())
1430  OS << (Node->isArrow() ? "->" : ".");
1431 
1432  if (FieldDecl *FD = dyn_cast<FieldDecl>(Node->getMemberDecl()))
1433  if (FD->isAnonymousStructOrUnion())
1434  return;
1435 
1436  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1437  Qualifier->print(OS, Policy);
1438  if (Node->hasTemplateKeyword())
1439  OS << "template ";
1440  OS << Node->getMemberNameInfo();
1441  if (Node->hasExplicitTemplateArgs())
1443  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
1444 }
1445 void StmtPrinter::VisitObjCIsaExpr(ObjCIsaExpr *Node) {
1446  PrintExpr(Node->getBase());
1447  OS << (Node->isArrow() ? "->isa" : ".isa");
1448 }
1449 
1450 void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
1451  PrintExpr(Node->getBase());
1452  OS << ".";
1453  OS << Node->getAccessor().getName();
1454 }
1455 void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
1456  OS << '(';
1457  Node->getTypeAsWritten().print(OS, Policy);
1458  OS << ')';
1459  PrintExpr(Node->getSubExpr());
1460 }
1461 void StmtPrinter::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
1462  OS << '(';
1463  Node->getType().print(OS, Policy);
1464  OS << ')';
1465  PrintExpr(Node->getInitializer());
1466 }
1467 void StmtPrinter::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
1468  // No need to print anything, simply forward to the subexpression.
1469  PrintExpr(Node->getSubExpr());
1470 }
1471 void StmtPrinter::VisitBinaryOperator(BinaryOperator *Node) {
1472  PrintExpr(Node->getLHS());
1473  OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1474  PrintExpr(Node->getRHS());
1475 }
1476 void StmtPrinter::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
1477  PrintExpr(Node->getLHS());
1478  OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1479  PrintExpr(Node->getRHS());
1480 }
1481 void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
1482  PrintExpr(Node->getCond());
1483  OS << " ? ";
1484  PrintExpr(Node->getLHS());
1485  OS << " : ";
1486  PrintExpr(Node->getRHS());
1487 }
1488 
1489 // GNU extensions.
1490 
1491 void
1492 StmtPrinter::VisitBinaryConditionalOperator(BinaryConditionalOperator *Node) {
1493  PrintExpr(Node->getCommon());
1494  OS << " ?: ";
1495  PrintExpr(Node->getFalseExpr());
1496 }
1497 void StmtPrinter::VisitAddrLabelExpr(AddrLabelExpr *Node) {
1498  OS << "&&" << Node->getLabel()->getName();
1499 }
1500 
1501 void StmtPrinter::VisitStmtExpr(StmtExpr *E) {
1502  OS << "(";
1503  PrintRawCompoundStmt(E->getSubStmt());
1504  OS << ")";
1505 }
1506 
1507 void StmtPrinter::VisitChooseExpr(ChooseExpr *Node) {
1508  OS << "__builtin_choose_expr(";
1509  PrintExpr(Node->getCond());
1510  OS << ", ";
1511  PrintExpr(Node->getLHS());
1512  OS << ", ";
1513  PrintExpr(Node->getRHS());
1514  OS << ")";
1515 }
1516 
1517 void StmtPrinter::VisitGNUNullExpr(GNUNullExpr *) {
1518  OS << "__null";
1519 }
1520 
1521 void StmtPrinter::VisitShuffleVectorExpr(ShuffleVectorExpr *Node) {
1522  OS << "__builtin_shufflevector(";
1523  for (unsigned i = 0, e = Node->getNumSubExprs(); i != e; ++i) {
1524  if (i) OS << ", ";
1525  PrintExpr(Node->getExpr(i));
1526  }
1527  OS << ")";
1528 }
1529 
1530 void StmtPrinter::VisitConvertVectorExpr(ConvertVectorExpr *Node) {
1531  OS << "__builtin_convertvector(";
1532  PrintExpr(Node->getSrcExpr());
1533  OS << ", ";
1534  Node->getType().print(OS, Policy);
1535  OS << ")";
1536 }
1537 
1538 void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
1539  if (Node->getSyntacticForm()) {
1540  Visit(Node->getSyntacticForm());
1541  return;
1542  }
1543 
1544  OS << "{";
1545  for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
1546  if (i) OS << ", ";
1547  if (Node->getInit(i))
1548  PrintExpr(Node->getInit(i));
1549  else
1550  OS << "{}";
1551  }
1552  OS << "}";
1553 }
1554 
1555 void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
1556  OS << "(";
1557  for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
1558  if (i) OS << ", ";
1559  PrintExpr(Node->getExpr(i));
1560  }
1561  OS << ")";
1562 }
1563 
1564 void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
1565  bool NeedsEquals = true;
1567  DEnd = Node->designators_end();
1568  D != DEnd; ++D) {
1569  if (D->isFieldDesignator()) {
1570  if (D->getDotLoc().isInvalid()) {
1571  if (IdentifierInfo *II = D->getFieldName()) {
1572  OS << II->getName() << ":";
1573  NeedsEquals = false;
1574  }
1575  } else {
1576  OS << "." << D->getFieldName()->getName();
1577  }
1578  } else {
1579  OS << "[";
1580  if (D->isArrayDesignator()) {
1581  PrintExpr(Node->getArrayIndex(*D));
1582  } else {
1583  PrintExpr(Node->getArrayRangeStart(*D));
1584  OS << " ... ";
1585  PrintExpr(Node->getArrayRangeEnd(*D));
1586  }
1587  OS << "]";
1588  }
1589  }
1590 
1591  if (NeedsEquals)
1592  OS << " = ";
1593  else
1594  OS << " ";
1595  PrintExpr(Node->getInit());
1596 }
1597 
1598 void StmtPrinter::VisitDesignatedInitUpdateExpr(
1599  DesignatedInitUpdateExpr *Node) {
1600  OS << "{";
1601  OS << "/*base*/";
1602  PrintExpr(Node->getBase());
1603  OS << ", ";
1604 
1605  OS << "/*updater*/";
1606  PrintExpr(Node->getUpdater());
1607  OS << "}";
1608 }
1609 
1610 void StmtPrinter::VisitNoInitExpr(NoInitExpr *Node) {
1611  OS << "/*no init*/";
1612 }
1613 
1614 void StmtPrinter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *Node) {
1615  if (Policy.LangOpts.CPlusPlus) {
1616  OS << "/*implicit*/";
1617  Node->getType().print(OS, Policy);
1618  OS << "()";
1619  } else {
1620  OS << "/*implicit*/(";
1621  Node->getType().print(OS, Policy);
1622  OS << ')';
1623  if (Node->getType()->isRecordType())
1624  OS << "{}";
1625  else
1626  OS << 0;
1627  }
1628 }
1629 
1630 void StmtPrinter::VisitVAArgExpr(VAArgExpr *Node) {
1631  OS << "__builtin_va_arg(";
1632  PrintExpr(Node->getSubExpr());
1633  OS << ", ";
1634  Node->getType().print(OS, Policy);
1635  OS << ")";
1636 }
1637 
1638 void StmtPrinter::VisitPseudoObjectExpr(PseudoObjectExpr *Node) {
1639  PrintExpr(Node->getSyntacticForm());
1640 }
1641 
1642 void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
1643  const char *Name = nullptr;
1644  switch (Node->getOp()) {
1645 #define BUILTIN(ID, TYPE, ATTRS)
1646 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1647  case AtomicExpr::AO ## ID: \
1648  Name = #ID "("; \
1649  break;
1650 #include "clang/Basic/Builtins.def"
1651  }
1652  OS << Name;
1653 
1654  // AtomicExpr stores its subexpressions in a permuted order.
1655  PrintExpr(Node->getPtr());
1656  if (Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1657  Node->getOp() != AtomicExpr::AO__atomic_load_n) {
1658  OS << ", ";
1659  PrintExpr(Node->getVal1());
1660  }
1661  if (Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1662  Node->isCmpXChg()) {
1663  OS << ", ";
1664  PrintExpr(Node->getVal2());
1665  }
1666  if (Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1667  Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1668  OS << ", ";
1669  PrintExpr(Node->getWeak());
1670  }
1671  if (Node->getOp() != AtomicExpr::AO__c11_atomic_init) {
1672  OS << ", ";
1673  PrintExpr(Node->getOrder());
1674  }
1675  if (Node->isCmpXChg()) {
1676  OS << ", ";
1677  PrintExpr(Node->getOrderFail());
1678  }
1679  OS << ")";
1680 }
1681 
1682 // C++
1683 void StmtPrinter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) {
1684  const char *OpStrings[NUM_OVERLOADED_OPERATORS] = {
1685  "",
1686 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
1687  Spelling,
1688 #include "clang/Basic/OperatorKinds.def"
1689  };
1690 
1692  if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1693  if (Node->getNumArgs() == 1) {
1694  OS << OpStrings[Kind] << ' ';
1695  PrintExpr(Node->getArg(0));
1696  } else {
1697  PrintExpr(Node->getArg(0));
1698  OS << ' ' << OpStrings[Kind];
1699  }
1700  } else if (Kind == OO_Arrow) {
1701  PrintExpr(Node->getArg(0));
1702  } else if (Kind == OO_Call) {
1703  PrintExpr(Node->getArg(0));
1704  OS << '(';
1705  for (unsigned ArgIdx = 1; ArgIdx < Node->getNumArgs(); ++ArgIdx) {
1706  if (ArgIdx > 1)
1707  OS << ", ";
1708  if (!isa<CXXDefaultArgExpr>(Node->getArg(ArgIdx)))
1709  PrintExpr(Node->getArg(ArgIdx));
1710  }
1711  OS << ')';
1712  } else if (Kind == OO_Subscript) {
1713  PrintExpr(Node->getArg(0));
1714  OS << '[';
1715  PrintExpr(Node->getArg(1));
1716  OS << ']';
1717  } else if (Node->getNumArgs() == 1) {
1718  OS << OpStrings[Kind] << ' ';
1719  PrintExpr(Node->getArg(0));
1720  } else if (Node->getNumArgs() == 2) {
1721  PrintExpr(Node->getArg(0));
1722  OS << ' ' << OpStrings[Kind] << ' ';
1723  PrintExpr(Node->getArg(1));
1724  } else {
1725  llvm_unreachable("unknown overloaded operator");
1726  }
1727 }
1728 
1729 void StmtPrinter::VisitCXXMemberCallExpr(CXXMemberCallExpr *Node) {
1730  // If we have a conversion operator call only print the argument.
1731  CXXMethodDecl *MD = Node->getMethodDecl();
1732  if (MD && isa<CXXConversionDecl>(MD)) {
1733  PrintExpr(Node->getImplicitObjectArgument());
1734  return;
1735  }
1736  VisitCallExpr(cast<CallExpr>(Node));
1737 }
1738 
1739 void StmtPrinter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *Node) {
1740  PrintExpr(Node->getCallee());
1741  OS << "<<<";
1742  PrintCallArgs(Node->getConfig());
1743  OS << ">>>(";
1744  PrintCallArgs(Node);
1745  OS << ")";
1746 }
1747 
1748 void StmtPrinter::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) {
1749  OS << Node->getCastName() << '<';
1750  Node->getTypeAsWritten().print(OS, Policy);
1751  OS << ">(";
1752  PrintExpr(Node->getSubExpr());
1753  OS << ")";
1754 }
1755 
1756 void StmtPrinter::VisitCXXStaticCastExpr(CXXStaticCastExpr *Node) {
1757  VisitCXXNamedCastExpr(Node);
1758 }
1759 
1760 void StmtPrinter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *Node) {
1761  VisitCXXNamedCastExpr(Node);
1762 }
1763 
1764 void StmtPrinter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *Node) {
1765  VisitCXXNamedCastExpr(Node);
1766 }
1767 
1768 void StmtPrinter::VisitCXXConstCastExpr(CXXConstCastExpr *Node) {
1769  VisitCXXNamedCastExpr(Node);
1770 }
1771 
1772 void StmtPrinter::VisitCXXTypeidExpr(CXXTypeidExpr *Node) {
1773  OS << "typeid(";
1774  if (Node->isTypeOperand()) {
1775  Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1776  } else {
1777  PrintExpr(Node->getExprOperand());
1778  }
1779  OS << ")";
1780 }
1781 
1782 void StmtPrinter::VisitCXXUuidofExpr(CXXUuidofExpr *Node) {
1783  OS << "__uuidof(";
1784  if (Node->isTypeOperand()) {
1785  Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1786  } else {
1787  PrintExpr(Node->getExprOperand());
1788  }
1789  OS << ")";
1790 }
1791 
1792 void StmtPrinter::VisitMSPropertyRefExpr(MSPropertyRefExpr *Node) {
1793  PrintExpr(Node->getBaseExpr());
1794  if (Node->isArrow())
1795  OS << "->";
1796  else
1797  OS << ".";
1798  if (NestedNameSpecifier *Qualifier =
1800  Qualifier->print(OS, Policy);
1801  OS << Node->getPropertyDecl()->getDeclName();
1802 }
1803 
1804 void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
1805  PrintExpr(Node->getBase());
1806  OS << "[";
1807  PrintExpr(Node->getIdx());
1808  OS << "]";
1809 }
1810 
1811 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
1812  switch (Node->getLiteralOperatorKind()) {
1814  OS << cast<StringLiteral>(Node->getArg(0)->IgnoreImpCasts())->getString();
1815  break;
1817  DeclRefExpr *DRE = cast<DeclRefExpr>(Node->getCallee()->IgnoreImpCasts());
1818  const TemplateArgumentList *Args =
1819  cast<FunctionDecl>(DRE->getDecl())->getTemplateSpecializationArgs();
1820  assert(Args);
1821 
1822  if (Args->size() != 1) {
1823  OS << "operator\"\"" << Node->getUDSuffix()->getName();
1825  OS, Args->data(), Args->size(), Policy);
1826  OS << "()";
1827  return;
1828  }
1829 
1830  const TemplateArgument &Pack = Args->get(0);
1831  for (const auto &P : Pack.pack_elements()) {
1832  char C = (char)P.getAsIntegral().getZExtValue();
1833  OS << C;
1834  }
1835  break;
1836  }
1838  // Print integer literal without suffix.
1839  IntegerLiteral *Int = cast<IntegerLiteral>(Node->getCookedLiteral());
1840  OS << Int->getValue().toString(10, /*isSigned*/false);
1841  break;
1842  }
1844  // Print floating literal without suffix.
1845  FloatingLiteral *Float = cast<FloatingLiteral>(Node->getCookedLiteral());
1846  PrintFloatingLiteral(OS, Float, /*PrintSuffix=*/false);
1847  break;
1848  }
1851  PrintExpr(Node->getCookedLiteral());
1852  break;
1853  }
1854  OS << Node->getUDSuffix()->getName();
1855 }
1856 
1857 void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
1858  OS << (Node->getValue() ? "true" : "false");
1859 }
1860 
1861 void StmtPrinter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *Node) {
1862  OS << "nullptr";
1863 }
1864 
1865 void StmtPrinter::VisitCXXThisExpr(CXXThisExpr *Node) {
1866  OS << "this";
1867 }
1868 
1869 void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
1870  if (!Node->getSubExpr())
1871  OS << "throw";
1872  else {
1873  OS << "throw ";
1874  PrintExpr(Node->getSubExpr());
1875  }
1876 }
1877 
1878 void StmtPrinter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Node) {
1879  // Nothing to print: we picked up the default argument.
1880 }
1881 
1882 void StmtPrinter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Node) {
1883  // Nothing to print: we picked up the default initializer.
1884 }
1885 
1886 void StmtPrinter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
1887  Node->getType().print(OS, Policy);
1888  // If there are no parens, this is list-initialization, and the braces are
1889  // part of the syntax of the inner construct.
1890  if (Node->getLParenLoc().isValid())
1891  OS << "(";
1892  PrintExpr(Node->getSubExpr());
1893  if (Node->getLParenLoc().isValid())
1894  OS << ")";
1895 }
1896 
1897 void StmtPrinter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
1898  PrintExpr(Node->getSubExpr());
1899 }
1900 
1901 void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
1902  Node->getType().print(OS, Policy);
1903  if (Node->isStdInitListInitialization())
1904  /* Nothing to do; braces are part of creating the std::initializer_list. */;
1905  else if (Node->isListInitialization())
1906  OS << "{";
1907  else
1908  OS << "(";
1910  ArgEnd = Node->arg_end();
1911  Arg != ArgEnd; ++Arg) {
1912  if ((*Arg)->isDefaultArgument())
1913  break;
1914  if (Arg != Node->arg_begin())
1915  OS << ", ";
1916  PrintExpr(*Arg);
1917  }
1918  if (Node->isStdInitListInitialization())
1919  /* See above. */;
1920  else if (Node->isListInitialization())
1921  OS << "}";
1922  else
1923  OS << ")";
1924 }
1925 
1926 void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
1927  OS << '[';
1928  bool NeedComma = false;
1929  switch (Node->getCaptureDefault()) {
1930  case LCD_None:
1931  break;
1932 
1933  case LCD_ByCopy:
1934  OS << '=';
1935  NeedComma = true;
1936  break;
1937 
1938  case LCD_ByRef:
1939  OS << '&';
1940  NeedComma = true;
1941  break;
1942  }
1944  CEnd = Node->explicit_capture_end();
1945  C != CEnd;
1946  ++C) {
1947  if (NeedComma)
1948  OS << ", ";
1949  NeedComma = true;
1950 
1951  switch (C->getCaptureKind()) {
1952  case LCK_This:
1953  OS << "this";
1954  break;
1955 
1956  case LCK_ByRef:
1957  if (Node->getCaptureDefault() != LCD_ByRef || Node->isInitCapture(C))
1958  OS << '&';
1959  OS << C->getCapturedVar()->getName();
1960  break;
1961 
1962  case LCK_ByCopy:
1963  OS << C->getCapturedVar()->getName();
1964  break;
1965  case LCK_VLAType:
1966  llvm_unreachable("VLA type in explicit captures.");
1967  }
1968 
1969  if (Node->isInitCapture(C))
1970  PrintExpr(C->getCapturedVar()->getInit());
1971  }
1972  OS << ']';
1973 
1974  if (Node->hasExplicitParameters()) {
1975  OS << " (";
1976  CXXMethodDecl *Method = Node->getCallOperator();
1977  NeedComma = false;
1978  for (auto P : Method->params()) {
1979  if (NeedComma) {
1980  OS << ", ";
1981  } else {
1982  NeedComma = true;
1983  }
1984  std::string ParamStr = P->getNameAsString();
1985  P->getOriginalType().print(OS, Policy, ParamStr);
1986  }
1987  if (Method->isVariadic()) {
1988  if (NeedComma)
1989  OS << ", ";
1990  OS << "...";
1991  }
1992  OS << ')';
1993 
1994  if (Node->isMutable())
1995  OS << " mutable";
1996 
1997  const FunctionProtoType *Proto
1998  = Method->getType()->getAs<FunctionProtoType>();
1999  Proto->printExceptionSpecification(OS, Policy);
2000 
2001  // FIXME: Attributes
2002 
2003  // Print the trailing return type if it was specified in the source.
2004  if (Node->hasExplicitResultType()) {
2005  OS << " -> ";
2006  Proto->getReturnType().print(OS, Policy);
2007  }
2008  }
2009 
2010  // Print the body.
2011  CompoundStmt *Body = Node->getBody();
2012  OS << ' ';
2013  PrintStmt(Body);
2014 }
2015 
2016 void StmtPrinter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *Node) {
2017  if (TypeSourceInfo *TSInfo = Node->getTypeSourceInfo())
2018  TSInfo->getType().print(OS, Policy);
2019  else
2020  Node->getType().print(OS, Policy);
2021  OS << "()";
2022 }
2023 
2024 void StmtPrinter::VisitCXXNewExpr(CXXNewExpr *E) {
2025  if (E->isGlobalNew())
2026  OS << "::";
2027  OS << "new ";
2028  unsigned NumPlace = E->getNumPlacementArgs();
2029  if (NumPlace > 0 && !isa<CXXDefaultArgExpr>(E->getPlacementArg(0))) {
2030  OS << "(";
2031  PrintExpr(E->getPlacementArg(0));
2032  for (unsigned i = 1; i < NumPlace; ++i) {
2033  if (isa<CXXDefaultArgExpr>(E->getPlacementArg(i)))
2034  break;
2035  OS << ", ";
2036  PrintExpr(E->getPlacementArg(i));
2037  }
2038  OS << ") ";
2039  }
2040  if (E->isParenTypeId())
2041  OS << "(";
2042  std::string TypeS;
2043  if (Expr *Size = E->getArraySize()) {
2044  llvm::raw_string_ostream s(TypeS);
2045  s << '[';
2046  Size->printPretty(s, Helper, Policy);
2047  s << ']';
2048  }
2049  E->getAllocatedType().print(OS, Policy, TypeS);
2050  if (E->isParenTypeId())
2051  OS << ")";
2052 
2054  if (InitStyle) {
2055  if (InitStyle == CXXNewExpr::CallInit)
2056  OS << "(";
2057  PrintExpr(E->getInitializer());
2058  if (InitStyle == CXXNewExpr::CallInit)
2059  OS << ")";
2060  }
2061 }
2062 
2063 void StmtPrinter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
2064  if (E->isGlobalDelete())
2065  OS << "::";
2066  OS << "delete ";
2067  if (E->isArrayForm())
2068  OS << "[] ";
2069  PrintExpr(E->getArgument());
2070 }
2071 
2072 void StmtPrinter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
2073  PrintExpr(E->getBase());
2074  if (E->isArrow())
2075  OS << "->";
2076  else
2077  OS << '.';
2078  if (E->getQualifier())
2079  E->getQualifier()->print(OS, Policy);
2080  OS << "~";
2081 
2083  OS << II->getName();
2084  else
2085  E->getDestroyedType().print(OS, Policy);
2086 }
2087 
2088 void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
2090  OS << "{";
2091 
2092  for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
2093  if (isa<CXXDefaultArgExpr>(E->getArg(i))) {
2094  // Don't print any defaulted arguments
2095  break;
2096  }
2097 
2098  if (i) OS << ", ";
2099  PrintExpr(E->getArg(i));
2100  }
2101 
2103  OS << "}";
2104 }
2105 
2106 void StmtPrinter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
2107  PrintExpr(E->getSubExpr());
2108 }
2109 
2110 void StmtPrinter::VisitExprWithCleanups(ExprWithCleanups *E) {
2111  // Just forward to the subexpression.
2112  PrintExpr(E->getSubExpr());
2113 }
2114 
2115 void
2116 StmtPrinter::VisitCXXUnresolvedConstructExpr(
2118  Node->getTypeAsWritten().print(OS, Policy);
2119  OS << "(";
2121  ArgEnd = Node->arg_end();
2122  Arg != ArgEnd; ++Arg) {
2123  if (Arg != Node->arg_begin())
2124  OS << ", ";
2125  PrintExpr(*Arg);
2126  }
2127  OS << ")";
2128 }
2129 
2130 void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2132  if (!Node->isImplicitAccess()) {
2133  PrintExpr(Node->getBase());
2134  OS << (Node->isArrow() ? "->" : ".");
2135  }
2136  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2137  Qualifier->print(OS, Policy);
2138  if (Node->hasTemplateKeyword())
2139  OS << "template ";
2140  OS << Node->getMemberNameInfo();
2141  if (Node->hasExplicitTemplateArgs())
2143  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
2144 }
2145 
2146 void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) {
2147  if (!Node->isImplicitAccess()) {
2148  PrintExpr(Node->getBase());
2149  OS << (Node->isArrow() ? "->" : ".");
2150  }
2151  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2152  Qualifier->print(OS, Policy);
2153  if (Node->hasTemplateKeyword())
2154  OS << "template ";
2155  OS << Node->getMemberNameInfo();
2156  if (Node->hasExplicitTemplateArgs())
2158  OS, Node->getTemplateArgs(), Node->getNumTemplateArgs(), Policy);
2159 }
2160 
2161 static const char *getTypeTraitName(TypeTrait TT) {
2162  switch (TT) {
2163 #define TYPE_TRAIT_1(Spelling, Name, Key) \
2164 case clang::UTT_##Name: return #Spelling;
2165 #define TYPE_TRAIT_2(Spelling, Name, Key) \
2166 case clang::BTT_##Name: return #Spelling;
2167 #define TYPE_TRAIT_N(Spelling, Name, Key) \
2168  case clang::TT_##Name: return #Spelling;
2169 #include "clang/Basic/TokenKinds.def"
2170  }
2171  llvm_unreachable("Type trait not covered by switch");
2172 }
2173 
2174 static const char *getTypeTraitName(ArrayTypeTrait ATT) {
2175  switch (ATT) {
2176  case ATT_ArrayRank: return "__array_rank";
2177  case ATT_ArrayExtent: return "__array_extent";
2178  }
2179  llvm_unreachable("Array type trait not covered by switch");
2180 }
2181 
2182 static const char *getExpressionTraitName(ExpressionTrait ET) {
2183  switch (ET) {
2184  case ET_IsLValueExpr: return "__is_lvalue_expr";
2185  case ET_IsRValueExpr: return "__is_rvalue_expr";
2186  }
2187  llvm_unreachable("Expression type trait not covered by switch");
2188 }
2189 
2190 void StmtPrinter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2191  OS << getTypeTraitName(E->getTrait()) << "(";
2192  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
2193  if (I > 0)
2194  OS << ", ";
2195  E->getArg(I)->getType().print(OS, Policy);
2196  }
2197  OS << ")";
2198 }
2199 
2200 void StmtPrinter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2201  OS << getTypeTraitName(E->getTrait()) << '(';
2202  E->getQueriedType().print(OS, Policy);
2203  OS << ')';
2204 }
2205 
2206 void StmtPrinter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2207  OS << getExpressionTraitName(E->getTrait()) << '(';
2208  PrintExpr(E->getQueriedExpression());
2209  OS << ')';
2210 }
2211 
2212 void StmtPrinter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2213  OS << "noexcept(";
2214  PrintExpr(E->getOperand());
2215  OS << ")";
2216 }
2217 
2218 void StmtPrinter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2219  PrintExpr(E->getPattern());
2220  OS << "...";
2221 }
2222 
2223 void StmtPrinter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2224  OS << "sizeof...(" << *E->getPack() << ")";
2225 }
2226 
2227 void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2229  OS << *Node->getParameterPack();
2230 }
2231 
2232 void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2234  Visit(Node->getReplacement());
2235 }
2236 
2237 void StmtPrinter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2238  OS << *E->getParameterPack();
2239 }
2240 
2241 void StmtPrinter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *Node){
2242  PrintExpr(Node->GetTemporaryExpr());
2243 }
2244 
2245 void StmtPrinter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2246  OS << "(";
2247  if (E->getLHS()) {
2248  PrintExpr(E->getLHS());
2249  OS << " " << BinaryOperator::getOpcodeStr(E->getOperator()) << " ";
2250  }
2251  OS << "...";
2252  if (E->getRHS()) {
2253  OS << " " << BinaryOperator::getOpcodeStr(E->getOperator()) << " ";
2254  PrintExpr(E->getRHS());
2255  }
2256  OS << ")";
2257 }
2258 
2259 // C++ Coroutines TS
2260 
2261 void StmtPrinter::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
2262  Visit(S->getBody());
2263 }
2264 
2265 void StmtPrinter::VisitCoreturnStmt(CoreturnStmt *S) {
2266  OS << "co_return";
2267  if (S->getOperand()) {
2268  OS << " ";
2269  Visit(S->getOperand());
2270  }
2271  OS << ";";
2272 }
2273 
2274 void StmtPrinter::VisitCoawaitExpr(CoawaitExpr *S) {
2275  OS << "co_await ";
2276  PrintExpr(S->getOperand());
2277 }
2278 
2279 void StmtPrinter::VisitCoyieldExpr(CoyieldExpr *S) {
2280  OS << "co_yield ";
2281  PrintExpr(S->getOperand());
2282 }
2283 
2284 // Obj-C
2285 
2286 void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
2287  OS << "@";
2288  VisitStringLiteral(Node->getString());
2289 }
2290 
2291 void StmtPrinter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
2292  OS << "@";
2293  Visit(E->getSubExpr());
2294 }
2295 
2296 void StmtPrinter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
2297  OS << "@[ ";
2298  ObjCArrayLiteral::child_range Ch = E->children();
2299  for (auto I = Ch.begin(), E = Ch.end(); I != E; ++I) {
2300  if (I != Ch.begin())
2301  OS << ", ";
2302  Visit(*I);
2303  }
2304  OS << " ]";
2305 }
2306 
2307 void StmtPrinter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
2308  OS << "@{ ";
2309  for (unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
2310  if (I > 0)
2311  OS << ", ";
2312 
2313  ObjCDictionaryElement Element = E->getKeyValueElement(I);
2314  Visit(Element.Key);
2315  OS << " : ";
2316  Visit(Element.Value);
2317  if (Element.isPackExpansion())
2318  OS << "...";
2319  }
2320  OS << " }";
2321 }
2322 
2323 void StmtPrinter::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
2324  OS << "@encode(";
2325  Node->getEncodedType().print(OS, Policy);
2326  OS << ')';
2327 }
2328 
2329 void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
2330  OS << "@selector(";
2331  Node->getSelector().print(OS);
2332  OS << ')';
2333 }
2334 
2335 void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
2336  OS << "@protocol(" << *Node->getProtocol() << ')';
2337 }
2338 
2339 void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
2340  OS << "[";
2341  switch (Mess->getReceiverKind()) {
2343  PrintExpr(Mess->getInstanceReceiver());
2344  break;
2345 
2347  Mess->getClassReceiver().print(OS, Policy);
2348  break;
2349 
2352  OS << "Super";
2353  break;
2354  }
2355 
2356  OS << ' ';
2357  Selector selector = Mess->getSelector();
2358  if (selector.isUnarySelector()) {
2359  OS << selector.getNameForSlot(0);
2360  } else {
2361  for (unsigned i = 0, e = Mess->getNumArgs(); i != e; ++i) {
2362  if (i < selector.getNumArgs()) {
2363  if (i > 0) OS << ' ';
2364  if (selector.getIdentifierInfoForSlot(i))
2365  OS << selector.getIdentifierInfoForSlot(i)->getName() << ':';
2366  else
2367  OS << ":";
2368  }
2369  else OS << ", "; // Handle variadic methods.
2370 
2371  PrintExpr(Mess->getArg(i));
2372  }
2373  }
2374  OS << "]";
2375 }
2376 
2377 void StmtPrinter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node) {
2378  OS << (Node->getValue() ? "__objc_yes" : "__objc_no");
2379 }
2380 
2381 void
2382 StmtPrinter::VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
2383  PrintExpr(E->getSubExpr());
2384 }
2385 
2386 void
2387 StmtPrinter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
2388  OS << '(' << E->getBridgeKindName();
2389  E->getType().print(OS, Policy);
2390  OS << ')';
2391  PrintExpr(E->getSubExpr());
2392 }
2393 
2394 void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
2395  BlockDecl *BD = Node->getBlockDecl();
2396  OS << "^";
2397 
2398  const FunctionType *AFT = Node->getFunctionType();
2399 
2400  if (isa<FunctionNoProtoType>(AFT)) {
2401  OS << "()";
2402  } else if (!BD->param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2403  OS << '(';
2404  for (BlockDecl::param_iterator AI = BD->param_begin(),
2405  E = BD->param_end(); AI != E; ++AI) {
2406  if (AI != BD->param_begin()) OS << ", ";
2407  std::string ParamStr = (*AI)->getNameAsString();
2408  (*AI)->getType().print(OS, Policy, ParamStr);
2409  }
2410 
2411  const FunctionProtoType *FT = cast<FunctionProtoType>(AFT);
2412  if (FT->isVariadic()) {
2413  if (!BD->param_empty()) OS << ", ";
2414  OS << "...";
2415  }
2416  OS << ')';
2417  }
2418  OS << "{ }";
2419 }
2420 
2421 void StmtPrinter::VisitOpaqueValueExpr(OpaqueValueExpr *Node) {
2422  PrintExpr(Node->getSourceExpr());
2423 }
2424 
2425 void StmtPrinter::VisitTypoExpr(TypoExpr *Node) {
2426  // TODO: Print something reasonable for a TypoExpr, if necessary.
2427  assert(false && "Cannot print TypoExpr nodes");
2428 }
2429 
2430 void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) {
2431  OS << "__builtin_astype(";
2432  PrintExpr(Node->getSrcExpr());
2433  OS << ", ";
2434  Node->getType().print(OS, Policy);
2435  OS << ")";
2436 }
2437 
2438 //===----------------------------------------------------------------------===//
2439 // Stmt method implementations
2440 //===----------------------------------------------------------------------===//
2441 
2442 void Stmt::dumpPretty(const ASTContext &Context) const {
2443  printPretty(llvm::errs(), nullptr, PrintingPolicy(Context.getLangOpts()));
2444 }
2445 
2446 void Stmt::printPretty(raw_ostream &OS,
2447  PrinterHelper *Helper,
2448  const PrintingPolicy &Policy,
2449  unsigned Indentation) const {
2450  StmtPrinter P(OS, Helper, Policy, Indentation);
2451  P.Visit(const_cast<Stmt*>(this));
2452 }
2453 
2454 //===----------------------------------------------------------------------===//
2455 // PrinterHelper
2456 //===----------------------------------------------------------------------===//
2457 
2458 // Implement virtual destructor.
Expr * getInc()
Definition: Stmt.h:1165
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:539
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1464
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:54
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1009
Represents a single C99 designator.
Definition: Expr.h:4007
Raw form: operator "" X (const char *)
Definition: ExprCXX.h:408
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2393
Defines the clang::ASTContext interface.
unsigned getNumInits() const
Definition: Expr.h:3754
This represents '#pragma omp master' directive.
Definition: StmtOpenMP.h:1100
operator "" X (long double)
Definition: ExprCXX.h:411
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:1106
const Expr * getBase() const
Definition: ExprObjC.h:509
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:489
This represents '#pragma omp task' directive.
Definition: StmtOpenMP.h:1440
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:1543
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1357
bool isVariadic() const
Definition: Type.h:3255
OpenMPScheduleClauseModifier getSecondScheduleModifier() const
Get the second modifier of the clause.
Definition: OpenMPClause.h:794
unsigned getNumOutputs() const
Definition: Stmt.h:1440
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
The receiver is an object instance.
Definition: ExprObjC.h:1005
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
Definition: ExprCXX.h:1660
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:169
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:4736
Smart pointer class that efficiently represents Objective-C method names.
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:329
This represents clause 'copyin' in the '#pragma omp ...' directives.
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword...
Definition: Expr.h:1081
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
Definition: StmtObjC.h:224
A (possibly-)qualified type.
Definition: Type.h:575
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition: ExprCXX.h:2545
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:216
bool getValue() const
Definition: ExprCXX.h:467
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2199
Expr * getCond()
Definition: Stmt.h:1053
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition: Expr.h:3440
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Definition: Expr.h:2481
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1174
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2191
CompoundStmt * getSubStmt()
Definition: Expr.h:3374
Expr * getSimdlen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:436
CharacterKind getKind() const
Definition: Expr.h:1317
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:374
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:2847
CXXCatchStmt * getHandler(unsigned i)
Definition: StmtCXX.h:104
bool isArgumentType() const
Definition: Expr.h:1996
IfStmt - This represents an if/then/else.
Definition: Stmt.h:869
Expr * getInit() const
Retrieve the initializer value.
Definition: Expr.h:4197
bool isGlobalDelete() const
Definition: ExprCXX.h:1960
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
Definition: ExprCXX.h:3905
This represents '#pragma omp for simd' directive.
Definition: StmtOpenMP.h:850
Expr * getOperand() const
Definition: ExprCXX.h:4142
OpenMPProcBindClauseKind getProcBindKind() const
Returns kind of the clause.
Definition: OpenMPClause.h:631
TypeSourceInfo * getTypeSourceInfo() const
Definition: Expr.h:1902
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: Expr.h:2422
bool isRecordType() const
Definition: Type.h:5362
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:77
This represents 'grainsize' clause in the '#pragma omp ...' directive.
arg_iterator arg_begin()
Definition: ExprCXX.h:1263
param_iterator param_end()
Definition: Decl.h:3471
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2586
This represents 'if' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:152
Defines the C++ template declaration subclasses.
Represents an attribute applied to a statement.
Definition: Stmt.h:818
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2239
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1605
Expr * getLowerBound()
Get lower bound of array section.
Definition: ExprOpenMP.h:91
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:1814
This represents 'priority' clause in the '#pragma omp ...' directive.
Represents Objective-C's @throw statement.
Definition: StmtObjC.h:313
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
InitListExpr * getSyntacticForm() const
Definition: Expr.h:3860
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1149
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:760
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition: ExprCXX.h:2789
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:1702
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Definition: ExprCXX.h:2275
A container of type source information.
Definition: Decl.h:61
This represents 'update' clause in the '#pragma omp atomic' directive.
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
const Stmt * getElse() const
Definition: Stmt.h:905
This represents '#pragma omp parallel for' directive.
Definition: StmtOpenMP.h:1221
MS property subscript expression.
Definition: ExprCXX.h:712
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:3864
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:2553
Expr * getVal1() const
Definition: Expr.h:4863
Expr * getAlignment()
Returns alignment.
int Delta
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
Definition: Expr.h:2452
CompoundStmt * getBlock() const
Definition: Stmt.h:1888
IdentType getIdentType() const
Definition: Expr.h:1173
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:1923
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:309
Stmt * getSubStmt()
Definition: Stmt.h:748
This represents 'read' clause in the '#pragma omp atomic' directive.
Definition: OpenMPClause.h:997
Expr * getOperand() const
Definition: ExprCXX.h:3450
This represents clause 'private' in the '#pragma omp ...' directives.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
Definition: ExprObjC.h:1383
CompoundLiteralExpr - [C99 6.5.2.5].
Definition: Expr.h:2540
This represents 'num_threads' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:289
const Expr * getCallee() const
Definition: Expr.h:2170
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
Definition: Expr.cpp:2009
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
Definition: ExprCXX.h:1657
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: ExprCXX.h:3191
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:517
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:1991
bool varlist_empty() const
Definition: OpenMPClause.h:117
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:35
unsigned getValue() const
Definition: Expr.h:1324
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:900
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:2847
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:887
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1299
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isArrow() const
Definition: ExprObjC.h:1410
Expr * getArrayIndex(const Designator &D) const
Definition: Expr.cpp:3767
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2318
This represents 'nogroup' clause in the '#pragma omp ...' directive.
bool getIsCXXTry() const
Definition: Stmt.h:1927
This represents 'safelen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:347
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:238
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:777
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Definition: Expr.h:2755
Represents a C99 designated initializer expression.
Definition: Expr.h:3931
Expr * getNumThreads() const
Returns number of threads.
Definition: OpenMPClause.h:325
DeclarationName getName() const
getName - Returns the embedded declaration name.
One of these records is kept for each identifier that is lexed.
Stmt * getBody()
Definition: Stmt.h:1101
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:453
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
Definition: StmtCXX.h:275
An element in an Objective-C dictionary literal.
Definition: ExprObjC.h:212
This represents '#pragma omp parallel' directive.
Definition: StmtOpenMP.h:232
unsigned getNumInputs() const
Definition: Stmt.h:1462
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3400
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4381
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:91
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:696
This represents 'simd' clause in the '#pragma omp ...' directive.
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
Definition: ExprCXX.h:1521
OpenMPScheduleClauseModifier getFirstScheduleModifier() const
Get the first modifier of the clause.
Definition: OpenMPClause.h:789
unsigned getNumAssocs() const
Definition: Expr.h:4453
child_range children()
Definition: ExprObjC.h:201
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2209
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3336
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4253
StringLiteral * getString()
Definition: ExprObjC.h:40
Expr * getImplicitObjectArgument() const
Retrieves the implicit object argument for the member call.
Definition: ExprCXX.cpp:532
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:2464
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:3602
This represents clause 'map' in the '#pragma omp ...' directives.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Definition: ExprCXX.cpp:1067
Expr * getOrder() const
Definition: Expr.h:4860
Expr * getPlacementArg(unsigned i)
Definition: ExprCXX.h:1826
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Definition: StmtCXX.h:271
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3268
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition: ExprCXX.h:2503
IdentifierInfo & getAccessor() const
Definition: Expr.h:4544
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:4522
QualType getQueriedType() const
Definition: ExprCXX.h:2320
Expr * getSubExpr()
Definition: Expr.h:2662
This represents '#pragma omp barrier' directive.
Definition: StmtOpenMP.h:1552
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:144
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:3724
This represents '#pragma omp critical' directive.
Definition: StmtOpenMP.h:1147
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2214
Expr * getFilterExpr() const
Definition: Stmt.h:1848
Expr * getLHS() const
Definition: Expr.h:2921
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:94
Represents Objective-C's @catch statement.
Definition: StmtObjC.h:74
const CompoundStmt * getSynchBody() const
Definition: StmtObjC.h:282
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:1236
Describes an C or C++ initializer list.
Definition: Expr.h:3724
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:559
Expr * getRHS() const
Definition: ExprCXX.h:3991
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition: Decl.cpp:4006
Expr * getArraySize()
Definition: ExprCXX.h:1814
Expr * getVal2() const
Definition: Expr.h:4873
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Definition: Stmt.h:1131
const LangOptions & getLangOpts() const
Definition: ASTContext.h:596
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
Definition: ExprCXX.h:2149
Capturing by copy (a.k.a., by value)
Definition: Lambda.h:36
DeclarationNameInfo getNameInfo() const
Definition: Expr.h:1011
QualType getReturnType() const
Definition: Type.h:2977
bool isSuperReceiver() const
Definition: ExprObjC.h:700
Stmt * getHandlerBlock() const
Definition: StmtCXX.h:52
Expr * getInitializer()
The initializer of this new-expression.
Definition: ExprCXX.h:1851
Expr * getExprOperand() const
Definition: ExprCXX.h:614
Stmt * getBody()
Definition: Stmt.h:1166
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the full name info for the member that this expression refers to.
Definition: ExprCXX.h:3363
OpenMPScheduleClauseKind getScheduleKind() const
Get kind of the clause.
Definition: OpenMPClause.h:786
const Expr * getSubExpr() const
Definition: Expr.h:3651
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:2875
Selector getSelector() const
Definition: ExprObjC.cpp:306
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:1844
Stmt * getInit()
Definition: Stmt.h:1145
Expr * getOutputExpr(unsigned i)
Definition: Stmt.cpp:397
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1689
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:128
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:2760
This represents '#pragma omp cancellation point' directive.
Definition: StmtOpenMP.h:2107
This represents 'default' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:509
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:29
bool isVariadic() const
Whether this function is variadic.
Definition: Decl.cpp:2454
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:2801
const DeclStmt * getConditionVariableDeclStmt() const
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition: Stmt.h:968
Expr * getBaseExpr() const
Definition: ExprCXX.h:692
New-expression has a C++98 paren-delimited initializer.
Definition: ExprCXX.h:1765
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:4918
const Stmt * getCatchBody() const
Definition: StmtObjC.h:90
This represents 'final' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:235
This represents 'mergeable' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:966
Expr * getCond()
Definition: Stmt.h:1164
This represents '#pragma omp teams' directive.
Definition: StmtOpenMP.h:2050
Expr * getLHS() const
Definition: Expr.h:3193
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
Definition: ExprObjC.cpp:349
This represents clause 'reduction' in the '#pragma omp ...' directives.
Helper class for OffsetOfExpr.
Definition: Expr.h:1756
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1106
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
Definition: StmtObjC.h:206
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:1707
CompoundStmt * getBody() const
Retrieve the body of the lambda.
Definition: ExprCXX.cpp:1078
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:86
Expr * Key
The key for the dictionary element.
Definition: ExprObjC.h:214
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1422
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3034
const Expr * getBase() const
Definition: ExprObjC.h:682
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.
Definition: ExprCXX.h:2112
Expr * getHint() const
Returns number of threads.
static void PrintTemplateArgumentList(raw_ostream &OS, const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
detail::InMemoryDirectory::const_iterator I
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:954
QualType getType() const
Definition: Decl.h:530
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2381
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition: Expr.h:1034
Represents the this expression in C++.
Definition: ExprCXX.h:860
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:693
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:505
OpenMPDefaultClauseKind getDefaultKind() const
Returns kind of the clause.
Definition: OpenMPClause.h:558
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
Expr * getRHS() const
Definition: Expr.h:3194
AnnotatingParser & P
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:2965
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:45
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3148
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2151
Expr * getLHS() const
Definition: Expr.h:3572
llvm::APInt getValue() const
Definition: Expr.h:1234
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2048
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:539
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3041
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3131
This represents 'threads' clause in the '#pragma omp ...' directive.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: Expr.h:1097
StringRef getAsmString() const
Definition: Stmt.h:1757
CXXMethodDecl * getMethodDecl() const
Retrieves the declaration of the called method.
Definition: ExprCXX.cpp:544
This represents '#pragma omp taskgroup' directive.
Definition: StmtOpenMP.h:1640
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2236
const Expr * getControllingExpr() const
Definition: Expr.h:4476
This represents clause 'aligned' in the '#pragma omp ...' directives.
bool isCmpXChg() const
Definition: Expr.h:4893
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2383
NestedNameSpecifierLoc getQualifierLoc() const
Definition: ExprCXX.h:696
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:1960
ASTContext * Context
arg_iterator arg_end()
Definition: ExprCXX.h:1264
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:3633
Expr * getCond() const
Definition: Expr.h:3182
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
Definition: ExprObjC.h:227
bool isUnarySelector() const
This represents '#pragma omp distribute' directive.
Definition: StmtOpenMP.h:2361
This represents implicit clause 'depend' for the '#pragma omp task' directive.
designators_iterator designators_begin()
Definition: Expr.h:4137
unsigned getNumExprs() const
Definition: Expr.h:4363
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:1683
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3369
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:581
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
Definition: ExprCXX.cpp:1089
This represents 'capture' clause in the '#pragma omp atomic' directive.
Expr - This represents one expression.
Definition: Expr.h:104
StringRef getName() const
Return the actual identifier string.
const Expr * getExpr(unsigned Init) const
Definition: Expr.h:4365
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:863
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: ExprCXX.h:3216
bool hasBraces() const
Definition: Stmt.h:1751
unsigned getNumArgs() const
static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, bool PrintSuffix)
This represents 'simdlen' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:402
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1227
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:271
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1374
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:356
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:4580
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:2744
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3195
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition: ExprCXX.h:2542
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:638
Stmt * getBody()
Definition: Stmt.h:1056
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:257
Expr * getArrayRangeStart(const Designator &D) const
Definition: Expr.cpp:3772
Expr * getRHS()
Definition: Stmt.h:703
Represents Objective-C's @synchronized statement.
Definition: StmtObjC.h:262
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:397
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:1303
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3555
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:65
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Definition: Expr.h:4622
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
Definition: OpenMPClause.h:215
This represents 'ordered' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:852
Selector getSelector() const
Definition: ExprObjC.h:409
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
Definition: ExprCXX.h:3750
QualType getAllocatedType() const
Definition: ExprCXX.h:1782
StringRef getInputName(unsigned i) const
Definition: Stmt.h:1665
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
Definition: Type.h:911
Expr * getSubExpr() const
Definition: Expr.h:1681
This represents '#pragma omp for' directive.
Definition: StmtOpenMP.h:773
Expr * getLHS() const
Definition: ExprCXX.h:3990
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:3967
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:1344
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:3489
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:860
unsigned getNumComponents() const
Definition: Expr.h:1919
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:1722
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition: Stmt.h:897
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1654
Expr * getCond() const
Definition: Expr.h:3570
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:647
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:190
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:3669
Expr * getDevice()
Return device number.
This represents '#pragma omp cancel' directive.
Definition: StmtOpenMP.h:2165
This represents 'collapse' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:457
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
ValueDecl * getDecl()
Definition: Expr.h:1007
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: ExprCXX.h:2106
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:2812
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
AtomicOp getOp() const
Definition: Expr.h:4884
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Definition: Expr.h:2082
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1409
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: ExprObjC.h:1290
This represents '#pragma omp flush' directive.
Definition: StmtOpenMP.h:1691
bool param_empty() const
Definition: Decl.h:3468
This represents '#pragma omp parallel for simd' directive.
Definition: StmtOpenMP.h:1301
InitListExpr * getUpdater() const
Definition: Expr.h:4308
DoStmt - This represents a 'do/while' stmt.
Definition: Stmt.h:1080
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'untied' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:934
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:3434
param_iterator param_begin()
Definition: Decl.h:3470
LabelDecl * getLabel() const
Definition: Stmt.h:1213
unsigned getNumTemplateArgs() const
Definition: ExprCXX.h:2806
Expr * getBase() const
Definition: ExprObjC.h:1408
Expr * getArgument()
Definition: ExprCXX.h:1974
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Definition: ExprCXX.h:3207
bool isArrayForm() const
Definition: ExprCXX.h:1961
This represents 'num_teams' clause in the '#pragma omp ...' directive.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:274
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:840
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:3465
const StringLiteral * getAsmString() const
Definition: Stmt.h:1570
Kind
This captures a statement into a function.
Definition: Stmt.h:1984
operator "" X (const CharT *, size_t)
Definition: ExprCXX.h:412
Expr * getArrayRangeEnd(const Designator &D) const
Definition: Expr.cpp:3778
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4692
bool getValue() const
Definition: ExprObjC.h:71
Raw form: operator "" X<cs...> ()
Definition: ExprCXX.h:409
Expr * getNumForLoops() const
Return the number of associated for-loops.
Definition: OpenMPClause.h:492
This represents '#pragma omp single' directive.
Definition: StmtOpenMP.h:1045
body_range body()
Definition: Stmt.h:569
This represents 'hint' clause in the '#pragma omp ...' directive.
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2547
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:892
Expr * getPtr() const
Definition: Expr.h:4857
This is a basic class for representing single OpenMP executable directive.
Definition: StmtOpenMP.h:33
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:267
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1723
Expr * getLHS()
Definition: Stmt.h:702
static const char * getExpressionTraitName(ExpressionTrait ET)
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Definition: ExprCXX.h:393
Expr * getCondition() const
Returns condition.
Definition: OpenMPClause.h:213
This represents 'schedule' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:653
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:124
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:431
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
Definition: Expr.h:2473
CompoundStmt * getBlock() const
Definition: Stmt.h:1852
This represents clause 'shared' in the '#pragma omp ...' directives.
const Expr * getCond() const
Definition: Stmt.h:972
Expr * getOperand() const
Retrieve the operand of the 'co_return' statement.
Definition: StmtCXX.h:392
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1701
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:4645
void VisitStmt(Stmt *S)
Expr * getPriority()
Return Priority number.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Definition: StmtVisitor.h:178
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents '#pragma omp taskwait' directive.
Definition: StmtOpenMP.h:1596
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3157
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.cpp:1249
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3626
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>.
Definition: Expr.h:4817
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:441
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
Definition: ExprCXX.cpp:1007
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:2712
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents. ...
Definition: ExprCXX.cpp:733
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition: ExprCXX.cpp:1028
QualType getAssocType(unsigned i) const
Definition: Expr.h:4469
OpenMPMapClauseKind getMapTypeModifier() const LLVM_READONLY
Fetches the map type modifier for the clause.
ParmVarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:3815
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Definition: Stmt.cpp:913
This represents '#pragma omp target' directive.
Definition: StmtOpenMP.h:1935
Expr * getInputExpr(unsigned i)
Definition: Stmt.cpp:408
static const char * getTypeTraitName(TypeTrait TT)
TypeTrait getTrait() const
Determine which type trait this expression uses.
Definition: ExprCXX.h:2226
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:1637
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
Definition: ExprCXX.h:3353
Expr * getSubExpr()
Definition: ExprObjC.h:108
An expression trait intrinsic.
Definition: ExprCXX.h:2347
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:604
This represents '#pragma omp ordered' directive.
Definition: StmtOpenMP.h:1746
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3358
const Expr * getBase() const
Definition: Expr.h:4540
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:94
Expr * getGrainsize() const
Return safe iteration space distance.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:4594
bool isObjectReceiver() const
Definition: ExprObjC.h:699
bool isParenTypeId() const
Definition: ExprCXX.h:1835
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:69
Opcode getOpcode() const
Definition: Expr.h:1678
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:235
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:1909
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2706
Expr * Value
The value of the dictionary element.
Definition: ExprObjC.h:217
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3070
Represents a C11 generic selection.
Definition: Expr.h:4426
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
Definition: ExprCXX.cpp:573
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1155
param_range params()
Definition: Decl.h:1910
bool isArrow() const
Definition: Expr.h:2488
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3317
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1519
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:3786
Represents a template argument.
Definition: TemplateBase.h:40
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:3258
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:499
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
const Expr * getSubExpr() const
Definition: ExprCXX.h:920
bool isImplicitProperty() const
Definition: ExprObjC.h:630
Stmt * getBody() const
Retrieve the body of the coroutine as written.
Definition: StmtCXX.h:326
This represents 'device' clause in the '#pragma omp ...' directive.
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:4459
StringRef getOpcodeStr() const
Definition: Expr.h:2937
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1146
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:1927
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:803
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
TemplateArgumentLoc const * getTemplateArgs() const
Definition: ExprCXX.h:2799
static LLVM_READONLY bool isPrintable(unsigned char c)
Return true if this character is an ASCII printable character; that is, a character that should take ...
Definition: CharInfo.h:140
const Stmt * getBody() const
Definition: Stmt.h:973
This represents '#pragma omp section' directive.
Definition: StmtOpenMP.h:983
SourceLocation getLParenLoc() const
Definition: ExprCXX.h:1343
bool isClassReceiver() const
Definition: ExprObjC.h:701
designators_iterator designators_end()
Definition: Expr.h:4138
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:316
This represents '#pragma omp simd' directive.
Definition: StmtOpenMP.h:708
Represents a 'co_yield' expression.
Definition: ExprCXX.h:4130
const Expr * getSynchExpr() const
Definition: StmtObjC.h:290
unsigned getNumHandlers() const
Definition: StmtCXX.h:103
Expr * getNumTasks() const
Return safe iteration space distance.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1646
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:3483
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:1821
This represents clause 'linear' in the '#pragma omp ...' directives.
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1205
Selector getSelector() const
Definition: DeclObjC.h:328
bool isTypeOperand() const
Definition: ExprCXX.h:796
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
detail::InMemoryDirectory::const_iterator E
const Expr * getRetValue() const
Definition: Stmt.cpp:888
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2187
unsigned getNumArgs() const
Definition: ExprCXX.h:1272
This represents '#pragma omp atomic' directive.
Definition: StmtOpenMP.h:1801
Expr * getBaseExpr() const
Definition: ExprObjC.h:807
llvm::APFloat getValue() const
Definition: Expr.h:1354
Represents a __leave statement.
Definition: Stmt.h:1950
const Stmt * getThen() const
Definition: Stmt.h:903
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3428
SwitchStmt - This represents a 'switch' stmt.
Definition: Stmt.h:938
Capturing variable-length array type.
Definition: Lambda.h:38
Not an overloaded operator.
Definition: OperatorKinds.h:23
Expr * getSafelen() const
Return safe iteration space distance.
Definition: OpenMPClause.h:381
Represents the body of a coroutine.
Definition: StmtCXX.h:294
Expr * getRHS() const
Definition: Expr.h:3574
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3115
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:5675
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2049
const Stmt * getSubStmt() const
Definition: StmtObjC.h:356
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition: ExprCXX.cpp:1024
Represents Objective-C's collection statement.
Definition: StmtObjC.h:24
static StringRef getIdentTypeName(IdentType IT)
Definition: Expr.cpp:450
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:355
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword...
An implicit indirection through a C++ base class, when the field found is in a base class...
Definition: Expr.h:1768
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:155
Represents a 'co_await' expression.
Definition: ExprCXX.h:4107
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1275
decl_range decls()
Definition: Stmt.h:479
Expr * getExprOperand() const
Definition: ExprCXX.h:813
bool isVolatile() const
Definition: Stmt.h:1427
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: Expr.h:2448
Represents Objective-C's @finally statement.
Definition: StmtObjC.h:120
const Expr * getSubExpr() const
Definition: Expr.h:1421
Expr * getKeyExpr() const
Definition: ExprObjC.h:810
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1277
LabelDecl * getLabel() const
Definition: Expr.h:3339
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition: Stmt.h:1049
Capturing the this pointer.
Definition: Lambda.h:35
This represents 'write' clause in the '#pragma omp atomic' directive.
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:633
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Definition: StmtObjC.h:203
const char * getOpenMPDirectiveName(OpenMPDirectiveKind Kind)
Definition: OpenMPKinds.cpp:31
const Expr * getInitializer() const
Definition: Expr.h:2566
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:479
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Definition: StmtOpenMP.h:194
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Definition: Expr.h:3277
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:2927
void printExceptionSpecification(raw_ostream &OS, const PrintingPolicy &Policy) const
GotoStmt - This represents a direct goto.
Definition: Stmt.h:1202
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:850
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1024
Expr * getTarget()
Definition: Stmt.h:1255
Expr * getBase() const
Definition: Expr.h:2387
A template argument list.
Definition: DeclTemplate.h:172
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1074
Expr * getCond()
Definition: Stmt.h:1098
Expr * getWeak() const
Definition: Expr.h:4879
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:1674
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2297
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:80
const Expr * getSubExpr() const
Definition: Expr.h:1621
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
Definition: ExprCXX.cpp:762
This represents 'nowait' clause in the '#pragma omp ...' directive.
Definition: OpenMPClause.h:903
ContinueStmt - This represents a continue.
Definition: Stmt.h:1280
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
bool isGlobalNew() const
Definition: ExprCXX.h:1838
Opcode getOpcode() const
Definition: Expr.h:2918
QualType getEncodedType() const
Definition: ExprObjC.h:376
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:3525
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:3218
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:29
VarDecl * getLoopVariable()
Definition: StmtCXX.cpp:78
An index into an array.
Definition: Expr.h:1761
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1315
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
WhileStmt - This represents a 'while' stmt.
Definition: Stmt.h:1025
Capturing by reference.
Definition: Lambda.h:37
const Expr * getCond() const
Definition: Stmt.h:901
Expr * getThreadLimit()
Return ThreadLimit number.
This class is used for builtin types like 'int'.
Definition: Type.h:2011
CompoundStmt * getTryBlock()
Definition: StmtCXX.h:96
The receiver is a class.
Definition: ExprObjC.h:1003
Represents Objective-C's @try ... @catch ... @finally statement.
Definition: StmtObjC.h:154
This represents '#pragma omp taskloop simd' directive.
Definition: StmtOpenMP.h:2295
const Expr * getThrowExpr() const
Definition: StmtObjC.h:325
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Definition: Expr.h:1085
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1452
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2134
Expr * getRHS() const
Definition: Expr.h:2923
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:3512
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:260
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:772
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:187
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1234
This represents '#pragma omp sections' directive.
Definition: StmtOpenMP.h:915
Expr * getBase() const
Definition: Expr.h:4305
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:60
const Stmt * getTryBody() const
Retrieve the @try body.
Definition: StmtObjC.h:197
This represents '#pragma omp target data' directive.
Definition: StmtOpenMP.h:1993
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:50
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:922
BreakStmt - This represents a break.
Definition: Stmt.h:1306
SourceLocation getColonLoc() const
Definition: ExprOpenMP.h:109
Expr * getChunkSize()
Get chunk size.
Definition: OpenMPClause.h:818
const Expr * getInit(unsigned Init) const
Definition: Expr.h:3763
const Expr * getSubExpr() const
Definition: ExprCXX.h:1130
Stmt * getSubStmt()
Definition: Stmt.h:797
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition: ExprCXX.h:2786
ExprIterator arg_iterator
Definition: ExprCXX.h:1253
BinaryOperatorKind getOperator() const
Definition: ExprCXX.h:4005
unsigned getNumClobbers() const
Definition: Stmt.h:1472
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1085
This represents '#pragma omp taskyield' directive.
Definition: StmtOpenMP.h:1508
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:455
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition: ExprCXX.h:2512
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:1860
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:270
CompoundStmt * getTryBlock() const
Definition: Stmt.h:1929
This represents '#pragma omp parallel sections' directive.
Definition: StmtOpenMP.h:1369
bool isArrow() const
Definition: ExprCXX.h:694
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:768
Expr * getOperand() const
Definition: ExprCXX.h:4119
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Definition: Type.cpp:1700
const CallExpr * getConfig() const
Definition: ExprCXX.h:170
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:642
bool isTypeOperand() const
Definition: ExprCXX.h:597
The receiver is a superclass.
Definition: ExprObjC.h:1007
const char * getName() const
Definition: Stmt.cpp:309
Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
Definition: StmtOpenMP.h:197
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1136
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:3124
Expr * getOrderFail() const
Definition: Expr.h:4869
Stmt * getSubStmt()
Definition: Stmt.h:853
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:4328
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:307
Attr - This represents one attribute.
Definition: Attr.h:44
operator "" X (unsigned long long)
Definition: ExprCXX.h:410
Expr * getLength()
Get length of array section.
Definition: ExprOpenMP.h:99
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:1810
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
Definition: ExprCXX.cpp:754
bool isArrow() const
Definition: ExprObjC.h:513
SEHFinallyStmt * getFinallyHandler() const
Definition: Stmt.cpp:917
Expr * getBase()
An array section can be written only as Base[LowerBound:Length].
Definition: ExprOpenMP.h:82
unsigned Indent
The current line's indent.
Stmt * getSubStmt()
Definition: Stmt.h:704
QualType getArgumentType() const
Definition: Expr.h:1997
This represents '#pragma omp taskloop' directive.
Definition: StmtOpenMP.h:2230