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);
125 void PrintRawIfStmt(
IfStmt *If);
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"
179 PrintFPPragmas(
Node);
180 for (
auto *I :
Node->body())
187 if (!S->hasStoredFPFeatures())
190 bool FEnvAccess =
false;
191 if (FPO.hasAllowFEnvAccessOverride()) {
192 FEnvAccess = FPO.getAllowFEnvAccessOverride();
193 Indent() <<
"#pragma STDC FENV_ACCESS " << (FEnvAccess ?
"ON" :
"OFF")
196 if (FPO.hasSpecifiedExceptionModeOverride()) {
198 FPO.getSpecifiedExceptionModeOverride();
200 Indent() <<
"#pragma clang fp exceptions(";
201 switch (FPO.getSpecifiedExceptionModeOverride()) {
217 if (FPO.hasConstRoundingModeOverride()) {
219 Indent() <<
"#pragma STDC FENV_ROUND ";
221 case llvm::RoundingMode::TowardZero:
222 OS <<
"FE_TOWARDZERO";
224 case llvm::RoundingMode::NearestTiesToEven:
225 OS <<
"FE_TONEAREST";
227 case llvm::RoundingMode::TowardPositive:
230 case llvm::RoundingMode::TowardNegative:
233 case llvm::RoundingMode::NearestTiesToAway:
234 OS <<
"FE_TONEARESTFROMZERO";
236 case llvm::RoundingMode::Dynamic:
240 llvm_unreachable(
"Invalid rounding mode");
246void StmtPrinter::PrintRawDecl(
Decl *D) {
247 D->
print(OS, Policy, IndentLevel);
250void StmtPrinter::PrintRawDeclStmt(
const DeclStmt *S) {
256 Indent() <<
";" << NL;
261 PrintRawDeclStmt(
Node);
267 PrintRawCompoundStmt(
Node);
272 Indent(-1) <<
"case ";
273 PrintExpr(
Node->getLHS());
274 if (
Node->getRHS()) {
276 PrintExpr(
Node->getRHS());
280 PrintStmt(
Node->getSubStmt(), 0);
284 Indent(-1) <<
"default:" << NL;
285 PrintStmt(
Node->getSubStmt(), 0);
289 Indent(-1) <<
Node->getName() <<
":" << NL;
290 PrintStmt(
Node->getSubStmt(), 0);
294 for (
const auto *
Attr :
Node->getAttrs()) {
298 PrintStmt(
Node->getSubStmt(), 0);
301void StmtPrinter::PrintRawIfStmt(
IfStmt *If) {
320 PrintInitStmt(If->
getInit(), 4);
322 PrintRawDeclStmt(DS);
327 if (
auto *CS = dyn_cast<CompoundStmt>(If->
getThen())) {
329 PrintRawCompoundStmt(CS);
330 OS << (If->
getElse() ?
" " : NL);
340 if (
auto *CS = dyn_cast<CompoundStmt>(Else)) {
342 PrintRawCompoundStmt(CS);
344 }
else if (
auto *ElseIf = dyn_cast<IfStmt>(Else)) {
346 PrintRawIfStmt(ElseIf);
354void StmtPrinter::VisitIfStmt(
IfStmt *If) {
360 Indent() <<
"switch (";
362 PrintInitStmt(
Node->getInit(), 8);
363 if (
const DeclStmt *DS =
Node->getConditionVariableDeclStmt())
364 PrintRawDeclStmt(DS);
366 PrintExpr(
Node->getCond());
368 PrintControlledStmt(
Node->getBody());
372 Indent() <<
"while (";
373 if (
const DeclStmt *DS =
Node->getConditionVariableDeclStmt())
374 PrintRawDeclStmt(DS);
376 PrintExpr(
Node->getCond());
378 PrintStmt(
Node->getBody());
383 if (
auto *CS = dyn_cast<CompoundStmt>(
Node->getBody())) {
384 PrintRawCompoundStmt(CS);
388 PrintStmt(
Node->getBody());
393 PrintExpr(
Node->getCond());
400 PrintInitStmt(
Node->getInit(), 5);
402 OS << (
Node->getCond() ?
"; " :
";");
404 PrintExpr(
Node->getCond());
406 if (
Node->getInc()) {
408 PrintExpr(
Node->getInc());
411 PrintControlledStmt(
Node->getBody());
416 if (
auto *DS = dyn_cast<DeclStmt>(
Node->getElement()))
417 PrintRawDeclStmt(DS);
419 PrintExpr(cast<Expr>(
Node->getElement()));
421 PrintExpr(
Node->getCollection());
423 PrintControlledStmt(
Node->getBody());
429 PrintInitStmt(
Node->getInit(), 5);
431 SubPolicy.SuppressInitializers =
true;
432 Node->getLoopVariable()->
print(OS, SubPolicy, IndentLevel);
434 PrintExpr(
Node->getRangeInit());
436 PrintControlledStmt(
Node->getBody());
441 if (
Node->isIfExists())
442 OS <<
"__if_exists (";
444 OS <<
"__if_not_exists (";
447 =
Node->getQualifierLoc().getNestedNameSpecifier())
450 OS <<
Node->getNameInfo() <<
") ";
452 PrintRawCompoundStmt(
Node->getSubStmt());
456 Indent() <<
"goto " <<
Node->getLabel()->getName() <<
";";
461 Indent() <<
"goto *";
462 PrintExpr(
Node->getTarget());
468 Indent() <<
"continue;";
473 Indent() <<
"break;";
478 Indent() <<
"return";
479 if (
Node->getRetValue()) {
481 PrintExpr(
Node->getRetValue());
490 if (
Node->isVolatile())
493 if (
Node->isAsmGoto())
497 VisitStringLiteral(
Node->getAsmString());
500 if (
Node->getNumOutputs() != 0 ||
Node->getNumInputs() != 0 ||
501 Node->getNumClobbers() != 0 ||
Node->getNumLabels() != 0)
504 for (
unsigned i = 0, e =
Node->getNumOutputs(); i != e; ++i) {
508 if (!
Node->getOutputName(i).empty()) {
510 OS <<
Node->getOutputName(i);
514 VisitStringLiteral(
Node->getOutputConstraintLiteral(i));
516 Visit(
Node->getOutputExpr(i));
521 if (
Node->getNumInputs() != 0 ||
Node->getNumClobbers() != 0 ||
522 Node->getNumLabels() != 0)
525 for (
unsigned i = 0, e =
Node->getNumInputs(); i != e; ++i) {
529 if (!
Node->getInputName(i).empty()) {
531 OS <<
Node->getInputName(i);
535 VisitStringLiteral(
Node->getInputConstraintLiteral(i));
537 Visit(
Node->getInputExpr(i));
542 if (
Node->getNumClobbers() != 0 ||
Node->getNumLabels())
545 for (
unsigned i = 0, e =
Node->getNumClobbers(); i != e; ++i) {
549 VisitStringLiteral(
Node->getClobberStringLiteral(i));
553 if (
Node->getNumLabels() != 0)
556 for (
unsigned i = 0, e =
Node->getNumLabels(); i != e; ++i) {
559 OS <<
Node->getLabelName(i);
568 Indent() <<
"__asm ";
569 if (
Node->hasBraces())
571 OS <<
Node->getAsmString() << NL;
572 if (
Node->hasBraces())
573 Indent() <<
"}" << NL;
577 PrintStmt(
Node->getCapturedDecl()->getBody());
582 if (
auto *TS = dyn_cast<CompoundStmt>(
Node->getTryBody())) {
583 PrintRawCompoundStmt(TS);
588 Indent() <<
"@catch(";
589 if (
Decl *DS = catchStmt->getCatchParamDecl())
592 if (
auto *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
593 PrintRawCompoundStmt(CS);
599 Indent() <<
"@finally";
600 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
609 Indent() <<
"@catch (...) { /* todo */ } " << NL;
613 Indent() <<
"@throw";
614 if (
Node->getThrowExpr()) {
616 PrintExpr(
Node->getThrowExpr());
621void StmtPrinter::VisitObjCAvailabilityCheckExpr(
623 OS <<
"@available(...)";
627 Indent() <<
"@synchronized (";
628 PrintExpr(
Node->getSynchExpr());
630 PrintRawCompoundStmt(
Node->getSynchBody());
635 Indent() <<
"@autoreleasepool";
636 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(
Node->getSubStmt()));
642 if (
Decl *ExDecl =
Node->getExceptionDecl())
643 PrintRawDecl(ExDecl);
647 PrintRawCompoundStmt(cast<CompoundStmt>(
Node->getHandlerBlock()));
652 PrintRawCXXCatchStmt(
Node);
658 PrintRawCompoundStmt(
Node->getTryBlock());
659 for (
unsigned i = 0, e =
Node->getNumHandlers(); i < e; ++i) {
661 PrintRawCXXCatchStmt(
Node->getHandler(i));
667 Indent() << (
Node->getIsCXXTry() ?
"try " :
"__try ");
668 PrintRawCompoundStmt(
Node->getTryBlock());
672 PrintRawSEHExceptHandler(E);
674 assert(F &&
"Must have a finally block...");
675 PrintRawSEHFinallyStmt(F);
682 PrintRawCompoundStmt(
Node->getBlock());
688 VisitExpr(
Node->getFilterExpr());
690 PrintRawCompoundStmt(
Node->getBlock());
696 PrintRawSEHExceptHandler(
Node);
702 PrintRawSEHFinallyStmt(
Node);
707 Indent() <<
"__leave;";
716 PrintStmt(
Node->getLoopStmt());
723 for (
auto *Clause : Clauses)
724 if (Clause && !Clause->isImplicit()) {
726 Printer.Visit(Clause);
729 if (!ForceNoStmt && S->hasAssociatedStmt())
730 PrintStmt(S->getRawStmt());
734 Indent() <<
"#pragma omp metadirective";
735 PrintOMPExecutableDirective(
Node);
739 Indent() <<
"#pragma omp parallel";
740 PrintOMPExecutableDirective(
Node);
744 Indent() <<
"#pragma omp simd";
745 PrintOMPExecutableDirective(
Node);
749 Indent() <<
"#pragma omp tile";
750 PrintOMPExecutableDirective(
Node);
754 Indent() <<
"#pragma omp unroll";
755 PrintOMPExecutableDirective(
Node);
759 Indent() <<
"#pragma omp for";
760 PrintOMPExecutableDirective(
Node);
764 Indent() <<
"#pragma omp for simd";
765 PrintOMPExecutableDirective(
Node);
769 Indent() <<
"#pragma omp sections";
770 PrintOMPExecutableDirective(
Node);
774 Indent() <<
"#pragma omp section";
775 PrintOMPExecutableDirective(
Node);
779 Indent() <<
"#pragma omp single";
780 PrintOMPExecutableDirective(
Node);
784 Indent() <<
"#pragma omp master";
785 PrintOMPExecutableDirective(
Node);
789 Indent() <<
"#pragma omp critical";
790 if (
Node->getDirectiveName().getName()) {
792 Node->getDirectiveName().printName(OS, Policy);
795 PrintOMPExecutableDirective(
Node);
799 Indent() <<
"#pragma omp parallel for";
800 PrintOMPExecutableDirective(
Node);
803void StmtPrinter::VisitOMPParallelForSimdDirective(
805 Indent() <<
"#pragma omp parallel for simd";
806 PrintOMPExecutableDirective(
Node);
809void StmtPrinter::VisitOMPParallelMasterDirective(
811 Indent() <<
"#pragma omp parallel master";
812 PrintOMPExecutableDirective(
Node);
815void StmtPrinter::VisitOMPParallelMaskedDirective(
817 Indent() <<
"#pragma omp parallel masked";
818 PrintOMPExecutableDirective(
Node);
821void StmtPrinter::VisitOMPParallelSectionsDirective(
823 Indent() <<
"#pragma omp parallel sections";
824 PrintOMPExecutableDirective(
Node);
828 Indent() <<
"#pragma omp task";
829 PrintOMPExecutableDirective(
Node);
833 Indent() <<
"#pragma omp taskyield";
834 PrintOMPExecutableDirective(
Node);
838 Indent() <<
"#pragma omp barrier";
839 PrintOMPExecutableDirective(
Node);
843 Indent() <<
"#pragma omp taskwait";
844 PrintOMPExecutableDirective(
Node);
848 Indent() <<
"#pragma omp error";
849 PrintOMPExecutableDirective(
Node);
853 Indent() <<
"#pragma omp taskgroup";
854 PrintOMPExecutableDirective(
Node);
858 Indent() <<
"#pragma omp flush";
859 PrintOMPExecutableDirective(
Node);
863 Indent() <<
"#pragma omp depobj";
864 PrintOMPExecutableDirective(
Node);
868 Indent() <<
"#pragma omp scan";
869 PrintOMPExecutableDirective(
Node);
873 Indent() <<
"#pragma omp ordered";
878 Indent() <<
"#pragma omp atomic";
879 PrintOMPExecutableDirective(
Node);
883 Indent() <<
"#pragma omp target";
884 PrintOMPExecutableDirective(
Node);
888 Indent() <<
"#pragma omp target data";
889 PrintOMPExecutableDirective(
Node);
892void StmtPrinter::VisitOMPTargetEnterDataDirective(
894 Indent() <<
"#pragma omp target enter data";
895 PrintOMPExecutableDirective(
Node,
true);
898void StmtPrinter::VisitOMPTargetExitDataDirective(
900 Indent() <<
"#pragma omp target exit data";
901 PrintOMPExecutableDirective(
Node,
true);
904void StmtPrinter::VisitOMPTargetParallelDirective(
906 Indent() <<
"#pragma omp target parallel";
907 PrintOMPExecutableDirective(
Node);
910void StmtPrinter::VisitOMPTargetParallelForDirective(
912 Indent() <<
"#pragma omp target parallel for";
913 PrintOMPExecutableDirective(
Node);
917 Indent() <<
"#pragma omp teams";
918 PrintOMPExecutableDirective(
Node);
921void StmtPrinter::VisitOMPCancellationPointDirective(
923 Indent() <<
"#pragma omp cancellation point "
924 << getOpenMPDirectiveName(
Node->getCancelRegion());
925 PrintOMPExecutableDirective(
Node);
929 Indent() <<
"#pragma omp cancel "
930 << getOpenMPDirectiveName(
Node->getCancelRegion());
931 PrintOMPExecutableDirective(
Node);
935 Indent() <<
"#pragma omp taskloop";
936 PrintOMPExecutableDirective(
Node);
939void StmtPrinter::VisitOMPTaskLoopSimdDirective(
941 Indent() <<
"#pragma omp taskloop simd";
942 PrintOMPExecutableDirective(
Node);
945void StmtPrinter::VisitOMPMasterTaskLoopDirective(
947 Indent() <<
"#pragma omp master taskloop";
948 PrintOMPExecutableDirective(
Node);
951void StmtPrinter::VisitOMPMaskedTaskLoopDirective(
953 Indent() <<
"#pragma omp masked taskloop";
954 PrintOMPExecutableDirective(
Node);
957void StmtPrinter::VisitOMPMasterTaskLoopSimdDirective(
959 Indent() <<
"#pragma omp master taskloop simd";
960 PrintOMPExecutableDirective(
Node);
963void StmtPrinter::VisitOMPMaskedTaskLoopSimdDirective(
965 Indent() <<
"#pragma omp masked taskloop simd";
966 PrintOMPExecutableDirective(
Node);
969void StmtPrinter::VisitOMPParallelMasterTaskLoopDirective(
971 Indent() <<
"#pragma omp parallel master taskloop";
972 PrintOMPExecutableDirective(
Node);
975void StmtPrinter::VisitOMPParallelMaskedTaskLoopDirective(
977 Indent() <<
"#pragma omp parallel masked taskloop";
978 PrintOMPExecutableDirective(
Node);
981void StmtPrinter::VisitOMPParallelMasterTaskLoopSimdDirective(
983 Indent() <<
"#pragma omp parallel master taskloop simd";
984 PrintOMPExecutableDirective(
Node);
987void StmtPrinter::VisitOMPParallelMaskedTaskLoopSimdDirective(
989 Indent() <<
"#pragma omp parallel masked taskloop simd";
990 PrintOMPExecutableDirective(
Node);
994 Indent() <<
"#pragma omp distribute";
995 PrintOMPExecutableDirective(
Node);
998void StmtPrinter::VisitOMPTargetUpdateDirective(
1000 Indent() <<
"#pragma omp target update";
1001 PrintOMPExecutableDirective(
Node,
true);
1004void StmtPrinter::VisitOMPDistributeParallelForDirective(
1006 Indent() <<
"#pragma omp distribute parallel for";
1007 PrintOMPExecutableDirective(
Node);
1010void StmtPrinter::VisitOMPDistributeParallelForSimdDirective(
1012 Indent() <<
"#pragma omp distribute parallel for simd";
1013 PrintOMPExecutableDirective(
Node);
1016void StmtPrinter::VisitOMPDistributeSimdDirective(
1018 Indent() <<
"#pragma omp distribute simd";
1019 PrintOMPExecutableDirective(
Node);
1022void StmtPrinter::VisitOMPTargetParallelForSimdDirective(
1024 Indent() <<
"#pragma omp target parallel for simd";
1025 PrintOMPExecutableDirective(
Node);
1029 Indent() <<
"#pragma omp target simd";
1030 PrintOMPExecutableDirective(
Node);
1033void StmtPrinter::VisitOMPTeamsDistributeDirective(
1035 Indent() <<
"#pragma omp teams distribute";
1036 PrintOMPExecutableDirective(
Node);
1039void StmtPrinter::VisitOMPTeamsDistributeSimdDirective(
1041 Indent() <<
"#pragma omp teams distribute simd";
1042 PrintOMPExecutableDirective(
Node);
1045void StmtPrinter::VisitOMPTeamsDistributeParallelForSimdDirective(
1047 Indent() <<
"#pragma omp teams distribute parallel for simd";
1048 PrintOMPExecutableDirective(
Node);
1051void StmtPrinter::VisitOMPTeamsDistributeParallelForDirective(
1053 Indent() <<
"#pragma omp teams distribute parallel for";
1054 PrintOMPExecutableDirective(
Node);
1058 Indent() <<
"#pragma omp target teams";
1059 PrintOMPExecutableDirective(
Node);
1062void StmtPrinter::VisitOMPTargetTeamsDistributeDirective(
1064 Indent() <<
"#pragma omp target teams distribute";
1065 PrintOMPExecutableDirective(
Node);
1068void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective(
1070 Indent() <<
"#pragma omp target teams distribute parallel for";
1071 PrintOMPExecutableDirective(
Node);
1074void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1076 Indent() <<
"#pragma omp target teams distribute parallel for simd";
1077 PrintOMPExecutableDirective(
Node);
1080void StmtPrinter::VisitOMPTargetTeamsDistributeSimdDirective(
1082 Indent() <<
"#pragma omp target teams distribute simd";
1083 PrintOMPExecutableDirective(
Node);
1087 Indent() <<
"#pragma omp interop";
1088 PrintOMPExecutableDirective(
Node);
1092 Indent() <<
"#pragma omp dispatch";
1093 PrintOMPExecutableDirective(
Node);
1097 Indent() <<
"#pragma omp masked";
1098 PrintOMPExecutableDirective(
Node);
1102 Indent() <<
"#pragma omp loop";
1103 PrintOMPExecutableDirective(
Node);
1106void StmtPrinter::VisitOMPTeamsGenericLoopDirective(
1108 Indent() <<
"#pragma omp teams loop";
1109 PrintOMPExecutableDirective(
Node);
1112void StmtPrinter::VisitOMPTargetTeamsGenericLoopDirective(
1114 Indent() <<
"#pragma omp target teams loop";
1115 PrintOMPExecutableDirective(
Node);
1118void StmtPrinter::VisitOMPParallelGenericLoopDirective(
1120 Indent() <<
"#pragma omp parallel loop";
1121 PrintOMPExecutableDirective(
Node);
1124void StmtPrinter::VisitOMPTargetParallelGenericLoopDirective(
1126 Indent() <<
"#pragma omp target parallel loop";
1127 PrintOMPExecutableDirective(
Node);
1135 OS <<
Node->getBuiltinStr() <<
"()";
1139 PrintExpr(
Node->getSubExpr());
1143 if (
const auto *OCED = dyn_cast<OMPCapturedExprDecl>(
Node->getDecl())) {
1144 OCED->getInit()->IgnoreImpCasts()->printPretty(OS,
nullptr, Policy);
1147 if (
const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(
Node->getDecl())) {
1148 TPOD->printAsExpr(OS, Policy);
1153 if (
Node->hasTemplateKeyword())
1156 isa<ParmVarDecl, NonTypeTemplateParmDecl>(
Node->getDecl()) &&
1157 Node->getDecl()->getIdentifier())
1158 OS <<
Node->getDecl()->getIdentifier()->deuglifiedName();
1160 Node->getNameInfo().printName(OS, Policy);
1161 if (
Node->hasExplicitTemplateArgs()) {
1163 if (!
Node->hadMultipleCandidates())
1164 if (
auto *TD = dyn_cast<TemplateDecl>(
Node->getDecl()))
1165 TPL = TD->getTemplateParameters();
1170void StmtPrinter::VisitDependentScopeDeclRefExpr(
1174 if (
Node->hasTemplateKeyword())
1176 OS <<
Node->getNameInfo();
1177 if (
Node->hasExplicitTemplateArgs())
1182 if (
Node->getQualifier())
1183 Node->getQualifier()->
print(OS, Policy);
1184 if (
Node->hasTemplateKeyword())
1186 OS <<
Node->getNameInfo();
1187 if (
Node->hasExplicitTemplateArgs())
1192 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
1193 if (
const auto *PD = dyn_cast<ImplicitParamDecl>(DRE->getDecl())) {
1195 DRE->getBeginLoc().isInvalid())
1203 if (
Node->getBase()) {
1206 PrintExpr(
Node->getBase());
1207 OS << (
Node->isArrow() ?
"->" :
".");
1210 OS << *
Node->getDecl();
1214 if (
Node->isSuperReceiver())
1216 else if (
Node->isObjectReceiver() &&
Node->getBase()) {
1217 PrintExpr(
Node->getBase());
1219 }
else if (
Node->isClassReceiver() &&
Node->getClassReceiver()) {
1220 OS <<
Node->getClassReceiver()->getName() <<
".";
1223 if (
Node->isImplicitProperty()) {
1224 if (
const auto *Getter =
Node->getImplicitPropertyGetter())
1225 Getter->getSelector().
print(OS);
1228 Node->getImplicitPropertySetter()->getSelector());
1230 OS <<
Node->getExplicitProperty()->getName();
1234 PrintExpr(
Node->getBaseExpr());
1236 PrintExpr(
Node->getKeyExpr());
1240void StmtPrinter::VisitSYCLUniqueStableNameExpr(
1242 OS <<
"__builtin_sycl_unique_stable_name(";
1243 Node->getTypeSourceInfo()->getType().
print(OS, Policy);
1275 bool isSigned =
Node->getType()->isSignedIntegerType();
1278 if (isa<BitIntType>(
Node->getType())) {
1279 OS << (isSigned ?
"wb" :
"uwb");
1285 default: llvm_unreachable(
"Unexpected type for integer literal!");
1286 case BuiltinType::Char_S:
1287 case BuiltinType::Char_U: OS <<
"i8";
break;
1288 case BuiltinType::UChar: OS <<
"Ui8";
break;
1289 case BuiltinType::SChar: OS <<
"i8";
break;
1290 case BuiltinType::Short: OS <<
"i16";
break;
1291 case BuiltinType::UShort: OS <<
"Ui16";
break;
1292 case BuiltinType::Int:
break;
1293 case BuiltinType::UInt: OS <<
'U';
break;
1294 case BuiltinType::Long: OS <<
'L';
break;
1295 case BuiltinType::ULong: OS <<
"UL";
break;
1296 case BuiltinType::LongLong: OS <<
"LL";
break;
1297 case BuiltinType::ULongLong: OS <<
"ULL";
break;
1298 case BuiltinType::Int128:
1300 case BuiltinType::UInt128:
1302 case BuiltinType::WChar_S:
1303 case BuiltinType::WChar_U:
1311 OS <<
Node->getValueAsString(10);
1314 default: llvm_unreachable(
"Unexpected type for fixed point literal!");
1315 case BuiltinType::ShortFract: OS <<
"hr";
break;
1316 case BuiltinType::ShortAccum: OS <<
"hk";
break;
1317 case BuiltinType::UShortFract: OS <<
"uhr";
break;
1318 case BuiltinType::UShortAccum: OS <<
"uhk";
break;
1319 case BuiltinType::Fract: OS <<
"r";
break;
1320 case BuiltinType::Accum: OS <<
"k";
break;
1321 case BuiltinType::UFract: OS <<
"ur";
break;
1322 case BuiltinType::UAccum: OS <<
"uk";
break;
1323 case BuiltinType::LongFract: OS <<
"lr";
break;
1324 case BuiltinType::LongAccum: OS <<
"lk";
break;
1325 case BuiltinType::ULongFract: OS <<
"ulr";
break;
1326 case BuiltinType::ULongAccum: OS <<
"ulk";
break;
1333 Node->getValue().toString(Str);
1335 if (Str.find_first_not_of(
"-0123456789") == StringRef::npos)
1343 default: llvm_unreachable(
"Unexpected type for float literal!");
1344 case BuiltinType::Half:
break;
1345 case BuiltinType::Ibm128:
break;
1346 case BuiltinType::Double:
break;
1347 case BuiltinType::Float16: OS <<
"F16";
break;
1348 case BuiltinType::Float: OS <<
'F';
break;
1349 case BuiltinType::LongDouble: OS <<
'L';
break;
1350 case BuiltinType::Float128: OS <<
'Q';
break;
1361 PrintExpr(
Node->getSubExpr());
1371 PrintExpr(
Node->getSubExpr());
1376 if (!
Node->isPostfix()) {
1381 switch (
Node->getOpcode()) {
1390 if (isa<UnaryOperator>(
Node->getSubExpr()))
1395 PrintExpr(
Node->getSubExpr());
1397 if (
Node->isPostfix())
1402 OS <<
"__builtin_offsetof(";
1403 Node->getTypeSourceInfo()->getType().
print(OS, Policy);
1405 bool PrintedSomething =
false;
1406 for (
unsigned i = 0, n =
Node->getNumComponents(); i < n; ++i) {
1413 PrintedSomething =
true;
1426 if (PrintedSomething)
1429 PrintedSomething =
true;
1430 OS <<
Id->getName();
1435void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(
1438 if (
Node->getKind() == UETT_AlignOf) {
1440 Spelling =
"alignof";
1442 Spelling =
"_Alignof";
1444 Spelling =
"__alignof";
1449 if (
Node->isArgumentType()) {
1451 Node->getArgumentType().
print(OS, Policy);
1455 PrintExpr(
Node->getArgumentExpr());
1461 PrintExpr(
Node->getControllingExpr());
1468 T.
print(OS, Policy);
1470 PrintExpr(Assoc.getAssociationExpr());
1476 PrintExpr(
Node->getLHS());
1478 PrintExpr(
Node->getRHS());
1483 PrintExpr(
Node->getBase());
1485 PrintExpr(
Node->getRowIdx());
1488 PrintExpr(
Node->getColumnIdx());
1493 PrintExpr(
Node->getBase());
1495 if (
Node->getLowerBound())
1496 PrintExpr(
Node->getLowerBound());
1497 if (
Node->getColonLocFirst().isValid()) {
1499 if (
Node->getLength())
1500 PrintExpr(
Node->getLength());
1502 if (
Node->getColonLocSecond().isValid()) {
1504 if (
Node->getStride())
1505 PrintExpr(
Node->getStride());
1512 for (
Expr *E :
Node->getDimensions()) {
1518 PrintExpr(
Node->getBase());
1523 for (
unsigned I = 0, E =
Node->numOfIterators(); I < E; ++I) {
1524 auto *VD = cast<ValueDecl>(
Node->getIteratorDecl(I));
1525 VD->getType().print(OS, Policy);
1527 OS <<
" " << VD->getName() <<
" = ";
1528 PrintExpr(
Range.Begin);
1530 PrintExpr(
Range.End);
1533 PrintExpr(
Range.Step);
1541void StmtPrinter::PrintCallArgs(
CallExpr *Call) {
1542 for (
unsigned i = 0, e =
Call->getNumArgs(); i != e; ++i) {
1543 if (isa<CXXDefaultArgExpr>(
Call->getArg(i))) {
1549 PrintExpr(
Call->getArg(i));
1553void StmtPrinter::VisitCallExpr(
CallExpr *Call) {
1554 PrintExpr(
Call->getCallee());
1556 PrintCallArgs(Call);
1561 if (
const auto *TE = dyn_cast<CXXThisExpr>(E))
1562 return TE->isImplicit();
1568 PrintExpr(
Node->getBase());
1570 auto *ParentMember = dyn_cast<MemberExpr>(
Node->getBase());
1572 ParentMember ? dyn_cast<FieldDecl>(ParentMember->getMemberDecl())
1576 OS << (
Node->isArrow() ?
"->" :
".");
1579 if (
auto *FD = dyn_cast<FieldDecl>(
Node->getMemberDecl()))
1580 if (FD->isAnonymousStructOrUnion())
1585 if (
Node->hasTemplateKeyword())
1587 OS <<
Node->getMemberNameInfo();
1589 if (
auto *FD = dyn_cast<FunctionDecl>(
Node->getMemberDecl())) {
1590 if (!
Node->hadMultipleCandidates())
1591 if (
auto *FTD = FD->getPrimaryTemplate())
1592 TPL = FTD->getTemplateParameters();
1593 }
else if (
auto *VTSD =
1594 dyn_cast<VarTemplateSpecializationDecl>(
Node->getMemberDecl()))
1595 TPL = VTSD->getSpecializedTemplate()->getTemplateParameters();
1596 if (
Node->hasExplicitTemplateArgs())
1601 PrintExpr(
Node->getBase());
1602 OS << (
Node->isArrow() ?
"->isa" :
".isa");
1606 PrintExpr(
Node->getBase());
1608 OS <<
Node->getAccessor().getName();
1613 Node->getTypeAsWritten().
print(OS, Policy);
1615 PrintExpr(
Node->getSubExpr());
1622 PrintExpr(
Node->getInitializer());
1627 PrintExpr(
Node->getSubExpr());
1631 PrintExpr(
Node->getLHS());
1633 PrintExpr(
Node->getRHS());
1637 PrintExpr(
Node->getLHS());
1639 PrintExpr(
Node->getRHS());
1643 PrintExpr(
Node->getCond());
1645 PrintExpr(
Node->getLHS());
1647 PrintExpr(
Node->getRHS());
1654 PrintExpr(
Node->getCommon());
1656 PrintExpr(
Node->getFalseExpr());
1660 OS <<
"&&" <<
Node->getLabel()->getName();
1663void StmtPrinter::VisitStmtExpr(
StmtExpr *E) {
1670 OS <<
"__builtin_choose_expr(";
1671 PrintExpr(
Node->getCond());
1673 PrintExpr(
Node->getLHS());
1675 PrintExpr(
Node->getRHS());
1679void StmtPrinter::VisitGNUNullExpr(
GNUNullExpr *) {
1684 OS <<
"__builtin_shufflevector(";
1685 for (
unsigned i = 0, e =
Node->getNumSubExprs(); i != e; ++i) {
1687 PrintExpr(
Node->getExpr(i));
1693 OS <<
"__builtin_convertvector(";
1694 PrintExpr(
Node->getSrcExpr());
1701 if (
Node->getSyntacticForm()) {
1702 Visit(
Node->getSyntacticForm());
1707 for (
unsigned i = 0, e =
Node->getNumInits(); i != e; ++i) {
1709 if (
Node->getInit(i))
1710 PrintExpr(
Node->getInit(i));
1721 PrintExpr(
Node->getSubExpr());
1731 for (
unsigned i = 0, e =
Node->getNumExprs(); i != e; ++i) {
1733 PrintExpr(
Node->getExpr(i));
1739 bool NeedsEquals =
true;
1741 if (D.isFieldDesignator()) {
1742 if (D.getDotLoc().isInvalid()) {
1744 OS << II->getName() <<
":";
1745 NeedsEquals =
false;
1748 OS <<
"." << D.getFieldName()->getName();
1752 if (D.isArrayDesignator()) {
1753 PrintExpr(
Node->getArrayIndex(D));
1755 PrintExpr(
Node->getArrayRangeStart(D));
1757 PrintExpr(
Node->getArrayRangeEnd(D));
1767 PrintExpr(
Node->getInit());
1770void StmtPrinter::VisitDesignatedInitUpdateExpr(
1774 PrintExpr(
Node->getBase());
1777 OS <<
"/*updater*/";
1778 PrintExpr(
Node->getUpdater());
1783 OS <<
"/*no init*/";
1787 if (
Node->getType()->getAsCXXRecordDecl()) {
1788 OS <<
"/*implicit*/";
1792 OS <<
"/*implicit*/(";
1795 if (
Node->getType()->isRecordType())
1803 OS <<
"__builtin_va_arg(";
1804 PrintExpr(
Node->getSubExpr());
1811 PrintExpr(
Node->getSyntacticForm());
1815 const char *Name =
nullptr;
1816 switch (
Node->getOp()) {
1817#define BUILTIN(ID, TYPE, ATTRS)
1818#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1819 case AtomicExpr::AO ## ID: \
1822#include "clang/Basic/Builtins.def"
1827 PrintExpr(
Node->getPtr());
1828 if (
Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1829 Node->getOp() != AtomicExpr::AO__atomic_load_n &&
1830 Node->getOp() != AtomicExpr::AO__opencl_atomic_load &&
1831 Node->getOp() != AtomicExpr::AO__hip_atomic_load) {
1833 PrintExpr(
Node->getVal1());
1835 if (
Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1836 Node->isCmpXChg()) {
1838 PrintExpr(
Node->getVal2());
1840 if (
Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1841 Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1843 PrintExpr(
Node->getWeak());
1845 if (
Node->getOp() != AtomicExpr::AO__c11_atomic_init &&
1846 Node->getOp() != AtomicExpr::AO__opencl_atomic_init) {
1848 PrintExpr(
Node->getOrder());
1850 if (
Node->isCmpXChg()) {
1852 PrintExpr(
Node->getOrderFail());
1860 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1861 if (
Node->getNumArgs() == 1) {
1863 PrintExpr(
Node->getArg(0));
1865 PrintExpr(
Node->getArg(0));
1868 }
else if (Kind == OO_Arrow) {
1869 PrintExpr(
Node->getArg(0));
1870 }
else if (Kind == OO_Call || Kind == OO_Subscript) {
1871 PrintExpr(
Node->getArg(0));
1872 OS << (
Kind == OO_Call ?
'(' :
'[');
1873 for (
unsigned ArgIdx = 1; ArgIdx <
Node->getNumArgs(); ++ArgIdx) {
1876 if (!isa<CXXDefaultArgExpr>(
Node->getArg(ArgIdx)))
1877 PrintExpr(
Node->getArg(ArgIdx));
1879 OS << (
Kind == OO_Call ?
')' :
']');
1880 }
else if (
Node->getNumArgs() == 1) {
1882 PrintExpr(
Node->getArg(0));
1883 }
else if (
Node->getNumArgs() == 2) {
1884 PrintExpr(
Node->getArg(0));
1886 PrintExpr(
Node->getArg(1));
1888 llvm_unreachable(
"unknown overloaded operator");
1895 if (MD && isa<CXXConversionDecl>(MD)) {
1896 PrintExpr(
Node->getImplicitObjectArgument());
1899 VisitCallExpr(cast<CallExpr>(
Node));
1903 PrintExpr(
Node->getCallee());
1905 PrintCallArgs(
Node->getConfig());
1907 PrintCallArgs(
Node);
1911void StmtPrinter::VisitCXXRewrittenBinaryOperator(
1914 Node->getDecomposedForm();
1915 PrintExpr(
const_cast<Expr*
>(Decomposed.
LHS));
1917 PrintExpr(
const_cast<Expr*
>(Decomposed.
RHS));
1921 OS <<
Node->getCastName() <<
'<';
1922 Node->getTypeAsWritten().
print(OS, Policy);
1924 PrintExpr(
Node->getSubExpr());
1929 VisitCXXNamedCastExpr(
Node);
1933 VisitCXXNamedCastExpr(
Node);
1937 VisitCXXNamedCastExpr(
Node);
1941 VisitCXXNamedCastExpr(
Node);
1945 OS <<
"__builtin_bit_cast(";
1946 Node->getTypeInfoAsWritten()->getType().
print(OS, Policy);
1948 PrintExpr(
Node->getSubExpr());
1953 VisitCXXNamedCastExpr(
Node);
1958 if (
Node->isTypeOperand()) {
1959 Node->getTypeOperandSourceInfo()->getType().
print(OS, Policy);
1961 PrintExpr(
Node->getExprOperand());
1968 if (
Node->isTypeOperand()) {
1969 Node->getTypeOperandSourceInfo()->getType().
print(OS, Policy);
1971 PrintExpr(
Node->getExprOperand());
1977 PrintExpr(
Node->getBaseExpr());
1978 if (
Node->isArrow())
1983 Node->getQualifierLoc().getNestedNameSpecifier())
1985 OS <<
Node->getPropertyDecl()->getDeclName();
1989 PrintExpr(
Node->getBase());
1991 PrintExpr(
Node->getIdx());
1996 switch (
Node->getLiteralOperatorKind()) {
1998 OS << cast<StringLiteral>(
Node->getArg(0)->IgnoreImpCasts())->getString();
2001 const auto *DRE = cast<DeclRefExpr>(
Node->getCallee()->IgnoreImpCasts());
2003 cast<FunctionDecl>(DRE->getDecl())->getTemplateSpecializationArgs();
2008 if (!DRE->hadMultipleCandidates())
2009 if (
const auto *TD = dyn_cast<TemplateDecl>(DRE->getDecl()))
2010 TPL = TD->getTemplateParameters();
2011 OS <<
"operator\"\"" <<
Node->getUDSuffix()->getName();
2019 char C = (char)
P.getAsIntegral().getZExtValue();
2026 const auto *Int = cast<IntegerLiteral>(
Node->getCookedLiteral());
2027 OS <<
toString(Int->getValue(), 10,
false);
2032 auto *
Float = cast<FloatingLiteral>(
Node->getCookedLiteral());
2038 PrintExpr(
Node->getCookedLiteral());
2041 OS <<
Node->getUDSuffix()->getName();
2045 OS << (
Node->getValue() ?
"true" :
"false");
2057 if (!
Node->getSubExpr())
2061 PrintExpr(
Node->getSubExpr());
2074 auto TargetType =
Node->getType();
2075 auto *
Auto = TargetType->getContainedDeducedType();
2076 bool Bare =
Auto &&
Auto->isDeduced();
2081 TargetType.print(OS, Policy);
2086 if (!
Node->isListInitialization())
2088 PrintExpr(
Node->getSubExpr());
2089 if (!
Node->isListInitialization())
2094 PrintExpr(
Node->getSubExpr());
2099 if (
Node->isStdInitListInitialization())
2101 else if (
Node->isListInitialization())
2106 ArgEnd =
Node->arg_end();
2107 Arg != ArgEnd; ++Arg) {
2108 if ((*Arg)->isDefaultArgument())
2110 if (Arg !=
Node->arg_begin())
2114 if (
Node->isStdInitListInitialization())
2116 else if (
Node->isListInitialization())
2124 bool NeedComma =
false;
2125 switch (
Node->getCaptureDefault()) {
2140 CEnd =
Node->explicit_capture_end();
2143 if (
C->capturesVLAType())
2150 switch (
C->getCaptureKind()) {
2162 OS <<
C->getCapturedVar()->getName();
2166 OS <<
C->getCapturedVar()->getName();
2170 llvm_unreachable(
"VLA type in explicit captures.");
2173 if (
C->isPackExpansion())
2176 if (
Node->isInitCapture(
C)) {
2178 auto *D = cast<VarDecl>(
C->getCapturedVar());
2180 llvm::StringRef
Pre;
2181 llvm::StringRef
Post;
2183 !isa<ParenListExpr>(D->getInit())) {
2191 PrintExpr(D->getInit());
2197 if (!
Node->getExplicitTemplateParameters().empty()) {
2198 Node->getTemplateParameterList()->
print(
2199 OS,
Node->getLambdaClass()->getASTContext(),
2203 if (
Node->hasExplicitParameters()) {
2213 std::string ParamStr =
2215 ?
P->getIdentifier()->deuglifiedName().str()
2216 :
P->getNameAsString();
2217 P->getOriginalType().print(OS, Policy, ParamStr);
2226 if (
Node->isMutable())
2235 if (
Node->hasExplicitResultType()) {
2237 Proto->getReturnType().print(OS, Policy);
2246 PrintRawCompoundStmt(
Node->getCompoundStmtBody());
2251 TSInfo->getType().print(OS, Policy);
2257void StmtPrinter::VisitCXXNewExpr(
CXXNewExpr *E) {
2265 for (
unsigned i = 1; i < NumPlace; ++i) {
2277 llvm::raw_string_ostream
s(TypeS);
2280 (*Size)->printPretty(
s, Helper, Policy);
2319 OS << II->getName();
2328 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
2329 if (isa<CXXDefaultArgExpr>(E->
getArg(i))) {
2344 OS <<
"<forwarded>";
2356void StmtPrinter::VisitCXXUnresolvedConstructExpr(
2358 Node->getTypeAsWritten().
print(OS, Policy);
2359 if (!
Node->isListInitialization())
2361 for (
auto Arg =
Node->arg_begin(), ArgEnd =
Node->arg_end(); Arg != ArgEnd;
2363 if (Arg !=
Node->arg_begin())
2367 if (!
Node->isListInitialization())
2371void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2373 if (!
Node->isImplicitAccess()) {
2374 PrintExpr(
Node->getBase());
2375 OS << (
Node->isArrow() ?
"->" :
".");
2379 if (
Node->hasTemplateKeyword())
2381 OS <<
Node->getMemberNameInfo();
2382 if (
Node->hasExplicitTemplateArgs())
2387 if (!
Node->isImplicitAccess()) {
2388 PrintExpr(
Node->getBase());
2389 OS << (
Node->isArrow() ?
"->" :
".");
2393 if (
Node->hasTemplateKeyword())
2395 OS <<
Node->getMemberNameInfo();
2396 if (
Node->hasExplicitTemplateArgs())
2402 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++I) {
2434 OS <<
"sizeof...(" << *E->
getPack() <<
")";
2437void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2439 OS << *
Node->getParameterPack();
2442void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2444 Visit(
Node->getReplacement());
2452 PrintExpr(
Node->getSubExpr());
2455void StmtPrinter::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2471 llvm::interleaveComma(
Node->getInitExprs(), OS,
2472 [&](
Expr *E) { PrintExpr(E); });
2491 if (!LocalParameters.empty()) {
2494 PrintRawDecl(LocalParam);
2495 if (LocalParam != LocalParameters.back())
2504 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
2505 if (TypeReq->isSubstitutionFailure())
2506 OS <<
"<<error-type>>";
2508 TypeReq->getType()->getType().print(OS, Policy);
2509 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
2510 if (ExprReq->isCompound())
2512 if (ExprReq->isExprSubstitutionFailure())
2513 OS <<
"<<error-expression>>";
2515 PrintExpr(ExprReq->getExpr());
2516 if (ExprReq->isCompound()) {
2518 if (ExprReq->getNoexceptLoc().isValid())
2520 const auto &RetReq = ExprReq->getReturnTypeRequirement();
2521 if (!RetReq.isEmpty()) {
2523 if (RetReq.isSubstitutionFailure())
2524 OS <<
"<<error-type>>";
2525 else if (RetReq.isTypeConstraint())
2526 RetReq.getTypeConstraint()->print(OS, Policy);
2530 auto *NestedReq = cast<concepts::NestedRequirement>(Req);
2532 if (NestedReq->hasInvalidConstraint())
2533 OS <<
"<<error-expression>>";
2535 PrintExpr(NestedReq->getConstraintExpr());
2545 Visit(S->getBody());
2550 if (S->getOperand()) {
2552 Visit(S->getOperand());
2557void StmtPrinter::VisitCoawaitExpr(
CoawaitExpr *S) {
2559 PrintExpr(S->getOperand());
2564 PrintExpr(S->getOperand());
2567void StmtPrinter::VisitCoyieldExpr(
CoyieldExpr *S) {
2569 PrintExpr(S->getOperand());
2576 VisitStringLiteral(
Node->getString());
2587 for (
auto I = Ch.begin(), E = Ch.end(); I != E; ++I) {
2588 if (I != Ch.begin())
2604 Visit(Element.
Value);
2613 Node->getEncodedType().
print(OS, Policy);
2624 OS <<
"@protocol(" << *
Node->getProtocol() <<
')';
2649 for (
unsigned i = 0, e = Mess->
getNumArgs(); i != e; ++i) {
2651 if (i > 0) OS <<
' ';
2659 PrintExpr(Mess->
getArg(i));
2666 OS << (
Node->getValue() ?
"__objc_yes" :
"__objc_no");
2688 if (isa<FunctionNoProtoType>(AFT)) {
2690 }
else if (!BD->
param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2695 std::string ParamStr = (*AI)->getNameAsString();
2696 (*AI)->getType().print(OS, Policy, ParamStr);
2699 const auto *FT = cast<FunctionProtoType>(AFT);
2700 if (FT->isVariadic()) {
2710 PrintExpr(
Node->getSourceExpr());
2715 llvm_unreachable(
"Cannot print TypoExpr nodes");
2719 OS <<
"<recovery-expr>(";
2720 const char *Sep =
"";
2721 for (
Expr *E :
Node->subExpressions()) {
2730 OS <<
"__builtin_astype(";
2731 PrintExpr(
Node->getSrcExpr());
2747 StringRef NL,
const ASTContext *Context)
const {
2748 StmtPrinter
P(Out, Helper, Policy, Indentation, NL, Context);
2749 P.Visit(
const_cast<Stmt *
>(
this));
2754 unsigned Indentation, StringRef NL,
2756 StmtPrinter
P(Out, Helper, Policy, Indentation, NL, Context);
2757 P.PrintControlledStmt(
const_cast<Stmt *
>(
this));
2763 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 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.
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...
Expr * getPlacementArg(unsigned I)
unsigned getNumPlacementArgs() const
bool isParenTypeId() const
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
@ CallInit
New-expression has a C++98 paren-delimited initializer.
@ NoInit
New-expression has no initializer as written.
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,...
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
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.
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, CharacterKind 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 }.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
NamedDecl * getFoundDecl() const
ConceptDecl * getNamedConcept() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
SourceLocation getTemplateKWLoc() const
Represents the specialization of a concept - evaluates to a prvalue of type bool.
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.
bool isNegatedConsteval() const
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
@ ObjCSelf
Parameter for Objective-C 'self' argument.
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.
@ FPE_Ignore
Assume that floating-point exceptions are masked.
@ FPE_MayTrap
Transformations do not cause new exceptions but may hide some.
@ FPE_Strict
Strictly preserve the floating-point exception semantics.
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.
OpenMP 5.0 [2.1.5, Array Sections].
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 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.
Represents a C++11 pack expansion that produces a sequence of expressions.
Expr * getPattern()
Retrieve the pattern of the pack expansion.
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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.
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...
bool Call(InterpState &S, CodePtr OpPC, const Function *Func)
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.
@ C
Languages that the frontend can parse and compile.
std::string JsonFormat(StringRef RawSR, bool AddQuotes)
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
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.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Iterator range representation begin:end[:step].
An element in an Objective-C dictionary literal.
Expr * Value
The value of the dictionary element.
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
Expr * Key
The key for the dictionary element.
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 *.