47#include "llvm/ADT/ArrayRef.h"
48#include "llvm/ADT/SmallString.h"
49#include "llvm/ADT/SmallVector.h"
50#include "llvm/ADT/StringExtras.h"
51#include "llvm/ADT/StringRef.h"
52#include "llvm/Support/Casting.h"
53#include "llvm/Support/Compiler.h"
54#include "llvm/Support/ErrorHandling.h"
55#include "llvm/Support/raw_ostream.h"
68 class StmtPrinter :
public StmtVisitor<StmtPrinter> {
79 StringRef NL =
"\n",
const ASTContext *Context =
nullptr)
80 : OS(os), IndentLevel(Indentation), Helper(helper), Policy(Policy),
81 NL(NL), Context(Context) {}
85 void PrintStmt(
Stmt *S,
int SubIndent) {
86 IndentLevel += SubIndent;
87 if (S && isa<Expr>(S)) {
95 Indent() <<
"<<<NULL STATEMENT>>>" << NL;
97 IndentLevel -= SubIndent;
100 void PrintInitStmt(
Stmt *S,
unsigned PrefixWidth) {
102 IndentLevel += (PrefixWidth + 1) / 2;
103 if (
auto *DS = dyn_cast<DeclStmt>(S))
104 PrintRawDeclStmt(DS);
106 PrintExpr(cast<Expr>(S));
108 IndentLevel -= (PrefixWidth + 1) / 2;
111 void PrintControlledStmt(
Stmt *S) {
112 if (
auto *CS = dyn_cast<CompoundStmt>(S)) {
114 PrintRawCompoundStmt(CS);
123 void PrintRawDecl(
Decl *D);
124 void PrintRawDeclStmt(
const DeclStmt *S);
131 bool ForceNoStmt =
false);
134 void PrintExpr(
Expr *E) {
141 raw_ostream &Indent(
int Delta = 0) {
142 for (
int i = 0, e = IndentLevel+Delta; i < e; ++i)
153 void VisitStmt(
Stmt *
Node) LLVM_ATTRIBUTE_UNUSED {
154 Indent() <<
"<<unknown stmt type>>" << NL;
157 void VisitExpr(
Expr *
Node) LLVM_ATTRIBUTE_UNUSED {
158 OS <<
"<<unknown expr type>>";
163#define ABSTRACT_STMT(CLASS)
164#define STMT(CLASS, PARENT) \
165 void Visit##CLASS(CLASS *Node);
166#include "clang/AST/StmtNodes.inc"
178 assert(
Node &&
"Compound statement cannot be null");
180 PrintFPPragmas(
Node);
181 for (
auto *I :
Node->body())
188 if (!S->hasStoredFPFeatures())
191 bool FEnvAccess =
false;
192 if (FPO.hasAllowFEnvAccessOverride()) {
193 FEnvAccess = FPO.getAllowFEnvAccessOverride();
194 Indent() <<
"#pragma STDC FENV_ACCESS " << (FEnvAccess ?
"ON" :
"OFF")
197 if (FPO.hasSpecifiedExceptionModeOverride()) {
199 FPO.getSpecifiedExceptionModeOverride();
200 if (!FEnvAccess || EM != LangOptions::FPE_Strict) {
201 Indent() <<
"#pragma clang fp exceptions(";
202 switch (FPO.getSpecifiedExceptionModeOverride()) {
205 case LangOptions::FPE_Ignore:
208 case LangOptions::FPE_MayTrap:
211 case LangOptions::FPE_Strict:
218 if (FPO.hasConstRoundingModeOverride()) {
220 Indent() <<
"#pragma STDC FENV_ROUND ";
222 case llvm::RoundingMode::TowardZero:
223 OS <<
"FE_TOWARDZERO";
225 case llvm::RoundingMode::NearestTiesToEven:
226 OS <<
"FE_TONEAREST";
228 case llvm::RoundingMode::TowardPositive:
231 case llvm::RoundingMode::TowardNegative:
234 case llvm::RoundingMode::NearestTiesToAway:
235 OS <<
"FE_TONEARESTFROMZERO";
237 case llvm::RoundingMode::Dynamic:
241 llvm_unreachable(
"Invalid rounding mode");
247void StmtPrinter::PrintRawDecl(
Decl *D) {
248 D->
print(OS, Policy, IndentLevel);
251void StmtPrinter::PrintRawDeclStmt(
const DeclStmt *S) {
257 Indent() <<
";" << NL;
262 PrintRawDeclStmt(
Node);
268 PrintRawCompoundStmt(
Node);
273 Indent(-1) <<
"case ";
274 PrintExpr(
Node->getLHS());
275 if (
Node->getRHS()) {
277 PrintExpr(
Node->getRHS());
281 PrintStmt(
Node->getSubStmt(), 0);
285 Indent(-1) <<
"default:" << NL;
286 PrintStmt(
Node->getSubStmt(), 0);
290 Indent(-1) <<
Node->getName() <<
":" << NL;
291 PrintStmt(
Node->getSubStmt(), 0);
296 for (
const auto *
Attr : Attrs) {
298 if (
Attr != Attrs.back())
302 PrintStmt(
Node->getSubStmt(), 0);
305void StmtPrinter::PrintRawIfStmt(
IfStmt *
If) {
306 if (
If->isConsteval()) {
308 if (
If->isNegatedConsteval())
312 PrintStmt(
If->getThen());
313 if (
Stmt *Else =
If->getElse()) {
324 PrintInitStmt(
If->getInit(), 4);
325 if (
const DeclStmt *DS =
If->getConditionVariableDeclStmt())
326 PrintRawDeclStmt(DS);
328 PrintExpr(
If->getCond());
331 if (
auto *CS = dyn_cast<CompoundStmt>(
If->getThen())) {
333 PrintRawCompoundStmt(CS);
334 OS << (
If->getElse() ?
" " : NL);
337 PrintStmt(
If->getThen());
338 if (
If->getElse()) Indent();
341 if (
Stmt *Else =
If->getElse()) {
344 if (
auto *CS = dyn_cast<CompoundStmt>(Else)) {
346 PrintRawCompoundStmt(CS);
348 }
else if (
auto *ElseIf = dyn_cast<IfStmt>(Else)) {
350 PrintRawIfStmt(ElseIf);
353 PrintStmt(
If->getElse());
358void StmtPrinter::VisitIfStmt(
IfStmt *
If) {
364 Indent() <<
"switch (";
366 PrintInitStmt(
Node->getInit(), 8);
367 if (
const DeclStmt *DS =
Node->getConditionVariableDeclStmt())
368 PrintRawDeclStmt(DS);
370 PrintExpr(
Node->getCond());
372 PrintControlledStmt(
Node->getBody());
376 Indent() <<
"while (";
377 if (
const DeclStmt *DS =
Node->getConditionVariableDeclStmt())
378 PrintRawDeclStmt(DS);
380 PrintExpr(
Node->getCond());
382 PrintStmt(
Node->getBody());
387 if (
auto *CS = dyn_cast<CompoundStmt>(
Node->getBody())) {
388 PrintRawCompoundStmt(CS);
392 PrintStmt(
Node->getBody());
397 PrintExpr(
Node->getCond());
404 PrintInitStmt(
Node->getInit(), 5);
406 OS << (
Node->getCond() ?
"; " :
";");
407 if (
const DeclStmt *DS =
Node->getConditionVariableDeclStmt())
408 PrintRawDeclStmt(DS);
409 else if (
Node->getCond())
410 PrintExpr(
Node->getCond());
412 if (
Node->getInc()) {
414 PrintExpr(
Node->getInc());
417 PrintControlledStmt(
Node->getBody());
422 if (
auto *DS = dyn_cast<DeclStmt>(
Node->getElement()))
423 PrintRawDeclStmt(DS);
425 PrintExpr(cast<Expr>(
Node->getElement()));
427 PrintExpr(
Node->getCollection());
429 PrintControlledStmt(
Node->getBody());
435 PrintInitStmt(
Node->getInit(), 5);
437 SubPolicy.SuppressInitializers =
true;
438 Node->getLoopVariable()->
print(OS, SubPolicy, IndentLevel);
440 PrintExpr(
Node->getRangeInit());
442 PrintControlledStmt(
Node->getBody());
447 if (
Node->isIfExists())
448 OS <<
"__if_exists (";
450 OS <<
"__if_not_exists (";
453 =
Node->getQualifierLoc().getNestedNameSpecifier())
456 OS <<
Node->getNameInfo() <<
") ";
458 PrintRawCompoundStmt(
Node->getSubStmt());
462 Indent() <<
"goto " <<
Node->getLabel()->getName() <<
";";
467 Indent() <<
"goto *";
468 PrintExpr(
Node->getTarget());
474 Indent() <<
"continue;";
479 Indent() <<
"break;";
484 Indent() <<
"return";
485 if (
Node->getRetValue()) {
487 PrintExpr(
Node->getRetValue());
496 if (
Node->isVolatile())
499 if (
Node->isAsmGoto())
503 VisitStringLiteral(
Node->getAsmString());
506 if (
Node->getNumOutputs() != 0 ||
Node->getNumInputs() != 0 ||
507 Node->getNumClobbers() != 0 ||
Node->getNumLabels() != 0)
510 for (
unsigned i = 0, e =
Node->getNumOutputs(); i != e; ++i) {
514 if (!
Node->getOutputName(i).empty()) {
516 OS <<
Node->getOutputName(i);
520 VisitStringLiteral(
Node->getOutputConstraintLiteral(i));
522 Visit(
Node->getOutputExpr(i));
527 if (
Node->getNumInputs() != 0 ||
Node->getNumClobbers() != 0 ||
528 Node->getNumLabels() != 0)
531 for (
unsigned i = 0, e =
Node->getNumInputs(); i != e; ++i) {
535 if (!
Node->getInputName(i).empty()) {
537 OS <<
Node->getInputName(i);
541 VisitStringLiteral(
Node->getInputConstraintLiteral(i));
543 Visit(
Node->getInputExpr(i));
548 if (
Node->getNumClobbers() != 0 ||
Node->getNumLabels())
551 for (
unsigned i = 0, e =
Node->getNumClobbers(); i != e; ++i) {
555 VisitStringLiteral(
Node->getClobberStringLiteral(i));
559 if (
Node->getNumLabels() != 0)
562 for (
unsigned i = 0, e =
Node->getNumLabels(); i != e; ++i) {
565 OS <<
Node->getLabelName(i);
574 Indent() <<
"__asm ";
575 if (
Node->hasBraces())
577 OS <<
Node->getAsmString() << NL;
578 if (
Node->hasBraces())
579 Indent() <<
"}" << NL;
583 PrintStmt(
Node->getCapturedDecl()->getBody());
588 if (
auto *TS = dyn_cast<CompoundStmt>(
Node->getTryBody())) {
589 PrintRawCompoundStmt(TS);
594 Indent() <<
"@catch(";
595 if (
Decl *DS = catchStmt->getCatchParamDecl())
598 if (
auto *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
599 PrintRawCompoundStmt(CS);
605 Indent() <<
"@finally";
606 if (
auto *CS = dyn_cast<CompoundStmt>(FS->getFinallyBody())) {
607 PrintRawCompoundStmt(CS);
617 Indent() <<
"@catch (...) { /* todo */ } " << NL;
621 Indent() <<
"@throw";
622 if (
Node->getThrowExpr()) {
624 PrintExpr(
Node->getThrowExpr());
629void StmtPrinter::VisitObjCAvailabilityCheckExpr(
631 OS <<
"@available(...)";
635 Indent() <<
"@synchronized (";
636 PrintExpr(
Node->getSynchExpr());
638 PrintRawCompoundStmt(
Node->getSynchBody());
643 Indent() <<
"@autoreleasepool";
644 PrintRawCompoundStmt(cast<CompoundStmt>(
Node->getSubStmt()));
650 if (
Decl *ExDecl =
Node->getExceptionDecl())
651 PrintRawDecl(ExDecl);
655 PrintRawCompoundStmt(cast<CompoundStmt>(
Node->getHandlerBlock()));
660 PrintRawCXXCatchStmt(
Node);
666 PrintRawCompoundStmt(
Node->getTryBlock());
667 for (
unsigned i = 0, e =
Node->getNumHandlers(); i < e; ++i) {
669 PrintRawCXXCatchStmt(
Node->getHandler(i));
675 Indent() << (
Node->getIsCXXTry() ?
"try " :
"__try ");
676 PrintRawCompoundStmt(
Node->getTryBlock());
680 PrintRawSEHExceptHandler(E);
682 assert(F &&
"Must have a finally block...");
683 PrintRawSEHFinallyStmt(F);
690 PrintRawCompoundStmt(
Node->getBlock());
696 VisitExpr(
Node->getFilterExpr());
698 PrintRawCompoundStmt(
Node->getBlock());
704 PrintRawSEHExceptHandler(
Node);
710 PrintRawSEHFinallyStmt(
Node);
715 Indent() <<
"__leave;";
724 PrintStmt(
Node->getLoopStmt());
731 for (
auto *Clause : Clauses)
732 if (Clause && !Clause->isImplicit()) {
734 Printer.Visit(Clause);
737 if (!ForceNoStmt && S->hasAssociatedStmt())
738 PrintStmt(S->getRawStmt());
742 Indent() <<
"#pragma omp metadirective";
743 PrintOMPExecutableDirective(
Node);
747 Indent() <<
"#pragma omp parallel";
748 PrintOMPExecutableDirective(
Node);
752 Indent() <<
"#pragma omp simd";
753 PrintOMPExecutableDirective(
Node);
757 Indent() <<
"#pragma omp tile";
758 PrintOMPExecutableDirective(
Node);
762 Indent() <<
"#pragma omp unroll";
763 PrintOMPExecutableDirective(
Node);
767 Indent() <<
"#pragma omp for";
768 PrintOMPExecutableDirective(
Node);
772 Indent() <<
"#pragma omp for simd";
773 PrintOMPExecutableDirective(
Node);
777 Indent() <<
"#pragma omp sections";
778 PrintOMPExecutableDirective(
Node);
782 Indent() <<
"#pragma omp section";
783 PrintOMPExecutableDirective(
Node);
787 Indent() <<
"#pragma omp scope";
788 PrintOMPExecutableDirective(
Node);
792 Indent() <<
"#pragma omp single";
793 PrintOMPExecutableDirective(
Node);
797 Indent() <<
"#pragma omp master";
798 PrintOMPExecutableDirective(
Node);
802 Indent() <<
"#pragma omp critical";
803 if (
Node->getDirectiveName().getName()) {
805 Node->getDirectiveName().printName(OS, Policy);
808 PrintOMPExecutableDirective(
Node);
812 Indent() <<
"#pragma omp parallel for";
813 PrintOMPExecutableDirective(
Node);
816void StmtPrinter::VisitOMPParallelForSimdDirective(
818 Indent() <<
"#pragma omp parallel for simd";
819 PrintOMPExecutableDirective(
Node);
822void StmtPrinter::VisitOMPParallelMasterDirective(
824 Indent() <<
"#pragma omp parallel master";
825 PrintOMPExecutableDirective(
Node);
828void StmtPrinter::VisitOMPParallelMaskedDirective(
830 Indent() <<
"#pragma omp parallel masked";
831 PrintOMPExecutableDirective(
Node);
834void StmtPrinter::VisitOMPParallelSectionsDirective(
836 Indent() <<
"#pragma omp parallel sections";
837 PrintOMPExecutableDirective(
Node);
841 Indent() <<
"#pragma omp task";
842 PrintOMPExecutableDirective(
Node);
846 Indent() <<
"#pragma omp taskyield";
847 PrintOMPExecutableDirective(
Node);
851 Indent() <<
"#pragma omp barrier";
852 PrintOMPExecutableDirective(
Node);
856 Indent() <<
"#pragma omp taskwait";
857 PrintOMPExecutableDirective(
Node);
861 Indent() <<
"#pragma omp error";
862 PrintOMPExecutableDirective(
Node);
866 Indent() <<
"#pragma omp taskgroup";
867 PrintOMPExecutableDirective(
Node);
871 Indent() <<
"#pragma omp flush";
872 PrintOMPExecutableDirective(
Node);
876 Indent() <<
"#pragma omp depobj";
877 PrintOMPExecutableDirective(
Node);
881 Indent() <<
"#pragma omp scan";
882 PrintOMPExecutableDirective(
Node);
886 Indent() <<
"#pragma omp ordered";
891 Indent() <<
"#pragma omp atomic";
892 PrintOMPExecutableDirective(
Node);
896 Indent() <<
"#pragma omp target";
897 PrintOMPExecutableDirective(
Node);
901 Indent() <<
"#pragma omp target data";
902 PrintOMPExecutableDirective(
Node);
905void StmtPrinter::VisitOMPTargetEnterDataDirective(
907 Indent() <<
"#pragma omp target enter data";
908 PrintOMPExecutableDirective(
Node,
true);
911void StmtPrinter::VisitOMPTargetExitDataDirective(
913 Indent() <<
"#pragma omp target exit data";
914 PrintOMPExecutableDirective(
Node,
true);
917void StmtPrinter::VisitOMPTargetParallelDirective(
919 Indent() <<
"#pragma omp target parallel";
920 PrintOMPExecutableDirective(
Node);
923void StmtPrinter::VisitOMPTargetParallelForDirective(
925 Indent() <<
"#pragma omp target parallel for";
926 PrintOMPExecutableDirective(
Node);
930 Indent() <<
"#pragma omp teams";
931 PrintOMPExecutableDirective(
Node);
934void StmtPrinter::VisitOMPCancellationPointDirective(
936 Indent() <<
"#pragma omp cancellation point "
937 << getOpenMPDirectiveName(
Node->getCancelRegion());
938 PrintOMPExecutableDirective(
Node);
942 Indent() <<
"#pragma omp cancel "
943 << getOpenMPDirectiveName(
Node->getCancelRegion());
944 PrintOMPExecutableDirective(
Node);
948 Indent() <<
"#pragma omp taskloop";
949 PrintOMPExecutableDirective(
Node);
952void StmtPrinter::VisitOMPTaskLoopSimdDirective(
954 Indent() <<
"#pragma omp taskloop simd";
955 PrintOMPExecutableDirective(
Node);
958void StmtPrinter::VisitOMPMasterTaskLoopDirective(
960 Indent() <<
"#pragma omp master taskloop";
961 PrintOMPExecutableDirective(
Node);
964void StmtPrinter::VisitOMPMaskedTaskLoopDirective(
966 Indent() <<
"#pragma omp masked taskloop";
967 PrintOMPExecutableDirective(
Node);
970void StmtPrinter::VisitOMPMasterTaskLoopSimdDirective(
972 Indent() <<
"#pragma omp master taskloop simd";
973 PrintOMPExecutableDirective(
Node);
976void StmtPrinter::VisitOMPMaskedTaskLoopSimdDirective(
978 Indent() <<
"#pragma omp masked taskloop simd";
979 PrintOMPExecutableDirective(
Node);
982void StmtPrinter::VisitOMPParallelMasterTaskLoopDirective(
984 Indent() <<
"#pragma omp parallel master taskloop";
985 PrintOMPExecutableDirective(
Node);
988void StmtPrinter::VisitOMPParallelMaskedTaskLoopDirective(
990 Indent() <<
"#pragma omp parallel masked taskloop";
991 PrintOMPExecutableDirective(
Node);
994void StmtPrinter::VisitOMPParallelMasterTaskLoopSimdDirective(
996 Indent() <<
"#pragma omp parallel master taskloop simd";
997 PrintOMPExecutableDirective(
Node);
1000void StmtPrinter::VisitOMPParallelMaskedTaskLoopSimdDirective(
1002 Indent() <<
"#pragma omp parallel masked taskloop simd";
1003 PrintOMPExecutableDirective(
Node);
1007 Indent() <<
"#pragma omp distribute";
1008 PrintOMPExecutableDirective(
Node);
1011void StmtPrinter::VisitOMPTargetUpdateDirective(
1013 Indent() <<
"#pragma omp target update";
1014 PrintOMPExecutableDirective(
Node,
true);
1017void StmtPrinter::VisitOMPDistributeParallelForDirective(
1019 Indent() <<
"#pragma omp distribute parallel for";
1020 PrintOMPExecutableDirective(
Node);
1023void StmtPrinter::VisitOMPDistributeParallelForSimdDirective(
1025 Indent() <<
"#pragma omp distribute parallel for simd";
1026 PrintOMPExecutableDirective(
Node);
1029void StmtPrinter::VisitOMPDistributeSimdDirective(
1031 Indent() <<
"#pragma omp distribute simd";
1032 PrintOMPExecutableDirective(
Node);
1035void StmtPrinter::VisitOMPTargetParallelForSimdDirective(
1037 Indent() <<
"#pragma omp target parallel for simd";
1038 PrintOMPExecutableDirective(
Node);
1042 Indent() <<
"#pragma omp target simd";
1043 PrintOMPExecutableDirective(
Node);
1046void StmtPrinter::VisitOMPTeamsDistributeDirective(
1048 Indent() <<
"#pragma omp teams distribute";
1049 PrintOMPExecutableDirective(
Node);
1052void StmtPrinter::VisitOMPTeamsDistributeSimdDirective(
1054 Indent() <<
"#pragma omp teams distribute simd";
1055 PrintOMPExecutableDirective(
Node);
1058void StmtPrinter::VisitOMPTeamsDistributeParallelForSimdDirective(
1060 Indent() <<
"#pragma omp teams distribute parallel for simd";
1061 PrintOMPExecutableDirective(
Node);
1064void StmtPrinter::VisitOMPTeamsDistributeParallelForDirective(
1066 Indent() <<
"#pragma omp teams distribute parallel for";
1067 PrintOMPExecutableDirective(
Node);
1071 Indent() <<
"#pragma omp target teams";
1072 PrintOMPExecutableDirective(
Node);
1075void StmtPrinter::VisitOMPTargetTeamsDistributeDirective(
1077 Indent() <<
"#pragma omp target teams distribute";
1078 PrintOMPExecutableDirective(
Node);
1081void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective(
1083 Indent() <<
"#pragma omp target teams distribute parallel for";
1084 PrintOMPExecutableDirective(
Node);
1087void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1089 Indent() <<
"#pragma omp target teams distribute parallel for simd";
1090 PrintOMPExecutableDirective(
Node);
1093void StmtPrinter::VisitOMPTargetTeamsDistributeSimdDirective(
1095 Indent() <<
"#pragma omp target teams distribute simd";
1096 PrintOMPExecutableDirective(
Node);
1100 Indent() <<
"#pragma omp interop";
1101 PrintOMPExecutableDirective(
Node);
1105 Indent() <<
"#pragma omp dispatch";
1106 PrintOMPExecutableDirective(
Node);
1110 Indent() <<
"#pragma omp masked";
1111 PrintOMPExecutableDirective(
Node);
1115 Indent() <<
"#pragma omp loop";
1116 PrintOMPExecutableDirective(
Node);
1119void StmtPrinter::VisitOMPTeamsGenericLoopDirective(
1121 Indent() <<
"#pragma omp teams loop";
1122 PrintOMPExecutableDirective(
Node);
1125void StmtPrinter::VisitOMPTargetTeamsGenericLoopDirective(
1127 Indent() <<
"#pragma omp target teams loop";
1128 PrintOMPExecutableDirective(
Node);
1131void StmtPrinter::VisitOMPParallelGenericLoopDirective(
1133 Indent() <<
"#pragma omp parallel loop";
1134 PrintOMPExecutableDirective(
Node);
1137void StmtPrinter::VisitOMPTargetParallelGenericLoopDirective(
1139 Indent() <<
"#pragma omp target parallel loop";
1140 PrintOMPExecutableDirective(
Node);
1147 Indent() <<
"#pragma acc " << S->getDirectiveKind();
1149 if (!S->clauses().empty()) {
1152 Printer.VisitClauseList(S->clauses());
1156 PrintStmt(S->getStructuredBlock());
1164 OS <<
Node->getBuiltinStr() <<
"()";
1168 PrintExpr(
Node->getSubExpr());
1172 if (
const auto *OCED = dyn_cast<OMPCapturedExprDecl>(
Node->getDecl())) {
1173 OCED->getInit()->IgnoreImpCasts()->printPretty(OS,
nullptr, Policy);
1176 if (
const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(
Node->getDecl())) {
1177 TPOD->printAsExpr(OS, Policy);
1182 if (
Node->hasTemplateKeyword())
1185 isa<ParmVarDecl, NonTypeTemplateParmDecl>(
Node->getDecl()) &&
1186 Node->getDecl()->getIdentifier())
1187 OS <<
Node->getDecl()->getIdentifier()->deuglifiedName();
1189 Node->getNameInfo().printName(OS, Policy);
1190 if (
Node->hasExplicitTemplateArgs()) {
1192 if (!
Node->hadMultipleCandidates())
1193 if (
auto *TD = dyn_cast<TemplateDecl>(
Node->getDecl()))
1194 TPL = TD->getTemplateParameters();
1199void StmtPrinter::VisitDependentScopeDeclRefExpr(
1203 if (
Node->hasTemplateKeyword())
1205 OS <<
Node->getNameInfo();
1206 if (
Node->hasExplicitTemplateArgs())
1211 if (
Node->getQualifier())
1212 Node->getQualifier()->
print(OS, Policy);
1213 if (
Node->hasTemplateKeyword())
1215 OS <<
Node->getNameInfo();
1216 if (
Node->hasExplicitTemplateArgs())
1221 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
1222 if (
const auto *PD = dyn_cast<ImplicitParamDecl>(DRE->getDecl())) {
1223 if (PD->getParameterKind() == ImplicitParamKind::ObjCSelf &&
1224 DRE->getBeginLoc().isInvalid())
1232 if (
Node->getBase()) {
1235 PrintExpr(
Node->getBase());
1236 OS << (
Node->isArrow() ?
"->" :
".");
1239 OS << *
Node->getDecl();
1243 if (
Node->isSuperReceiver())
1245 else if (
Node->isObjectReceiver() &&
Node->getBase()) {
1246 PrintExpr(
Node->getBase());
1248 }
else if (
Node->isClassReceiver() &&
Node->getClassReceiver()) {
1249 OS <<
Node->getClassReceiver()->getName() <<
".";
1252 if (
Node->isImplicitProperty()) {
1253 if (
const auto *Getter =
Node->getImplicitPropertyGetter())
1254 Getter->getSelector().
print(OS);
1257 Node->getImplicitPropertySetter()->getSelector());
1259 OS <<
Node->getExplicitProperty()->getName();
1263 PrintExpr(
Node->getBaseExpr());
1265 PrintExpr(
Node->getKeyExpr());
1269void StmtPrinter::VisitSYCLUniqueStableNameExpr(
1271 OS <<
"__builtin_sycl_unique_stable_name(";
1272 Node->getTypeSourceInfo()->getType().
print(OS, Policy);
1304 bool isSigned =
Node->getType()->isSignedIntegerType();
1307 if (isa<BitIntType>(
Node->getType())) {
1308 OS << (isSigned ?
"wb" :
"uwb");
1314 default: llvm_unreachable(
"Unexpected type for integer literal!");
1315 case BuiltinType::Char_S:
1316 case BuiltinType::Char_U: OS <<
"i8";
break;
1317 case BuiltinType::UChar: OS <<
"Ui8";
break;
1318 case BuiltinType::SChar: OS <<
"i8";
break;
1319 case BuiltinType::Short: OS <<
"i16";
break;
1320 case BuiltinType::UShort: OS <<
"Ui16";
break;
1321 case BuiltinType::Int:
break;
1322 case BuiltinType::UInt: OS <<
'U';
break;
1323 case BuiltinType::Long: OS <<
'L';
break;
1324 case BuiltinType::ULong: OS <<
"UL";
break;
1325 case BuiltinType::LongLong: OS <<
"LL";
break;
1326 case BuiltinType::ULongLong: OS <<
"ULL";
break;
1327 case BuiltinType::Int128:
1329 case BuiltinType::UInt128:
1331 case BuiltinType::WChar_S:
1332 case BuiltinType::WChar_U:
1340 OS <<
Node->getValueAsString(10);
1343 default: llvm_unreachable(
"Unexpected type for fixed point literal!");
1344 case BuiltinType::ShortFract: OS <<
"hr";
break;
1345 case BuiltinType::ShortAccum: OS <<
"hk";
break;
1346 case BuiltinType::UShortFract: OS <<
"uhr";
break;
1347 case BuiltinType::UShortAccum: OS <<
"uhk";
break;
1348 case BuiltinType::Fract: OS <<
"r";
break;
1349 case BuiltinType::Accum: OS <<
"k";
break;
1350 case BuiltinType::UFract: OS <<
"ur";
break;
1351 case BuiltinType::UAccum: OS <<
"uk";
break;
1352 case BuiltinType::LongFract: OS <<
"lr";
break;
1353 case BuiltinType::LongAccum: OS <<
"lk";
break;
1354 case BuiltinType::ULongFract: OS <<
"ulr";
break;
1355 case BuiltinType::ULongAccum: OS <<
"ulk";
break;
1362 Node->getValue().toString(Str);
1364 if (Str.find_first_not_of(
"-0123456789") == StringRef::npos)
1372 default: llvm_unreachable(
"Unexpected type for float literal!");
1373 case BuiltinType::Half:
break;
1374 case BuiltinType::Ibm128:
break;
1375 case BuiltinType::Double:
break;
1376 case BuiltinType::Float16: OS <<
"F16";
break;
1377 case BuiltinType::Float: OS <<
'F';
break;
1378 case BuiltinType::LongDouble: OS <<
'L';
break;
1379 case BuiltinType::Float128: OS <<
'Q';
break;
1390 PrintExpr(
Node->getSubExpr());
1400 PrintExpr(
Node->getSubExpr());
1405 if (!
Node->isPostfix()) {
1410 switch (
Node->getOpcode()) {
1419 if (isa<UnaryOperator>(
Node->getSubExpr()))
1424 PrintExpr(
Node->getSubExpr());
1426 if (
Node->isPostfix())
1431 OS <<
"__builtin_offsetof(";
1432 Node->getTypeSourceInfo()->getType().
print(OS, Policy);
1434 bool PrintedSomething =
false;
1435 for (
unsigned i = 0, n =
Node->getNumComponents(); i < n; ++i) {
1442 PrintedSomething =
true;
1455 if (PrintedSomething)
1458 PrintedSomething =
true;
1459 OS <<
Id->getName();
1464void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(
1467 if (
Node->getKind() == UETT_AlignOf) {
1469 Spelling =
"alignof";
1471 Spelling =
"_Alignof";
1473 Spelling =
"__alignof";
1478 if (
Node->isArgumentType()) {
1480 Node->getArgumentType().
print(OS, Policy);
1484 PrintExpr(
Node->getArgumentExpr());
1490 if (
Node->isExprPredicate())
1491 PrintExpr(
Node->getControllingExpr());
1493 Node->getControllingType()->getType().
print(OS, Policy);
1501 T.print(OS, Policy);
1503 PrintExpr(Assoc.getAssociationExpr());
1509 PrintExpr(
Node->getLHS());
1511 PrintExpr(
Node->getRHS());
1516 PrintExpr(
Node->getBase());
1518 PrintExpr(
Node->getRowIdx());
1521 PrintExpr(
Node->getColumnIdx());
1526 PrintExpr(
Node->getBase());
1528 if (
Node->getLowerBound())
1529 PrintExpr(
Node->getLowerBound());
1530 if (
Node->getColonLocFirst().isValid()) {
1532 if (
Node->getLength())
1533 PrintExpr(
Node->getLength());
1535 if (
Node->isOMPArraySection() &&
Node->getColonLocSecond().isValid()) {
1537 if (
Node->getStride())
1538 PrintExpr(
Node->getStride());
1545 for (
Expr *E :
Node->getDimensions()) {
1551 PrintExpr(
Node->getBase());
1556 for (
unsigned I = 0, E =
Node->numOfIterators(); I < E; ++I) {
1557 auto *VD = cast<ValueDecl>(
Node->getIteratorDecl(I));
1558 VD->getType().print(OS, Policy);
1560 OS <<
" " << VD->getName() <<
" = ";
1561 PrintExpr(
Range.Begin);
1563 PrintExpr(
Range.End);
1566 PrintExpr(
Range.Step);
1575 for (
unsigned i = 0, e =
Call->getNumArgs(); i != e; ++i) {
1576 if (isa<CXXDefaultArgExpr>(
Call->getArg(i))) {
1582 PrintExpr(
Call->getArg(i));
1587 PrintExpr(
Call->getCallee());
1589 PrintCallArgs(
Call);
1594 if (
const auto *TE = dyn_cast<CXXThisExpr>(E))
1595 return TE->isImplicit();
1601 PrintExpr(
Node->getBase());
1603 auto *ParentMember = dyn_cast<MemberExpr>(
Node->getBase());
1605 ParentMember ? dyn_cast<FieldDecl>(ParentMember->getMemberDecl())
1609 OS << (
Node->isArrow() ?
"->" :
".");
1612 if (
auto *FD = dyn_cast<FieldDecl>(
Node->getMemberDecl()))
1613 if (FD->isAnonymousStructOrUnion())
1618 if (
Node->hasTemplateKeyword())
1620 OS <<
Node->getMemberNameInfo();
1622 if (
auto *FD = dyn_cast<FunctionDecl>(
Node->getMemberDecl())) {
1623 if (!
Node->hadMultipleCandidates())
1624 if (
auto *FTD = FD->getPrimaryTemplate())
1625 TPL = FTD->getTemplateParameters();
1626 }
else if (
auto *VTSD =
1627 dyn_cast<VarTemplateSpecializationDecl>(
Node->getMemberDecl()))
1628 TPL = VTSD->getSpecializedTemplate()->getTemplateParameters();
1629 if (
Node->hasExplicitTemplateArgs())
1634 PrintExpr(
Node->getBase());
1635 OS << (
Node->isArrow() ?
"->isa" :
".isa");
1639 PrintExpr(
Node->getBase());
1641 OS <<
Node->getAccessor().getName();
1646 Node->getTypeAsWritten().
print(OS, Policy);
1648 PrintExpr(
Node->getSubExpr());
1655 PrintExpr(
Node->getInitializer());
1660 PrintExpr(
Node->getSubExpr());
1664 PrintExpr(
Node->getLHS());
1666 PrintExpr(
Node->getRHS());
1670 PrintExpr(
Node->getLHS());
1672 PrintExpr(
Node->getRHS());
1676 PrintExpr(
Node->getCond());
1678 PrintExpr(
Node->getLHS());
1680 PrintExpr(
Node->getRHS());
1687 PrintExpr(
Node->getCommon());
1689 PrintExpr(
Node->getFalseExpr());
1693 OS <<
"&&" <<
Node->getLabel()->getName();
1696void StmtPrinter::VisitStmtExpr(
StmtExpr *E) {
1703 OS <<
"__builtin_choose_expr(";
1704 PrintExpr(
Node->getCond());
1706 PrintExpr(
Node->getLHS());
1708 PrintExpr(
Node->getRHS());
1712void StmtPrinter::VisitGNUNullExpr(
GNUNullExpr *) {
1717 OS <<
"__builtin_shufflevector(";
1718 for (
unsigned i = 0, e =
Node->getNumSubExprs(); i != e; ++i) {
1720 PrintExpr(
Node->getExpr(i));
1726 OS <<
"__builtin_convertvector(";
1727 PrintExpr(
Node->getSrcExpr());
1734 if (
Node->getSyntacticForm()) {
1735 Visit(
Node->getSyntacticForm());
1740 for (
unsigned i = 0, e =
Node->getNumInits(); i != e; ++i) {
1742 if (
Node->getInit(i))
1743 PrintExpr(
Node->getInit(i));
1754 PrintExpr(
Node->getSubExpr());
1764 for (
unsigned i = 0, e =
Node->getNumExprs(); i != e; ++i) {
1766 PrintExpr(
Node->getExpr(i));
1772 bool NeedsEquals =
true;
1774 if (D.isFieldDesignator()) {
1775 if (D.getDotLoc().isInvalid()) {
1777 OS << II->getName() <<
":";
1778 NeedsEquals =
false;
1781 OS <<
"." << D.getFieldName()->getName();
1785 if (D.isArrayDesignator()) {
1786 PrintExpr(
Node->getArrayIndex(D));
1788 PrintExpr(
Node->getArrayRangeStart(D));
1790 PrintExpr(
Node->getArrayRangeEnd(D));
1800 PrintExpr(
Node->getInit());
1803void StmtPrinter::VisitDesignatedInitUpdateExpr(
1807 PrintExpr(
Node->getBase());
1810 OS <<
"/*updater*/";
1811 PrintExpr(
Node->getUpdater());
1816 OS <<
"/*no init*/";
1820 if (
Node->getType()->getAsCXXRecordDecl()) {
1821 OS <<
"/*implicit*/";
1825 OS <<
"/*implicit*/(";
1828 if (
Node->getType()->isRecordType())
1836 OS <<
"__builtin_va_arg(";
1837 PrintExpr(
Node->getSubExpr());
1844 PrintExpr(
Node->getSyntacticForm());
1848 const char *Name =
nullptr;
1849 switch (
Node->getOp()) {
1850#define BUILTIN(ID, TYPE, ATTRS)
1851#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1852 case AtomicExpr::AO ## ID: \
1855#include "clang/Basic/Builtins.inc"
1860 PrintExpr(
Node->getPtr());
1861 if (
Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1862 Node->getOp() != AtomicExpr::AO__atomic_load_n &&
1863 Node->getOp() != AtomicExpr::AO__scoped_atomic_load_n &&
1864 Node->getOp() != AtomicExpr::AO__opencl_atomic_load &&
1865 Node->getOp() != AtomicExpr::AO__hip_atomic_load) {
1867 PrintExpr(
Node->getVal1());
1869 if (
Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1870 Node->isCmpXChg()) {
1872 PrintExpr(
Node->getVal2());
1874 if (
Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1875 Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1877 PrintExpr(
Node->getWeak());
1879 if (
Node->getOp() != AtomicExpr::AO__c11_atomic_init &&
1880 Node->getOp() != AtomicExpr::AO__opencl_atomic_init) {
1882 PrintExpr(
Node->getOrder());
1884 if (
Node->isCmpXChg()) {
1886 PrintExpr(
Node->getOrderFail());
1894 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1895 if (
Node->getNumArgs() == 1) {
1897 PrintExpr(
Node->getArg(0));
1899 PrintExpr(
Node->getArg(0));
1902 }
else if (Kind == OO_Arrow) {
1903 PrintExpr(
Node->getArg(0));
1904 }
else if (Kind == OO_Call || Kind == OO_Subscript) {
1905 PrintExpr(
Node->getArg(0));
1906 OS << (
Kind == OO_Call ?
'(' :
'[');
1907 for (
unsigned ArgIdx = 1; ArgIdx <
Node->getNumArgs(); ++ArgIdx) {
1910 if (!isa<CXXDefaultArgExpr>(
Node->getArg(ArgIdx)))
1911 PrintExpr(
Node->getArg(ArgIdx));
1913 OS << (
Kind == OO_Call ?
')' :
']');
1914 }
else if (
Node->getNumArgs() == 1) {
1916 PrintExpr(
Node->getArg(0));
1917 }
else if (
Node->getNumArgs() == 2) {
1918 PrintExpr(
Node->getArg(0));
1920 PrintExpr(
Node->getArg(1));
1922 llvm_unreachable(
"unknown overloaded operator");
1929 if (MD && isa<CXXConversionDecl>(MD)) {
1930 PrintExpr(
Node->getImplicitObjectArgument());
1933 VisitCallExpr(cast<CallExpr>(
Node));
1937 PrintExpr(
Node->getCallee());
1939 PrintCallArgs(
Node->getConfig());
1941 PrintCallArgs(
Node);
1945void StmtPrinter::VisitCXXRewrittenBinaryOperator(
1948 Node->getDecomposedForm();
1949 PrintExpr(
const_cast<Expr*
>(Decomposed.
LHS));
1951 PrintExpr(
const_cast<Expr*
>(Decomposed.
RHS));
1955 OS <<
Node->getCastName() <<
'<';
1956 Node->getTypeAsWritten().
print(OS, Policy);
1958 PrintExpr(
Node->getSubExpr());
1963 VisitCXXNamedCastExpr(
Node);
1967 VisitCXXNamedCastExpr(
Node);
1971 VisitCXXNamedCastExpr(
Node);
1975 VisitCXXNamedCastExpr(
Node);
1979 OS <<
"__builtin_bit_cast(";
1980 Node->getTypeInfoAsWritten()->getType().
print(OS, Policy);
1982 PrintExpr(
Node->getSubExpr());
1987 VisitCXXNamedCastExpr(
Node);
1992 if (
Node->isTypeOperand()) {
1993 Node->getTypeOperandSourceInfo()->getType().
print(OS, Policy);
1995 PrintExpr(
Node->getExprOperand());
2002 if (
Node->isTypeOperand()) {
2003 Node->getTypeOperandSourceInfo()->getType().
print(OS, Policy);
2005 PrintExpr(
Node->getExprOperand());
2011 PrintExpr(
Node->getBaseExpr());
2012 if (
Node->isArrow())
2017 Node->getQualifierLoc().getNestedNameSpecifier())
2019 OS <<
Node->getPropertyDecl()->getDeclName();
2023 PrintExpr(
Node->getBase());
2025 PrintExpr(
Node->getIdx());
2030 switch (
Node->getLiteralOperatorKind()) {
2032 OS << cast<StringLiteral>(
Node->getArg(0)->IgnoreImpCasts())->getString();
2035 const auto *DRE = cast<DeclRefExpr>(
Node->getCallee()->IgnoreImpCasts());
2037 cast<FunctionDecl>(DRE->getDecl())->getTemplateSpecializationArgs();
2042 if (!DRE->hadMultipleCandidates())
2043 if (
const auto *TD = dyn_cast<TemplateDecl>(DRE->getDecl()))
2044 TPL = TD->getTemplateParameters();
2045 OS <<
"operator\"\"" <<
Node->getUDSuffix()->getName();
2053 char C = (char)
P.getAsIntegral().getZExtValue();
2060 const auto *
Int = cast<IntegerLiteral>(
Node->getCookedLiteral());
2066 auto *
Float = cast<FloatingLiteral>(
Node->getCookedLiteral());
2072 PrintExpr(
Node->getCookedLiteral());
2075 OS <<
Node->getUDSuffix()->getName();
2079 OS << (
Node->getValue() ?
"true" :
"false");
2091 if (!
Node->getSubExpr())
2095 PrintExpr(
Node->getSubExpr());
2108 auto TargetType =
Node->getType();
2109 auto *
Auto = TargetType->getContainedDeducedType();
2110 bool Bare =
Auto &&
Auto->isDeduced();
2115 TargetType.print(OS, Policy);
2120 if (!
Node->isListInitialization())
2122 PrintExpr(
Node->getSubExpr());
2123 if (!
Node->isListInitialization())
2128 PrintExpr(
Node->getSubExpr());
2133 if (
Node->isStdInitListInitialization())
2135 else if (
Node->isListInitialization())
2140 ArgEnd =
Node->arg_end();
2141 Arg != ArgEnd; ++Arg) {
2142 if ((*Arg)->isDefaultArgument())
2144 if (Arg !=
Node->arg_begin())
2148 if (
Node->isStdInitListInitialization())
2150 else if (
Node->isListInitialization())
2158 bool NeedComma =
false;
2159 switch (
Node->getCaptureDefault()) {
2174 CEnd =
Node->explicit_capture_end();
2177 if (
C->capturesVLAType())
2184 switch (
C->getCaptureKind()) {
2196 OS <<
C->getCapturedVar()->getName();
2200 OS <<
C->getCapturedVar()->getName();
2204 llvm_unreachable(
"VLA type in explicit captures.");
2207 if (
C->isPackExpansion())
2210 if (
Node->isInitCapture(
C)) {
2212 auto *D = cast<VarDecl>(
C->getCapturedVar());
2214 llvm::StringRef
Pre;
2215 llvm::StringRef
Post;
2217 !isa<ParenListExpr>(D->getInit())) {
2225 PrintExpr(D->getInit());
2231 if (!
Node->getExplicitTemplateParameters().empty()) {
2232 Node->getTemplateParameterList()->
print(
2233 OS,
Node->getLambdaClass()->getASTContext(),
2237 if (
Node->hasExplicitParameters()) {
2247 std::string ParamStr =
2249 ?
P->getIdentifier()->deuglifiedName().str()
2250 :
P->getNameAsString();
2251 P->getOriginalType().print(OS, Policy, ParamStr);
2260 if (
Node->isMutable())
2269 if (
Node->hasExplicitResultType()) {
2271 Proto->getReturnType().print(OS, Policy);
2280 PrintRawCompoundStmt(
Node->getCompoundStmtBody());
2285 TSInfo->getType().print(OS, Policy);
2291void StmtPrinter::VisitCXXNewExpr(
CXXNewExpr *E) {
2299 for (
unsigned i = 1; i < NumPlace; ++i) {
2311 llvm::raw_string_ostream
s(TypeS);
2314 (*Size)->printPretty(
s, Helper, Policy);
2322 if (InitStyle != CXXNewInitializationStyle::None) {
2323 bool Bare = InitStyle == CXXNewInitializationStyle::Parens &&
2353 OS << II->getName();
2362 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
2363 if (isa<CXXDefaultArgExpr>(E->
getArg(i))) {
2378 OS <<
"<forwarded>";
2390void StmtPrinter::VisitCXXUnresolvedConstructExpr(
2392 Node->getTypeAsWritten().
print(OS, Policy);
2393 if (!
Node->isListInitialization())
2395 for (
auto Arg =
Node->arg_begin(), ArgEnd =
Node->arg_end(); Arg != ArgEnd;
2397 if (Arg !=
Node->arg_begin())
2401 if (!
Node->isListInitialization())
2405void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2407 if (!
Node->isImplicitAccess()) {
2408 PrintExpr(
Node->getBase());
2409 OS << (
Node->isArrow() ?
"->" :
".");
2413 if (
Node->hasTemplateKeyword())
2415 OS <<
Node->getMemberNameInfo();
2416 if (
Node->hasExplicitTemplateArgs())
2421 if (!
Node->isImplicitAccess()) {
2422 PrintExpr(
Node->getBase());
2423 OS << (
Node->isArrow() ?
"->" :
".");
2427 if (
Node->hasTemplateKeyword())
2429 OS <<
Node->getMemberNameInfo();
2430 if (
Node->hasExplicitTemplateArgs())
2436 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++I) {
2468 OS <<
"sizeof...(" << *E->
getPack() <<
")";
2475void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2477 OS << *
Node->getParameterPack();
2480void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2482 Visit(
Node->getReplacement());
2490 PrintExpr(
Node->getSubExpr());
2493void StmtPrinter::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2509 llvm::interleaveComma(
Node->getInitExprs(), OS,
2510 [&](
Expr *E) { PrintExpr(E); });
2529 if (!LocalParameters.empty()) {
2532 PrintRawDecl(LocalParam);
2533 if (LocalParam != LocalParameters.back())
2542 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
2543 if (TypeReq->isSubstitutionFailure())
2544 OS <<
"<<error-type>>";
2546 TypeReq->getType()->getType().print(OS, Policy);
2547 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
2548 if (ExprReq->isCompound())
2550 if (ExprReq->isExprSubstitutionFailure())
2551 OS <<
"<<error-expression>>";
2553 PrintExpr(ExprReq->getExpr());
2554 if (ExprReq->isCompound()) {
2556 if (ExprReq->getNoexceptLoc().isValid())
2558 const auto &RetReq = ExprReq->getReturnTypeRequirement();
2559 if (!RetReq.isEmpty()) {
2561 if (RetReq.isSubstitutionFailure())
2562 OS <<
"<<error-type>>";
2563 else if (RetReq.isTypeConstraint())
2564 RetReq.getTypeConstraint()->print(OS, Policy);
2568 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
2570 if (NestedReq->hasInvalidConstraint())
2571 OS <<
"<<error-expression>>";
2573 PrintExpr(NestedReq->getConstraintExpr());
2583 Visit(S->getBody());
2588 if (S->getOperand()) {
2590 Visit(S->getOperand());
2595void StmtPrinter::VisitCoawaitExpr(
CoawaitExpr *S) {
2597 PrintExpr(S->getOperand());
2602 PrintExpr(S->getOperand());
2605void StmtPrinter::VisitCoyieldExpr(
CoyieldExpr *S) {
2607 PrintExpr(S->getOperand());
2614 VisitStringLiteral(
Node->getString());
2625 for (
auto I = Ch.begin(), E = Ch.end(); I != E; ++I) {
2626 if (I != Ch.begin())
2642 Visit(Element.Value);
2643 if (Element.isPackExpansion())
2651 Node->getEncodedType().
print(OS, Policy);
2662 OS <<
"@protocol(" << *
Node->getProtocol() <<
')';
2687 for (
unsigned i = 0, e = Mess->
getNumArgs(); i != e; ++i) {
2689 if (i > 0) OS <<
' ';
2697 PrintExpr(Mess->
getArg(i));
2704 OS << (
Node->getValue() ?
"__objc_yes" :
"__objc_no");
2726 if (isa<FunctionNoProtoType>(AFT)) {
2728 }
else if (!BD->
param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2733 std::string ParamStr = (*AI)->getNameAsString();
2734 (*AI)->getType().print(OS, Policy, ParamStr);
2737 const auto *FT = cast<FunctionProtoType>(AFT);
2738 if (FT->isVariadic()) {
2748 PrintExpr(
Node->getSourceExpr());
2753 llvm_unreachable(
"Cannot print TypoExpr nodes");
2757 OS <<
"<recovery-expr>(";
2758 const char *Sep =
"";
2759 for (
Expr *E :
Node->subExpressions()) {
2768 OS <<
"__builtin_astype(";
2769 PrintExpr(
Node->getSrcExpr());
2785 StringRef NL,
const ASTContext *Context)
const {
2786 StmtPrinter
P(Out, Helper, Policy, Indentation, NL, Context);
2787 P.Visit(
const_cast<Stmt *
>(
this));
2792 unsigned Indentation, StringRef NL,
2794 StmtPrinter
P(Out, Helper, Policy, Indentation, NL, Context);
2795 P.PrintControlledStmt(
const_cast<Stmt *
>(
this));
2801 llvm::raw_string_ostream TempOut(Buf);
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines enumerations for expression traits intrinsics.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
This file defines OpenMP AST classes for clauses.
Defines some OpenMP-specific enums and functions.
Defines an enumeration for C++ overloaded operators.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Defines the clang::SourceLocation class and associated facilities.
Defines the Objective-C statement AST node classes.
This file defines OpenMP AST classes for executable directives and clauses.
static bool isImplicitThis(const Expr *E)
static bool isImplicitSelf(const Expr *E)
static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, bool PrintSuffix)
static bool printExprAsWritten(raw_ostream &OS, Expr *E, const ASTContext *Context)
Prints the given expression using the original source text.
Defines enumerations for the type traits support.
C Language Family Type Representation.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
const LangOptions & getLangOpts() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
Represents a loop initializing the elements of an array.
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.
ArrayTypeTrait getTrait() const
QualType getQueriedType() const
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
StringRef getOpcodeStr() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
param_iterator param_end()
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
param_iterator param_begin()
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BreakStmt - This represents a break.
Represents a C++2a __builtin_bit_cast(T, v) expression.
This class is used for builtin types like 'int'.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Represents a call to a CUDA kernel function.
A C++ addrspace_cast expression (currently only enabled for OpenCL).
Represents binding an expression to a temporary.
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
A C++ const_cast expression (C++ [expr.const.cast]).
Represents a call to a C++ constructor.
Expr * getArg(unsigned Arg)
Return the specified argument.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
bool isGlobalDelete() const
Represents a C++ member access expression where the actual member referenced could not be resolved be...
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a folding of a pack over an operator.
BinaryOperatorKind getOperator() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr....
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Abstract class common to all of the C++ "named"/"keyword" casts.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
QualType getAllocatedType() const
std::optional< Expr * > getArraySize()
This might return std::nullopt even if isArray() returns true, since there might not be an array size...
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Expr * getPlacementArg(unsigned I)
unsigned getNumPlacementArgs() const
bool isParenTypeId() const
Expr * getInitializer()
The initializer of this new-expression.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Expr * getOperand() const
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
Represents a list-initialization with parenthesis.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
QualType getDestroyedType() const
Retrieve the type being destroyed.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
const IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
A C++ static_cast expression (C++ [expr.static.cast]).
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
Represents a C++ functional cast expression that builds a temporary object.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
This captures a statement into a function.
CaseStmt - Represent a case statement.
static CharSourceRange getTokenRange(SourceRange R)
static void print(unsigned val, CharacterLiteralKind Kind, raw_ostream &OS)
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Represents a 'co_await' expression.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents the specialization of a concept - evaluates to a prvalue of type bool.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
SourceLocation getTemplateKWLoc() const
ConceptDecl * getNamedConcept() const
ConditionalOperator - The ?: ternary operator.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ContinueStmt - This represents a continue.
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents a 'co_yield' expression.
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
Represents a 'co_await' expression while the type of the promise is dependent.
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a single C99 designator.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const
Prints the node to the given output stream.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
An expression trait intrinsic.
Expr * getQueriedExpression() const
ExpressionTrait getTrait() const
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
bool isAnonymousStructOrUnion() const
Determines whether this field is a representative for an anonymous struct or union.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
const Expr * getSubExpr() const
ArrayRef< ParmVarDecl * > parameters() const
bool isVariadic() const
Whether this function is variadic.
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
VarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Represents a prototype with parameter type info, e.g.
void printExceptionSpecification(raw_ostream &OS, const PrintingPolicy &Policy) const
FunctionType - C99 6.7.5.3 - Function Declarators.
This represents a GCC inline-assembly statement extension.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Represents a C11 generic selection.
AssociationTy< false > Association
GotoStmt - This represents a direct goto.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
IfStmt - This represents an if/then/else.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Represents an implicitly-generated value initialization of an object of a given type.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
LabelStmt - Represents a label, which has a substatement.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
llvm::RoundingMode RoundingMode
FPExceptionModeKind
Possible floating point exception behavior.
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
This represents a Microsoft inline-assembly statement extension.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
A member reference to an MSPropertyDecl.
MS property subscript expression.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
Represents a place-holder for an object not to be initialized by anything.
NullStmt - This is the null statement ";": C99 6.8.3p3.
An explicit cast in C or a C-style cast in C++, which uses the syntax ([s1][s2]......
This represents '#pragma omp atomic' directive.
This represents '#pragma omp barrier' directive.
This represents '#pragma omp cancel' directive.
This represents '#pragma omp cancellation point' directive.
Representation of an OpenMP canonical loop.
This represents '#pragma omp critical' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
This represents '#pragma omp depobj' directive.
This represents '#pragma omp dispatch' directive.
This represents '#pragma omp distribute' directive.
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
This represents '#pragma omp distribute simd' composite directive.
This represents '#pragma omp error' directive.
This is a basic class for representing single OpenMP executable directive.
This represents '#pragma omp flush' directive.
This represents '#pragma omp for' directive.
This represents '#pragma omp for simd' directive.
This represents '#pragma omp loop' directive.
This represents '#pragma omp interop' directive.
OpenMP 5.0 [2.1.6 Iterators] Iterators are identifiers that expand to multiple values in the clause o...
This represents '#pragma omp masked' directive.
This represents '#pragma omp masked taskloop' directive.
This represents '#pragma omp masked taskloop simd' directive.
This represents '#pragma omp master' directive.
This represents '#pragma omp master taskloop' directive.
This represents '#pragma omp master taskloop simd' directive.
This represents '#pragma omp ordered' directive.
This represents '#pragma omp parallel' directive.
This represents '#pragma omp parallel for' directive.
This represents '#pragma omp parallel for simd' directive.
This represents '#pragma omp parallel loop' directive.
This represents '#pragma omp parallel masked' directive.
This represents '#pragma omp parallel masked taskloop' directive.
This represents '#pragma omp parallel masked taskloop simd' directive.
This represents '#pragma omp parallel master' directive.
This represents '#pragma omp parallel master taskloop' directive.
This represents '#pragma omp parallel master taskloop simd' directive.
This represents '#pragma omp parallel sections' directive.
This represents '#pragma omp scan' directive.
This represents '#pragma omp scope' directive.
This represents '#pragma omp section' directive.
This represents '#pragma omp sections' directive.
This represents '#pragma omp simd' directive.
This represents '#pragma omp single' directive.
This represents '#pragma omp target data' directive.
This represents '#pragma omp target' directive.
This represents '#pragma omp target enter data' directive.
This represents '#pragma omp target exit data' directive.
This represents '#pragma omp target parallel' directive.
This represents '#pragma omp target parallel for' directive.
This represents '#pragma omp target parallel for simd' directive.
This represents '#pragma omp target parallel loop' directive.
This represents '#pragma omp target simd' directive.
This represents '#pragma omp target teams' directive.
This represents '#pragma omp target teams distribute' combined directive.
This represents '#pragma omp target teams distribute parallel for' combined directive.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
This represents '#pragma omp target teams distribute simd' combined directive.
This represents '#pragma omp target teams loop' directive.
This represents '#pragma omp target update' directive.
This represents '#pragma omp task' directive.
This represents '#pragma omp taskloop' directive.
This represents '#pragma omp taskloop simd' directive.
This represents '#pragma omp taskgroup' directive.
This represents '#pragma omp taskwait' directive.
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp teams' directive.
This represents '#pragma omp teams distribute' directive.
This represents '#pragma omp teams distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
This represents '#pragma omp teams distribute simd' combined directive.
This represents '#pragma omp teams loop' directive.
This represents the '#pragma omp tile' loop transformation directive.
This represents the '#pragma omp unroll' loop transformation directive.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Selector getSelector() const
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
Helper class for OffsetOfExpr.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
@ Array
An index into an array.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Kind getKind() const
Determine what kind of offsetof node this is.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Represents a C++11 pack expansion that produces a sequence of expressions.
Expr * getPattern()
Retrieve the pattern of the pack expansion.
Expr * getIndexExpr() const
Expr * getPackIdExpression() const
ParenExpr - This represents a parethesized expression, e.g.
Represents a parameter to a function.
[C99 6.4.2.2] - A predefined identifier such as func.
StringRef getIdentKindName() const
virtual bool handledStmt(Stmt *E, raw_ostream &OS)=0
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Frontend produces RecoveryExprs on semantic errors that prevent creating other well-formed expression...
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ArrayRef< concepts::Requirement * > getRequirements() const
ArrayRef< ParmVarDecl * > getLocalParameters() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Represents a __leave statement.
static std::string getPropertyNameFromSetterSelector(Selector Sel)
Return the property name for the given setter selector.
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
bool isUnarySelector() const
unsigned getNumArgs() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents an expression that computes the length of a parameter pack.
NamedDecl * getPack() const
Retrieve the parameter pack.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
bool isValid() const
Return true if this is a valid SourceLocation object.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
CompoundStmt * getSubStmt()
RetTy Visit(PTR(Stmt) S, ParamTys... P)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
void printJson(raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
Pretty-prints in JSON format.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
void printPrettyControlled(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
llvm::iterator_range< child_iterator > child_range
void dumpPretty(const ASTContext &Context) const
dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source...
StringLiteral - This represents a string literal expression, e.g.
void outputString(raw_ostream &OS) const
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
SwitchStmt - This represents a 'switch' stmt.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Represents a template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Pack
The template argument is actually a parameter pack.
ArgKind getKind() const
Return the kind of stored template argument.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
TypeTrait getTrait() const
Determine which type trait this expression uses.
const T * castAs() const
Member-template castAs<specific type>.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit....
@ LOK_String
operator "" X (const CharT *, size_t)
@ LOK_Raw
Raw form: operator "" X (const char *)
@ LOK_Floating
operator "" X (long double)
@ LOK_Integer
operator "" X (unsigned long long)
@ LOK_Template
Raw form: operator "" X<cs...> ()
@ LOK_Character
operator "" X (CharT)
Represents a call to the builtin function __builtin_va_arg.
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
WhileStmt - This represents a 'while' stmt.
A static requirement that can be used in a requires-expression to check properties of types and expre...
The JSON file list parser is used to communicate input to InstallAPI.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_VLAType
Capturing variable-length array type.
@ LCK_StarThis
Capturing the *this object by copy.
@ LCK_This
Capturing the *this object by reference.
std::string JsonFormat(StringRef RawSR, bool AddQuotes)
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
CXXNewInitializationStyle
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Iterator range representation begin:end[:step].
An element in an Objective-C dictionary literal.
Describes how types, statements, expressions, and declarations should be printed.
unsigned Alignof
Whether we can use 'alignof' rather than '__alignof'.
unsigned CleanUglifiedParameters
Whether to strip underscores when printing reserved parameter names.
unsigned ConstantsAsWritten
Whether we should print the constant expressions as written in the sources.
unsigned IncludeNewlines
When true, include newlines after statements like "break", etc.
unsigned Indentation
The number of spaces to use to indent each line.
unsigned TerseOutput
Provide a 'terse' output.
unsigned UnderscoreAlignof
Whether we can use '_Alignof' rather than '__alignof'.
unsigned SuppressImplicitBase
When true, don't print the implicit 'self' or 'this' expressions.
Iterator for iterating over Stmt * arrays that contain only T *.