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