26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/Support/Format.h"
28 using namespace clang;
35 class StmtPrinter :
public StmtVisitor<StmtPrinter> {
44 unsigned Indentation = 0)
45 : OS(os), IndentLevel(Indentation), Helper(helper), Policy(Policy) {}
47 void PrintStmt(
Stmt *
S) {
48 PrintStmt(S, Policy.Indentation);
51 void PrintStmt(
Stmt *
S,
int SubIndent) {
52 IndentLevel += SubIndent;
53 if (S && isa<Expr>(S)) {
61 Indent() <<
"<<<NULL STATEMENT>>>\n";
63 IndentLevel -= SubIndent;
67 void PrintRawDecl(
Decl *D);
68 void PrintRawDeclStmt(
const DeclStmt *S);
69 void PrintRawIfStmt(
IfStmt *If);
76 void PrintExpr(
Expr *
E) {
84 for (
int i = 0, e = IndentLevel+
Delta; i < e; ++i)
90 if (Helper && Helper->handledStmt(S,OS))
96 Indent() <<
"<<unknown stmt type>>\n";
98 void VisitExpr(
Expr *
Node) LLVM_ATTRIBUTE_UNUSED {
99 OS <<
"<<unknown expr type>>";
103 #define ABSTRACT_STMT(CLASS)
104 #define STMT(CLASS, PARENT) \
105 void Visit##CLASS(CLASS *Node);
106 #include "clang/AST/StmtNodes.inc"
118 for (
auto *
I : Node->
body())
124 void StmtPrinter::PrintRawDecl(
Decl *D) {
125 D->
print(OS, Policy, IndentLevel);
128 void StmtPrinter::PrintRawDeclStmt(
const DeclStmt *S) {
139 PrintRawDeclStmt(Node);
145 PrintRawCompoundStmt(Node);
151 PrintExpr(Node->
getLHS());
154 PrintExpr(Node->
getRHS());
161 void StmtPrinter::VisitDefaultStmt(
DefaultStmt *Node) {
162 Indent(-1) <<
"default:\n";
166 void StmtPrinter::VisitLabelStmt(
LabelStmt *Node) {
179 void StmtPrinter::PrintRawIfStmt(
IfStmt *If) {
182 PrintRawDeclStmt(DS);
189 PrintRawCompoundStmt(CS);
190 OS << (If->
getElse() ?
' ' :
'\n');
202 PrintRawCompoundStmt(CS);
204 }
else if (
IfStmt *ElseIf = dyn_cast<IfStmt>(Else)) {
206 PrintRawIfStmt(ElseIf);
214 void StmtPrinter::VisitIfStmt(
IfStmt *If) {
219 void StmtPrinter::VisitSwitchStmt(
SwitchStmt *Node) {
222 PrintRawDeclStmt(DS);
230 PrintRawCompoundStmt(CS);
238 void StmtPrinter::VisitWhileStmt(
WhileStmt *Node) {
241 PrintRawDeclStmt(DS);
248 void StmtPrinter::VisitDoStmt(
DoStmt *Node) {
251 PrintRawCompoundStmt(CS);
264 void StmtPrinter::VisitForStmt(
ForStmt *Node) {
268 PrintRawDeclStmt(DS);
270 PrintExpr(cast<Expr>(Node->
getInit()));
280 PrintExpr(Node->
getInc());
285 PrintRawCompoundStmt(CS);
296 PrintRawDeclStmt(DS);
304 PrintRawCompoundStmt(CS);
315 SubPolicy.SuppressInitializers =
true;
322 if (Policy.IncludeNewlines) OS <<
"\n";
328 OS <<
"__if_exists (";
330 OS <<
"__if_not_exists (";
334 Qualifier->print(OS, Policy);
341 void StmtPrinter::VisitGotoStmt(
GotoStmt *Node) {
343 if (Policy.IncludeNewlines) OS <<
"\n";
350 if (Policy.IncludeNewlines) OS <<
"\n";
353 void StmtPrinter::VisitContinueStmt(
ContinueStmt *Node) {
355 if (Policy.IncludeNewlines) OS <<
"\n";
358 void StmtPrinter::VisitBreakStmt(
BreakStmt *Node) {
360 if (Policy.IncludeNewlines) OS <<
"\n";
364 void StmtPrinter::VisitReturnStmt(
ReturnStmt *Node) {
371 if (Policy.IncludeNewlines) OS <<
"\n";
375 void StmtPrinter::VisitGCCAsmStmt(
GCCAsmStmt *Node) {
389 for (
unsigned i = 0, e = Node->
getNumOutputs(); i != e; ++i) {
409 for (
unsigned i = 0, e = Node->
getNumInputs(); i != e; ++i) {
437 if (Policy.IncludeNewlines) OS <<
"\n";
440 void StmtPrinter::VisitMSAsmStmt(
MSAsmStmt *Node) {
450 void StmtPrinter::VisitCapturedStmt(
CapturedStmt *Node) {
457 PrintRawCompoundStmt(TS);
470 PrintRawCompoundStmt(CS);
478 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
487 Indent() <<
"@catch (...) { /* todo */ } \n";
500 Indent() <<
"@synchronized (";
508 Indent() <<
"@autoreleasepool";
509 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(Node->
getSubStmt()));
513 void StmtPrinter::PrintRawCXXCatchStmt(
CXXCatchStmt *Node) {
516 PrintRawDecl(ExDecl);
523 void StmtPrinter::VisitCXXCatchStmt(
CXXCatchStmt *Node) {
525 PrintRawCXXCatchStmt(Node);
529 void StmtPrinter::VisitCXXTryStmt(
CXXTryStmt *Node) {
539 void StmtPrinter::VisitSEHTryStmt(
SEHTryStmt *Node) {
545 PrintRawSEHExceptHandler(E);
547 assert(F &&
"Must have a finally block...");
548 PrintRawSEHFinallyStmt(F);
555 PrintRawCompoundStmt(Node->
getBlock());
559 void StmtPrinter::PrintRawSEHExceptHandler(
SEHExceptStmt *Node) {
563 PrintRawCompoundStmt(Node->
getBlock());
569 PrintRawSEHExceptHandler(Node);
575 PrintRawSEHFinallyStmt(Node);
579 void StmtPrinter::VisitSEHLeaveStmt(
SEHLeaveStmt *Node) {
581 if (Policy.IncludeNewlines) OS <<
"\n";
593 template <
typename T>
594 void VisitOMPClauseList(T *Node,
char StartSym);
597 : OS(OS), Policy(Policy) { }
598 #define OPENMP_CLAUSE(Name, Class) \
599 void Visit##Class(Class *S);
600 #include "clang/Basic/OpenMPKinds.def"
603 void OMPClausePrinter::VisitOMPIfClause(
OMPIfClause *Node) {
607 Node->
getCondition()->printPretty(OS,
nullptr, Policy, 0);
611 void OMPClausePrinter::VisitOMPFinalClause(
OMPFinalClause *Node) {
613 Node->
getCondition()->printPretty(OS,
nullptr, Policy, 0);
618 OS <<
"num_threads(";
625 Node->
getSafelen()->printPretty(OS,
nullptr, Policy, 0);
631 Node->
getSimdlen()->printPretty(OS,
nullptr, Policy, 0);
677 Num->printPretty(OS,
nullptr, Policy, 0);
698 void OMPClausePrinter::VisitOMPReadClause(
OMPReadClause *) { OS <<
"read"; }
700 void OMPClausePrinter::VisitOMPWriteClause(
OMPWriteClause *) { OS <<
"write"; }
718 void OMPClausePrinter::VisitOMPSIMDClause(
OMPSIMDClause *) { OS <<
"simd"; }
722 Node->
getDevice()->printPretty(OS,
nullptr, Policy, 0);
728 Node->
getNumTeams()->printPretty(OS,
nullptr, Policy, 0);
733 OS <<
"thread_limit(";
740 Node->
getPriority()->printPretty(OS,
nullptr, Policy, 0);
746 Node->
getGrainsize()->printPretty(OS,
nullptr, Policy, 0);
752 Node->
getNumTasks()->printPretty(OS,
nullptr, Policy, 0);
756 void OMPClausePrinter::VisitOMPHintClause(
OMPHintClause *Node) {
758 Node->
getHint()->printPretty(OS,
nullptr, Policy, 0);
763 void OMPClausePrinter::VisitOMPClauseList(T *Node,
char StartSym) {
764 for (
typename T::varlist_iterator
I = Node->varlist_begin(),
765 E = Node->varlist_end();
767 assert(*
I &&
"Expected non-null Stmt");
769 OS << (
I == Node->varlist_begin() ? StartSym :
',');
770 cast<NamedDecl>(DRE->getDecl())->printQualifiedName(OS);
772 OS << (I == Node->varlist_begin() ? StartSym :
',');
773 (*I)->printPretty(OS,
nullptr, Policy, 0);
781 VisitOMPClauseList(Node,
'(');
788 OS <<
"firstprivate";
789 VisitOMPClauseList(Node,
'(');
797 VisitOMPClauseList(Node,
'(');
805 VisitOMPClauseList(Node,
'(');
817 if (QualifierLoc ==
nullptr && OOK !=
OO_None) {
822 if (QualifierLoc !=
nullptr)
823 QualifierLoc->
print(OS, Policy);
827 VisitOMPClauseList(Node,
' ');
835 if (Node->getModifierLoc().isValid()) {
839 VisitOMPClauseList(Node,
'(');
840 if (Node->getModifierLoc().isValid())
842 if (Node->getStep() !=
nullptr) {
844 Node->getStep()->printPretty(OS,
nullptr, Policy, 0);
851 if (!Node->varlist_empty()) {
853 VisitOMPClauseList(Node,
'(');
856 Node->
getAlignment()->printPretty(OS,
nullptr, Policy, 0);
863 if (!Node->varlist_empty()) {
865 VisitOMPClauseList(Node,
'(');
871 if (!Node->varlist_empty()) {
873 VisitOMPClauseList(Node,
'(');
878 void OMPClausePrinter::VisitOMPFlushClause(
OMPFlushClause *Node) {
879 if (!Node->varlist_empty()) {
880 VisitOMPClauseList(Node,
'(');
889 if (!Node->varlist_empty()) {
891 VisitOMPClauseList(Node,
' ');
896 void OMPClausePrinter::VisitOMPMapClause(
OMPMapClause *Node) {
897 if (!Node->varlist_empty()) {
908 VisitOMPClauseList(Node,
' ');
919 OMPClausePrinter Printer(OS, Policy);
923 if (*I && !(*I)->isImplicit()) {
930 "Expected captured statement!");
937 Indent() <<
"#pragma omp parallel ";
938 PrintOMPExecutableDirective(Node);
942 Indent() <<
"#pragma omp simd ";
943 PrintOMPExecutableDirective(Node);
947 Indent() <<
"#pragma omp for ";
948 PrintOMPExecutableDirective(Node);
952 Indent() <<
"#pragma omp for simd ";
953 PrintOMPExecutableDirective(Node);
957 Indent() <<
"#pragma omp sections ";
958 PrintOMPExecutableDirective(Node);
962 Indent() <<
"#pragma omp section";
963 PrintOMPExecutableDirective(Node);
967 Indent() <<
"#pragma omp single ";
968 PrintOMPExecutableDirective(Node);
972 Indent() <<
"#pragma omp master";
973 PrintOMPExecutableDirective(Node);
977 Indent() <<
"#pragma omp critical";
984 PrintOMPExecutableDirective(Node);
988 Indent() <<
"#pragma omp parallel for ";
989 PrintOMPExecutableDirective(Node);
992 void StmtPrinter::VisitOMPParallelForSimdDirective(
994 Indent() <<
"#pragma omp parallel for simd ";
995 PrintOMPExecutableDirective(Node);
998 void StmtPrinter::VisitOMPParallelSectionsDirective(
1000 Indent() <<
"#pragma omp parallel sections ";
1001 PrintOMPExecutableDirective(Node);
1005 Indent() <<
"#pragma omp task ";
1006 PrintOMPExecutableDirective(Node);
1010 Indent() <<
"#pragma omp taskyield";
1011 PrintOMPExecutableDirective(Node);
1015 Indent() <<
"#pragma omp barrier";
1016 PrintOMPExecutableDirective(Node);
1020 Indent() <<
"#pragma omp taskwait";
1021 PrintOMPExecutableDirective(Node);
1025 Indent() <<
"#pragma omp taskgroup";
1026 PrintOMPExecutableDirective(Node);
1030 Indent() <<
"#pragma omp flush ";
1031 PrintOMPExecutableDirective(Node);
1035 Indent() <<
"#pragma omp ordered ";
1036 PrintOMPExecutableDirective(Node);
1040 Indent() <<
"#pragma omp atomic ";
1041 PrintOMPExecutableDirective(Node);
1045 Indent() <<
"#pragma omp target ";
1046 PrintOMPExecutableDirective(Node);
1050 Indent() <<
"#pragma omp target data ";
1051 PrintOMPExecutableDirective(Node);
1055 Indent() <<
"#pragma omp teams ";
1056 PrintOMPExecutableDirective(Node);
1059 void StmtPrinter::VisitOMPCancellationPointDirective(
1061 Indent() <<
"#pragma omp cancellation point "
1063 PrintOMPExecutableDirective(Node);
1067 Indent() <<
"#pragma omp cancel "
1069 PrintOMPExecutableDirective(Node);
1073 Indent() <<
"#pragma omp taskloop ";
1074 PrintOMPExecutableDirective(Node);
1077 void StmtPrinter::VisitOMPTaskLoopSimdDirective(
1079 Indent() <<
"#pragma omp taskloop simd ";
1080 PrintOMPExecutableDirective(Node);
1084 Indent() <<
"#pragma omp distribute ";
1085 PrintOMPExecutableDirective(Node);
1092 void StmtPrinter::VisitDeclRefExpr(
DeclRefExpr *Node) {
1094 Qualifier->print(OS, Policy);
1103 void StmtPrinter::VisitDependentScopeDeclRefExpr(
1106 Qualifier->print(OS, Policy);
1129 OS << (Node->
isArrow() ?
"->" :
".");
1207 if (value < 256 &&
isPrintable((
unsigned char)value))
1208 OS <<
"'" << (
char)value <<
"'";
1209 else if (value < 256)
1210 OS <<
"'\\x" << llvm::format(
"%02x", value) <<
"'";
1211 else if (value <= 0xFFFF)
1212 OS <<
"'\\u" << llvm::format(
"%04x", value) <<
"'";
1214 OS <<
"'\\U" << llvm::format(
"%08x", value) <<
"'";
1220 OS << Node->
getValue().toString(10, isSigned);
1224 default: llvm_unreachable(
"Unexpected type for integer literal!");
1225 case BuiltinType::Char_S:
1226 case BuiltinType::Char_U: OS <<
"i8";
break;
1227 case BuiltinType::UChar: OS <<
"Ui8";
break;
1228 case BuiltinType::Short: OS <<
"i16";
break;
1229 case BuiltinType::UShort: OS <<
"Ui16";
break;
1230 case BuiltinType::Int:
break;
1231 case BuiltinType::UInt: OS <<
'U';
break;
1232 case BuiltinType::Long: OS <<
'L';
break;
1233 case BuiltinType::ULong: OS <<
"UL";
break;
1234 case BuiltinType::LongLong: OS <<
"LL";
break;
1235 case BuiltinType::ULongLong: OS <<
"ULL";
break;
1244 if (Str.find_first_not_of(
"-0123456789") == StringRef::npos)
1252 default: llvm_unreachable(
"Unexpected type for float literal!");
1253 case BuiltinType::Half:
break;
1254 case BuiltinType::Double:
break;
1255 case BuiltinType::Float: OS <<
'F';
break;
1256 case BuiltinType::LongDouble: OS <<
'L';
break;
1272 void StmtPrinter::VisitParenExpr(
ParenExpr *Node) {
1303 void StmtPrinter::VisitOffsetOfExpr(
OffsetOfExpr *Node) {
1304 OS <<
"__builtin_offsetof(";
1307 bool PrintedSomething =
false;
1315 PrintedSomething =
true;
1328 if (PrintedSomething)
1331 PrintedSomething =
true;
1343 if (Policy.LangOpts.CPlusPlus)
1345 else if (Policy.LangOpts.C11)
1354 OS <<
"__builtin_omp_required_simd_align";
1376 T.
print(OS, Policy);
1384 PrintExpr(Node->
getLHS());
1386 PrintExpr(Node->
getRHS());
1403 void StmtPrinter::PrintCallArgs(
CallExpr *Call) {
1404 for (
unsigned i = 0, e = Call->
getNumArgs(); i != e; ++i) {
1405 if (isa<CXXDefaultArgExpr>(Call->
getArg(i))) {
1411 PrintExpr(Call->
getArg(i));
1415 void StmtPrinter::VisitCallExpr(
CallExpr *Call) {
1418 PrintCallArgs(Call);
1421 void StmtPrinter::VisitMemberExpr(
MemberExpr *Node) {
1427 ? dyn_cast<
FieldDecl>(ParentMember->getMemberDecl()) :
nullptr;
1429 if (!ParentDecl || !ParentDecl->isAnonymousStructOrUnion())
1430 OS << (Node->
isArrow() ?
"->" :
".");
1433 if (FD->isAnonymousStructOrUnion())
1437 Qualifier->
print(OS, Policy);
1445 void StmtPrinter::VisitObjCIsaExpr(
ObjCIsaExpr *Node) {
1447 OS << (Node->
isArrow() ?
"->isa" :
".isa");
1472 PrintExpr(Node->
getLHS());
1474 PrintExpr(Node->
getRHS());
1477 PrintExpr(Node->
getLHS());
1479 PrintExpr(Node->
getRHS());
1484 PrintExpr(Node->
getLHS());
1486 PrintExpr(Node->
getRHS());
1501 void StmtPrinter::VisitStmtExpr(
StmtExpr *E) {
1507 void StmtPrinter::VisitChooseExpr(
ChooseExpr *Node) {
1508 OS <<
"__builtin_choose_expr(";
1511 PrintExpr(Node->
getLHS());
1513 PrintExpr(Node->
getRHS());
1517 void StmtPrinter::VisitGNUNullExpr(
GNUNullExpr *) {
1522 OS <<
"__builtin_shufflevector(";
1531 OS <<
"__builtin_convertvector(";
1538 void StmtPrinter::VisitInitListExpr(
InitListExpr* Node) {
1545 for (
unsigned i = 0, e = Node->
getNumInits(); i != e; ++i) {
1557 for (
unsigned i = 0, e = Node->
getNumExprs(); i != e; ++i) {
1565 bool NeedsEquals =
true;
1569 if (D->isFieldDesignator()) {
1570 if (D->getDotLoc().isInvalid()) {
1572 OS << II->getName() <<
":";
1573 NeedsEquals =
false;
1576 OS <<
"." << D->getFieldName()->getName();
1580 if (D->isArrayDesignator()) {
1598 void StmtPrinter::VisitDesignatedInitUpdateExpr(
1605 OS <<
"/*updater*/";
1610 void StmtPrinter::VisitNoInitExpr(
NoInitExpr *Node) {
1611 OS <<
"/*no init*/";
1615 if (Policy.LangOpts.CPlusPlus) {
1616 OS <<
"/*implicit*/";
1620 OS <<
"/*implicit*/(";
1630 void StmtPrinter::VisitVAArgExpr(
VAArgExpr *Node) {
1631 OS <<
"__builtin_va_arg(";
1642 void StmtPrinter::VisitAtomicExpr(
AtomicExpr *Node) {
1643 const char *
Name =
nullptr;
1644 switch (Node->
getOp()) {
1645 #define BUILTIN(ID, TYPE, ATTRS)
1646 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1647 case AtomicExpr::AO ## ID: \
1650 #include "clang/Basic/Builtins.def"
1655 PrintExpr(Node->
getPtr());
1656 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_load &&
1657 Node->
getOp() != AtomicExpr::AO__atomic_load_n) {
1661 if (Node->
getOp() == AtomicExpr::AO__atomic_exchange ||
1666 if (Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1667 Node->
getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1671 if (Node->
getOp() != AtomicExpr::AO__c11_atomic_init) {
1686 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
1688 #include "clang/Basic/OperatorKinds.def"
1692 if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
1694 OS << OpStrings[
Kind] <<
' ';
1695 PrintExpr(Node->
getArg(0));
1697 PrintExpr(Node->
getArg(0));
1698 OS <<
' ' << OpStrings[
Kind];
1700 }
else if (Kind == OO_Arrow) {
1701 PrintExpr(Node->
getArg(0));
1702 }
else if (Kind == OO_Call) {
1703 PrintExpr(Node->
getArg(0));
1705 for (
unsigned ArgIdx = 1; ArgIdx < Node->
getNumArgs(); ++ArgIdx) {
1708 if (!isa<CXXDefaultArgExpr>(Node->
getArg(ArgIdx)))
1709 PrintExpr(Node->
getArg(ArgIdx));
1712 }
else if (Kind == OO_Subscript) {
1713 PrintExpr(Node->
getArg(0));
1715 PrintExpr(Node->
getArg(1));
1718 OS << OpStrings[
Kind] <<
' ';
1719 PrintExpr(Node->
getArg(0));
1721 PrintExpr(Node->
getArg(0));
1722 OS <<
' ' << OpStrings[
Kind] <<
' ';
1723 PrintExpr(Node->
getArg(1));
1725 llvm_unreachable(
"unknown overloaded operator");
1732 if (MD && isa<CXXConversionDecl>(MD)) {
1736 VisitCallExpr(cast<CallExpr>(Node));
1744 PrintCallArgs(Node);
1757 VisitCXXNamedCastExpr(Node);
1761 VisitCXXNamedCastExpr(Node);
1765 VisitCXXNamedCastExpr(Node);
1769 VisitCXXNamedCastExpr(Node);
1800 Qualifier->print(OS, Policy);
1807 PrintExpr(Node->
getIdx());
1819 cast<FunctionDecl>(DRE->
getDecl())->getTemplateSpecializationArgs();
1822 if (Args->size() != 1) {
1825 OS, Args->data(), Args->size(), Policy);
1832 char C = (char)
P.getAsIntegral().getZExtValue();
1840 OS << Int->
getValue().toString(10,
false);
1858 OS << (Node->
getValue() ?
"true" :
"false");
1865 void StmtPrinter::VisitCXXThisExpr(
CXXThisExpr *Node) {
1869 void StmtPrinter::VisitCXXThrowExpr(
CXXThrowExpr *Node) {
1911 Arg != ArgEnd; ++Arg) {
1912 if ((*Arg)->isDefaultArgument())
1926 void StmtPrinter::VisitLambdaExpr(
LambdaExpr *Node) {
1928 bool NeedComma =
false;
1951 switch (
C->getCaptureKind()) {
1959 OS <<
C->getCapturedVar()->getName();
1963 OS <<
C->getCapturedVar()->getName();
1966 llvm_unreachable(
"VLA type in explicit captures.");
1970 PrintExpr(
C->getCapturedVar()->getInit());
1978 for (
auto P : Method->
params()) {
1984 std::string ParamStr =
P->getNameAsString();
1985 P->getOriginalType().print(OS, Policy, ParamStr);
2018 TSInfo->getType().print(OS, Policy);
2024 void StmtPrinter::VisitCXXNewExpr(
CXXNewExpr *E) {
2032 for (
unsigned i = 1; i < NumPlace; ++i) {
2044 llvm::raw_string_ostream s(TypeS);
2046 Size->printPretty(s, Helper, Policy);
2083 OS << II->getName();
2092 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
2093 if (isa<CXXDefaultArgExpr>(E->
getArg(i))) {
2116 StmtPrinter::VisitCXXUnresolvedConstructExpr(
2122 Arg != ArgEnd; ++Arg) {
2130 void StmtPrinter::VisitCXXDependentScopeMemberExpr(
2134 OS << (Node->
isArrow() ?
"->" :
".");
2137 Qualifier->print(OS, Policy);
2149 OS << (Node->
isArrow() ?
"->" :
".");
2152 Qualifier->print(OS, Policy);
2163 #define TYPE_TRAIT_1(Spelling, Name, Key) \
2164 case clang::UTT_##Name: return #Spelling;
2165 #define TYPE_TRAIT_2(Spelling, Name, Key) \
2166 case clang::BTT_##Name: return #Spelling;
2167 #define TYPE_TRAIT_N(Spelling, Name, Key) \
2168 case clang::TT_##Name: return #Spelling;
2169 #include "clang/Basic/TokenKinds.def"
2171 llvm_unreachable(
"Type trait not covered by switch");
2179 llvm_unreachable(
"Array type trait not covered by switch");
2187 llvm_unreachable(
"Expression type trait not covered by switch");
2192 for (
unsigned I = 0, N = E->
getNumArgs(); I != N; ++
I) {
2224 OS <<
"sizeof...(" << *E->
getPack() <<
")";
2227 void StmtPrinter::VisitSubstNonTypeTemplateParmPackExpr(
2232 void StmtPrinter::VisitSubstNonTypeTemplateParmExpr(
2245 void StmtPrinter::VisitCXXFoldExpr(
CXXFoldExpr *E) {
2274 void StmtPrinter::VisitCoawaitExpr(
CoawaitExpr *S) {
2279 void StmtPrinter::VisitCoyieldExpr(
CoyieldExpr *S) {
2298 ObjCArrayLiteral::child_range Ch = E->
children();
2299 for (
auto I = Ch.begin(), E = Ch.end(); I !=
E; ++
I) {
2300 if (I != Ch.begin())
2316 Visit(Element.
Value);
2336 OS <<
"@protocol(" << *Node->
getProtocol() <<
')';
2361 for (
unsigned i = 0, e = Mess->
getNumArgs(); i != e; ++i) {
2363 if (i > 0) OS <<
' ';
2371 PrintExpr(Mess->
getArg(i));
2378 OS << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2394 void StmtPrinter::VisitBlockExpr(
BlockExpr *Node) {
2400 if (isa<FunctionNoProtoType>(AFT)) {
2402 }
else if (!BD->
param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
2407 std::string ParamStr = (*AI)->getNameAsString();
2408 (*AI)->getType().print(OS, Policy, ParamStr);
2425 void StmtPrinter::VisitTypoExpr(
TypoExpr *Node) {
2427 assert(
false &&
"Cannot print TypoExpr nodes");
2430 void StmtPrinter::VisitAsTypeExpr(
AsTypeExpr *Node) {
2431 OS <<
"__builtin_astype(";
2446 void Stmt::printPretty(raw_ostream &OS,
2449 unsigned Indentation)
const {
2450 StmtPrinter
P(OS, Helper, Policy, Indentation);
2451 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.
unsigned getNumInits() const
This represents '#pragma omp master' directive.
operator "" X (long double)
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
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.
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.
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
Decl - This represents one declaration (or definition), e.g.
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.
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.
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...
unsigned getNumTemplateArgs() const
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 '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
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.
ParmVarDecl - Represents a parameter to a function.
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.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
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.
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...
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
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 by copy (a.k.a., by value)
DeclarationNameInfo getNameInfo() const
QualType getReturnType() const
bool isSuperReceiver() const
Stmt * getHandlerBlock() const
Expr * getInitializer()
The initializer of this new-expression.
Expr * getExprOperand() 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
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
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.
Expr * getHint() const
Returns number of threads.
static void PrintTemplateArgumentList(raw_ostream &OS, const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
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.
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.
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.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
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.
designators_iterator designators_begin()
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...
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 getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
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
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) 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
unsigned getNumTemplateArgs() const
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
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.
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.
TemplateArgumentLoc const * getTemplateArgs() const
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. ...
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
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>::".
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.
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;}).
const Expr * getBase() const
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.
TemplateArgumentLoc const * getTemplateArgs() const
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
designators_iterator designators_end()
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.
Expr * getArg(unsigned Arg)
Return the specified argument.
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 pointer.
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 '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()
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.
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.
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.
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.
Attr - This represents one attribute.
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.