27 #include "llvm/ADT/SmallString.h"
28 #include "llvm/Support/Format.h"
29 using namespace clang;
36 class StmtPrinter :
public StmtVisitor<StmtPrinter> {
45 unsigned Indentation = 0)
46 : OS(os), IndentLevel(Indentation), Helper(helper), Policy(Policy) {}
48 void PrintStmt(
Stmt *
S) {
49 PrintStmt(S, Policy.Indentation);
52 void PrintStmt(
Stmt *
S,
int SubIndent) {
53 IndentLevel += SubIndent;
54 if (S && isa<Expr>(S)) {
62 Indent() <<
"<<<NULL STATEMENT>>>\n";
64 IndentLevel -= SubIndent;
68 void PrintRawDecl(
Decl *D);
69 void PrintRawDeclStmt(
const DeclStmt *S);
70 void PrintRawIfStmt(
IfStmt *If);
77 void PrintExpr(
Expr *
E) {
85 for (
int i = 0, e = IndentLevel+
Delta; i < e; ++i)
91 if (Helper && Helper->handledStmt(S,OS))
96 void VisitStmt(
Stmt *
Node) LLVM_ATTRIBUTE_UNUSED {
97 Indent() <<
"<<unknown stmt type>>\n";
99 void VisitExpr(
Expr *
Node) LLVM_ATTRIBUTE_UNUSED {
100 OS <<
"<<unknown expr type>>";
104 #define ABSTRACT_STMT(CLASS)
105 #define STMT(CLASS, PARENT) \
106 void Visit##CLASS(CLASS *Node);
107 #include "clang/AST/StmtNodes.inc"
119 for (
auto *
I : Node->
body())
125 void StmtPrinter::PrintRawDecl(
Decl *D) {
126 D->
print(OS, Policy, IndentLevel);
129 void StmtPrinter::PrintRawDeclStmt(
const DeclStmt *S) {
140 PrintRawDeclStmt(Node);
146 PrintRawCompoundStmt(Node);
152 PrintExpr(Node->
getLHS());
155 PrintExpr(Node->
getRHS());
162 void StmtPrinter::VisitDefaultStmt(
DefaultStmt *Node) {
163 Indent(-1) <<
"default:\n";
167 void StmtPrinter::VisitLabelStmt(
LabelStmt *Node) {
180 void StmtPrinter::PrintRawIfStmt(
IfStmt *If) {
183 PrintRawDeclStmt(DS);
190 PrintRawCompoundStmt(CS);
191 OS << (If->
getElse() ?
' ' :
'\n');
203 PrintRawCompoundStmt(CS);
205 }
else if (
IfStmt *ElseIf = dyn_cast<IfStmt>(Else)) {
207 PrintRawIfStmt(ElseIf);
215 void StmtPrinter::VisitIfStmt(
IfStmt *If) {
220 void StmtPrinter::VisitSwitchStmt(
SwitchStmt *Node) {
223 PrintRawDeclStmt(DS);
231 PrintRawCompoundStmt(CS);
239 void StmtPrinter::VisitWhileStmt(
WhileStmt *Node) {
242 PrintRawDeclStmt(DS);
249 void StmtPrinter::VisitDoStmt(
DoStmt *Node) {
252 PrintRawCompoundStmt(CS);
265 void StmtPrinter::VisitForStmt(
ForStmt *Node) {
269 PrintRawDeclStmt(DS);
271 PrintExpr(cast<Expr>(Node->
getInit()));
281 PrintExpr(Node->
getInc());
286 PrintRawCompoundStmt(CS);
297 PrintRawDeclStmt(DS);
305 PrintRawCompoundStmt(CS);
316 SubPolicy.SuppressInitializers =
true;
323 if (Policy.IncludeNewlines) OS <<
"\n";
329 OS <<
"__if_exists (";
331 OS <<
"__if_not_exists (";
335 Qualifier->print(OS, Policy);
342 void StmtPrinter::VisitGotoStmt(
GotoStmt *Node) {
344 if (Policy.IncludeNewlines) OS <<
"\n";
351 if (Policy.IncludeNewlines) OS <<
"\n";
354 void StmtPrinter::VisitContinueStmt(
ContinueStmt *Node) {
356 if (Policy.IncludeNewlines) OS <<
"\n";
359 void StmtPrinter::VisitBreakStmt(
BreakStmt *Node) {
361 if (Policy.IncludeNewlines) OS <<
"\n";
365 void StmtPrinter::VisitReturnStmt(
ReturnStmt *Node) {
372 if (Policy.IncludeNewlines) OS <<
"\n";
376 void StmtPrinter::VisitGCCAsmStmt(
GCCAsmStmt *Node) {
390 for (
unsigned i = 0, e = Node->
getNumOutputs(); i != e; ++i) {
410 for (
unsigned i = 0, e = Node->
getNumInputs(); i != e; ++i) {
438 if (Policy.IncludeNewlines) OS <<
"\n";
441 void StmtPrinter::VisitMSAsmStmt(
MSAsmStmt *Node) {
451 void StmtPrinter::VisitCapturedStmt(
CapturedStmt *Node) {
458 PrintRawCompoundStmt(TS);
471 PrintRawCompoundStmt(CS);
479 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
488 Indent() <<
"@catch (...) { /* todo */ } \n";
500 void StmtPrinter::VisitObjCAvailabilityCheckExpr(
502 OS <<
"@available(...)";
506 Indent() <<
"@synchronized (";
514 Indent() <<
"@autoreleasepool";
515 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(Node->
getSubStmt()));
519 void StmtPrinter::PrintRawCXXCatchStmt(
CXXCatchStmt *Node) {
522 PrintRawDecl(ExDecl);
529 void StmtPrinter::VisitCXXCatchStmt(
CXXCatchStmt *Node) {
531 PrintRawCXXCatchStmt(Node);
535 void StmtPrinter::VisitCXXTryStmt(
CXXTryStmt *Node) {
545 void StmtPrinter::VisitSEHTryStmt(
SEHTryStmt *Node) {
551 PrintRawSEHExceptHandler(E);
553 assert(F &&
"Must have a finally block...");
554 PrintRawSEHFinallyStmt(F);
561 PrintRawCompoundStmt(Node->
getBlock());
565 void StmtPrinter::PrintRawSEHExceptHandler(
SEHExceptStmt *Node) {
569 PrintRawCompoundStmt(Node->
getBlock());
575 PrintRawSEHExceptHandler(Node);
581 PrintRawSEHFinallyStmt(Node);
585 void StmtPrinter::VisitSEHLeaveStmt(
SEHLeaveStmt *Node) {
587 if (Policy.IncludeNewlines) OS <<
"\n";
599 template <
typename T>
600 void VisitOMPClauseList(T *Node,
char StartSym);
603 : OS(OS), Policy(Policy) { }
604 #define OPENMP_CLAUSE(Name, Class) \
605 void Visit##Class(Class *S);
606 #include "clang/Basic/OpenMPKinds.def"
609 void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
617 void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
624 OS <<
"num_threads(";
674 E->printPretty(OS,
nullptr, Policy);
683 Num->printPretty(OS,
nullptr, Policy, 0);
704 void OMPClausePrinter::VisitOMPReadClause(
OMPReadClause *) { OS <<
"read"; }
706 void OMPClausePrinter::VisitOMPWriteClause(
OMPWriteClause *) { OS <<
"write"; }
724 void OMPClausePrinter::VisitOMPSIMDClause(
OMPSIMDClause *) { OS <<
"simd"; }
739 OS <<
"thread_limit(";
762 void OMPClausePrinter::VisitOMPHintClause(
OMPHintClause *Node) {
769 void OMPClausePrinter::VisitOMPClauseList(T *Node,
char StartSym) {
770 for (
typename T::varlist_iterator
I = Node->varlist_begin(),
771 E = Node->varlist_end();
773 assert(*
I &&
"Expected non-null Stmt");
774 OS << (
I == Node->varlist_begin() ? StartSym :
',');
775 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(*I)) {
776 if (isa<OMPCapturedExprDecl>(DRE->getDecl()))
777 DRE->printPretty(OS,
nullptr, Policy, 0);
779 DRE->getDecl()->printQualifiedName(OS);
781 (*I)->printPretty(OS,
nullptr, Policy, 0);
788 VisitOMPClauseList(Node,
'(');
795 OS <<
"firstprivate";
796 VisitOMPClauseList(Node,
'(');
804 VisitOMPClauseList(Node,
'(');
812 VisitOMPClauseList(Node,
'(');
824 if (QualifierLoc ==
nullptr && OOK !=
OO_None) {
829 if (QualifierLoc !=
nullptr)
830 QualifierLoc->
print(OS, Policy);
834 VisitOMPClauseList(Node,
' ');
839 void OMPClausePrinter::VisitOMPTaskReductionClause(
842 OS <<
"task_reduction(";
847 if (QualifierLoc ==
nullptr && OOK !=
OO_None) {
852 if (QualifierLoc !=
nullptr)
853 QualifierLoc->
print(OS, Policy);
857 VisitOMPClauseList(Node,
' ');
865 if (Node->getModifierLoc().isValid()) {
869 VisitOMPClauseList(Node,
'(');
870 if (Node->getModifierLoc().isValid())
872 if (Node->getStep() !=
nullptr) {
874 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
881 if (!Node->varlist_empty()) {
883 VisitOMPClauseList(Node,
'(');
893 if (!Node->varlist_empty()) {
895 VisitOMPClauseList(Node,
'(');
901 if (!Node->varlist_empty()) {
903 VisitOMPClauseList(Node,
'(');
908 void OMPClausePrinter::VisitOMPFlushClause(
OMPFlushClause *Node) {
909 if (!Node->varlist_empty()) {
910 VisitOMPClauseList(Node,
'(');
919 if (!Node->varlist_empty()) {
921 VisitOMPClauseList(Node,
' ');
926 void OMPClausePrinter::VisitOMPMapClause(
OMPMapClause *Node) {
927 if (!Node->varlist_empty()) {
938 VisitOMPClauseList(Node,
' ');
943 void OMPClausePrinter::VisitOMPToClause(
OMPToClause *Node) {
944 if (!Node->varlist_empty()) {
946 VisitOMPClauseList(Node,
'(');
951 void OMPClausePrinter::VisitOMPFromClause(
OMPFromClause *Node) {
952 if (!Node->varlist_empty()) {
954 VisitOMPClauseList(Node,
'(');
964 E->printPretty(OS,
nullptr, Policy);
980 if (!Node->varlist_empty()) {
981 OS <<
"use_device_ptr";
982 VisitOMPClauseList(Node,
'(');
988 if (!Node->varlist_empty()) {
989 OS <<
"is_device_ptr";
990 VisitOMPClauseList(Node,
'(');
1001 OMPClausePrinter Printer(OS, Policy);
1005 if (*I && !(*I)->isImplicit()) {
1012 "Expected captured statement!");
1019 Indent() <<
"#pragma omp parallel ";
1020 PrintOMPExecutableDirective(Node);
1024 Indent() <<
"#pragma omp simd ";
1025 PrintOMPExecutableDirective(Node);
1029 Indent() <<
"#pragma omp for ";
1030 PrintOMPExecutableDirective(Node);
1034 Indent() <<
"#pragma omp for simd ";
1035 PrintOMPExecutableDirective(Node);
1039 Indent() <<
"#pragma omp sections ";
1040 PrintOMPExecutableDirective(Node);
1044 Indent() <<
"#pragma omp section";
1045 PrintOMPExecutableDirective(Node);
1049 Indent() <<
"#pragma omp single ";
1050 PrintOMPExecutableDirective(Node);
1054 Indent() <<
"#pragma omp master";
1055 PrintOMPExecutableDirective(Node);
1059 Indent() <<
"#pragma omp critical";
1066 PrintOMPExecutableDirective(Node);
1070 Indent() <<
"#pragma omp parallel for ";
1071 PrintOMPExecutableDirective(Node);
1074 void StmtPrinter::VisitOMPParallelForSimdDirective(
1076 Indent() <<
"#pragma omp parallel for simd ";
1077 PrintOMPExecutableDirective(Node);
1080 void StmtPrinter::VisitOMPParallelSectionsDirective(
1082 Indent() <<
"#pragma omp parallel sections ";
1083 PrintOMPExecutableDirective(Node);
1087 Indent() <<
"#pragma omp task ";
1088 PrintOMPExecutableDirective(Node);
1092 Indent() <<
"#pragma omp taskyield";
1093 PrintOMPExecutableDirective(Node);
1097 Indent() <<
"#pragma omp barrier";
1098 PrintOMPExecutableDirective(Node);
1102 Indent() <<
"#pragma omp taskwait";
1103 PrintOMPExecutableDirective(Node);
1107 Indent() <<
"#pragma omp taskgroup ";
1108 PrintOMPExecutableDirective(Node);
1112 Indent() <<
"#pragma omp flush ";
1113 PrintOMPExecutableDirective(Node);
1117 Indent() <<
"#pragma omp ordered ";
1118 PrintOMPExecutableDirective(Node);
1122 Indent() <<
"#pragma omp atomic ";
1123 PrintOMPExecutableDirective(Node);
1127 Indent() <<
"#pragma omp target ";
1128 PrintOMPExecutableDirective(Node);
1132 Indent() <<
"#pragma omp target data ";
1133 PrintOMPExecutableDirective(Node);
1136 void StmtPrinter::VisitOMPTargetEnterDataDirective(
1138 Indent() <<
"#pragma omp target enter data ";
1139 PrintOMPExecutableDirective(Node);
1142 void StmtPrinter::VisitOMPTargetExitDataDirective(
1144 Indent() <<
"#pragma omp target exit data ";
1145 PrintOMPExecutableDirective(Node);
1148 void StmtPrinter::VisitOMPTargetParallelDirective(
1150 Indent() <<
"#pragma omp target parallel ";
1151 PrintOMPExecutableDirective(Node);
1154 void StmtPrinter::VisitOMPTargetParallelForDirective(
1156 Indent() <<
"#pragma omp target parallel for ";
1157 PrintOMPExecutableDirective(Node);
1161 Indent() <<
"#pragma omp teams ";
1162 PrintOMPExecutableDirective(Node);
1165 void StmtPrinter::VisitOMPCancellationPointDirective(
1167 Indent() <<
"#pragma omp cancellation point "
1169 PrintOMPExecutableDirective(Node);
1173 Indent() <<
"#pragma omp cancel "
1175 PrintOMPExecutableDirective(Node);
1179 Indent() <<
"#pragma omp taskloop ";
1180 PrintOMPExecutableDirective(Node);
1183 void StmtPrinter::VisitOMPTaskLoopSimdDirective(
1185 Indent() <<
"#pragma omp taskloop simd ";
1186 PrintOMPExecutableDirective(Node);
1190 Indent() <<
"#pragma omp distribute ";
1191 PrintOMPExecutableDirective(Node);
1194 void StmtPrinter::VisitOMPTargetUpdateDirective(
1196 Indent() <<
"#pragma omp target update ";
1197 PrintOMPExecutableDirective(Node);
1200 void StmtPrinter::VisitOMPDistributeParallelForDirective(
1202 Indent() <<
"#pragma omp distribute parallel for ";
1203 PrintOMPExecutableDirective(Node);
1206 void StmtPrinter::VisitOMPDistributeParallelForSimdDirective(
1208 Indent() <<
"#pragma omp distribute parallel for simd ";
1209 PrintOMPExecutableDirective(Node);
1212 void StmtPrinter::VisitOMPDistributeSimdDirective(
1214 Indent() <<
"#pragma omp distribute simd ";
1215 PrintOMPExecutableDirective(Node);
1218 void StmtPrinter::VisitOMPTargetParallelForSimdDirective(
1220 Indent() <<
"#pragma omp target parallel for simd ";
1221 PrintOMPExecutableDirective(Node);
1225 Indent() <<
"#pragma omp target simd ";
1226 PrintOMPExecutableDirective(Node);
1229 void StmtPrinter::VisitOMPTeamsDistributeDirective(
1231 Indent() <<
"#pragma omp teams distribute ";
1232 PrintOMPExecutableDirective(Node);
1235 void StmtPrinter::VisitOMPTeamsDistributeSimdDirective(
1237 Indent() <<
"#pragma omp teams distribute simd ";
1238 PrintOMPExecutableDirective(Node);
1241 void StmtPrinter::VisitOMPTeamsDistributeParallelForSimdDirective(
1243 Indent() <<
"#pragma omp teams distribute parallel for simd ";
1244 PrintOMPExecutableDirective(Node);
1247 void StmtPrinter::VisitOMPTeamsDistributeParallelForDirective(
1249 Indent() <<
"#pragma omp teams distribute parallel for ";
1250 PrintOMPExecutableDirective(Node);
1254 Indent() <<
"#pragma omp target teams ";
1255 PrintOMPExecutableDirective(Node);
1258 void StmtPrinter::VisitOMPTargetTeamsDistributeDirective(
1260 Indent() <<
"#pragma omp target teams distribute ";
1261 PrintOMPExecutableDirective(Node);
1264 void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective(
1266 Indent() <<
"#pragma omp target teams distribute parallel for ";
1267 PrintOMPExecutableDirective(Node);
1270 void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1272 Indent() <<
"#pragma omp target teams distribute parallel for simd ";
1273 PrintOMPExecutableDirective(Node);
1276 void StmtPrinter::VisitOMPTargetTeamsDistributeSimdDirective(
1278 Indent() <<
"#pragma omp target teams distribute simd ";
1279 PrintOMPExecutableDirective(Node);
1286 void StmtPrinter::VisitDeclRefExpr(
DeclRefExpr *Node) {
1287 if (
auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->
getDecl())) {
1288 OCED->getInit()->IgnoreImpCasts()->printPretty(OS,
nullptr, Policy);
1292 Qualifier->print(OS, Policy);
1301 void StmtPrinter::VisitDependentScopeDeclRefExpr(
1304 Qualifier->print(OS, Policy);
1327 OS << (Node->
isArrow() ?
"->" :
".");
1411 if (value < 256 &&
isPrintable((
unsigned char)value))
1412 OS <<
"'" << (
char)value <<
"'";
1413 else if (value < 256)
1414 OS <<
"'\\x" << llvm::format(
"%02x", value) <<
"'";
1415 else if (value <= 0xFFFF)
1416 OS <<
"'\\u" << llvm::format(
"%04x", value) <<
"'";
1418 OS <<
"'\\U" << llvm::format(
"%08x", value) <<
"'";
1424 OS << Node->
getValue().toString(10, isSigned);
1428 default: llvm_unreachable(
"Unexpected type for integer literal!");
1429 case BuiltinType::Char_S:
1430 case BuiltinType::Char_U: OS <<
"i8";
break;
1431 case BuiltinType::UChar: OS <<
"Ui8";
break;
1432 case BuiltinType::Short: OS <<
"i16";
break;
1433 case BuiltinType::UShort: OS <<
"Ui16";
break;
1434 case BuiltinType::Int:
break;
1435 case BuiltinType::UInt: OS <<
'U';
break;
1436 case BuiltinType::Long: OS <<
'L';
break;
1437 case BuiltinType::ULong: OS <<
"UL";
break;
1438 case BuiltinType::LongLong: OS <<
"LL";
break;
1439 case BuiltinType::ULongLong: OS <<
"ULL";
break;
1448 if (Str.find_first_not_of(
"-0123456789") == StringRef::npos)
1456 default: llvm_unreachable(
"Unexpected type for float literal!");
1457 case BuiltinType::Half:
break;
1458 case BuiltinType::Double:
break;
1459 case BuiltinType::Float: OS <<
'F';
break;
1460 case BuiltinType::LongDouble: OS <<
'L';
break;
1461 case BuiltinType::Float128: OS <<
'Q';
break;
1477 void StmtPrinter::VisitParenExpr(
ParenExpr *Node) {
1508 void StmtPrinter::VisitOffsetOfExpr(
OffsetOfExpr *Node) {
1509 OS <<
"__builtin_offsetof(";
1512 bool PrintedSomething =
false;
1520 PrintedSomething =
true;
1533 if (PrintedSomething)
1536 PrintedSomething =
true;
1550 else if (Policy.UnderscoreAlignof)
1559 OS <<
"__builtin_omp_required_simd_align";
1581 T.
print(OS, Policy);
1589 PrintExpr(Node->
getLHS());
1591 PrintExpr(Node->
getRHS());
1608 void StmtPrinter::PrintCallArgs(
CallExpr *Call) {
1609 for (
unsigned i = 0, e = Call->
getNumArgs(); i != e; ++i) {
1610 if (isa<CXXDefaultArgExpr>(Call->
getArg(i))) {
1616 PrintExpr(Call->
getArg(i));
1620 void StmtPrinter::VisitCallExpr(
CallExpr *Call) {
1623 PrintCallArgs(Call);
1626 void StmtPrinter::VisitMemberExpr(
MemberExpr *Node) {
1632 ? dyn_cast<
FieldDecl>(ParentMember->getMemberDecl()) :
nullptr;
1634 if (!ParentDecl || !ParentDecl->isAnonymousStructOrUnion())
1635 OS << (Node->
isArrow() ?
"->" :
".");
1638 if (FD->isAnonymousStructOrUnion())
1642 Qualifier->
print(OS, Policy);
1650 void StmtPrinter::VisitObjCIsaExpr(
ObjCIsaExpr *Node) {
1652 OS << (Node->
isArrow() ?
"->isa" :
".isa");
1677 PrintExpr(Node->
getLHS());
1679 PrintExpr(Node->
getRHS());
1682 PrintExpr(Node->
getLHS());
1684 PrintExpr(Node->
getRHS());
1689 PrintExpr(Node->
getLHS());
1691 PrintExpr(Node->
getRHS());
1706 void StmtPrinter::VisitStmtExpr(
StmtExpr *E) {
1712 void StmtPrinter::VisitChooseExpr(
ChooseExpr *Node) {
1713 OS <<
"__builtin_choose_expr(";
1716 PrintExpr(Node->
getLHS());
1718 PrintExpr(Node->
getRHS());
1722 void StmtPrinter::VisitGNUNullExpr(
GNUNullExpr *) {
1727 OS <<
"__builtin_shufflevector(";
1736 OS <<
"__builtin_convertvector(";
1743 void StmtPrinter::VisitInitListExpr(
InitListExpr* Node) {
1750 for (
unsigned i = 0, e = Node->
getNumInits(); i != e; ++i) {
1774 for (
unsigned i = 0, e = Node->
getNumExprs(); i != e; ++i) {
1782 bool NeedsEquals =
true;
1784 if (D.isFieldDesignator()) {
1785 if (D.getDotLoc().isInvalid()) {
1787 OS << II->getName() <<
":";
1788 NeedsEquals =
false;
1791 OS <<
"." << D.getFieldName()->getName();
1795 if (D.isArrayDesignator()) {
1813 void StmtPrinter::VisitDesignatedInitUpdateExpr(
1820 OS <<
"/*updater*/";
1825 void StmtPrinter::VisitNoInitExpr(
NoInitExpr *Node) {
1826 OS <<
"/*no init*/";
1831 OS <<
"/*implicit*/";
1835 OS <<
"/*implicit*/(";
1845 void StmtPrinter::VisitVAArgExpr(
VAArgExpr *Node) {
1846 OS <<
"__builtin_va_arg(";
1857 void StmtPrinter::VisitAtomicExpr(
AtomicExpr *Node) {
1858 const char *
Name =
nullptr;
1859 switch (Node->
getOp()) {
1860 #define BUILTIN(ID, TYPE, ATTRS)
1861 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1862 case AtomicExpr::AO ## ID: \
1865 #include "clang/Basic/Builtins.def"
1870 PrintExpr(Node->
getPtr());
1871 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_load &&
1872 Node->
getOp() != AtomicExpr::AO__atomic_load_n) {
1876 if (Node->
getOp() == AtomicExpr::AO__atomic_exchange ||
1881 if (Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1882 Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1886 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_init) {
1901 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
1903 #include "clang/Basic/OperatorKinds.def"
1907 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1909 OS << OpStrings[
Kind] <<
' ';
1910 PrintExpr(Node->
getArg(0));
1912 PrintExpr(Node->
getArg(0));
1913 OS <<
' ' << OpStrings[
Kind];
1915 }
else if (Kind == OO_Arrow) {
1916 PrintExpr(Node->
getArg(0));
1917 }
else if (Kind == OO_Call) {
1918 PrintExpr(Node->
getArg(0));
1920 for (
unsigned ArgIdx = 1; ArgIdx < Node->
getNumArgs(); ++ArgIdx) {
1923 if (!isa<CXXDefaultArgExpr>(Node->
getArg(ArgIdx)))
1924 PrintExpr(Node->
getArg(ArgIdx));
1927 }
else if (Kind == OO_Subscript) {
1928 PrintExpr(Node->
getArg(0));
1930 PrintExpr(Node->
getArg(1));
1933 OS << OpStrings[
Kind] <<
' ';
1934 PrintExpr(Node->
getArg(0));
1936 PrintExpr(Node->
getArg(0));
1937 OS <<
' ' << OpStrings[
Kind] <<
' ';
1938 PrintExpr(Node->
getArg(1));
1940 llvm_unreachable(
"unknown overloaded operator");
1947 if (MD && isa<CXXConversionDecl>(MD)) {
1951 VisitCallExpr(cast<CallExpr>(Node));
1959 PrintCallArgs(Node);
1972 VisitCXXNamedCastExpr(Node);
1976 VisitCXXNamedCastExpr(Node);
1980 VisitCXXNamedCastExpr(Node);
1984 VisitCXXNamedCastExpr(Node);
2015 Qualifier->print(OS, Policy);
2022 PrintExpr(Node->
getIdx());
2034 cast<FunctionDecl>(DRE->
getDecl())->getTemplateSpecializationArgs();
2037 if (Args->size() != 1) {
2040 OS, Args->asArray(), Policy);
2047 char C = (char)
P.getAsIntegral().getZExtValue();
2055 OS << Int->
getValue().toString(10,
false);
2073 OS << (Node->
getValue() ?
"true" :
"false");
2080 void StmtPrinter::VisitCXXThisExpr(
CXXThisExpr *Node) {
2084 void StmtPrinter::VisitCXXThrowExpr(
CXXThrowExpr *Node) {
2126 Arg != ArgEnd; ++Arg) {
2127 if ((*Arg)->isDefaultArgument())
2141 void StmtPrinter::VisitLambdaExpr(
LambdaExpr *Node) {
2143 bool NeedComma =
false;
2166 switch (
C->getCaptureKind()) {
2176 OS <<
C->getCapturedVar()->getName();
2180 OS <<
C->getCapturedVar()->getName();
2183 llvm_unreachable(
"VLA type in explicit captures.");
2187 PrintExpr(
C->getCapturedVar()->getInit());
2201 std::string ParamStr =
P->getNameAsString();
2202 P->getOriginalType().print(OS, Policy, ParamStr);
2235 TSInfo->getType().print(OS, Policy);
2241 void StmtPrinter::VisitCXXNewExpr(
CXXNewExpr *E) {
2249 for (
unsigned i = 1; i < NumPlace; ++i) {
2261 llvm::raw_string_ostream s(TypeS);
2263 Size->printPretty(s, Helper, Policy);
2300 OS << II->getName();
2309 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
2310 if (isa<CXXDefaultArgExpr>(E->
getArg(i))) {
2325 OS <<
"<forwarded>";
2338 StmtPrinter::VisitCXXUnresolvedConstructExpr(
2344 Arg != ArgEnd; ++Arg) {
2352 void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2356 OS << (Node->
isArrow() ?
"->" :
".");
2359 Qualifier->print(OS, Policy);
2371 OS << (Node->
isArrow() ?
"->" :
".");
2374 Qualifier->print(OS, Policy);
2385 #define TYPE_TRAIT_1(Spelling, Name, Key) \
2386 case clang::UTT_##Name: return #Spelling;
2387 #define TYPE_TRAIT_2(Spelling, Name, Key) \
2388 case clang::BTT_##Name: return #Spelling;
2389 #define TYPE_TRAIT_N(Spelling, Name, Key) \
2390 case clang::TT_##Name: return #Spelling;
2391 #include "clang/Basic/TokenKinds.def"
2393 llvm_unreachable(
"Type trait not covered by switch");
2401 llvm_unreachable(
"Array type trait not covered by switch");
2409 llvm_unreachable(
"Expression type trait not covered by switch");
2414 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++
I) {
2446 OS <<
"sizeof...(" << *E->
getPack() <<
")";
2449 void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2454 void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2467 void StmtPrinter::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2489 if (S->getOperand()) {
2491 Visit(S->getOperand());
2496 void StmtPrinter::VisitCoawaitExpr(
CoawaitExpr *S) {
2508 void StmtPrinter::VisitCoyieldExpr(
CoyieldExpr *S) {
2528 for (
auto I = Ch.begin(), E = Ch.end(); I !=
E; ++
I) {
2529 if (I != Ch.begin())
2545 Visit(Element.
Value);
2565 OS <<
"@protocol(" << *Node->
getProtocol() <<
')';
2590 for (
unsigned i = 0, e = Mess->
getNumArgs(); i != e; ++i) {
2592 if (i > 0) OS <<
' ';
2600 PrintExpr(Mess->
getArg(i));
2607 OS << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2623 void StmtPrinter::VisitBlockExpr(
BlockExpr *Node) {
2629 if (isa<FunctionNoProtoType>(AFT)) {
2631 }
else if (!BD->
param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2636 std::string ParamStr = (*AI)->getNameAsString();
2637 (*AI)->getType().print(OS, Policy, ParamStr);
2654 void StmtPrinter::VisitTypoExpr(
TypoExpr *Node) {
2656 llvm_unreachable(
"Cannot print TypoExpr nodes");
2659 void StmtPrinter::VisitAsTypeExpr(
AsTypeExpr *Node) {
2660 OS <<
"__builtin_astype(";
2678 unsigned Indentation)
const {
2679 StmtPrinter
P(OS, Helper, Policy, Indentation);
2680 P.Visit(const_cast<Stmt*>(
this));
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
A call to an overloaded operator written using operator syntax.
The receiver is the instance of the superclass object.
Represents a single C99 designator.
Raw form: operator "" X (const char *)
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0) const
Defines the clang::ASTContext interface.
This represents '#pragma omp distribute simd' composite directive.
unsigned getNumInits() const
This represents '#pragma omp master' directive.
operator "" X (long double)
const Expr * getBase() const
The null pointer literal (C++11 [lex.nullptr])
This represents '#pragma omp task' directive.
This represents a GCC inline-assembly statement extension.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
Represents a 'co_await' expression while the type of the promise is dependent.
OpenMPScheduleClauseModifier getSecondScheduleModifier() const
Get the second modifier of the clause.
unsigned getNumOutputs() const
This represents 'thread_limit' clause in the '#pragma omp ...' directive.
The receiver is an object instance.
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Expr * getSyntacticForm()
Return the syntactic form of this expression, i.e.
Smart pointer class that efficiently represents Objective-C method names.
This represents clause 'copyin' in the '#pragma omp ...' directives.
bool hasTemplateKeyword() const
Determines whether the name in this declaration reference was preceded by the template keyword...
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
A (possibly-)qualified type.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
ArrayRef< OMPClause * > clauses()
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
ArrayRef< TemplateArgumentLoc > template_arguments() const
Expr * getExpr(unsigned Index)
getExpr - Return the Expr at the specified index.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
CompoundStmt * getSubStmt()
Expr * getSimdlen() const
Return safe iteration space distance.
CharacterKind getKind() const
Represents a 'co_return' statement in the C++ Coroutines TS.
Stmt - This represents one statement.
FunctionType - C99 6.7.5.3 - Function Declarators.
CXXCatchStmt * getHandler(unsigned i)
bool isArgumentType() const
IfStmt - This represents an if/then/else.
Expr * getInit() const
Retrieve the initializer value.
bool isGlobalDelete() const
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
This represents '#pragma omp for simd' directive.
Expr * getOperand() const
OpenMPProcBindClauseKind getProcBindKind() const
Returns kind of the clause.
TypeSourceInfo * getTypeSourceInfo() const
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
bool isRecordType() const
Decl - This represents one declaration (or definition), e.g.
This represents 'grainsize' clause in the '#pragma omp ...' directive.
This represents '#pragma omp teams distribute parallel for' composite directive.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
param_iterator param_end()
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
This represents 'if' clause in the '#pragma omp ...' directive.
Defines the C++ template declaration subclasses.
Represents an attribute applied to a statement.
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
ParenExpr - This represents a parethesized expression, e.g.
Expr * getLowerBound()
Get lower bound of array section.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
This represents 'priority' clause in the '#pragma omp ...' directive.
This represents '#pragma omp target teams distribute' combined directive.
Represents Objective-C's @throw statement.
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
InitListExpr * getSyntacticForm() const
static void PrintTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
Represents a call to a C++ constructor.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
TypeSourceInfo * getTypeSourceInfo() const
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
Expr * getOperand() const
A container of type source information.
ArrayRef< TemplateArgumentLoc > template_arguments() const
This represents 'update' clause in the '#pragma omp atomic' directive.
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
const Stmt * getElse() const
This represents '#pragma omp parallel for' directive.
MS property subscript expression.
This represents '#pragma omp target teams distribute parallel for' combined directive.
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Expr * getAlignment()
Returns alignment.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
CompoundStmt * getBlock() const
IdentType getIdentType() const
Expr * getIndexExpr(unsigned Idx)
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
This represents '#pragma omp target exit data' directive.
This represents 'read' clause in the '#pragma omp atomic' directive.
Expr * getOperand() const
This represents clause 'private' in the '#pragma omp ...' directives.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
CompoundLiteralExpr - [C99 6.5.2.5].
This represents 'num_threads' clause in the '#pragma omp ...' directive.
const Expr * getCallee() const
This represents 'defaultmap' clause in the '#pragma omp ...' directive.
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
const FunctionProtoType * getFunctionType() const
getFunctionType - Return the underlying function type for this block.
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
UnaryExprOrTypeTrait getKind() const
bool varlist_empty() const
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
Describes how types, statements, expressions, and declarations should be printed. ...
unsigned getValue() const
A C++ throw-expression (C++ [except.throw]).
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Expr * getNumForLoops() const
Return the number of associated for-loops.
Defines the clang::Expr interface and subclasses for C++ expressions.
Expr * getArrayIndex(const Designator &D) const
ArrayTypeTrait getTrait() const
This represents 'nogroup' clause in the '#pragma omp ...' directive.
This represents 'safelen' clause in the '#pragma omp ...' directive.
A C++ static_cast expression (C++ [expr.static.cast]).
LabelStmt - Represents a label, which has a substatement.
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
Represents a C99 designated initializer expression.
Expr * getNumThreads() const
Returns number of threads.
DeclarationName getName() const
getName - Returns the embedded declaration name.
One of these records is kept for each identifier that is lexed.
ObjCProtocolDecl * getProtocol() const
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
An element in an Objective-C dictionary literal.
This represents '#pragma omp parallel' directive.
unsigned getNumInputs() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ObjCInterfaceDecl * getClassReceiver() const
This represents 'simd' clause in the '#pragma omp ...' directive.
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
OpenMPScheduleClauseModifier getFirstScheduleModifier() const
Get the first modifier of the clause.
unsigned getNumAssocs() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Represents a place-holder for an object not to be initialized by anything.
StringLiteral * getString()
Expr * getImplicitObjectArgument() const
Retrieves the implicit object argument for the member call.
Expr * getChunkSize()
Get chunk size.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
This represents clause 'map' in the '#pragma omp ...' directives.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
This represents clause 'to' in the '#pragma omp ...' directives.
Expr * getPlacementArg(unsigned i)
This represents '#pragma omp target simd' directive.
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
IdentifierInfo & getAccessor() const
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
QualType getQueriedType() const
This represents '#pragma omp barrier' directive.
const DeclarationNameInfo & getNameInfo() const
Gets the name info for specified reduction identifier.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Expr * getNumTeams()
Return NumTeams number.
Represents a reference to a non-type template parameter pack that has been substituted with a non-tem...
This represents '#pragma omp critical' directive.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
Expr * getFilterExpr() const
const VarDecl * getCatchParamDecl() const
Represents Objective-C's @catch statement.
const CompoundStmt * getSynchBody() const
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
This represents '#pragma omp distribute parallel for' composite directive.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
This represents '#pragma omp teams distribute parallel for simd' composite directive.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
const LangOptions & getLangOpts() const
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
< Capturing the *this object by copy
DeclarationNameInfo getNameInfo() const
QualType getReturnType() const
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
bool isSuperReceiver() const
Stmt * getHandlerBlock() const
Expr * getInitializer()
The initializer of this new-expression.
Expr * getExprOperand() const
ArrayRef< TemplateArgumentLoc > template_arguments() const
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the full name info for the member that this expression refers to.
OpenMPScheduleClauseKind getScheduleKind() const
Get kind of the clause.
const Expr * getSubExpr() const
A builtin binary operation expression such as "x + y" or "x <= y".
Selector getSelector() const
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
Expr * getOutputExpr(unsigned i)
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
This represents '#pragma omp cancellation point' directive.
This represents 'default' clause in the '#pragma omp ...' directive.
ObjCStringLiteral, used for Objective-C string literals i.e.
bool isVariadic() const
Whether this function is variadic.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
const DeclStmt * getConditionVariableDeclStmt() const
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Expr * getBaseExpr() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
New-expression has a C++98 paren-delimited initializer.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
const Stmt * getCatchBody() const
This represents 'final' clause in the '#pragma omp ...' directive.
This represents 'mergeable' clause in the '#pragma omp ...' directive.
This represents '#pragma omp teams' directive.
StringRef getBridgeKindName() const
Retrieve the kind of bridge being performed as a string.
This represents clause 'reduction' in the '#pragma omp ...' directives.
Helper class for OffsetOfExpr.
This represents '#pragma omp teams distribute simd' combined directive.
Represents binding an expression to a temporary.
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
StringLiteral * getClobberStringLiteral(unsigned i)
CompoundStmt * getBody() const
Retrieve the body of the lambda.
ArrayTypeTrait
Names for the array type traits.
Expr * Key
The key for the dictionary element.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Represents a C++ member access expression where the actual member referenced could not be resolved be...
const Expr * getBase() const
This represents clause 'is_device_ptr' in the '#pragma omp ...' directives.
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.
Expr * getHint() const
Returns number of threads.
detail::InMemoryDirectory::const_iterator I
A default argument (C++ [dcl.fct.default]).
ExpressionTrait getTrait() const
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
This represents clause 'from' in the '#pragma omp ...' directives.
Represents the this expression in C++.
MSPropertyDecl * getPropertyDecl() const
OpenMPDefaultClauseKind getDefaultKind() const
Returns kind of the clause.
TypeTrait
Names for traits that operate specifically on types.
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
This represents '#pragma omp target parallel for simd' directive.
OpenMP 4.0 [2.4, Array Sections].
ConditionalOperator - The ?: ternary operator.
OpenMPDirectiveKind getCancelRegion() const
Get cancellation region for the current cancellation point.
llvm::APInt getValue() const
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
CompoundStmt - This represents a group of statements like { stmt stmt }.
void dumpPretty(const ASTContext &Context) const
dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source...
Represents a prototype with parameter type info, e.g.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
This represents 'threads' clause in the '#pragma omp ...' directive.
StringRef getAsmString() const
CXXMethodDecl * getMethodDecl() const
Retrieves the declaration of the called method.
This represents '#pragma omp taskgroup' directive.
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
const Expr * getControllingExpr() const
This represents clause 'aligned' in the '#pragma omp ...' directives.
Expr * getQueriedExpression() const
NestedNameSpecifierLoc getQualifierLoc() const
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
This represents clause 'task_reduction' in the '#pragma omp taskgroup' directives.
Represents a call to the builtin function __builtin_va_arg.
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
bool isUnarySelector() const
This represents '#pragma omp distribute' directive.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
unsigned getNumExprs() const
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
llvm::MutableArrayRef< Designator > designators()
This represents 'proc_bind' clause in the '#pragma omp ...' directive.
bool isMutable() const
Determine whether the lambda is mutable, meaning that any captures values can be modified.
This represents 'capture' clause in the '#pragma omp atomic' directive.
Expr - This represents one expression.
StringRef getName() const
Return the actual identifier string.
const Expr * getExpr(unsigned Init) const
void outputString(raw_ostream &OS) const
unsigned getNumArgs() const
static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, bool PrintSuffix)
This represents 'simdlen' clause in the '#pragma omp ...' directive.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Expr * getCondition() const
Returns condition.
Represents a C++ functional cast expression that builds a temporary object.
A C++ const_cast expression (C++ [expr.const.cast]).
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
ObjCMethodDecl * getImplicitPropertyGetter() const
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Expr * getArrayRangeStart(const Designator &D) const
Represents Objective-C's @synchronized statement.
ObjCSelectorExpr used for @selector in Objective-C.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Represents an expression that computes the length of a parameter pack.
CXXTryStmt - A C++ try block, including all handlers.
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
This represents '#pragma omp target teams distribute simd' combined directive.
This represents 'ordered' clause in the '#pragma omp ...' directive.
Selector getSelector() const
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
QualType getAllocatedType() const
StringRef getInputName(unsigned i) const
Expr * getSubExpr() const
This represents '#pragma omp for' directive.
Represents a folding of a pack over an operator.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
This represents '#pragma omp target teams' directive.
An expression that sends a message to the given Objective-C object or class.
unsigned getNumComponents() const
This represents a Microsoft inline-assembly statement extension.
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
A member reference to an MSPropertyDecl.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Expr * getDevice()
Return device number.
This represents '#pragma omp cancel' directive.
This represents 'collapse' clause in the '#pragma omp ...' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
NestedNameSpecifierLoc getQualifierLoc() const
Gets the nested name specifier.
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
This represents '#pragma omp flush' directive.
This represents '#pragma omp parallel for simd' directive.
InitListExpr * getUpdater() const
DoStmt - This represents a 'do/while' stmt.
This represents 'seq_cst' clause in the '#pragma omp atomic' directive.
This represents 'untied' clause in the '#pragma omp ...' directive.
unsigned getNumSubExprs() const
getNumSubExprs - Return the size of the SubExprs array.
param_iterator param_begin()
LabelDecl * getLabel() const
This represents '#pragma omp target enter data' directive.
This represents 'num_teams' clause in the '#pragma omp ...' directive.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
ConvertVectorExpr - Clang builtin function __builtin_convertvector This AST node provides support for...
const StringLiteral * getAsmString() const
This captures a statement into a function.
Represents a call to an inherited base class constructor from an inheriting constructor.
operator "" X (const CharT *, size_t)
Expr * getArrayRangeEnd(const Designator &D) const
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Raw form: operator "" X<cs...> ()
Expr * getNumForLoops() const
Return the number of associated for-loops.
This represents '#pragma omp single' directive.
This represents 'hint' clause in the '#pragma omp ...' directive.
llvm::iterator_range< child_iterator > child_range
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This is a basic class for representing single OpenMP executable directive.
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
static const char * getExpressionTraitName(ExpressionTrait ET)
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Expr * getCondition() const
Returns condition.
This represents 'schedule' clause in the '#pragma omp ...' directive.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Represents a call to a member function that may be written either with member call syntax (e...
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
CompoundStmt * getBlock() const
This represents clause 'shared' in the '#pragma omp ...' directives.
const Expr * getCond() const
Represents a static or instance method of a struct/union/class.
Expr * getSrcExpr() const
getSrcExpr - Return the Expr to be converted.
Expr * getPriority()
Return Priority number.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ArrayRef< ParmVarDecl * > parameters() const
This represents '#pragma omp taskwait' directive.
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
This file defines OpenMP nodes for declarative directives.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
NamedDecl * getPack() const
Retrieve the parameter pack.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>.
ObjCProtocolExpr used for protocol expression in Objective-C.
bool isInitCapture(const LambdaCapture *Capture) const
Determine whether one of this lambda's captures is an init-capture.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
LiteralOperatorKind getLiteralOperatorKind() const
Returns the kind of literal operator invocation which this expression represents. ...
capture_iterator explicit_capture_end() const
Retrieve an iterator pointing past the end of the sequence of explicit lambda captures.
QualType getAssocType(unsigned i) const
OpenMPMapClauseKind getMapTypeModifier() const LLVM_READONLY
Fetches the map type modifier for the clause.
ParmVarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
This represents '#pragma omp target' directive.
Expr * getInputExpr(unsigned i)
static const char * getTypeTraitName(TypeTrait TT)
TypeTrait getTrait() const
Determine which type trait this expression uses.
StringRef getOutputName(unsigned i) const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
An expression trait intrinsic.
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
This represents '#pragma omp ordered' directive.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
ArrayRef< TemplateArgumentLoc > template_arguments() const
const Expr * getBase() const
This represents '#pragma omp target update' directive.
ObjCBoxedExpr - used for generalized expression boxing.
Expr * getGrainsize() const
Return safe iteration space distance.
const BlockDecl * getBlockDecl() const
bool isObjectReceiver() const
bool isParenTypeId() const
QualType getType() const
Return the type wrapped by this type source info.
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
const OffsetOfNode & getComponent(unsigned Idx) const
A qualified reference to a name whose declaration cannot yet be resolved.
Expr * Value
The value of the dictionary element.
CompoundAssignOperator - For compound assignments (e.g.
Represents a C11 generic selection.
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
AddrLabelExpr - The GNU address of label extension, representing &&label.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
ast_type_traits::DynTypedNode Node
Represents a reference to a function parameter pack that has been substituted but not yet expanded...
Represents a template argument.
Expr * getReplacement() const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
NullStmt - This is the null statement ";": C99 6.8.3p3.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
const Expr * getSubExpr() const
bool isImplicitProperty() const
Stmt * getBody() const
Retrieve the body of the coroutine as written.
This represents 'device' clause in the '#pragma omp ...' directive.
const Expr * getAssocExpr(unsigned i) const
StringRef getOpcodeStr() const
[C99 6.4.2.2] - A predefined identifier such as func.
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static LLVM_READONLY bool isPrintable(unsigned char c)
Return true if this character is an ASCII printable character; that is, a character that should take ...
const Stmt * getBody() const
This represents '#pragma omp section' directive.
This represents '#pragma omp teams distribute' directive.
SourceLocation getLParenLoc() const
bool isClassReceiver() const
A runtime availability query.
A C++ reinterpret_cast expression (C++ [expr.reinterpret.cast]).
This represents '#pragma omp simd' directive.
Represents a 'co_yield' expression.
const Expr * getSynchExpr() const
unsigned getNumHandlers() const
Expr * getNumTasks() const
Return safe iteration space distance.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Represents a C++11 pack expansion that produces a sequence of expressions.
unsigned getNumPlacementArgs() const
This represents clause 'linear' in the '#pragma omp ...' directives.
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
Selector getSelector() const
bool isTypeOperand() const
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
detail::InMemoryDirectory::const_iterator E
const Expr * getRetValue() const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
unsigned getNumArgs() const
This represents '#pragma omp atomic' directive.
Expr * getBaseExpr() const
llvm::APFloat getValue() const
Represents a __leave statement.
const Stmt * getThen() const
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SwitchStmt - This represents a 'switch' stmt.
Capturing variable-length array type.
Not an overloaded operator.
Expr * getSafelen() const
Return safe iteration space distance.
Represents the body of a coroutine.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
const T * getAs() const
Member-template getAs<specific type>'.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
const Stmt * getSubStmt() const
capture_iterator explicit_capture_begin() const
Retrieve an iterator pointing to the first explicit lambda capture.
Represents Objective-C's collection statement.
static StringRef getIdentTypeName(IdentType IT)
ObjCEncodeExpr, used for @encode in Objective-C.
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword...
An implicit indirection through a C++ base class, when the field found is in a base class...
Represents a call to a CUDA kernel function.
Represents a 'co_await' expression.
MutableArrayRef< ParmVarDecl * >::iterator param_iterator
Expr * getArg(unsigned Arg)
Return the specified argument.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Expr * getExprOperand() const
bool hasTemplateKeyword() const
Determines whether the member name was preceded by the template keyword.
Represents Objective-C's @finally statement.
const Expr * getSubExpr() const
Expr * getKeyExpr() const
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
LabelDecl * getLabel() const
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Capturing the *this object by reference.
This represents 'write' clause in the '#pragma omp atomic' directive.
ObjCPropertyDecl * getExplicitProperty() const
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
const char * getOpenMPDirectiveName(OpenMPDirectiveKind Kind)
const Expr * getInitializer() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
bool hasAssociatedStmt() const
Returns true if directive has associated statement.
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
void printExceptionSpecification(raw_ostream &OS, const PrintingPolicy &Policy) const
GotoStmt - This represents a direct goto.
ArrayRef< const Attr * > getAttrs() const
A use of a default initializer in a constructor or in aggregate initialization.
A template argument list.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
const StringLiteral * getInputConstraintLiteral(unsigned i) const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
const Expr * getSubExpr() const
const IdentifierInfo * getUDSuffix() const
Returns the ud-suffix specified for this literal.
This represents '#pragma omp target parallel' directive.
This represents 'nowait' clause in the '#pragma omp ...' directive.
ContinueStmt - This represents a continue.
Represents a loop initializing the elements of an array.
This represents 'num_tasks' clause in the '#pragma omp ...' directive.
QualType getEncodedType() const
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
VarDecl * getLoopVariable()
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
WhileStmt - This represents a 'while' stmt.
const Expr * getCond() const
Expr * getThreadLimit()
Return ThreadLimit number.
This class is used for builtin types like 'int'.
CompoundStmt * getTryBlock()
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
Represents Objective-C's @try ... @catch ... @finally statement.
This represents '#pragma omp taskloop simd' directive.
const Expr * getThrowExpr() const
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getPattern()
Retrieve the pattern of the pack expansion.
This represents 'dist_schedule' clause in the '#pragma omp ...' directive.
bool isIfExists() const
Determine whether this is an __if_exists statement.
static Decl::Kind getKind(const Decl *D)
Abstract class common to all of the C++ "named"/"keyword" casts.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
This represents '#pragma omp sections' directive.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
const Stmt * getTryBody() const
Retrieve the @try body.
This represents '#pragma omp target data' directive.
VarDecl * getExceptionDecl() const
A reference to a declared variable, function, enum, etc.
ArrayRef< TemplateArgumentLoc > template_arguments() const
BreakStmt - This represents a break.
SourceLocation getColonLoc() const
Expr * getChunkSize()
Get chunk size.
const Expr * getInit(unsigned Init) const
const Expr * getSubExpr() const
bool hasTemplateKeyword() const
Determines whether the name was preceded by the template keyword.
ExprIterator arg_iterator
BinaryOperatorKind getOperator() const
unsigned getNumClobbers() const
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
A boolean literal, per ([C++ lex.bool] Boolean literals).
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
QualType getDestroyedType() const
Retrieve the type being destroyed.
CompoundStmt * getTryBlock() const
This represents '#pragma omp parallel sections' directive.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Expr * getOperand() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
const CallExpr * getConfig() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isTypeOperand() const
The receiver is a superclass.
const char * getName() const
Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
Expr * getSubExpr() const
Get the initializer to use for each array element.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Represents Objective-C's @autoreleasepool Statement.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
Expr * getOrderFail() const
Represents an implicitly-generated value initialization of an object of a given type.
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
This represents '#pragma omp target parallel for' directive.
Attr - This represents one attribute.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
operator "" X (unsigned long long)
Expr * getLength()
Get length of array section.
Kind getKind() const
Determine what kind of offsetof node this is.
Expr * getCookedLiteral()
If this is not a raw user-defined literal, get the underlying cooked literal (representing the litera...
SEHFinallyStmt * getFinallyHandler() const
Expr * getBase()
An array section can be written only as Base[LowerBound:Length].
QualType getArgumentType() const
This represents '#pragma omp taskloop' directive.