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))
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) {
131 Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
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) {
613 Node->
getCondition()->printPretty(OS,
nullptr, Policy, 0);
617 void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
619 Node->
getCondition()->printPretty(OS,
nullptr, Policy, 0);
624 OS <<
"num_threads(";
631 Node->
getSafelen()->printPretty(OS,
nullptr, Policy, 0);
637 Node->
getSimdlen()->printPretty(OS,
nullptr, Policy, 0);
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"; }
728 Node->
getDevice()->printPretty(OS,
nullptr, Policy, 0);
734 Node->
getNumTeams()->printPretty(OS,
nullptr, Policy, 0);
739 OS <<
"thread_limit(";
746 Node->
getPriority()->printPretty(OS,
nullptr, Policy, 0);
752 Node->
getGrainsize()->printPretty(OS,
nullptr, Policy, 0);
758 Node->
getNumTasks()->printPretty(OS,
nullptr, Policy, 0);
762 void OMPClausePrinter::VisitOMPHintClause(
OMPHintClause *Node) {
764 Node->
getHint()->printPretty(OS,
nullptr, Policy, 0);
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,
' ');
842 if (Node->getModifierLoc().isValid()) {
846 VisitOMPClauseList(Node,
'(');
847 if (Node->getModifierLoc().isValid())
849 if (Node->getStep() !=
nullptr) {
851 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
858 if (!Node->varlist_empty()) {
860 VisitOMPClauseList(Node,
'(');
863 Node->
getAlignment()->printPretty(OS,
nullptr, Policy, 0);
870 if (!Node->varlist_empty()) {
872 VisitOMPClauseList(Node,
'(');
878 if (!Node->varlist_empty()) {
880 VisitOMPClauseList(Node,
'(');
885 void OMPClausePrinter::VisitOMPFlushClause(
OMPFlushClause *Node) {
886 if (!Node->varlist_empty()) {
887 VisitOMPClauseList(Node,
'(');
896 if (!Node->varlist_empty()) {
898 VisitOMPClauseList(Node,
' ');
903 void OMPClausePrinter::VisitOMPMapClause(
OMPMapClause *Node) {
904 if (!Node->varlist_empty()) {
915 VisitOMPClauseList(Node,
' ');
920 void OMPClausePrinter::VisitOMPToClause(
OMPToClause *Node) {
921 if (!Node->varlist_empty()) {
923 VisitOMPClauseList(Node,
'(');
928 void OMPClausePrinter::VisitOMPFromClause(
OMPFromClause *Node) {
929 if (!Node->varlist_empty()) {
931 VisitOMPClauseList(Node,
'(');
941 E->printPretty(OS,
nullptr, Policy);
957 if (!Node->varlist_empty()) {
958 OS <<
"use_device_ptr";
959 VisitOMPClauseList(Node,
'(');
965 if (!Node->varlist_empty()) {
966 OS <<
"is_device_ptr";
967 VisitOMPClauseList(Node,
'(');
978 OMPClausePrinter Printer(OS, Policy);
982 if (*I && !(*I)->isImplicit()) {
989 "Expected captured statement!");
996 Indent() <<
"#pragma omp parallel ";
997 PrintOMPExecutableDirective(Node);
1001 Indent() <<
"#pragma omp simd ";
1002 PrintOMPExecutableDirective(Node);
1006 Indent() <<
"#pragma omp for ";
1007 PrintOMPExecutableDirective(Node);
1011 Indent() <<
"#pragma omp for simd ";
1012 PrintOMPExecutableDirective(Node);
1016 Indent() <<
"#pragma omp sections ";
1017 PrintOMPExecutableDirective(Node);
1021 Indent() <<
"#pragma omp section";
1022 PrintOMPExecutableDirective(Node);
1026 Indent() <<
"#pragma omp single ";
1027 PrintOMPExecutableDirective(Node);
1031 Indent() <<
"#pragma omp master";
1032 PrintOMPExecutableDirective(Node);
1036 Indent() <<
"#pragma omp critical";
1043 PrintOMPExecutableDirective(Node);
1047 Indent() <<
"#pragma omp parallel for ";
1048 PrintOMPExecutableDirective(Node);
1051 void StmtPrinter::VisitOMPParallelForSimdDirective(
1053 Indent() <<
"#pragma omp parallel for simd ";
1054 PrintOMPExecutableDirective(Node);
1057 void StmtPrinter::VisitOMPParallelSectionsDirective(
1059 Indent() <<
"#pragma omp parallel sections ";
1060 PrintOMPExecutableDirective(Node);
1064 Indent() <<
"#pragma omp task ";
1065 PrintOMPExecutableDirective(Node);
1069 Indent() <<
"#pragma omp taskyield";
1070 PrintOMPExecutableDirective(Node);
1074 Indent() <<
"#pragma omp barrier";
1075 PrintOMPExecutableDirective(Node);
1079 Indent() <<
"#pragma omp taskwait";
1080 PrintOMPExecutableDirective(Node);
1084 Indent() <<
"#pragma omp taskgroup";
1085 PrintOMPExecutableDirective(Node);
1089 Indent() <<
"#pragma omp flush ";
1090 PrintOMPExecutableDirective(Node);
1094 Indent() <<
"#pragma omp ordered ";
1095 PrintOMPExecutableDirective(Node);
1099 Indent() <<
"#pragma omp atomic ";
1100 PrintOMPExecutableDirective(Node);
1104 Indent() <<
"#pragma omp target ";
1105 PrintOMPExecutableDirective(Node);
1109 Indent() <<
"#pragma omp target data ";
1110 PrintOMPExecutableDirective(Node);
1113 void StmtPrinter::VisitOMPTargetEnterDataDirective(
1115 Indent() <<
"#pragma omp target enter data ";
1116 PrintOMPExecutableDirective(Node);
1119 void StmtPrinter::VisitOMPTargetExitDataDirective(
1121 Indent() <<
"#pragma omp target exit data ";
1122 PrintOMPExecutableDirective(Node);
1125 void StmtPrinter::VisitOMPTargetParallelDirective(
1127 Indent() <<
"#pragma omp target parallel ";
1128 PrintOMPExecutableDirective(Node);
1131 void StmtPrinter::VisitOMPTargetParallelForDirective(
1133 Indent() <<
"#pragma omp target parallel for ";
1134 PrintOMPExecutableDirective(Node);
1138 Indent() <<
"#pragma omp teams ";
1139 PrintOMPExecutableDirective(Node);
1142 void StmtPrinter::VisitOMPCancellationPointDirective(
1144 Indent() <<
"#pragma omp cancellation point "
1146 PrintOMPExecutableDirective(Node);
1150 Indent() <<
"#pragma omp cancel "
1152 PrintOMPExecutableDirective(Node);
1156 Indent() <<
"#pragma omp taskloop ";
1157 PrintOMPExecutableDirective(Node);
1160 void StmtPrinter::VisitOMPTaskLoopSimdDirective(
1162 Indent() <<
"#pragma omp taskloop simd ";
1163 PrintOMPExecutableDirective(Node);
1167 Indent() <<
"#pragma omp distribute ";
1168 PrintOMPExecutableDirective(Node);
1171 void StmtPrinter::VisitOMPTargetUpdateDirective(
1173 Indent() <<
"#pragma omp target update ";
1174 PrintOMPExecutableDirective(Node);
1177 void StmtPrinter::VisitOMPDistributeParallelForDirective(
1179 Indent() <<
"#pragma omp distribute parallel for ";
1180 PrintOMPExecutableDirective(Node);
1183 void StmtPrinter::VisitOMPDistributeParallelForSimdDirective(
1185 Indent() <<
"#pragma omp distribute parallel for simd ";
1186 PrintOMPExecutableDirective(Node);
1189 void StmtPrinter::VisitOMPDistributeSimdDirective(
1191 Indent() <<
"#pragma omp distribute simd ";
1192 PrintOMPExecutableDirective(Node);
1195 void StmtPrinter::VisitOMPTargetParallelForSimdDirective(
1197 Indent() <<
"#pragma omp target parallel for simd ";
1198 PrintOMPExecutableDirective(Node);
1205 void StmtPrinter::VisitDeclRefExpr(
DeclRefExpr *Node) {
1206 if (
auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->
getDecl())) {
1207 OCED->getInit()->IgnoreImpCasts()->printPretty(OS,
nullptr, Policy);
1211 Qualifier->print(OS, Policy);
1220 void StmtPrinter::VisitDependentScopeDeclRefExpr(
1223 Qualifier->print(OS, Policy);
1246 OS << (Node->
isArrow() ?
"->" :
".");
1330 if (value < 256 &&
isPrintable((
unsigned char)value))
1331 OS <<
"'" << (
char)value <<
"'";
1332 else if (value < 256)
1333 OS <<
"'\\x" << llvm::format(
"%02x", value) <<
"'";
1334 else if (value <= 0xFFFF)
1335 OS <<
"'\\u" << llvm::format(
"%04x", value) <<
"'";
1337 OS <<
"'\\U" << llvm::format(
"%08x", value) <<
"'";
1343 OS << Node->
getValue().toString(10, isSigned);
1347 default: llvm_unreachable(
"Unexpected type for integer literal!");
1348 case BuiltinType::Char_S:
1349 case BuiltinType::Char_U: OS <<
"i8";
break;
1350 case BuiltinType::UChar: OS <<
"Ui8";
break;
1351 case BuiltinType::Short: OS <<
"i16";
break;
1352 case BuiltinType::UShort: OS <<
"Ui16";
break;
1353 case BuiltinType::Int:
break;
1354 case BuiltinType::UInt: OS <<
'U';
break;
1355 case BuiltinType::Long: OS <<
'L';
break;
1356 case BuiltinType::ULong: OS <<
"UL";
break;
1357 case BuiltinType::LongLong: OS <<
"LL";
break;
1358 case BuiltinType::ULongLong: OS <<
"ULL";
break;
1367 if (Str.find_first_not_of(
"-0123456789") == StringRef::npos)
1375 default: llvm_unreachable(
"Unexpected type for float literal!");
1376 case BuiltinType::Half:
break;
1377 case BuiltinType::Double:
break;
1378 case BuiltinType::Float: OS <<
'F';
break;
1379 case BuiltinType::LongDouble: OS <<
'L';
break;
1380 case BuiltinType::Float128: OS <<
'Q';
break;
1396 void StmtPrinter::VisitParenExpr(
ParenExpr *Node) {
1427 void StmtPrinter::VisitOffsetOfExpr(
OffsetOfExpr *Node) {
1428 OS <<
"__builtin_offsetof(";
1431 bool PrintedSomething =
false;
1439 PrintedSomething =
true;
1452 if (PrintedSomething)
1455 PrintedSomething =
true;
1469 else if (Policy.UnderscoreAlignof)
1478 OS <<
"__builtin_omp_required_simd_align";
1500 T.
print(OS, Policy);
1508 PrintExpr(Node->
getLHS());
1510 PrintExpr(Node->
getRHS());
1527 void StmtPrinter::PrintCallArgs(
CallExpr *Call) {
1528 for (
unsigned i = 0, e = Call->
getNumArgs(); i != e; ++i) {
1529 if (isa<CXXDefaultArgExpr>(Call->
getArg(i))) {
1535 PrintExpr(Call->
getArg(i));
1539 void StmtPrinter::VisitCallExpr(
CallExpr *Call) {
1542 PrintCallArgs(Call);
1545 void StmtPrinter::VisitMemberExpr(
MemberExpr *Node) {
1551 ? dyn_cast<
FieldDecl>(ParentMember->getMemberDecl()) :
nullptr;
1553 if (!ParentDecl || !ParentDecl->isAnonymousStructOrUnion())
1554 OS << (Node->
isArrow() ?
"->" :
".");
1557 if (FD->isAnonymousStructOrUnion())
1561 Qualifier->print(OS, Policy);
1569 void StmtPrinter::VisitObjCIsaExpr(
ObjCIsaExpr *Node) {
1571 OS << (Node->
isArrow() ?
"->isa" :
".isa");
1596 PrintExpr(Node->
getLHS());
1598 PrintExpr(Node->
getRHS());
1601 PrintExpr(Node->
getLHS());
1603 PrintExpr(Node->
getRHS());
1608 PrintExpr(Node->
getLHS());
1610 PrintExpr(Node->
getRHS());
1625 void StmtPrinter::VisitStmtExpr(
StmtExpr *E) {
1631 void StmtPrinter::VisitChooseExpr(
ChooseExpr *Node) {
1632 OS <<
"__builtin_choose_expr(";
1635 PrintExpr(Node->
getLHS());
1637 PrintExpr(Node->
getRHS());
1641 void StmtPrinter::VisitGNUNullExpr(
GNUNullExpr *) {
1646 OS <<
"__builtin_shufflevector(";
1655 OS <<
"__builtin_convertvector(";
1662 void StmtPrinter::VisitInitListExpr(
InitListExpr* Node) {
1669 for (
unsigned i = 0, e = Node->
getNumInits(); i != e; ++i) {
1681 for (
unsigned i = 0, e = Node->
getNumExprs(); i != e; ++i) {
1689 bool NeedsEquals =
true;
1691 if (D.isFieldDesignator()) {
1692 if (D.getDotLoc().isInvalid()) {
1694 OS << II->getName() <<
":";
1695 NeedsEquals =
false;
1698 OS <<
"." << D.getFieldName()->getName();
1702 if (D.isArrayDesignator()) {
1720 void StmtPrinter::VisitDesignatedInitUpdateExpr(
1727 OS <<
"/*updater*/";
1732 void StmtPrinter::VisitNoInitExpr(
NoInitExpr *Node) {
1733 OS <<
"/*no init*/";
1738 OS <<
"/*implicit*/";
1742 OS <<
"/*implicit*/(";
1752 void StmtPrinter::VisitVAArgExpr(
VAArgExpr *Node) {
1753 OS <<
"__builtin_va_arg(";
1764 void StmtPrinter::VisitAtomicExpr(
AtomicExpr *Node) {
1765 const char *
Name =
nullptr;
1766 switch (Node->
getOp()) {
1767 #define BUILTIN(ID, TYPE, ATTRS)
1768 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1769 case AtomicExpr::AO ## ID: \
1772 #include "clang/Basic/Builtins.def"
1777 PrintExpr(Node->
getPtr());
1778 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_load &&
1779 Node->
getOp() != AtomicExpr::AO__atomic_load_n) {
1783 if (Node->
getOp() == AtomicExpr::AO__atomic_exchange ||
1788 if (Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1789 Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1793 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_init) {
1808 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
1810 #include "clang/Basic/OperatorKinds.def"
1814 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1816 OS << OpStrings[
Kind] <<
' ';
1817 PrintExpr(Node->
getArg(0));
1819 PrintExpr(Node->
getArg(0));
1820 OS <<
' ' << OpStrings[
Kind];
1822 }
else if (Kind == OO_Arrow) {
1823 PrintExpr(Node->
getArg(0));
1824 }
else if (Kind == OO_Call) {
1825 PrintExpr(Node->
getArg(0));
1827 for (
unsigned ArgIdx = 1; ArgIdx < Node->
getNumArgs(); ++ArgIdx) {
1830 if (!isa<CXXDefaultArgExpr>(Node->
getArg(ArgIdx)))
1831 PrintExpr(Node->
getArg(ArgIdx));
1834 }
else if (Kind == OO_Subscript) {
1835 PrintExpr(Node->
getArg(0));
1837 PrintExpr(Node->
getArg(1));
1840 OS << OpStrings[
Kind] <<
' ';
1841 PrintExpr(Node->
getArg(0));
1843 PrintExpr(Node->
getArg(0));
1844 OS <<
' ' << OpStrings[
Kind] <<
' ';
1845 PrintExpr(Node->
getArg(1));
1847 llvm_unreachable(
"unknown overloaded operator");
1854 if (MD && isa<CXXConversionDecl>(MD)) {
1858 VisitCallExpr(cast<CallExpr>(Node));
1866 PrintCallArgs(Node);
1879 VisitCXXNamedCastExpr(Node);
1883 VisitCXXNamedCastExpr(Node);
1887 VisitCXXNamedCastExpr(Node);
1891 VisitCXXNamedCastExpr(Node);
1922 Qualifier->print(OS, Policy);
1929 PrintExpr(Node->
getIdx());
1941 cast<FunctionDecl>(DRE->
getDecl())->getTemplateSpecializationArgs();
1944 if (Args->size() != 1) {
1947 OS, Args->asArray(), Policy);
1954 char C = (char)
P.getAsIntegral().getZExtValue();
1962 OS << Int->
getValue().toString(10,
false);
1980 OS << (Node->
getValue() ?
"true" :
"false");
1987 void StmtPrinter::VisitCXXThisExpr(
CXXThisExpr *Node) {
1991 void StmtPrinter::VisitCXXThrowExpr(
CXXThrowExpr *Node) {
2033 Arg != ArgEnd; ++Arg) {
2034 if ((*Arg)->isDefaultArgument())
2048 void StmtPrinter::VisitLambdaExpr(
LambdaExpr *Node) {
2050 bool NeedComma =
false;
2073 switch (
C->getCaptureKind()) {
2083 OS <<
C->getCapturedVar()->getName();
2087 OS <<
C->getCapturedVar()->getName();
2090 llvm_unreachable(
"VLA type in explicit captures.");
2094 PrintExpr(
C->getCapturedVar()->getInit());
2108 std::string ParamStr =
P->getNameAsString();
2109 P->getOriginalType().print(OS, Policy, ParamStr);
2142 TSInfo->getType().print(OS, Policy);
2148 void StmtPrinter::VisitCXXNewExpr(
CXXNewExpr *E) {
2156 for (
unsigned i = 1; i < NumPlace; ++i) {
2168 llvm::raw_string_ostream s(TypeS);
2170 Size->printPretty(s, Helper, Policy);
2207 OS << II->getName();
2216 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
2217 if (isa<CXXDefaultArgExpr>(E->
getArg(i))) {
2232 OS <<
"<forwarded>";
2245 StmtPrinter::VisitCXXUnresolvedConstructExpr(
2251 Arg != ArgEnd; ++Arg) {
2259 void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2263 OS << (Node->
isArrow() ?
"->" :
".");
2266 Qualifier->print(OS, Policy);
2278 OS << (Node->
isArrow() ?
"->" :
".");
2281 Qualifier->print(OS, Policy);
2292 #define TYPE_TRAIT_1(Spelling, Name, Key) \
2293 case clang::UTT_##Name: return #Spelling;
2294 #define TYPE_TRAIT_2(Spelling, Name, Key) \
2295 case clang::BTT_##Name: return #Spelling;
2296 #define TYPE_TRAIT_N(Spelling, Name, Key) \
2297 case clang::TT_##Name: return #Spelling;
2298 #include "clang/Basic/TokenKinds.def"
2300 llvm_unreachable(
"Type trait not covered by switch");
2308 llvm_unreachable(
"Array type trait not covered by switch");
2316 llvm_unreachable(
"Expression type trait not covered by switch");
2321 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++
I) {
2353 OS <<
"sizeof...(" << *E->
getPack() <<
")";
2356 void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2361 void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2374 void StmtPrinter::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2403 void StmtPrinter::VisitCoawaitExpr(
CoawaitExpr *S) {
2408 void StmtPrinter::VisitCoyieldExpr(
CoyieldExpr *S) {
2427 ObjCArrayLiteral::child_range Ch = E->
children();
2428 for (
auto I = Ch.begin(), E = Ch.end(); I !=
E; ++
I) {
2429 if (I != Ch.begin())
2445 Visit(Element.
Value);
2465 OS <<
"@protocol(" << *Node->
getProtocol() <<
')';
2490 for (
unsigned i = 0, e = Mess->
getNumArgs(); i != e; ++i) {
2492 if (i > 0) OS <<
' ';
2500 PrintExpr(Mess->
getArg(i));
2507 OS << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2523 void StmtPrinter::VisitBlockExpr(
BlockExpr *Node) {
2529 if (isa<FunctionNoProtoType>(AFT)) {
2531 }
else if (!BD->
param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2536 std::string ParamStr = (*AI)->getNameAsString();
2537 (*AI)->getType().print(OS, Policy, ParamStr);
2554 void StmtPrinter::VisitTypoExpr(
TypoExpr *Node) {
2556 llvm_unreachable(
"Cannot print TypoExpr nodes");
2559 void StmtPrinter::VisitAsTypeExpr(
AsTypeExpr *Node) {
2560 OS <<
"__builtin_astype(";
2575 void Stmt::printPretty(raw_ostream &OS,
2578 unsigned Indentation)
const {
2579 StmtPrinter
P(OS, Helper, Policy, Indentation);
2580 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.
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.
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.
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
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.
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
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
bool isRecordType() const
This represents 'grainsize' clause in the '#pragma omp ...' directive.
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.
Represents Objective-C's @throw statement.
const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)
InitListExpr * getSyntacticForm() const
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...
A container of type source information.
ArrayRef< TemplateArgumentLoc > template_arguments() const
This represents 'update' clause in the '#pragma omp atomic' directive.
const Stmt * getElse() const
This represents '#pragma omp parallel for' directive.
MS property subscript expression.
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)
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.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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)
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
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
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.
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 }.
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...
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.
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 '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.
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.
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
Expr * getOperand() const
Retrieve the operand of the 'co_return' statement.
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
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...
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.
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.
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.
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.
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.