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