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 PrintInitStmt(Stmt *S, unsigned PrefixWidth) {
103  // FIXME: Cope better with odd prefix widths.
104  IndentLevel += (PrefixWidth + 1) / 2;
105  if (auto *DS = dyn_cast<DeclStmt>(S))
106  PrintRawDeclStmt(DS);
107  else
108  PrintExpr(cast<Expr>(S));
109  OS << "; ";
110  IndentLevel -= (PrefixWidth + 1) / 2;
111  }
112 
113  void PrintControlledStmt(Stmt *S) {
114  if (auto *CS = dyn_cast<CompoundStmt>(S)) {
115  OS << " ";
116  PrintRawCompoundStmt(CS);
117  OS << NL;
118  } else {
119  OS << NL;
120  PrintStmt(S);
121  }
122  }
123 
124  void PrintRawCompoundStmt(CompoundStmt *S);
125  void PrintRawDecl(Decl *D);
126  void PrintRawDeclStmt(const DeclStmt *S);
127  void PrintRawIfStmt(IfStmt *If);
128  void PrintRawCXXCatchStmt(CXXCatchStmt *Catch);
129  void PrintCallArgs(CallExpr *E);
130  void PrintRawSEHExceptHandler(SEHExceptStmt *S);
131  void PrintRawSEHFinallyStmt(SEHFinallyStmt *S);
132  void PrintOMPExecutableDirective(OMPExecutableDirective *S,
133  bool ForceNoStmt = false);
134 
135  void PrintExpr(Expr *E) {
136  if (E)
137  Visit(E);
138  else
139  OS << "<null expr>";
140  }
141 
142  raw_ostream &Indent(int Delta = 0) {
143  for (int i = 0, e = IndentLevel+Delta; i < e; ++i)
144  OS << " ";
145  return OS;
146  }
147 
148  void Visit(Stmt* S) {
149  if (Helper && Helper->handledStmt(S,OS))
150  return;
152  }
153 
154  void VisitStmt(Stmt *Node) LLVM_ATTRIBUTE_UNUSED {
155  Indent() << "<<unknown stmt type>>" << NL;
156  }
157 
158  void VisitExpr(Expr *Node) LLVM_ATTRIBUTE_UNUSED {
159  OS << "<<unknown expr type>>";
160  }
161 
162  void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
163 
164 #define ABSTRACT_STMT(CLASS)
165 #define STMT(CLASS, PARENT) \
166  void Visit##CLASS(CLASS *Node);
167 #include "clang/AST/StmtNodes.inc"
168  };
169 
170 } // namespace
171 
172 //===----------------------------------------------------------------------===//
173 // Stmt printing methods.
174 //===----------------------------------------------------------------------===//
175 
176 /// PrintRawCompoundStmt - Print a compound stmt without indenting the {, and
177 /// with no newline after the }.
178 void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
179  OS << "{" << NL;
180  for (auto *I : Node->body())
181  PrintStmt(I);
182 
183  Indent() << "}";
184 }
185 
186 void StmtPrinter::PrintRawDecl(Decl *D) {
187  D->print(OS, Policy, IndentLevel);
188 }
189 
190 void StmtPrinter::PrintRawDeclStmt(const DeclStmt *S) {
191  SmallVector<Decl *, 2> Decls(S->decls());
192  Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
193 }
194 
195 void StmtPrinter::VisitNullStmt(NullStmt *Node) {
196  Indent() << ";" << NL;
197 }
198 
199 void StmtPrinter::VisitDeclStmt(DeclStmt *Node) {
200  Indent();
201  PrintRawDeclStmt(Node);
202  OS << ";" << NL;
203 }
204 
205 void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {
206  Indent();
207  PrintRawCompoundStmt(Node);
208  OS << "" << NL;
209 }
210 
211 void StmtPrinter::VisitCaseStmt(CaseStmt *Node) {
212  Indent(-1) << "case ";
213  PrintExpr(Node->getLHS());
214  if (Node->getRHS()) {
215  OS << " ... ";
216  PrintExpr(Node->getRHS());
217  }
218  OS << ":" << NL;
219 
220  PrintStmt(Node->getSubStmt(), 0);
221 }
222 
223 void StmtPrinter::VisitDefaultStmt(DefaultStmt *Node) {
224  Indent(-1) << "default:" << NL;
225  PrintStmt(Node->getSubStmt(), 0);
226 }
227 
228 void StmtPrinter::VisitLabelStmt(LabelStmt *Node) {
229  Indent(-1) << Node->getName() << ":" << NL;
230  PrintStmt(Node->getSubStmt(), 0);
231 }
232 
233 void StmtPrinter::VisitAttributedStmt(AttributedStmt *Node) {
234  for (const auto *Attr : Node->getAttrs()) {
235  Attr->printPretty(OS, Policy);
236  }
237 
238  PrintStmt(Node->getSubStmt(), 0);
239 }
240 
241 void StmtPrinter::PrintRawIfStmt(IfStmt *If) {
242  OS << "if (";
243  if (If->getInit())
244  PrintInitStmt(If->getInit(), 4);
245  if (const DeclStmt *DS = If->getConditionVariableDeclStmt())
246  PrintRawDeclStmt(DS);
247  else
248  PrintExpr(If->getCond());
249  OS << ')';
250 
251  if (auto *CS = dyn_cast<CompoundStmt>(If->getThen())) {
252  OS << ' ';
253  PrintRawCompoundStmt(CS);
254  OS << (If->getElse() ? " " : NL);
255  } else {
256  OS << NL;
257  PrintStmt(If->getThen());
258  if (If->getElse()) Indent();
259  }
260 
261  if (Stmt *Else = If->getElse()) {
262  OS << "else";
263 
264  if (auto *CS = dyn_cast<CompoundStmt>(Else)) {
265  OS << ' ';
266  PrintRawCompoundStmt(CS);
267  OS << NL;
268  } else if (auto *ElseIf = dyn_cast<IfStmt>(Else)) {
269  OS << ' ';
270  PrintRawIfStmt(ElseIf);
271  } else {
272  OS << NL;
273  PrintStmt(If->getElse());
274  }
275  }
276 }
277 
278 void StmtPrinter::VisitIfStmt(IfStmt *If) {
279  Indent();
280  PrintRawIfStmt(If);
281 }
282 
283 void StmtPrinter::VisitSwitchStmt(SwitchStmt *Node) {
284  Indent() << "switch (";
285  if (Node->getInit())
286  PrintInitStmt(Node->getInit(), 8);
287  if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
288  PrintRawDeclStmt(DS);
289  else
290  PrintExpr(Node->getCond());
291  OS << ")";
292  PrintControlledStmt(Node->getBody());
293 }
294 
295 void StmtPrinter::VisitWhileStmt(WhileStmt *Node) {
296  Indent() << "while (";
297  if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
298  PrintRawDeclStmt(DS);
299  else
300  PrintExpr(Node->getCond());
301  OS << ")" << NL;
302  PrintStmt(Node->getBody());
303 }
304 
305 void StmtPrinter::VisitDoStmt(DoStmt *Node) {
306  Indent() << "do ";
307  if (auto *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
308  PrintRawCompoundStmt(CS);
309  OS << " ";
310  } else {
311  OS << NL;
312  PrintStmt(Node->getBody());
313  Indent();
314  }
315 
316  OS << "while (";
317  PrintExpr(Node->getCond());
318  OS << ");" << NL;
319 }
320 
321 void StmtPrinter::VisitForStmt(ForStmt *Node) {
322  Indent() << "for (";
323  if (Node->getInit())
324  PrintInitStmt(Node->getInit(), 5);
325  else
326  OS << (Node->getCond() ? "; " : ";");
327  if (Node->getCond())
328  PrintExpr(Node->getCond());
329  OS << ";";
330  if (Node->getInc()) {
331  OS << " ";
332  PrintExpr(Node->getInc());
333  }
334  OS << ")";
335  PrintControlledStmt(Node->getBody());
336 }
337 
338 void StmtPrinter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *Node) {
339  Indent() << "for (";
340  if (auto *DS = dyn_cast<DeclStmt>(Node->getElement()))
341  PrintRawDeclStmt(DS);
342  else
343  PrintExpr(cast<Expr>(Node->getElement()));
344  OS << " in ";
345  PrintExpr(Node->getCollection());
346  OS << ")";
347  PrintControlledStmt(Node->getBody());
348 }
349 
350 void StmtPrinter::VisitCXXForRangeStmt(CXXForRangeStmt *Node) {
351  Indent() << "for (";
352  if (Node->getInit())
353  PrintInitStmt(Node->getInit(), 5);
354  PrintingPolicy SubPolicy(Policy);
355  SubPolicy.SuppressInitializers = true;
356  Node->getLoopVariable()->print(OS, SubPolicy, IndentLevel);
357  OS << " : ";
358  PrintExpr(Node->getRangeInit());
359  OS << ")";
360  PrintControlledStmt(Node->getBody());
361 }
362 
363 void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) {
364  Indent();
365  if (Node->isIfExists())
366  OS << "__if_exists (";
367  else
368  OS << "__if_not_exists (";
369 
370  if (NestedNameSpecifier *Qualifier
372  Qualifier->print(OS, Policy);
373 
374  OS << Node->getNameInfo() << ") ";
375 
376  PrintRawCompoundStmt(Node->getSubStmt());
377 }
378 
379 void StmtPrinter::VisitGotoStmt(GotoStmt *Node) {
380  Indent() << "goto " << Node->getLabel()->getName() << ";";
381  if (Policy.IncludeNewlines) OS << NL;
382 }
383 
384 void StmtPrinter::VisitIndirectGotoStmt(IndirectGotoStmt *Node) {
385  Indent() << "goto *";
386  PrintExpr(Node->getTarget());
387  OS << ";";
388  if (Policy.IncludeNewlines) OS << NL;
389 }
390 
391 void StmtPrinter::VisitContinueStmt(ContinueStmt *Node) {
392  Indent() << "continue;";
393  if (Policy.IncludeNewlines) OS << NL;
394 }
395 
396 void StmtPrinter::VisitBreakStmt(BreakStmt *Node) {
397  Indent() << "break;";
398  if (Policy.IncludeNewlines) OS << NL;
399 }
400 
401 void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) {
402  Indent() << "return";
403  if (Node->getRetValue()) {
404  OS << " ";
405  PrintExpr(Node->getRetValue());
406  }
407  OS << ";";
408  if (Policy.IncludeNewlines) OS << NL;
409 }
410 
411 void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
412  Indent() << "asm ";
413 
414  if (Node->isVolatile())
415  OS << "volatile ";
416 
417  OS << "(";
418  VisitStringLiteral(Node->getAsmString());
419 
420  // Outputs
421  if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
422  Node->getNumClobbers() != 0)
423  OS << " : ";
424 
425  for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
426  if (i != 0)
427  OS << ", ";
428 
429  if (!Node->getOutputName(i).empty()) {
430  OS << '[';
431  OS << Node->getOutputName(i);
432  OS << "] ";
433  }
434 
435  VisitStringLiteral(Node->getOutputConstraintLiteral(i));
436  OS << " (";
437  Visit(Node->getOutputExpr(i));
438  OS << ")";
439  }
440 
441  // Inputs
442  if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0)
443  OS << " : ";
444 
445  for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
446  if (i != 0)
447  OS << ", ";
448 
449  if (!Node->getInputName(i).empty()) {
450  OS << '[';
451  OS << Node->getInputName(i);
452  OS << "] ";
453  }
454 
455  VisitStringLiteral(Node->getInputConstraintLiteral(i));
456  OS << " (";
457  Visit(Node->getInputExpr(i));
458  OS << ")";
459  }
460 
461  // Clobbers
462  if (Node->getNumClobbers() != 0)
463  OS << " : ";
464 
465  for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
466  if (i != 0)
467  OS << ", ";
468 
469  VisitStringLiteral(Node->getClobberStringLiteral(i));
470  }
471 
472  OS << ");";
473  if (Policy.IncludeNewlines) OS << NL;
474 }
475 
476 void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) {
477  // FIXME: Implement MS style inline asm statement printer.
478  Indent() << "__asm ";
479  if (Node->hasBraces())
480  OS << "{" << NL;
481  OS << Node->getAsmString() << NL;
482  if (Node->hasBraces())
483  Indent() << "}" << NL;
484 }
485 
486 void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) {
487  PrintStmt(Node->getCapturedDecl()->getBody());
488 }
489 
490 void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) {
491  Indent() << "@try";
492  if (auto *TS = dyn_cast<CompoundStmt>(Node->getTryBody())) {
493  PrintRawCompoundStmt(TS);
494  OS << NL;
495  }
496 
497  for (unsigned I = 0, N = Node->getNumCatchStmts(); I != N; ++I) {
498  ObjCAtCatchStmt *catchStmt = Node->getCatchStmt(I);
499  Indent() << "@catch(";
500  if (catchStmt->getCatchParamDecl()) {
501  if (Decl *DS = catchStmt->getCatchParamDecl())
502  PrintRawDecl(DS);
503  }
504  OS << ")";
505  if (auto *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
506  PrintRawCompoundStmt(CS);
507  OS << NL;
508  }
509  }
510 
511  if (auto *FS = static_cast<ObjCAtFinallyStmt *>(Node->getFinallyStmt())) {
512  Indent() << "@finally";
513  PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
514  OS << NL;
515  }
516 }
517 
518 void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
519 }
520 
521 void StmtPrinter::VisitObjCAtCatchStmt (ObjCAtCatchStmt *Node) {
522  Indent() << "@catch (...) { /* todo */ } " << NL;
523 }
524 
525 void StmtPrinter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *Node) {
526  Indent() << "@throw";
527  if (Node->getThrowExpr()) {
528  OS << " ";
529  PrintExpr(Node->getThrowExpr());
530  }
531  OS << ";" << NL;
532 }
533 
534 void StmtPrinter::VisitObjCAvailabilityCheckExpr(
536  OS << "@available(...)";
537 }
538 
539 void StmtPrinter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *Node) {
540  Indent() << "@synchronized (";
541  PrintExpr(Node->getSynchExpr());
542  OS << ")";
543  PrintRawCompoundStmt(Node->getSynchBody());
544  OS << NL;
545 }
546 
547 void StmtPrinter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *Node) {
548  Indent() << "@autoreleasepool";
549  PrintRawCompoundStmt(dyn_cast<CompoundStmt>(Node->getSubStmt()));
550  OS << NL;
551 }
552 
553 void StmtPrinter::PrintRawCXXCatchStmt(CXXCatchStmt *Node) {
554  OS << "catch (";
555  if (Decl *ExDecl = Node->getExceptionDecl())
556  PrintRawDecl(ExDecl);
557  else
558  OS << "...";
559  OS << ") ";
560  PrintRawCompoundStmt(cast<CompoundStmt>(Node->getHandlerBlock()));
561 }
562 
563 void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
564  Indent();
565  PrintRawCXXCatchStmt(Node);
566  OS << NL;
567 }
568 
569 void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
570  Indent() << "try ";
571  PrintRawCompoundStmt(Node->getTryBlock());
572  for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
573  OS << " ";
574  PrintRawCXXCatchStmt(Node->getHandler(i));
575  }
576  OS << NL;
577 }
578 
579 void StmtPrinter::VisitSEHTryStmt(SEHTryStmt *Node) {
580  Indent() << (Node->getIsCXXTry() ? "try " : "__try ");
581  PrintRawCompoundStmt(Node->getTryBlock());
582  SEHExceptStmt *E = Node->getExceptHandler();
583  SEHFinallyStmt *F = Node->getFinallyHandler();
584  if(E)
585  PrintRawSEHExceptHandler(E);
586  else {
587  assert(F && "Must have a finally block...");
588  PrintRawSEHFinallyStmt(F);
589  }
590  OS << NL;
591 }
592 
593 void StmtPrinter::PrintRawSEHFinallyStmt(SEHFinallyStmt *Node) {
594  OS << "__finally ";
595  PrintRawCompoundStmt(Node->getBlock());
596  OS << NL;
597 }
598 
599 void StmtPrinter::PrintRawSEHExceptHandler(SEHExceptStmt *Node) {
600  OS << "__except (";
601  VisitExpr(Node->getFilterExpr());
602  OS << ")" << NL;
603  PrintRawCompoundStmt(Node->getBlock());
604  OS << NL;
605 }
606 
607 void StmtPrinter::VisitSEHExceptStmt(SEHExceptStmt *Node) {
608  Indent();
609  PrintRawSEHExceptHandler(Node);
610  OS << NL;
611 }
612 
613 void StmtPrinter::VisitSEHFinallyStmt(SEHFinallyStmt *Node) {
614  Indent();
615  PrintRawSEHFinallyStmt(Node);
616  OS << NL;
617 }
618 
619 void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {
620  Indent() << "__leave;";
621  if (Policy.IncludeNewlines) OS << NL;
622 }
623 
624 //===----------------------------------------------------------------------===//
625 // OpenMP directives printing methods
626 //===----------------------------------------------------------------------===//
627 
628 void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S,
629  bool ForceNoStmt) {
630  OMPClausePrinter Printer(OS, Policy);
631  ArrayRef<OMPClause *> Clauses = S->clauses();
632  for (auto *Clause : Clauses)
633  if (Clause && !Clause->isImplicit()) {
634  OS << ' ';
635  Printer.Visit(Clause);
636  }
637  OS << NL;
638  if (!ForceNoStmt && S->hasAssociatedStmt())
639  PrintStmt(S->getInnermostCapturedStmt()->getCapturedStmt());
640 }
641 
642 void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
643  Indent() << "#pragma omp parallel";
644  PrintOMPExecutableDirective(Node);
645 }
646 
647 void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) {
648  Indent() << "#pragma omp simd";
649  PrintOMPExecutableDirective(Node);
650 }
651 
652 void StmtPrinter::VisitOMPForDirective(OMPForDirective *Node) {
653  Indent() << "#pragma omp for";
654  PrintOMPExecutableDirective(Node);
655 }
656 
657 void StmtPrinter::VisitOMPForSimdDirective(OMPForSimdDirective *Node) {
658  Indent() << "#pragma omp for simd";
659  PrintOMPExecutableDirective(Node);
660 }
661 
662 void StmtPrinter::VisitOMPSectionsDirective(OMPSectionsDirective *Node) {
663  Indent() << "#pragma omp sections";
664  PrintOMPExecutableDirective(Node);
665 }
666 
667 void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) {
668  Indent() << "#pragma omp section";
669  PrintOMPExecutableDirective(Node);
670 }
671 
672 void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) {
673  Indent() << "#pragma omp single";
674  PrintOMPExecutableDirective(Node);
675 }
676 
677 void StmtPrinter::VisitOMPMasterDirective(OMPMasterDirective *Node) {
678  Indent() << "#pragma omp master";
679  PrintOMPExecutableDirective(Node);
680 }
681 
682 void StmtPrinter::VisitOMPCriticalDirective(OMPCriticalDirective *Node) {
683  Indent() << "#pragma omp critical";
684  if (Node->getDirectiveName().getName()) {
685  OS << " (";
686  Node->getDirectiveName().printName(OS);
687  OS << ")";
688  }
689  PrintOMPExecutableDirective(Node);
690 }
691 
692 void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) {
693  Indent() << "#pragma omp parallel for";
694  PrintOMPExecutableDirective(Node);
695 }
696 
697 void StmtPrinter::VisitOMPParallelForSimdDirective(
699  Indent() << "#pragma omp parallel for simd";
700  PrintOMPExecutableDirective(Node);
701 }
702 
703 void StmtPrinter::VisitOMPParallelSectionsDirective(
705  Indent() << "#pragma omp parallel sections";
706  PrintOMPExecutableDirective(Node);
707 }
708 
709 void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) {
710  Indent() << "#pragma omp task";
711  PrintOMPExecutableDirective(Node);
712 }
713 
714 void StmtPrinter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *Node) {
715  Indent() << "#pragma omp taskyield";
716  PrintOMPExecutableDirective(Node);
717 }
718 
719 void StmtPrinter::VisitOMPBarrierDirective(OMPBarrierDirective *Node) {
720  Indent() << "#pragma omp barrier";
721  PrintOMPExecutableDirective(Node);
722 }
723 
724 void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
725  Indent() << "#pragma omp taskwait";
726  PrintOMPExecutableDirective(Node);
727 }
728 
729 void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) {
730  Indent() << "#pragma omp taskgroup";
731  PrintOMPExecutableDirective(Node);
732 }
733 
734 void StmtPrinter::VisitOMPFlushDirective(OMPFlushDirective *Node) {
735  Indent() << "#pragma omp flush";
736  PrintOMPExecutableDirective(Node);
737 }
738 
739 void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
740  Indent() << "#pragma omp ordered";
741  PrintOMPExecutableDirective(Node, Node->hasClausesOfKind<OMPDependClause>());
742 }
743 
744 void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
745  Indent() << "#pragma omp atomic";
746  PrintOMPExecutableDirective(Node);
747 }
748 
749 void StmtPrinter::VisitOMPTargetDirective(OMPTargetDirective *Node) {
750  Indent() << "#pragma omp target";
751  PrintOMPExecutableDirective(Node);
752 }
753 
754 void StmtPrinter::VisitOMPTargetDataDirective(OMPTargetDataDirective *Node) {
755  Indent() << "#pragma omp target data";
756  PrintOMPExecutableDirective(Node);
757 }
758 
759 void StmtPrinter::VisitOMPTargetEnterDataDirective(
761  Indent() << "#pragma omp target enter data";
762  PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
763 }
764 
765 void StmtPrinter::VisitOMPTargetExitDataDirective(
767  Indent() << "#pragma omp target exit data";
768  PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
769 }
770 
771 void StmtPrinter::VisitOMPTargetParallelDirective(
773  Indent() << "#pragma omp target parallel";
774  PrintOMPExecutableDirective(Node);
775 }
776 
777 void StmtPrinter::VisitOMPTargetParallelForDirective(
779  Indent() << "#pragma omp target parallel for";
780  PrintOMPExecutableDirective(Node);
781 }
782 
783 void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
784  Indent() << "#pragma omp teams";
785  PrintOMPExecutableDirective(Node);
786 }
787 
788 void StmtPrinter::VisitOMPCancellationPointDirective(
790  Indent() << "#pragma omp cancellation point "
792  PrintOMPExecutableDirective(Node);
793 }
794 
795 void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
796  Indent() << "#pragma omp cancel "
798  PrintOMPExecutableDirective(Node);
799 }
800 
801 void StmtPrinter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *Node) {
802  Indent() << "#pragma omp taskloop";
803  PrintOMPExecutableDirective(Node);
804 }
805 
806 void StmtPrinter::VisitOMPTaskLoopSimdDirective(
807  OMPTaskLoopSimdDirective *Node) {
808  Indent() << "#pragma omp taskloop simd";
809  PrintOMPExecutableDirective(Node);
810 }
811 
812 void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
813  Indent() << "#pragma omp distribute";
814  PrintOMPExecutableDirective(Node);
815 }
816 
817 void StmtPrinter::VisitOMPTargetUpdateDirective(
818  OMPTargetUpdateDirective *Node) {
819  Indent() << "#pragma omp target update";
820  PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
821 }
822 
823 void StmtPrinter::VisitOMPDistributeParallelForDirective(
825  Indent() << "#pragma omp distribute parallel for";
826  PrintOMPExecutableDirective(Node);
827 }
828 
829 void StmtPrinter::VisitOMPDistributeParallelForSimdDirective(
831  Indent() << "#pragma omp distribute parallel for simd";
832  PrintOMPExecutableDirective(Node);
833 }
834 
835 void StmtPrinter::VisitOMPDistributeSimdDirective(
837  Indent() << "#pragma omp distribute simd";
838  PrintOMPExecutableDirective(Node);
839 }
840 
841 void StmtPrinter::VisitOMPTargetParallelForSimdDirective(
843  Indent() << "#pragma omp target parallel for simd";
844  PrintOMPExecutableDirective(Node);
845 }
846 
847 void StmtPrinter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *Node) {
848  Indent() << "#pragma omp target simd";
849  PrintOMPExecutableDirective(Node);
850 }
851 
852 void StmtPrinter::VisitOMPTeamsDistributeDirective(
854  Indent() << "#pragma omp teams distribute";
855  PrintOMPExecutableDirective(Node);
856 }
857 
858 void StmtPrinter::VisitOMPTeamsDistributeSimdDirective(
860  Indent() << "#pragma omp teams distribute simd";
861  PrintOMPExecutableDirective(Node);
862 }
863 
864 void StmtPrinter::VisitOMPTeamsDistributeParallelForSimdDirective(
866  Indent() << "#pragma omp teams distribute parallel for simd";
867  PrintOMPExecutableDirective(Node);
868 }
869 
870 void StmtPrinter::VisitOMPTeamsDistributeParallelForDirective(
872  Indent() << "#pragma omp teams distribute parallel for";
873  PrintOMPExecutableDirective(Node);
874 }
875 
876 void StmtPrinter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *Node) {
877  Indent() << "#pragma omp target teams";
878  PrintOMPExecutableDirective(Node);
879 }
880 
881 void StmtPrinter::VisitOMPTargetTeamsDistributeDirective(
883  Indent() << "#pragma omp target teams distribute";
884  PrintOMPExecutableDirective(Node);
885 }
886 
887 void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective(
889  Indent() << "#pragma omp target teams distribute parallel for";
890  PrintOMPExecutableDirective(Node);
891 }
892 
893 void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
895  Indent() << "#pragma omp target teams distribute parallel for simd";
896  PrintOMPExecutableDirective(Node);
897 }
898 
899 void StmtPrinter::VisitOMPTargetTeamsDistributeSimdDirective(
901  Indent() << "#pragma omp target teams distribute simd";
902  PrintOMPExecutableDirective(Node);
903 }
904 
905 //===----------------------------------------------------------------------===//
906 // Expr printing methods.
907 //===----------------------------------------------------------------------===//
908 
909 void StmtPrinter::VisitConstantExpr(ConstantExpr *Node) {
910  PrintExpr(Node->getSubExpr());
911 }
912 
913 void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
914  if (const auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->getDecl())) {
915  OCED->getInit()->IgnoreImpCasts()->printPretty(OS, nullptr, Policy);
916  return;
917  }
918  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
919  Qualifier->print(OS, Policy);
920  if (Node->hasTemplateKeyword())
921  OS << "template ";
922  OS << Node->getNameInfo();
923  if (Node->hasExplicitTemplateArgs())
924  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
925 }
926 
927 void StmtPrinter::VisitDependentScopeDeclRefExpr(
929  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
930  Qualifier->print(OS, Policy);
931  if (Node->hasTemplateKeyword())
932  OS << "template ";
933  OS << Node->getNameInfo();
934  if (Node->hasExplicitTemplateArgs())
935  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
936 }
937 
938 void StmtPrinter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
939  if (Node->getQualifier())
940  Node->getQualifier()->print(OS, Policy);
941  if (Node->hasTemplateKeyword())
942  OS << "template ";
943  OS << Node->getNameInfo();
944  if (Node->hasExplicitTemplateArgs())
945  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
946 }
947 
948 static bool isImplicitSelf(const Expr *E) {
949  if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
950  if (const auto *PD = dyn_cast<ImplicitParamDecl>(DRE->getDecl())) {
951  if (PD->getParameterKind() == ImplicitParamDecl::ObjCSelf &&
952  DRE->getBeginLoc().isInvalid())
953  return true;
954  }
955  }
956  return false;
957 }
958 
959 void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
960  if (Node->getBase()) {
961  if (!Policy.SuppressImplicitBase ||
962  !isImplicitSelf(Node->getBase()->IgnoreImpCasts())) {
963  PrintExpr(Node->getBase());
964  OS << (Node->isArrow() ? "->" : ".");
965  }
966  }
967  OS << *Node->getDecl();
968 }
969 
970 void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
971  if (Node->isSuperReceiver())
972  OS << "super.";
973  else if (Node->isObjectReceiver() && Node->getBase()) {
974  PrintExpr(Node->getBase());
975  OS << ".";
976  } else if (Node->isClassReceiver() && Node->getClassReceiver()) {
977  OS << Node->getClassReceiver()->getName() << ".";
978  }
979 
980  if (Node->isImplicitProperty()) {
981  if (const auto *Getter = Node->getImplicitPropertyGetter())
982  Getter->getSelector().print(OS);
983  else
986  } else
987  OS << Node->getExplicitProperty()->getName();
988 }
989 
990 void StmtPrinter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node) {
991  PrintExpr(Node->getBaseExpr());
992  OS << "[";
993  PrintExpr(Node->getKeyExpr());
994  OS << "]";
995 }
996 
997 void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
999 }
1000 
1001 void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
1002  unsigned value = Node->getValue();
1003 
1004  switch (Node->getKind()) {
1005  case CharacterLiteral::Ascii: break; // no prefix.
1006  case CharacterLiteral::Wide: OS << 'L'; break;
1007  case CharacterLiteral::UTF8: OS << "u8"; break;
1008  case CharacterLiteral::UTF16: OS << 'u'; break;
1009  case CharacterLiteral::UTF32: OS << 'U'; break;
1010  }
1011 
1012  switch (value) {
1013  case '\\':
1014  OS << "'\\\\'";
1015  break;
1016  case '\'':
1017  OS << "'\\''";
1018  break;
1019  case '\a':
1020  // TODO: K&R: the meaning of '\\a' is different in traditional C
1021  OS << "'\\a'";
1022  break;
1023  case '\b':
1024  OS << "'\\b'";
1025  break;
1026  // Nonstandard escape sequence.
1027  /*case '\e':
1028  OS << "'\\e'";
1029  break;*/
1030  case '\f':
1031  OS << "'\\f'";
1032  break;
1033  case '\n':
1034  OS << "'\\n'";
1035  break;
1036  case '\r':
1037  OS << "'\\r'";
1038  break;
1039  case '\t':
1040  OS << "'\\t'";
1041  break;
1042  case '\v':
1043  OS << "'\\v'";
1044  break;
1045  default:
1046  // A character literal might be sign-extended, which
1047  // would result in an invalid \U escape sequence.
1048  // FIXME: multicharacter literals such as '\xFF\xFF\xFF\xFF'
1049  // are not correctly handled.
1050  if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == CharacterLiteral::Ascii)
1051  value &= 0xFFu;
1052  if (value < 256 && isPrintable((unsigned char)value))
1053  OS << "'" << (char)value << "'";
1054  else if (value < 256)
1055  OS << "'\\x" << llvm::format("%02x", value) << "'";
1056  else if (value <= 0xFFFF)
1057  OS << "'\\u" << llvm::format("%04x", value) << "'";
1058  else
1059  OS << "'\\U" << llvm::format("%08x", value) << "'";
1060  }
1061 }
1062 
1063 /// Prints the given expression using the original source text. Returns true on
1064 /// success, false otherwise.
1065 static bool printExprAsWritten(raw_ostream &OS, Expr *E,
1066  const ASTContext *Context) {
1067  if (!Context)
1068  return false;
1069  bool Invalid = false;
1070  StringRef Source = Lexer::getSourceText(
1072  Context->getSourceManager(), Context->getLangOpts(), &Invalid);
1073  if (!Invalid) {
1074  OS << Source;
1075  return true;
1076  }
1077  return false;
1078 }
1079 
1080 void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
1081  if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1082  return;
1083  bool isSigned = Node->getType()->isSignedIntegerType();
1084  OS << Node->getValue().toString(10, isSigned);
1085 
1086  // Emit suffixes. Integer literals are always a builtin integer type.
1087  switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1088  default: llvm_unreachable("Unexpected type for integer literal!");
1089  case BuiltinType::Char_S:
1090  case BuiltinType::Char_U: OS << "i8"; break;
1091  case BuiltinType::UChar: OS << "Ui8"; break;
1092  case BuiltinType::Short: OS << "i16"; break;
1093  case BuiltinType::UShort: OS << "Ui16"; break;
1094  case BuiltinType::Int: break; // no suffix.
1095  case BuiltinType::UInt: OS << 'U'; break;
1096  case BuiltinType::Long: OS << 'L'; break;
1097  case BuiltinType::ULong: OS << "UL"; break;
1098  case BuiltinType::LongLong: OS << "LL"; break;
1099  case BuiltinType::ULongLong: OS << "ULL"; break;
1100  }
1101 }
1102 
1103 void StmtPrinter::VisitFixedPointLiteral(FixedPointLiteral *Node) {
1104  if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1105  return;
1106  OS << Node->getValueAsString(/*Radix=*/10);
1107 
1108  switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1109  default: llvm_unreachable("Unexpected type for fixed point literal!");
1110  case BuiltinType::ShortFract: OS << "hr"; break;
1111  case BuiltinType::ShortAccum: OS << "hk"; break;
1112  case BuiltinType::UShortFract: OS << "uhr"; break;
1113  case BuiltinType::UShortAccum: OS << "uhk"; break;
1114  case BuiltinType::Fract: OS << "r"; break;
1115  case BuiltinType::Accum: OS << "k"; break;
1116  case BuiltinType::UFract: OS << "ur"; break;
1117  case BuiltinType::UAccum: OS << "uk"; break;
1118  case BuiltinType::LongFract: OS << "lr"; break;
1119  case BuiltinType::LongAccum: OS << "lk"; break;
1120  case BuiltinType::ULongFract: OS << "ulr"; break;
1121  case BuiltinType::ULongAccum: OS << "ulk"; break;
1122  }
1123 }
1124 
1125 static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
1126  bool PrintSuffix) {
1127  SmallString<16> Str;
1128  Node->getValue().toString(Str);
1129  OS << Str;
1130  if (Str.find_first_not_of("-0123456789") == StringRef::npos)
1131  OS << '.'; // Trailing dot in order to separate from ints.
1132 
1133  if (!PrintSuffix)
1134  return;
1135 
1136  // Emit suffixes. Float literals are always a builtin float type.
1137  switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1138  default: llvm_unreachable("Unexpected type for float literal!");
1139  case BuiltinType::Half: break; // FIXME: suffix?
1140  case BuiltinType::Double: break; // no suffix.
1141  case BuiltinType::Float16: OS << "F16"; break;
1142  case BuiltinType::Float: OS << 'F'; break;
1143  case BuiltinType::LongDouble: OS << 'L'; break;
1144  case BuiltinType::Float128: OS << 'Q'; break;
1145  }
1146 }
1147 
1148 void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) {
1149  if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1150  return;
1151  PrintFloatingLiteral(OS, Node, /*PrintSuffix=*/true);
1152 }
1153 
1154 void StmtPrinter::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
1155  PrintExpr(Node->getSubExpr());
1156  OS << "i";
1157 }
1158 
1159 void StmtPrinter::VisitStringLiteral(StringLiteral *Str) {
1160  Str->outputString(OS);
1161 }
1162 
1163 void StmtPrinter::VisitParenExpr(ParenExpr *Node) {
1164  OS << "(";
1165  PrintExpr(Node->getSubExpr());
1166  OS << ")";
1167 }
1168 
1169 void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
1170  if (!Node->isPostfix()) {
1171  OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1172 
1173  // Print a space if this is an "identifier operator" like __real, or if
1174  // it might be concatenated incorrectly like '+'.
1175  switch (Node->getOpcode()) {
1176  default: break;
1177  case UO_Real:
1178  case UO_Imag:
1179  case UO_Extension:
1180  OS << ' ';
1181  break;
1182  case UO_Plus:
1183  case UO_Minus:
1184  if (isa<UnaryOperator>(Node->getSubExpr()))
1185  OS << ' ';
1186  break;
1187  }
1188  }
1189  PrintExpr(Node->getSubExpr());
1190 
1191  if (Node->isPostfix())
1192  OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1193 }
1194 
1195 void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) {
1196  OS << "__builtin_offsetof(";
1197  Node->getTypeSourceInfo()->getType().print(OS, Policy);
1198  OS << ", ";
1199  bool PrintedSomething = false;
1200  for (unsigned i = 0, n = Node->getNumComponents(); i < n; ++i) {
1201  OffsetOfNode ON = Node->getComponent(i);
1202  if (ON.getKind() == OffsetOfNode::Array) {
1203  // Array node
1204  OS << "[";
1205  PrintExpr(Node->getIndexExpr(ON.getArrayExprIndex()));
1206  OS << "]";
1207  PrintedSomething = true;
1208  continue;
1209  }
1210 
1211  // Skip implicit base indirections.
1212  if (ON.getKind() == OffsetOfNode::Base)
1213  continue;
1214 
1215  // Field or identifier node.
1216  IdentifierInfo *Id = ON.getFieldName();
1217  if (!Id)
1218  continue;
1219 
1220  if (PrintedSomething)
1221  OS << ".";
1222  else
1223  PrintedSomething = true;
1224  OS << Id->getName();
1225  }
1226  OS << ")";
1227 }
1228 
1229 void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node){
1230  switch(Node->getKind()) {
1231  case UETT_SizeOf:
1232  OS << "sizeof";
1233  break;
1234  case UETT_AlignOf:
1235  if (Policy.Alignof)
1236  OS << "alignof";
1237  else if (Policy.UnderscoreAlignof)
1238  OS << "_Alignof";
1239  else
1240  OS << "__alignof";
1241  break;
1242  case UETT_PreferredAlignOf:
1243  OS << "__alignof";
1244  break;
1245  case UETT_VecStep:
1246  OS << "vec_step";
1247  break;
1249  OS << "__builtin_omp_required_simd_align";
1250  break;
1251  }
1252  if (Node->isArgumentType()) {
1253  OS << '(';
1254  Node->getArgumentType().print(OS, Policy);
1255  OS << ')';
1256  } else {
1257  OS << " ";
1258  PrintExpr(Node->getArgumentExpr());
1259  }
1260 }
1261 
1262 void StmtPrinter::VisitGenericSelectionExpr(GenericSelectionExpr *Node) {
1263  OS << "_Generic(";
1264  PrintExpr(Node->getControllingExpr());
1265  for (unsigned i = 0; i != Node->getNumAssocs(); ++i) {
1266  OS << ", ";
1267  QualType T = Node->getAssocType(i);
1268  if (T.isNull())
1269  OS << "default";
1270  else
1271  T.print(OS, Policy);
1272  OS << ": ";
1273  PrintExpr(Node->getAssocExpr(i));
1274  }
1275  OS << ")";
1276 }
1277 
1278 void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
1279  PrintExpr(Node->getLHS());
1280  OS << "[";
1281  PrintExpr(Node->getRHS());
1282  OS << "]";
1283 }
1284 
1285 void StmtPrinter::VisitOMPArraySectionExpr(OMPArraySectionExpr *Node) {
1286  PrintExpr(Node->getBase());
1287  OS << "[";
1288  if (Node->getLowerBound())
1289  PrintExpr(Node->getLowerBound());
1290  if (Node->getColonLoc().isValid()) {
1291  OS << ":";
1292  if (Node->getLength())
1293  PrintExpr(Node->getLength());
1294  }
1295  OS << "]";
1296 }
1297 
1298 void StmtPrinter::PrintCallArgs(CallExpr *Call) {
1299  for (unsigned i = 0, e = Call->getNumArgs(); i != e; ++i) {
1300  if (isa<CXXDefaultArgExpr>(Call->getArg(i))) {
1301  // Don't print any defaulted arguments
1302  break;
1303  }
1304 
1305  if (i) OS << ", ";
1306  PrintExpr(Call->getArg(i));
1307  }
1308 }
1309 
1310 void StmtPrinter::VisitCallExpr(CallExpr *Call) {
1311  PrintExpr(Call->getCallee());
1312  OS << "(";
1313  PrintCallArgs(Call);
1314  OS << ")";
1315 }
1316 
1317 static bool isImplicitThis(const Expr *E) {
1318  if (const auto *TE = dyn_cast<CXXThisExpr>(E))
1319  return TE->isImplicit();
1320  return false;
1321 }
1322 
1323 void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
1324  if (!Policy.SuppressImplicitBase || !isImplicitThis(Node->getBase())) {
1325  PrintExpr(Node->getBase());
1326 
1327  auto *ParentMember = dyn_cast<MemberExpr>(Node->getBase());
1328  FieldDecl *ParentDecl =
1329  ParentMember ? dyn_cast<FieldDecl>(ParentMember->getMemberDecl())
1330  : nullptr;
1331 
1332  if (!ParentDecl || !ParentDecl->isAnonymousStructOrUnion())
1333  OS << (Node->isArrow() ? "->" : ".");
1334  }
1335 
1336  if (auto *FD = dyn_cast<FieldDecl>(Node->getMemberDecl()))
1337  if (FD->isAnonymousStructOrUnion())
1338  return;
1339 
1340  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1341  Qualifier->print(OS, Policy);
1342  if (Node->hasTemplateKeyword())
1343  OS << "template ";
1344  OS << Node->getMemberNameInfo();
1345  if (Node->hasExplicitTemplateArgs())
1346  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
1347 }
1348 
1349 void StmtPrinter::VisitObjCIsaExpr(ObjCIsaExpr *Node) {
1350  PrintExpr(Node->getBase());
1351  OS << (Node->isArrow() ? "->isa" : ".isa");
1352 }
1353 
1354 void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
1355  PrintExpr(Node->getBase());
1356  OS << ".";
1357  OS << Node->getAccessor().getName();
1358 }
1359 
1360 void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
1361  OS << '(';
1362  Node->getTypeAsWritten().print(OS, Policy);
1363  OS << ')';
1364  PrintExpr(Node->getSubExpr());
1365 }
1366 
1367 void StmtPrinter::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
1368  OS << '(';
1369  Node->getType().print(OS, Policy);
1370  OS << ')';
1371  PrintExpr(Node->getInitializer());
1372 }
1373 
1374 void StmtPrinter::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
1375  // No need to print anything, simply forward to the subexpression.
1376  PrintExpr(Node->getSubExpr());
1377 }
1378 
1379 void StmtPrinter::VisitBinaryOperator(BinaryOperator *Node) {
1380  PrintExpr(Node->getLHS());
1381  OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1382  PrintExpr(Node->getRHS());
1383 }
1384 
1385 void StmtPrinter::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
1386  PrintExpr(Node->getLHS());
1387  OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1388  PrintExpr(Node->getRHS());
1389 }
1390 
1391 void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
1392  PrintExpr(Node->getCond());
1393  OS << " ? ";
1394  PrintExpr(Node->getLHS());
1395  OS << " : ";
1396  PrintExpr(Node->getRHS());
1397 }
1398 
1399 // GNU extensions.
1400 
1401 void
1402 StmtPrinter::VisitBinaryConditionalOperator(BinaryConditionalOperator *Node) {
1403  PrintExpr(Node->getCommon());
1404  OS << " ?: ";
1405  PrintExpr(Node->getFalseExpr());
1406 }
1407 
1408 void StmtPrinter::VisitAddrLabelExpr(AddrLabelExpr *Node) {
1409  OS << "&&" << Node->getLabel()->getName();
1410 }
1411 
1412 void StmtPrinter::VisitStmtExpr(StmtExpr *E) {
1413  OS << "(";
1414  PrintRawCompoundStmt(E->getSubStmt());
1415  OS << ")";
1416 }
1417 
1418 void StmtPrinter::VisitChooseExpr(ChooseExpr *Node) {
1419  OS << "__builtin_choose_expr(";
1420  PrintExpr(Node->getCond());
1421  OS << ", ";
1422  PrintExpr(Node->getLHS());
1423  OS << ", ";
1424  PrintExpr(Node->getRHS());
1425  OS << ")";
1426 }
1427 
1428 void StmtPrinter::VisitGNUNullExpr(GNUNullExpr *) {
1429  OS << "__null";
1430 }
1431 
1432 void StmtPrinter::VisitShuffleVectorExpr(ShuffleVectorExpr *Node) {
1433  OS << "__builtin_shufflevector(";
1434  for (unsigned i = 0, e = Node->getNumSubExprs(); i != e; ++i) {
1435  if (i) OS << ", ";
1436  PrintExpr(Node->getExpr(i));
1437  }
1438  OS << ")";
1439 }
1440 
1441 void StmtPrinter::VisitConvertVectorExpr(ConvertVectorExpr *Node) {
1442  OS << "__builtin_convertvector(";
1443  PrintExpr(Node->getSrcExpr());
1444  OS << ", ";
1445  Node->getType().print(OS, Policy);
1446  OS << ")";
1447 }
1448 
1449 void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
1450  if (Node->getSyntacticForm()) {
1451  Visit(Node->getSyntacticForm());
1452  return;
1453  }
1454 
1455  OS << "{";
1456  for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
1457  if (i) OS << ", ";
1458  if (Node->getInit(i))
1459  PrintExpr(Node->getInit(i));
1460  else
1461  OS << "{}";
1462  }
1463  OS << "}";
1464 }
1465 
1466 void StmtPrinter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *Node) {
1467  // There's no way to express this expression in any of our supported
1468  // languages, so just emit something terse and (hopefully) clear.
1469  OS << "{";
1470  PrintExpr(Node->getSubExpr());
1471  OS << "}";
1472 }
1473 
1474 void StmtPrinter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *Node) {
1475  OS << "*";
1476 }
1477 
1478 void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
1479  OS << "(";
1480  for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
1481  if (i) OS << ", ";
1482  PrintExpr(Node->getExpr(i));
1483  }
1484  OS << ")";
1485 }
1486 
1487 void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
1488  bool NeedsEquals = true;
1489  for (const DesignatedInitExpr::Designator &D : Node->designators()) {
1490  if (D.isFieldDesignator()) {
1491  if (D.getDotLoc().isInvalid()) {
1492  if (IdentifierInfo *II = D.getFieldName()) {
1493  OS << II->getName() << ":";
1494  NeedsEquals = false;
1495  }
1496  } else {
1497  OS << "." << D.getFieldName()->getName();
1498  }
1499  } else {
1500  OS << "[";
1501  if (D.isArrayDesignator()) {
1502  PrintExpr(Node->getArrayIndex(D));
1503  } else {
1504  PrintExpr(Node->getArrayRangeStart(D));
1505  OS << " ... ";
1506  PrintExpr(Node->getArrayRangeEnd(D));
1507  }
1508  OS << "]";
1509  }
1510  }
1511 
1512  if (NeedsEquals)
1513  OS << " = ";
1514  else
1515  OS << " ";
1516  PrintExpr(Node->getInit());
1517 }
1518 
1519 void StmtPrinter::VisitDesignatedInitUpdateExpr(
1520  DesignatedInitUpdateExpr *Node) {
1521  OS << "{";
1522  OS << "/*base*/";
1523  PrintExpr(Node->getBase());
1524  OS << ", ";
1525 
1526  OS << "/*updater*/";
1527  PrintExpr(Node->getUpdater());
1528  OS << "}";
1529 }
1530 
1531 void StmtPrinter::VisitNoInitExpr(NoInitExpr *Node) {
1532  OS << "/*no init*/";
1533 }
1534 
1535 void StmtPrinter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *Node) {
1536  if (Node->getType()->getAsCXXRecordDecl()) {
1537  OS << "/*implicit*/";
1538  Node->getType().print(OS, Policy);
1539  OS << "()";
1540  } else {
1541  OS << "/*implicit*/(";
1542  Node->getType().print(OS, Policy);
1543  OS << ')';
1544  if (Node->getType()->isRecordType())
1545  OS << "{}";
1546  else
1547  OS << 0;
1548  }
1549 }
1550 
1551 void StmtPrinter::VisitVAArgExpr(VAArgExpr *Node) {
1552  OS << "__builtin_va_arg(";
1553  PrintExpr(Node->getSubExpr());
1554  OS << ", ";
1555  Node->getType().print(OS, Policy);
1556  OS << ")";
1557 }
1558 
1559 void StmtPrinter::VisitPseudoObjectExpr(PseudoObjectExpr *Node) {
1560  PrintExpr(Node->getSyntacticForm());
1561 }
1562 
1563 void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
1564  const char *Name = nullptr;
1565  switch (Node->getOp()) {
1566 #define BUILTIN(ID, TYPE, ATTRS)
1567 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1568  case AtomicExpr::AO ## ID: \
1569  Name = #ID "("; \
1570  break;
1571 #include "clang/Basic/Builtins.def"
1572  }
1573  OS << Name;
1574 
1575  // AtomicExpr stores its subexpressions in a permuted order.
1576  PrintExpr(Node->getPtr());
1577  if (Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1578  Node->getOp() != AtomicExpr::AO__atomic_load_n &&
1579  Node->getOp() != AtomicExpr::AO__opencl_atomic_load) {
1580  OS << ", ";
1581  PrintExpr(Node->getVal1());
1582  }
1583  if (Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1584  Node->isCmpXChg()) {
1585  OS << ", ";
1586  PrintExpr(Node->getVal2());
1587  }
1588  if (Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1589  Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1590  OS << ", ";
1591  PrintExpr(Node->getWeak());
1592  }
1593  if (Node->getOp() != AtomicExpr::AO__c11_atomic_init &&
1594  Node->getOp() != AtomicExpr::AO__opencl_atomic_init) {
1595  OS << ", ";
1596  PrintExpr(Node->getOrder());
1597  }
1598  if (Node->isCmpXChg()) {
1599  OS << ", ";
1600  PrintExpr(Node->getOrderFail());
1601  }
1602  OS << ")";
1603 }
1604 
1605 // C++
1606 void StmtPrinter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) {
1607  const char *OpStrings[NUM_OVERLOADED_OPERATORS] = {
1608  "",
1609 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
1610  Spelling,
1611 #include "clang/Basic/OperatorKinds.def"
1612  };
1613 
1615  if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1616  if (Node->getNumArgs() == 1) {
1617  OS << OpStrings[Kind] << ' ';
1618  PrintExpr(Node->getArg(0));
1619  } else {
1620  PrintExpr(Node->getArg(0));
1621  OS << ' ' << OpStrings[Kind];
1622  }
1623  } else if (Kind == OO_Arrow) {
1624  PrintExpr(Node->getArg(0));
1625  } else if (Kind == OO_Call) {
1626  PrintExpr(Node->getArg(0));
1627  OS << '(';
1628  for (unsigned ArgIdx = 1; ArgIdx < Node->getNumArgs(); ++ArgIdx) {
1629  if (ArgIdx > 1)
1630  OS << ", ";
1631  if (!isa<CXXDefaultArgExpr>(Node->getArg(ArgIdx)))
1632  PrintExpr(Node->getArg(ArgIdx));
1633  }
1634  OS << ')';
1635  } else if (Kind == OO_Subscript) {
1636  PrintExpr(Node->getArg(0));
1637  OS << '[';
1638  PrintExpr(Node->getArg(1));
1639  OS << ']';
1640  } else if (Node->getNumArgs() == 1) {
1641  OS << OpStrings[Kind] << ' ';
1642  PrintExpr(Node->getArg(0));
1643  } else if (Node->getNumArgs() == 2) {
1644  PrintExpr(Node->getArg(0));
1645  OS << ' ' << OpStrings[Kind] << ' ';
1646  PrintExpr(Node->getArg(1));
1647  } else {
1648  llvm_unreachable("unknown overloaded operator");
1649  }
1650 }
1651 
1652 void StmtPrinter::VisitCXXMemberCallExpr(CXXMemberCallExpr *Node) {
1653  // If we have a conversion operator call only print the argument.
1654  CXXMethodDecl *MD = Node->getMethodDecl();
1655  if (MD && isa<CXXConversionDecl>(MD)) {
1656  PrintExpr(Node->getImplicitObjectArgument());
1657  return;
1658  }
1659  VisitCallExpr(cast<CallExpr>(Node));
1660 }
1661 
1662 void StmtPrinter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *Node) {
1663  PrintExpr(Node->getCallee());
1664  OS << "<<<";
1665  PrintCallArgs(Node->getConfig());
1666  OS << ">>>(";
1667  PrintCallArgs(Node);
1668  OS << ")";
1669 }
1670 
1671 void StmtPrinter::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) {
1672  OS << Node->getCastName() << '<';
1673  Node->getTypeAsWritten().print(OS, Policy);
1674  OS << ">(";
1675  PrintExpr(Node->getSubExpr());
1676  OS << ")";
1677 }
1678 
1679 void StmtPrinter::VisitCXXStaticCastExpr(CXXStaticCastExpr *Node) {
1680  VisitCXXNamedCastExpr(Node);
1681 }
1682 
1683 void StmtPrinter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *Node) {
1684  VisitCXXNamedCastExpr(Node);
1685 }
1686 
1687 void StmtPrinter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *Node) {
1688  VisitCXXNamedCastExpr(Node);
1689 }
1690 
1691 void StmtPrinter::VisitCXXConstCastExpr(CXXConstCastExpr *Node) {
1692  VisitCXXNamedCastExpr(Node);
1693 }
1694 
1695 void StmtPrinter::VisitCXXTypeidExpr(CXXTypeidExpr *Node) {
1696  OS << "typeid(";
1697  if (Node->isTypeOperand()) {
1698  Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1699  } else {
1700  PrintExpr(Node->getExprOperand());
1701  }
1702  OS << ")";
1703 }
1704 
1705 void StmtPrinter::VisitCXXUuidofExpr(CXXUuidofExpr *Node) {
1706  OS << "__uuidof(";
1707  if (Node->isTypeOperand()) {
1708  Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1709  } else {
1710  PrintExpr(Node->getExprOperand());
1711  }
1712  OS << ")";
1713 }
1714 
1715 void StmtPrinter::VisitMSPropertyRefExpr(MSPropertyRefExpr *Node) {
1716  PrintExpr(Node->getBaseExpr());
1717  if (Node->isArrow())
1718  OS << "->";
1719  else
1720  OS << ".";
1721  if (NestedNameSpecifier *Qualifier =
1723  Qualifier->print(OS, Policy);
1724  OS << Node->getPropertyDecl()->getDeclName();
1725 }
1726 
1727 void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
1728  PrintExpr(Node->getBase());
1729  OS << "[";
1730  PrintExpr(Node->getIdx());
1731  OS << "]";
1732 }
1733 
1734 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
1735  switch (Node->getLiteralOperatorKind()) {
1737  OS << cast<StringLiteral>(Node->getArg(0)->IgnoreImpCasts())->getString();
1738  break;
1740  const auto *DRE = cast<DeclRefExpr>(Node->getCallee()->IgnoreImpCasts());
1741  const TemplateArgumentList *Args =
1742  cast<FunctionDecl>(DRE->getDecl())->getTemplateSpecializationArgs();
1743  assert(Args);
1744 
1745  if (Args->size() != 1) {
1746  OS << "operator\"\"" << Node->getUDSuffix()->getName();
1747  printTemplateArgumentList(OS, Args->asArray(), Policy);
1748  OS << "()";
1749  return;
1750  }
1751 
1752  const TemplateArgument &Pack = Args->get(0);
1753  for (const auto &P : Pack.pack_elements()) {
1754  char C = (char)P.getAsIntegral().getZExtValue();
1755  OS << C;
1756  }
1757  break;
1758  }
1760  // Print integer literal without suffix.
1761  const auto *Int = cast<IntegerLiteral>(Node->getCookedLiteral());
1762  OS << Int->getValue().toString(10, /*isSigned*/false);
1763  break;
1764  }
1766  // Print floating literal without suffix.
1767  auto *Float = cast<FloatingLiteral>(Node->getCookedLiteral());
1768  PrintFloatingLiteral(OS, Float, /*PrintSuffix=*/false);
1769  break;
1770  }
1773  PrintExpr(Node->getCookedLiteral());
1774  break;
1775  }
1776  OS << Node->getUDSuffix()->getName();
1777 }
1778 
1779 void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
1780  OS << (Node->getValue() ? "true" : "false");
1781 }
1782 
1783 void StmtPrinter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *Node) {
1784  OS << "nullptr";
1785 }
1786 
1787 void StmtPrinter::VisitCXXThisExpr(CXXThisExpr *Node) {
1788  OS << "this";
1789 }
1790 
1791 void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
1792  if (!Node->getSubExpr())
1793  OS << "throw";
1794  else {
1795  OS << "throw ";
1796  PrintExpr(Node->getSubExpr());
1797  }
1798 }
1799 
1800 void StmtPrinter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Node) {
1801  // Nothing to print: we picked up the default argument.
1802 }
1803 
1804 void StmtPrinter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Node) {
1805  // Nothing to print: we picked up the default initializer.
1806 }
1807 
1808 void StmtPrinter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
1809  Node->getType().print(OS, Policy);
1810  // If there are no parens, this is list-initialization, and the braces are
1811  // part of the syntax of the inner construct.
1812  if (Node->getLParenLoc().isValid())
1813  OS << "(";
1814  PrintExpr(Node->getSubExpr());
1815  if (Node->getLParenLoc().isValid())
1816  OS << ")";
1817 }
1818 
1819 void StmtPrinter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
1820  PrintExpr(Node->getSubExpr());
1821 }
1822 
1823 void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
1824  Node->getType().print(OS, Policy);
1825  if (Node->isStdInitListInitialization())
1826  /* Nothing to do; braces are part of creating the std::initializer_list. */;
1827  else if (Node->isListInitialization())
1828  OS << "{";
1829  else
1830  OS << "(";
1832  ArgEnd = Node->arg_end();
1833  Arg != ArgEnd; ++Arg) {
1834  if ((*Arg)->isDefaultArgument())
1835  break;
1836  if (Arg != Node->arg_begin())
1837  OS << ", ";
1838  PrintExpr(*Arg);
1839  }
1840  if (Node->isStdInitListInitialization())
1841  /* See above. */;
1842  else if (Node->isListInitialization())
1843  OS << "}";
1844  else
1845  OS << ")";
1846 }
1847 
1848 void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
1849  OS << '[';
1850  bool NeedComma = false;
1851  switch (Node->getCaptureDefault()) {
1852  case LCD_None:
1853  break;
1854 
1855  case LCD_ByCopy:
1856  OS << '=';
1857  NeedComma = true;
1858  break;
1859 
1860  case LCD_ByRef:
1861  OS << '&';
1862  NeedComma = true;
1863  break;
1864  }
1866  CEnd = Node->explicit_capture_end();
1867  C != CEnd;
1868  ++C) {
1869  if (C->capturesVLAType())
1870  continue;
1871 
1872  if (NeedComma)
1873  OS << ", ";
1874  NeedComma = true;
1875 
1876  switch (C->getCaptureKind()) {
1877  case LCK_This:
1878  OS << "this";
1879  break;
1880 
1881  case LCK_StarThis:
1882  OS << "*this";
1883  break;
1884 
1885  case LCK_ByRef:
1886  if (Node->getCaptureDefault() != LCD_ByRef || Node->isInitCapture(C))
1887  OS << '&';
1888  OS << C->getCapturedVar()->getName();
1889  break;
1890 
1891  case LCK_ByCopy:
1892  OS << C->getCapturedVar()->getName();
1893  break;
1894 
1895  case LCK_VLAType:
1896  llvm_unreachable("VLA type in explicit captures.");
1897  }
1898 
1899  if (Node->isInitCapture(C))
1900  PrintExpr(C->getCapturedVar()->getInit());
1901  }
1902  OS << ']';
1903 
1904  if (Node->hasExplicitParameters()) {
1905  OS << " (";
1906  CXXMethodDecl *Method = Node->getCallOperator();
1907  NeedComma = false;
1908  for (const auto *P : Method->parameters()) {
1909  if (NeedComma) {
1910  OS << ", ";
1911  } else {
1912  NeedComma = true;
1913  }
1914  std::string ParamStr = P->getNameAsString();
1915  P->getOriginalType().print(OS, Policy, ParamStr);
1916  }
1917  if (Method->isVariadic()) {
1918  if (NeedComma)
1919  OS << ", ";
1920  OS << "...";
1921  }
1922  OS << ')';
1923 
1924  if (Node->isMutable())
1925  OS << " mutable";
1926 
1927  auto *Proto = Method->getType()->getAs<FunctionProtoType>();
1928  Proto->printExceptionSpecification(OS, Policy);
1929 
1930  // FIXME: Attributes
1931 
1932  // Print the trailing return type if it was specified in the source.
1933  if (Node->hasExplicitResultType()) {
1934  OS << " -> ";
1935  Proto->getReturnType().print(OS, Policy);
1936  }
1937  }
1938 
1939  // Print the body.
1940  CompoundStmt *Body = Node->getBody();
1941  OS << ' ';
1942  PrintStmt(Body);
1943 }
1944 
1945 void StmtPrinter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *Node) {
1946  if (TypeSourceInfo *TSInfo = Node->getTypeSourceInfo())
1947  TSInfo->getType().print(OS, Policy);
1948  else
1949  Node->getType().print(OS, Policy);
1950  OS << "()";
1951 }
1952 
1953 void StmtPrinter::VisitCXXNewExpr(CXXNewExpr *E) {
1954  if (E->isGlobalNew())
1955  OS << "::";
1956  OS << "new ";
1957  unsigned NumPlace = E->getNumPlacementArgs();
1958  if (NumPlace > 0 && !isa<CXXDefaultArgExpr>(E->getPlacementArg(0))) {
1959  OS << "(";
1960  PrintExpr(E->getPlacementArg(0));
1961  for (unsigned i = 1; i < NumPlace; ++i) {
1962  if (isa<CXXDefaultArgExpr>(E->getPlacementArg(i)))
1963  break;
1964  OS << ", ";
1965  PrintExpr(E->getPlacementArg(i));
1966  }
1967  OS << ") ";
1968  }
1969  if (E->isParenTypeId())
1970  OS << "(";
1971  std::string TypeS;
1972  if (Expr *Size = E->getArraySize()) {
1973  llvm::raw_string_ostream s(TypeS);
1974  s << '[';
1975  Size->printPretty(s, Helper, Policy);
1976  s << ']';
1977  }
1978  E->getAllocatedType().print(OS, Policy, TypeS);
1979  if (E->isParenTypeId())
1980  OS << ")";
1981 
1983  if (InitStyle) {
1984  if (InitStyle == CXXNewExpr::CallInit)
1985  OS << "(";
1986  PrintExpr(E->getInitializer());
1987  if (InitStyle == CXXNewExpr::CallInit)
1988  OS << ")";
1989  }
1990 }
1991 
1992 void StmtPrinter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
1993  if (E->isGlobalDelete())
1994  OS << "::";
1995  OS << "delete ";
1996  if (E->isArrayForm())
1997  OS << "[] ";
1998  PrintExpr(E->getArgument());
1999 }
2000 
2001 void StmtPrinter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
2002  PrintExpr(E->getBase());
2003  if (E->isArrow())
2004  OS << "->";
2005  else
2006  OS << '.';
2007  if (E->getQualifier())
2008  E->getQualifier()->print(OS, Policy);
2009  OS << "~";
2010 
2012  OS << II->getName();
2013  else
2014  E->getDestroyedType().print(OS, Policy);
2015 }
2016 
2017 void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
2019  OS << "{";
2020 
2021  for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
2022  if (isa<CXXDefaultArgExpr>(E->getArg(i))) {
2023  // Don't print any defaulted arguments
2024  break;
2025  }
2026 
2027  if (i) OS << ", ";
2028  PrintExpr(E->getArg(i));
2029  }
2030 
2032  OS << "}";
2033 }
2034 
2035 void StmtPrinter::VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E) {
2036  // Parens are printed by the surrounding context.
2037  OS << "<forwarded>";
2038 }
2039 
2040 void StmtPrinter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
2041  PrintExpr(E->getSubExpr());
2042 }
2043 
2044 void StmtPrinter::VisitExprWithCleanups(ExprWithCleanups *E) {
2045  // Just forward to the subexpression.
2046  PrintExpr(E->getSubExpr());
2047 }
2048 
2049 void
2050 StmtPrinter::VisitCXXUnresolvedConstructExpr(
2052  Node->getTypeAsWritten().print(OS, Policy);
2053  OS << "(";
2055  ArgEnd = Node->arg_end();
2056  Arg != ArgEnd; ++Arg) {
2057  if (Arg != Node->arg_begin())
2058  OS << ", ";
2059  PrintExpr(*Arg);
2060  }
2061  OS << ")";
2062 }
2063 
2064 void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2066  if (!Node->isImplicitAccess()) {
2067  PrintExpr(Node->getBase());
2068  OS << (Node->isArrow() ? "->" : ".");
2069  }
2070  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2071  Qualifier->print(OS, Policy);
2072  if (Node->hasTemplateKeyword())
2073  OS << "template ";
2074  OS << Node->getMemberNameInfo();
2075  if (Node->hasExplicitTemplateArgs())
2076  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
2077 }
2078 
2079 void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) {
2080  if (!Node->isImplicitAccess()) {
2081  PrintExpr(Node->getBase());
2082  OS << (Node->isArrow() ? "->" : ".");
2083  }
2084  if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2085  Qualifier->print(OS, Policy);
2086  if (Node->hasTemplateKeyword())
2087  OS << "template ";
2088  OS << Node->getMemberNameInfo();
2089  if (Node->hasExplicitTemplateArgs())
2090  printTemplateArgumentList(OS, Node->template_arguments(), Policy);
2091 }
2092 
2093 static const char *getTypeTraitName(TypeTrait TT) {
2094  switch (TT) {
2095 #define TYPE_TRAIT_1(Spelling, Name, Key) \
2096 case clang::UTT_##Name: return #Spelling;
2097 #define TYPE_TRAIT_2(Spelling, Name, Key) \
2098 case clang::BTT_##Name: return #Spelling;
2099 #define TYPE_TRAIT_N(Spelling, Name, Key) \
2100  case clang::TT_##Name: return #Spelling;
2101 #include "clang/Basic/TokenKinds.def"
2102  }
2103  llvm_unreachable("Type trait not covered by switch");
2104 }
2105 
2106 static const char *getTypeTraitName(ArrayTypeTrait ATT) {
2107  switch (ATT) {
2108  case ATT_ArrayRank: return "__array_rank";
2109  case ATT_ArrayExtent: return "__array_extent";
2110  }
2111  llvm_unreachable("Array type trait not covered by switch");
2112 }
2113 
2114 static const char *getExpressionTraitName(ExpressionTrait ET) {
2115  switch (ET) {
2116  case ET_IsLValueExpr: return "__is_lvalue_expr";
2117  case ET_IsRValueExpr: return "__is_rvalue_expr";
2118  }
2119  llvm_unreachable("Expression type trait not covered by switch");
2120 }
2121 
2122 void StmtPrinter::VisitTypeTraitExpr(TypeTraitExpr *E) {
2123  OS << getTypeTraitName(E->getTrait()) << "(";
2124  for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
2125  if (I > 0)
2126  OS << ", ";
2127  E->getArg(I)->getType().print(OS, Policy);
2128  }
2129  OS << ")";
2130 }
2131 
2132 void StmtPrinter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
2133  OS << getTypeTraitName(E->getTrait()) << '(';
2134  E->getQueriedType().print(OS, Policy);
2135  OS << ')';
2136 }
2137 
2138 void StmtPrinter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
2139  OS << getExpressionTraitName(E->getTrait()) << '(';
2140  PrintExpr(E->getQueriedExpression());
2141  OS << ')';
2142 }
2143 
2144 void StmtPrinter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
2145  OS << "noexcept(";
2146  PrintExpr(E->getOperand());
2147  OS << ")";
2148 }
2149 
2150 void StmtPrinter::VisitPackExpansionExpr(PackExpansionExpr *E) {
2151  PrintExpr(E->getPattern());
2152  OS << "...";
2153 }
2154 
2155 void StmtPrinter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {
2156  OS << "sizeof...(" << *E->getPack() << ")";
2157 }
2158 
2159 void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2161  OS << *Node->getParameterPack();
2162 }
2163 
2164 void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2166  Visit(Node->getReplacement());
2167 }
2168 
2169 void StmtPrinter::VisitFunctionParmPackExpr(FunctionParmPackExpr *E) {
2170  OS << *E->getParameterPack();
2171 }
2172 
2173 void StmtPrinter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *Node){
2174  PrintExpr(Node->GetTemporaryExpr());
2175 }
2176 
2177 void StmtPrinter::VisitCXXFoldExpr(CXXFoldExpr *E) {
2178  OS << "(";
2179  if (E->getLHS()) {
2180  PrintExpr(E->getLHS());
2181  OS << " " << BinaryOperator::getOpcodeStr(E->getOperator()) << " ";
2182  }
2183  OS << "...";
2184  if (E->getRHS()) {
2185  OS << " " << BinaryOperator::getOpcodeStr(E->getOperator()) << " ";
2186  PrintExpr(E->getRHS());
2187  }
2188  OS << ")";
2189 }
2190 
2191 // C++ Coroutines TS
2192 
2193 void StmtPrinter::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
2194  Visit(S->getBody());
2195 }
2196 
2197 void StmtPrinter::VisitCoreturnStmt(CoreturnStmt *S) {
2198  OS << "co_return";
2199  if (S->getOperand()) {
2200  OS << " ";
2201  Visit(S->getOperand());
2202  }
2203  OS << ";";
2204 }
2205 
2206 void StmtPrinter::VisitCoawaitExpr(CoawaitExpr *S) {
2207  OS << "co_await ";
2208  PrintExpr(S->getOperand());
2209 }
2210 
2211 void StmtPrinter::VisitDependentCoawaitExpr(DependentCoawaitExpr *S) {
2212  OS << "co_await ";
2213  PrintExpr(S->getOperand());
2214 }
2215 
2216 void StmtPrinter::VisitCoyieldExpr(CoyieldExpr *S) {
2217  OS << "co_yield ";
2218  PrintExpr(S->getOperand());
2219 }
2220 
2221 // Obj-C
2222 
2223 void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
2224  OS << "@";
2225  VisitStringLiteral(Node->getString());
2226 }
2227 
2228 void StmtPrinter::VisitObjCBoxedExpr(ObjCBoxedExpr *E) {
2229  OS << "@";
2230  Visit(E->getSubExpr());
2231 }
2232 
2233 void StmtPrinter::VisitObjCArrayLiteral(ObjCArrayLiteral *E) {
2234  OS << "@[ ";
2236  for (auto I = Ch.begin(), E = Ch.end(); I != E; ++I) {
2237  if (I != Ch.begin())
2238  OS << ", ";
2239  Visit(*I);
2240  }
2241  OS << " ]";
2242 }
2243 
2244 void StmtPrinter::VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
2245  OS << "@{ ";
2246  for (unsigned I = 0, N = E->getNumElements(); I != N; ++I) {
2247  if (I > 0)
2248  OS << ", ";
2249 
2250  ObjCDictionaryElement Element = E->getKeyValueElement(I);
2251  Visit(Element.Key);
2252  OS << " : ";
2253  Visit(Element.Value);
2254  if (Element.isPackExpansion())
2255  OS << "...";
2256  }
2257  OS << " }";
2258 }
2259 
2260 void StmtPrinter::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
2261  OS << "@encode(";
2262  Node->getEncodedType().print(OS, Policy);
2263  OS << ')';
2264 }
2265 
2266 void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
2267  OS << "@selector(";
2268  Node->getSelector().print(OS);
2269  OS << ')';
2270 }
2271 
2272 void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
2273  OS << "@protocol(" << *Node->getProtocol() << ')';
2274 }
2275 
2276 void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
2277  OS << "[";
2278  switch (Mess->getReceiverKind()) {
2280  PrintExpr(Mess->getInstanceReceiver());
2281  break;
2282 
2284  Mess->getClassReceiver().print(OS, Policy);
2285  break;
2286 
2289  OS << "Super";
2290  break;
2291  }
2292 
2293  OS << ' ';
2294  Selector selector = Mess->getSelector();
2295  if (selector.isUnarySelector()) {
2296  OS << selector.getNameForSlot(0);
2297  } else {
2298  for (unsigned i = 0, e = Mess->getNumArgs(); i != e; ++i) {
2299  if (i < selector.getNumArgs()) {
2300  if (i > 0) OS << ' ';
2301  if (selector.getIdentifierInfoForSlot(i))
2302  OS << selector.getIdentifierInfoForSlot(i)->getName() << ':';
2303  else
2304  OS << ":";
2305  }
2306  else OS << ", "; // Handle variadic methods.
2307 
2308  PrintExpr(Mess->getArg(i));
2309  }
2310  }
2311  OS << "]";
2312 }
2313 
2314 void StmtPrinter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node) {
2315  OS << (Node->getValue() ? "__objc_yes" : "__objc_no");
2316 }
2317 
2318 void
2319 StmtPrinter::VisitObjCIndirectCopyRestoreExpr(ObjCIndirectCopyRestoreExpr *E) {
2320  PrintExpr(E->getSubExpr());
2321 }
2322 
2323 void
2324 StmtPrinter::VisitObjCBridgedCastExpr(ObjCBridgedCastExpr *E) {
2325  OS << '(' << E->getBridgeKindName();
2326  E->getType().print(OS, Policy);
2327  OS << ')';
2328  PrintExpr(E->getSubExpr());
2329 }
2330 
2331 void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
2332  BlockDecl *BD = Node->getBlockDecl();
2333  OS << "^";
2334 
2335  const FunctionType *AFT = Node->getFunctionType();
2336 
2337  if (isa<FunctionNoProtoType>(AFT)) {
2338  OS << "()";
2339  } else if (!BD->param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2340  OS << '(';
2341  for (BlockDecl::param_iterator AI = BD->param_begin(),
2342  E = BD->param_end(); AI != E; ++AI) {
2343  if (AI != BD->param_begin()) OS << ", ";
2344  std::string ParamStr = (*AI)->getNameAsString();
2345  (*AI)->getType().print(OS, Policy, ParamStr);
2346  }
2347 
2348  const auto *FT = cast<FunctionProtoType>(AFT);
2349  if (FT->isVariadic()) {
2350  if (!BD->param_empty()) OS << ", ";
2351  OS << "...";
2352  }
2353  OS << ')';
2354  }
2355  OS << "{ }";
2356 }
2357 
2358 void StmtPrinter::VisitOpaqueValueExpr(OpaqueValueExpr *Node) {
2359  PrintExpr(Node->getSourceExpr());
2360 }
2361 
2362 void StmtPrinter::VisitTypoExpr(TypoExpr *Node) {
2363  // TODO: Print something reasonable for a TypoExpr, if necessary.
2364  llvm_unreachable("Cannot print TypoExpr nodes");
2365 }
2366 
2367 void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) {
2368  OS << "__builtin_astype(";
2369  PrintExpr(Node->getSrcExpr());
2370  OS << ", ";
2371  Node->getType().print(OS, Policy);
2372  OS << ")";
2373 }
2374 
2375 //===----------------------------------------------------------------------===//
2376 // Stmt method implementations
2377 //===----------------------------------------------------------------------===//
2378 
2379 void Stmt::dumpPretty(const ASTContext &Context) const {
2380  printPretty(llvm::errs(), nullptr, PrintingPolicy(Context.getLangOpts()));
2381 }
2382 
2383 void Stmt::printPretty(raw_ostream &OS, PrinterHelper *Helper,
2384  const PrintingPolicy &Policy, unsigned Indentation,
2385  StringRef NL,
2386  const ASTContext *Context) const {
2387  StmtPrinter P(OS, Helper, Policy, Indentation, NL, Context);
2388  P.Visit(const_cast<Stmt*>(this));
2389 }
2390 
2391 //===----------------------------------------------------------------------===//
2392 // PrinterHelper
2393 //===----------------------------------------------------------------------===//
2394 
2395 // Implement virtual destructor.
2396 PrinterHelper::~PrinterHelper() = default;
Expr * getInc()
Definition: Stmt.h:2050
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
const Expr * getSubExpr() const
Definition: Expr.h:890
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:1361
Represents a single C99 designator.
Definition: Expr.h:4440
Raw form: operator "" X (const char *)
Definition: ExprCXX.h:504
Expr * getVal2() const
Definition: Expr.h:5431
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
Definition: Expr.h:5137
This represents &#39;#pragma omp distribute simd&#39; composite directive.
Definition: StmtOpenMP.h:3248
This represents &#39;#pragma omp master&#39; directive.
Definition: StmtOpenMP.h:1431
operator "" X (long double)
Definition: ExprCXX.h:513
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:918
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:591
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
Definition: ExprCXX.cpp:993
This represents &#39;#pragma omp task&#39; directive.
Definition: StmtOpenMP.h:1771
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:2455
Represents a &#39;co_await&#39; expression while the type of the promise is dependent.
Definition: ExprCXX.h:4346
Expr * getArrayIndex(const Designator &D) const
Definition: Expr.cpp:3925
bool getValue() const
Definition: ExprObjC.h:94
The receiver is an object instance.
Definition: ExprObjC.h:1055
Expr * getLHS() const
Definition: Expr.h:3573
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
Definition: ExprCXX.h:2706
unsigned getNumInputs() const
Definition: Stmt.h:2371
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Definition: Expr.h:5289
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition: ExprCXX.h:2950
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: Expr.h:2749
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:2090
CompoundStmt * getBlock() const
Definition: Stmt.h:2790
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
Definition: Type.h:642
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:2977
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2692
ArrayRef< OMPClause * > clauses()
Definition: StmtOpenMP.h:260
unsigned SuppressInitializers
Suppress printing of variable initializers.
Expr * getCond() const
Definition: Expr.h:3968
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2480
Selector getSelector() const
Definition: ExprObjC.cpp:312
Defines enumerations for the type traits support.
const Expr * getSubExpr() const
Definition: ExprCXX.h:1032
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:1892
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
Definition: Expr.h:3832
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
Definition: Expr.h:3826
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:2355
CompoundStmt * getSubStmt()
Definition: Expr.h:3763
const Expr * getInit(unsigned Init) const
Definition: Expr.h:4179
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
Definition: ExprCXX.h:1808
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:490
Represents a &#39;co_return&#39; statement in the C++ Coroutines TS.
Definition: StmtCXX.h:435
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:2468
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:3361
CXXCatchStmt * getHandler(unsigned i)
Definition: StmtCXX.h:104
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1467
C Language Family Type Representation.
bool param_empty() const
Definition: Decl.h:3964
unsigned getNumOutputs() const
Definition: Stmt.h:2349
static CharSourceRange getTokenRange(SourceRange R)
This represents &#39;#pragma omp for simd&#39; directive.
Definition: StmtOpenMP.h:1181
bool isRecordType() const
Definition: Type.h:6355
Expr * getBase() const
Definition: Expr.h:2686
const StringLiteral * getAsmString() const
Definition: Stmt.h:2481
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
This represents &#39;#pragma omp teams distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3659
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:1371
llvm::APFloat getValue() const
Definition: Expr.h:1470
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:4804
param_iterator param_end()
Definition: Decl.h:3966
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2748
const Expr * getSubExpr() const
Definition: Expr.h:4055
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we&#39;re testing for, along with location information.
Definition: StmtCXX.h:277
Defines the C++ template declaration subclasses.
Opcode getOpcode() const
Definition: Expr.h:3268
StringRef P
CapturedStmt * getInnermostCapturedStmt()
Get innermost captured statement for the construct.
Definition: StmtOpenMP.h:226
Represents an attribute applied to a statement.
Definition: Stmt.h:1413
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:1855
static bool isImplicitThis(const Expr *E)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:273
Expr * getLowerBound()
Get lower bound of array section.
Definition: ExprOpenMP.h:91
This represents &#39;#pragma omp target teams distribute&#39; combined directive.
Definition: StmtOpenMP.h:3796
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
Definition: ExprCXX.h:2924
Represents Objective-C&#39;s @throw statement.
Definition: StmtObjC.h:313
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
Definition: Expr.h:1206
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:878
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1257
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:2439
bool getIsCXXTry() const
Definition: Stmt.h:2828
A container of type source information.
Definition: Decl.h:86
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Definition: ExprCXX.h:2268
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
This represents &#39;#pragma omp parallel for&#39; directive.
Definition: StmtOpenMP.h:1552
MS property subscript expression.
Definition: ExprCXX.h:823
IdentKind getIdentKind() const
Definition: Expr.h:1817
This represents &#39;#pragma omp target teams distribute parallel for&#39; combined directive.
Definition: StmtOpenMP.h:3864
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:4047
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
Definition: Decl.h:3961
void printExceptionSpecification(raw_ostream &OS, const PrintingPolicy &Policy) const
const Expr * getSubExpr() const
Definition: Expr.h:1540
Expr * getIndexExpr(unsigned Idx)
Definition: Expr.h:2191
This represents &#39;#pragma omp target exit data&#39; directive.
Definition: StmtOpenMP.h:2463
Stmt * getSubStmt()
Definition: Stmt.h:1335
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:2844
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6716
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Definition: ExprCXX.h:2404
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:734
bool isArrow() const
Definition: ExprObjC.h:1465
Expr * getVal1() const
Definition: Expr.h:5421
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Definition: ExprCXX.h:619
const char * getName() const
Definition: Stmt.cpp:348
Stmt * getThen()
Definition: Stmt.h:1554
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:1982
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
Defines the Objective-C statement AST node classes.
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1010
Expr * getExprOperand() const
Definition: ExprCXX.h:721
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3012
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
Definition: ExprCXX.h:2407
Defines the clang::Expr interface and subclasses for C++ expressions.
StringRef getInputName(unsigned i) const
Definition: Stmt.h:2573
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:670
A C++ static_cast expression (C++ [expr.static.cast]).
Definition: ExprCXX.h:307
virtual ~PrinterHelper()
Expr * getExprOperand() const
Definition: ExprCXX.h:928
const Stmt * getSubStmt() const
Definition: StmtObjC.h:356
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1373
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Definition: Expr.h:3103
Represents a C99 designated initializer expression.
Definition: Expr.h:4365
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:1990
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
Definition: ExprCXX.h:4088
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:3792
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition: Stmt.h:1783
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:4599
Used for GCC&#39;s __alignof.
Definition: TypeTraits.h:107
child_range children()
Definition: ExprObjC.h:227
Represents a member of a struct/union/class.
Definition: Decl.h:2588
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Definition: ExprCXX.h:3518
Represents a place-holder for an object not to be initialized by anything.
Definition: Expr.h:4659
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
Definition: ExprCXX.h:2664
StringLiteral * getString()
Definition: ExprObjC.h:63
RetTy Visit(PTR(OMPClause) S)
CompoundStmt * getBody() const
Retrieve the body of the lambda.
Definition: ExprCXX.cpp:1030
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
Definition: Expr.h:2082
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
Definition: Expr.h:2753
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Definition: Expr.h:4003
QualType getDestroyedType() const
Retrieve the type being destroyed.
Definition: ExprCXX.cpp:246
Expr * getPlacementArg(unsigned i)
Definition: ExprCXX.h:1988
This represents &#39;#pragma omp target simd&#39; directive.
Definition: StmtOpenMP.h:3384
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Definition: Expr.h:1004
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3450
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:5062
Expr * getSubExpr()
Definition: Expr.h:2982
This represents &#39;#pragma omp barrier&#39; directive.
Definition: StmtOpenMP.h:1883
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:171
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
Definition: ExprCXX.h:3905
This represents &#39;#pragma omp critical&#39; directive.
Definition: StmtOpenMP.h:1478
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
Definition: ExprCXX.h:1677
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2762
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:2721
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Definition: ExprCXX.h:2953
Selector getSelector() const
Definition: ExprObjC.h:442
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2263
bool isUnarySelector() const
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:74
Expr * getLHS() const
Definition: ExprCXX.h:4182
StringRef getOpcodeStr() const
Definition: Expr.h:3289
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2119
Describes an C or C++ initializer list.
Definition: Expr.h:4131
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Definition: ExprCXX.h:664
This represents &#39;#pragma omp distribute parallel for&#39; composite directive.
Definition: StmtOpenMP.h:3099
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:4480
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:3588
Expr * getArraySize()
Definition: ExprCXX.h:1975
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:2017
Expr * getBaseExpr() const
Definition: ExprObjC.h:848
Expr * getOperand() const
Definition: ExprCXX.h:3630
const Expr * getThrowExpr() const
Definition: StmtObjC.h:325
< Capturing the *this object by copy
Definition: Lambda.h:37
bool isGlobalNew() const
Definition: ExprCXX.h:2000
Expr * getPtr() const
Definition: Expr.h:5411
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:2013
Stmt * getBody()
Definition: Stmt.h:2051
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3233
const Expr * getAssocExpr(unsigned i) const
Definition: Expr.h:4989
Stmt * getInit()
Definition: Stmt.h:2030
Expr * getOutputExpr(unsigned i)
Definition: Stmt.cpp:436
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: Expr.h:2781
bool isClassReceiver() const
Definition: ExprObjC.h:740
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:2582
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1954
CXXForRangeStmt - This represents C++0x [stmt.ranged]&#39;s ranged for statement, represented as &#39;for (ra...
Definition: StmtCXX.h:127
bool isArrow() const
Definition: Expr.h:2793
This represents &#39;#pragma omp cancellation point&#39; directive.
Definition: StmtOpenMP.h:2718
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
Expr * getRHS() const
Definition: ExprCXX.h:4183
const CallExpr * getConfig() const
Definition: ExprCXX.h:221
bool isArrow() const
Definition: ExprCXX.h:807
New-expression has a C++98 paren-delimited initializer.
Definition: ExprCXX.h:1923
CaseStmt - Represent a case statement.
Definition: Stmt.h:1174
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:5508
Expr * getCond()
Definition: Stmt.h:2049
This represents &#39;#pragma omp teams&#39; directive.
Definition: StmtOpenMP.h:2661
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
Definition: ExprCXX.h:2673
const Expr * getControllingExpr() const
Definition: Expr.h:5014
Helper class for OffsetOfExpr.
Definition: Expr.h:2024
Expr * getOperand() const
Definition: ExprCXX.h:4371
This represents &#39;#pragma omp teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:3518
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1212
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:2616
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:2545
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:1606
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3213
bool isCmpXChg() const
Definition: Expr.h:5455
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda&#39;s captures is an init-capture.
Definition: ExprCXX.cpp:972
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
TypeSourceInfo * getTypeSourceInfo() const
Definition: ExprCXX.h:1847
Stmt * getBody()
Definition: Stmt.h:1738
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1068
Stmt * getInit()
Definition: Stmt.h:1610
bool isTypeOperand() const
Definition: ExprCXX.h:911
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
Definition: ExprCXX.cpp:748
Represents the this expression in C++.
Definition: ExprCXX.h:971
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:2122
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:3316
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:3154
OpenMP 4.0 [2.4, Array Sections].
Definition: ExprOpenMP.h:45
ConditionalOperator - The ?: ternary operator.
Definition: Expr.h:3528
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1342
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Definition: ExprCXX.h:2211
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1021
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1613
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3686
QualType getQueriedType() const
Definition: ExprCXX.h:2480
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
Definition: StmtCXX.h:281
This represents &#39;#pragma omp taskgroup&#39; directive.
Definition: StmtOpenMP.h:1971
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:2720
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2233
arg_iterator arg_end()
Definition: ExprCXX.h:1372
InitListExpr * getUpdater() const
Definition: Expr.h:4717
ConstantExpr - An expression that occurs in a constant context.
Definition: Expr.h:904
Represents a call to the builtin function __builtin_va_arg.
Definition: Expr.h:4037
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:991
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:1437
This represents &#39;#pragma omp distribute&#39; directive.
Definition: StmtOpenMP.h:2972
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:5195
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:1828
Expr * getCond() const
Definition: Expr.h:3562
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3867
llvm::MutableArrayRef< Designator > designators()
Definition: Expr.h:4568
This represents one expression.
Definition: Expr.h:106
bool isVariadic() const
Whether this function is variadic.
Definition: Decl.cpp:2689
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Definition: Expr.cpp:1429
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3535
int Id
Definition: ASTDiff.cpp:191
static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, bool PrintSuffix)
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:1253
Represents a C++ functional cast expression that builds a temporary object.
Definition: ExprCXX.h:1556
A C++ const_cast expression (C++ [expr.const.cast]).
Definition: ExprCXX.h:440
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Definition: Expr.h:5123
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:2311
unsigned getNumInits() const
Definition: Expr.h:4161
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Definition: ExprCXX.cpp:1200
Expr * getSubExpr() const
Get the initializer to use for each array element.
Definition: Expr.h:4771
Defines an enumeration for C++ overloaded operators.
const Expr * getCallee() const
Definition: Expr.h:2451
This represents &#39;#pragma omp target teams distribute parallel for simd&#39; combined directive.
Definition: StmtOpenMP.h:3948
QualType getArgumentType() const
Definition: Expr.h:2270
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an &#39;->&#39; (otherwise, it used a &#39;.
Definition: ExprCXX.h:2274
Stmt * getBody()
Definition: Stmt.h:1904
Expr * getOrder() const
Definition: Expr.h:5414
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:1275
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:2170
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3735
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:5172
IdentifierInfo & getAccessor() const
Definition: Expr.h:5084
This represents &#39;#pragma omp target teams distribute simd&#39; combined directive.
Definition: StmtOpenMP.h:4021
ArrayTypeTrait getTrait() const
Definition: ExprCXX.h:2478
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.
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:1844
Kind getKind() const
Determine what kind of offsetof node this is.
Definition: Expr.h:2078
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:128
virtual bool handledStmt(Stmt *E, raw_ostream &OS)=0
This represents &#39;#pragma omp for&#39; directive.
Definition: StmtOpenMP.h:1104
LabelDecl * getLabel() const
Definition: Stmt.h:2097
const Stmt * getTryBody() const
Retrieve the @try body.
Definition: StmtObjC.h:197
Represents a folding of a pack over an operator.
Definition: ExprCXX.h:4157
QualType getEncodedType() const
Definition: ExprObjC.h:407
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2223
This represents &#39;#pragma omp target teams&#39; directive.
Definition: StmtOpenMP.h:3737
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:2630
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:1907
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:5443
A member reference to an MSPropertyDecl.
Definition: ExprCXX.h:754
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:3849
const OffsetOfNode & getComponent(unsigned Idx) const
Definition: Expr.h:2177
unsigned getNumArgs() const
This represents &#39;#pragma omp cancel&#39; directive.
Definition: StmtOpenMP.h:2776
Expr * getCond()
Definition: Stmt.h:1542
ValueDecl * getDecl()
Definition: Expr.h:1125
Selector getSelector() const
Definition: DeclObjC.h:321
const Expr * getSubExpr() const
Definition: Expr.h:1871
const Expr * getSubExpr() const
Definition: ExprCXX.h:1235
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:3165
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
Definition: ExprCXX.cpp:1019
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:2358
bool getValue() const
Definition: ExprCXX.h:569
This file defines OpenMP AST classes for clauses.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Definition: Expr.h:1528
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: ExprObjC.h:1342
This represents &#39;#pragma omp flush&#39; directive.
Definition: StmtOpenMP.h:2044
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:1632
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:1965
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
Definition: ExprObjC.cpp:355
param_iterator param_begin()
Definition: Decl.h:3965
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
Definition: ExprCXX.h:3314
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
Definition: ExprCXX.h:2908
Expr * getArgument()
Definition: ExprCXX.h:2137
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:2404
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Definition: ExprCXX.h:348
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:945
Expr * getBase() const
Definition: Expr.h:4714
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Definition: Expr.h:3860
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1329
static StringRef getIdentKindName(IdentKind IK)
Definition: Expr.cpp:499
Kind
This captures a statement into a function.
Definition: Stmt.h:2885
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1418
operator "" X (const CharT *, size_t)
Definition: ExprCXX.h:516
ExpressionTrait getTrait() const
Definition: ExprCXX.h:2542
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5245
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:507
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Definition: Expr.h:4891
This represents &#39;#pragma omp single&#39; directive.
Definition: StmtOpenMP.h:1376
unsigned Indentation
The number of spaces to use to indent each line.
Definition: PrettyPrinter.h:67
body_range body()
Definition: Stmt.h:1054
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Definition: ExprCXX.cpp:989
Expr * getRetValue()
Definition: Stmt.h:2256
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:1937
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Definition: ExprCXX.h:3377
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:1868
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:342
Expr * getLHS()
Definition: Stmt.h:1263
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:482
DeclarationName getName() const
getName - Returns the embedded declaration name.
Represents a call to a member function that may be written either with member call syntax (e...
Definition: ExprCXX.h:166
Stmt * getElse()
Definition: Stmt.h:1563
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:923
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Definition: StmtOpenMP.h:1536
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2041
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:808
Expr * getCond()
Definition: Stmt.h:1726
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:1927
QualType getAllocatedType() const
Definition: ExprCXX.h:1942
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:5379
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2264
Expr * getExpr(unsigned Init)
Definition: Expr.h:4893
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:474
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:2554
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3051
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:2986
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Definition: ExprCXX.h:3373
CharacterKind getKind() const
Definition: Expr.h:1430
This represents &#39;#pragma omp target&#39; directive.
Definition: StmtOpenMP.h:2288
Expr * getInputExpr(unsigned i)
Definition: Stmt.cpp:447
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...
Used for C&#39;s _Alignof and C++&#39;s alignof.
Definition: TypeTraits.h:101
bool isParenTypeId() const
Definition: ExprCXX.h:1997
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
Expr * getArrayRangeStart(const Designator &D) const
Definition: Expr.cpp:3930
Expr * getSubExpr()
Definition: ExprObjC.h:135
An expression trait intrinsic.
Definition: ExprCXX.h:2505
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition: Stmt.h:1932
This represents &#39;#pragma omp ordered&#39; directive.
Definition: StmtOpenMP.h:2099
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Definition: Expr.h:3747
This represents &#39;#pragma omp target update&#39; directive.
Definition: StmtOpenMP.h:3040
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:117
bool isArgumentType() const
Definition: Expr.h:2269
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: ExprCXX.h:3405
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
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Definition: StmtCXX.h:241
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:1202
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2866
Expr * Value
The value of the dictionary element.
Definition: ExprObjC.h:244
const Expr * getInitializer() const
Definition: Expr.h:2870
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Definition: ExprCXX.h:2006
Expr * getLHS() const
Definition: Expr.h:3273
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:3450
Represents a C11 generic selection.
Definition: Expr.h:4956
StringRef getName() const
Return the actual identifier string.
const Expr * getBase() const
Definition: Expr.h:5080
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:3703
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:3969
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:3660
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:990
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
Definition: ExprCXX.cpp:1041
bool isTypeOperand() const
Definition: ExprCXX.h:704
unsigned getNumAssocs() const
Definition: Expr.h:4983
Dataflow Directional Tag Classes.
static std::string getPropertyNameFromSetterSelector(Selector Sel)
Return the property name for the given setter selector.
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:2336
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1769
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
Definition: Expr.h:2786
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2095
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:108
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:3933
MSPropertyDecl * getPropertyDecl() const
Definition: ExprCXX.h:806
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:1449
Parameter for Objective-C &#39;self&#39; argument.
Definition: Decl.h:1496
This represents &#39;#pragma omp section&#39; directive.
Definition: StmtOpenMP.h:1314
This represents &#39;#pragma omp teams distribute&#39; directive.
Definition: StmtOpenMP.h:3450
QualType getAssocType(unsigned i) const
Definition: Expr.h:5007
A runtime availability query.
Definition: ExprObjC.h:1641
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
Definition: ExprCXX.h:395
This represents &#39;#pragma omp simd&#39; directive.
Definition: StmtOpenMP.h:1039
Represents a &#39;co_yield&#39; expression.
Definition: ExprCXX.h:4393
Expr * getOperand() const
Retrieve the operand of the &#39;co_return&#39; statement.
Definition: StmtCXX.h:459
Represents a C++11 pack expansion that produces a sequence of expressions.
Definition: ExprCXX.h:3663
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1335
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Definition: Stmt.cpp:1113
const Expr * getSynchExpr() const
Definition: StmtObjC.h:290
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:266
NestedNameSpecifierLoc getQualifierLoc() const
Definition: ExprCXX.h:809
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the full name info for the member that this expression refers to.
Definition: ExprCXX.h:3545
This represents &#39;#pragma omp atomic&#39; directive.
Definition: StmtOpenMP.h:2154
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition: Stmt.h:1598
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Definition: ExprCXX.h:711
Expr * getArrayRangeEnd(const Designator &D) const
Definition: Expr.cpp:3936
llvm::APInt getValue() const
Definition: Expr.h:1303
Represents a __leave statement.
Definition: Stmt.h:2850
LabelDecl * getLabel() const
Definition: Expr.h:3725
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:3611
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1666
Capturing variable-length array type.
Definition: Lambda.h:39
Expr * getOrderFail() const
Definition: Expr.h:5427
DeclarationNameInfo getNameInfo() const
Definition: Expr.h:1129
Represents the body of a coroutine.
Definition: StmtCXX.h:302
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
Definition: ExprCXX.h:2703
Expr * getBase() const
Definition: ExprObjC.h:1463
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2323
This file defines OpenMP AST classes for executable directives and clauses.
bool hasBraces() const
Definition: Stmt.h:2658
Represents Objective-C&#39;s collection statement.
Definition: StmtObjC.h:24
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:386
An implicit indirection through a C++ base class, when the field found is in a base class...
Definition: Expr.h:2036
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:206
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4310
Stmt * getInit()
Definition: Stmt.h:1747
Opcode getOpcode() const
Definition: Expr.h:1932
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1383
decl_range decls()
Definition: Stmt.h:966
Represents Objective-C&#39;s @finally statement.
Definition: StmtObjC.h:120
StringRef getAsmString() const
Definition: Stmt.h:2664
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:3307
Capturing the *this object by reference.
Definition: Lambda.h:35
const char * getOpenMPDirectiveName(OpenMPDirectiveKind Kind)
Definition: OpenMPKinds.cpp:31
unsigned getNumClobbers() const
Definition: Stmt.h:2381
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:513
SourceManager & getSourceManager()
Definition: ASTContext.h:661
Expr * getRHS() const
Definition: Expr.h:3972
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3092
SEHFinallyStmt * getFinallyHandler() const
Definition: Stmt.cpp:1117
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2084
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1132
Expr * getTarget()
Definition: Stmt.h:2139
A template argument list.
Definition: DeclTemplate.h:210
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Definition: Expr.h:3884
ArrayRef< TemplateArgumentLoc > template_arguments() const
Definition: Expr.h:1232
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Definition: Stmt.cpp:1265
Expr * getCond()
Definition: Stmt.h:1983
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
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:2601
Defines the clang::SourceLocation class and associated facilities.
This represents &#39;#pragma omp target parallel&#39; directive.
Definition: StmtOpenMP.h:2521
ContinueStmt - This represents a continue.
Definition: Stmt.h:2164
Represents a loop initializing the elements of an array.
Definition: Expr.h:4749
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Definition: Expr.h:3923
Expr * getFilterExpr() const
Definition: Stmt.h:2753
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
Definition: Expr.h:3601
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:29
VarDecl * getLoopVariable()
Definition: StmtCXX.cpp:77
An index into an array.
Definition: Expr.h:2029
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1489
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
Definition: ExprObjC.h:254
Expr * getOperand() const
Definition: ExprCXX.h:4331
Expr * getRHS() const
Definition: Expr.h:3574
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:1843
Capturing by reference.
Definition: Lambda.h:38
SourceLocation getLParenLoc() const
Definition: ExprCXX.h:1525
This class is used for builtin types like &#39;int&#39;.
Definition: Type.h:2397
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:276
bool isGlobalDelete() const
Definition: ExprCXX.h:2121
This represents &#39;#pragma omp taskloop simd&#39; directive.
Definition: StmtOpenMP.h:2906
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:3298
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1577
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
Definition: ExprCXX.h:1805
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2407
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Definition: ExprCXX.h:3692
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:275
Expr * getLHS() const
Definition: Expr.h:3970
Stmt * getBody() const
Retrieve the body of the coroutine as written.
Definition: StmtCXX.h:363
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:954
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:251
This represents &#39;#pragma omp sections&#39; directive.
Definition: StmtOpenMP.h:1246
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:82
bool isObjectReceiver() const
Definition: ExprObjC.h:738
unsigned getNumComponents() const
Definition: Expr.h:2187
This represents &#39;#pragma omp target data&#39; directive.
Definition: StmtOpenMP.h:2346
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Definition: StmtOpenMP.h:2825
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1042
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:3275
unsigned IncludeNewlines
When true, include newlines after statements like "break", etc.
BreakStmt - This represents a break.
Definition: Stmt.h:2190
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:4406
Stmt * getSubStmt()
Definition: Stmt.h:1394
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:3130
QualType getType() const
Definition: Decl.h:647
ParmVarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Definition: ExprCXX.h:3998
unsigned getNumArgs() const
Definition: ExprCXX.h:1380
const Expr * getBase() const
Definition: ExprObjC.h:719
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1179
This represents &#39;#pragma omp taskyield&#39; directive.
Definition: StmtOpenMP.h:1839
This represents &#39;#pragma omp distribute parallel for simd&#39; composite directive.
Definition: StmtOpenMP.h:3179
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:557
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Definition: Expr.h:1152
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2128
Expr * getQueriedExpression() const
Definition: ExprCXX.h:2544
This represents &#39;#pragma omp parallel sections&#39; directive.
Definition: StmtOpenMP.h:1700
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Definition: ExprCXX.h:882
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
Definition: Expr.h:3641
The receiver is a superclass.
Definition: ExprObjC.h:1058
BinaryOperatorKind getOperator() const
Definition: ExprCXX.h:4200
const LangOptions & getLangOpts() const
Definition: ASTContext.h:706
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3806
Represents Objective-C&#39;s @autoreleasepool Statement.
Definition: StmtObjC.h:345
CompoundStmt * getTryBlock() const
Definition: Stmt.h:2830
Stmt * getSubStmt()
Definition: Stmt.h:1453
InitListExpr * getSyntacticForm() const
Definition: Expr.h:4288
Expr * getBaseExpr() const
Definition: ExprCXX.h:805
Represents an implicitly-generated value initialization of an object of a given type.
Definition: Expr.h:4839
CompoundStmt * getBlock() const
Definition: Stmt.h:2757
Expr * getWeak() const
Definition: Expr.h:5437
This represents &#39;#pragma omp target parallel for&#39; directive.
Definition: StmtOpenMP.h:2581
Attr - This represents one attribute.
Definition: Attr.h:43
operator "" X (unsigned long long)
Definition: ExprCXX.h:510
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:2394
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:3339
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:1293
This represents &#39;#pragma omp taskloop&#39; directive.
Definition: StmtOpenMP.h:2841