26 #include "llvm/ADT/StringExtras.h"
27 #include "llvm/Support/raw_ostream.h"
28 using namespace clang;
43 #define ABSTRACT_STMT(STMT)
44 #define STMT(CLASS, PARENT) \
45 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
46 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
47 #include "clang/AST/StmtNodes.inc"
54 return ::operator
new(
bytes,
C, alignment);
57 const char *Stmt::getStmtClassName()
const {
61 void Stmt::PrintStats() {
66 llvm::errs() <<
"\n*** Stmt/Expr Stats:\n";
67 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
71 llvm::errs() <<
" " << sum <<
" stmts/exprs total.\n";
73 for (
int i = 0; i != Stmt::lastStmtConstant+1; i++) {
83 llvm::errs() <<
"Total bytes = " << sum <<
"\n";
86 void Stmt::addStmtClass(StmtClass s) {
90 bool Stmt::StatisticsEnabled =
false;
91 void Stmt::EnableStatistics() {
92 StatisticsEnabled =
true;
95 Stmt *Stmt::IgnoreImplicit() {
98 if (
auto *ewc = dyn_cast<ExprWithCleanups>(s))
99 s = ewc->getSubExpr();
101 if (
auto *mte = dyn_cast<MaterializeTemporaryExpr>(s))
102 s = mte->GetTemporaryExpr();
104 if (
auto *bte = dyn_cast<CXXBindTemporaryExpr>(s))
105 s = bte->getSubExpr();
107 while (
auto *ice = dyn_cast<ImplicitCastExpr>(s))
108 s = ice->getSubExpr();
115 Stmt *Stmt::IgnoreContainers(
bool IgnoreCaptured) {
118 if (
auto CapS = dyn_cast_or_null<CapturedStmt>(S))
119 S = CapS->getCapturedStmt();
121 if (
auto AS = dyn_cast_or_null<AttributedStmt>(S))
122 S = AS->getSubStmt();
123 else if (
auto CS = dyn_cast_or_null<CompoundStmt>(S)) {
137 const Stmt *Stmt::stripLabelLikeStatements()
const {
138 const Stmt *S =
this;
140 if (
const LabelStmt *LS = dyn_cast<LabelStmt>(S))
141 S = LS->getSubStmt();
142 else if (
const SwitchCase *SC = dyn_cast<SwitchCase>(S))
143 S = SC->getSubStmt();
145 S = AS->getSubStmt();
158 static inline good is_good(good) {
return good(); }
160 typedef Stmt::child_range children_t();
161 template <
class T> good implements_children(children_t T::*) {
164 LLVM_ATTRIBUTE_UNUSED
165 static inline bad implements_children(children_t
Stmt::*) {
170 template <
class T> good implements_getLocStart(getLocStart_t T::*) {
173 LLVM_ATTRIBUTE_UNUSED
174 static inline bad implements_getLocStart(getLocStart_t
Stmt::*) {
179 template <
class T> good implements_getLocEnd(getLocEnd_t T::*) {
182 LLVM_ATTRIBUTE_UNUSED
183 static inline bad implements_getLocEnd(getLocEnd_t
Stmt::*) {
187 #define ASSERT_IMPLEMENTS_children(type) \
188 (void) is_good(implements_children(&type::children))
189 #define ASSERT_IMPLEMENTS_getLocStart(type) \
190 (void) is_good(implements_getLocStart(&type::getLocStart))
191 #define ASSERT_IMPLEMENTS_getLocEnd(type) \
192 (void) is_good(implements_getLocEnd(&type::getLocEnd))
197 LLVM_ATTRIBUTE_UNUSED
199 #define ABSTRACT_STMT(type)
200 #define STMT(type, base) \
201 ASSERT_IMPLEMENTS_children(type); \
202 ASSERT_IMPLEMENTS_getLocStart(type); \
203 ASSERT_IMPLEMENTS_getLocEnd(type);
204 #include "clang/AST/StmtNodes.inc"
208 switch (getStmtClass()) {
209 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
210 #define ABSTRACT_STMT(type)
211 #define STMT(type, base) \
212 case Stmt::type##Class: \
213 return static_cast<type*>(this)->children();
214 #include "clang/AST/StmtNodes.inc"
216 llvm_unreachable(
"unknown statement kind!");
226 template <
class S,
class T>
229 return static_cast<const S*
>(
stmt)->getSourceRange();
239 return SourceRange(static_cast<const S*>(stmt)->getLocStart(),
240 static_cast<const S*>(stmt)->getLocEnd());
245 switch (getStmtClass()) {
246 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
247 #define ABSTRACT_STMT(type)
248 #define STMT(type, base) \
249 case Stmt::type##Class: \
250 return getSourceRangeImpl<type>(this, &type::getSourceRange);
251 #include "clang/AST/StmtNodes.inc"
253 llvm_unreachable(
"unknown statement kind!");
258 switch (getStmtClass()) {
259 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
260 #define ABSTRACT_STMT(type)
261 #define STMT(type, base) \
262 case Stmt::type##Class: \
263 return static_cast<const type*>(this)->getLocStart();
264 #include "clang/AST/StmtNodes.inc"
266 llvm_unreachable(
"unknown statement kind");
270 switch (getStmtClass()) {
271 case Stmt::NoStmtClass: llvm_unreachable(
"statement without class");
272 #define ABSTRACT_STMT(type)
273 #define STMT(type, base) \
274 case Stmt::type##Class: \
275 return static_cast<const type*>(this)->getLocEnd();
276 #include "clang/AST/StmtNodes.inc"
278 llvm_unreachable(
"unknown statement kind");
283 :
Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
284 CompoundStmtBits.NumStmts = Stmts.size();
285 assert(CompoundStmtBits.NumStmts == Stmts.size() &&
286 "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
288 if (Stmts.size() == 0) {
293 Body =
new (
C)
Stmt*[Stmts.size()];
294 std::copy(Stmts.begin(), Stmts.end(), Body);
301 this->CompoundStmtBits.NumStmts = NumStmts;
303 Body =
new (
C)
Stmt*[NumStmts];
304 memcpy(Body, Stmts,
sizeof(
Stmt *) * NumStmts);
314 assert(!Attrs.empty() &&
"Attrs should not be empty");
316 llvm::alignOf<AttributedStmt>());
322 assert(NumAttrs > 0 &&
"NumAttrs should be greater than zero");
324 llvm::alignOf<AttributedStmt>());
329 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
330 return gccAsmStmt->generateAsmString(C);
331 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
332 return msAsmStmt->generateAsmString(C);
333 llvm_unreachable(
"unknown asm statement kind!");
337 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
338 return gccAsmStmt->getOutputConstraint(i);
339 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
340 return msAsmStmt->getOutputConstraint(i);
341 llvm_unreachable(
"unknown asm statement kind!");
345 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
346 return gccAsmStmt->getOutputExpr(i);
347 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
348 return msAsmStmt->getOutputExpr(i);
349 llvm_unreachable(
"unknown asm statement kind!");
353 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
354 return gccAsmStmt->getInputConstraint(i);
355 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
356 return msAsmStmt->getInputConstraint(i);
357 llvm_unreachable(
"unknown asm statement kind!");
361 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
362 return gccAsmStmt->getInputExpr(i);
363 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
364 return msAsmStmt->getInputExpr(i);
365 llvm_unreachable(
"unknown asm statement kind!");
369 if (
const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(
this))
370 return gccAsmStmt->getClobber(i);
371 if (
const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(
this))
372 return msAsmStmt->getClobber(i);
373 llvm_unreachable(
"unknown asm statement kind!");
387 assert(
isOperand() &&
"Only Operands can have modifiers.");
388 return isLetter(Str[0]) ? Str[0] :
'\0';
396 return cast<Expr>(
Exprs[i]);
419 void GCCAsmStmt::setOutputsAndInputsAndClobbers(
const ASTContext &
C,
431 unsigned NumExprs = NumOutputs +
NumInputs;
435 std::copy(Names, Names + NumExprs, this->Names);
438 this->Exprs =
new (
C)
Stmt*[NumExprs];
439 std::copy(Exprs, Exprs + NumExprs, this->Exprs);
443 std::copy(Constraints, Constraints + NumExprs, this->Constraints);
447 std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers);
454 unsigned NumPlusOperands = 0;
474 const ASTContext &C,
unsigned &DiagOffs)
const {
476 const char *StrStart = Str.begin();
477 const char *StrEnd = Str.end();
478 const char *CurPtr = StrStart;
484 for (; CurPtr != StrEnd; ++CurPtr) {
500 std::string CurStringPiece;
506 if (CurPtr == StrEnd) {
507 if (!CurStringPiece.empty())
512 char CurChar = *CurPtr++;
514 case '$': CurStringPiece +=
"$$";
continue;
515 case '{': CurStringPiece += (HasVariants ?
"$(" :
"{");
continue;
516 case '|': CurStringPiece += (HasVariants ?
"$|" :
"|");
continue;
517 case '}': CurStringPiece += (HasVariants ?
"$)" :
"}");
continue;
521 CurStringPiece += CurChar;
526 if (CurPtr == StrEnd) {
528 DiagOffs = CurPtr-StrStart-1;
529 return diag::err_asm_invalid_escape;
532 char EscapedChar = *CurPtr++;
533 if (EscapedChar ==
'%') {
535 CurStringPiece +=
'%';
539 if (EscapedChar ==
'=') {
540 CurStringPiece +=
"${:uid}";
546 if (!CurStringPiece.empty()) {
548 CurStringPiece.clear();
554 const char *Begin = CurPtr - 1;
555 const char *Percent = Begin - 1;
558 if (CurPtr == StrEnd) {
559 DiagOffs = CurPtr-StrStart-1;
560 return diag::err_asm_invalid_escape;
562 EscapedChar = *CurPtr++;
575 while (CurPtr != StrEnd &&
isDigit(*CurPtr))
576 N = N*10 + ((*CurPtr++)-
'0');
578 unsigned NumOperands =
580 if (N >= NumOperands) {
581 DiagOffs = CurPtr-StrStart-1;
582 return diag::err_asm_invalid_operand_number;
586 std::string Str(Begin, CurPtr - Begin);
595 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
600 if (EscapedChar ==
'[') {
601 DiagOffs = CurPtr-StrStart-1;
604 const char *NameEnd = (
const char*)memchr(CurPtr,
']', StrEnd-CurPtr);
605 if (NameEnd ==
nullptr)
606 return diag::err_asm_unterminated_symbolic_operand_name;
607 if (NameEnd == CurPtr)
608 return diag::err_asm_empty_symbolic_operand_name;
610 StringRef SymbolicName(CurPtr, NameEnd - CurPtr);
615 DiagOffs = CurPtr-StrStart;
616 return diag::err_asm_unknown_symbolic_operand_name;
620 std::string Str(Begin, NameEnd + 1 - Begin);
629 Pieces.emplace_back(N, std::move(Str), BeginLoc, EndLoc);
635 DiagOffs = CurPtr-StrStart-1;
636 return diag::err_asm_invalid_escape;
648 std::string AsmString;
649 for (
unsigned i = 0, e = Pieces.size(); i != e; ++i) {
650 if (Pieces[i].isString())
651 AsmString += Pieces[i].getString();
652 else if (Pieces[i].getModifier() ==
'\0')
653 AsmString +=
'$' + llvm::utostr(Pieces[i].getOperandNo());
655 AsmString +=
"${" + llvm::utostr(Pieces[i].getOperandNo()) +
':' +
656 Pieces[i].getModifier() +
'}';
668 return cast<Expr>(Exprs[i]);
680 return ExceptionDecl->getType();
689 bool issimple,
bool isvolatile,
unsigned numoutputs,
694 :
AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
695 numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
697 unsigned NumExprs = NumOutputs +
NumInputs;
700 std::copy(names, names + NumExprs, Names);
702 Exprs =
new (
C)
Stmt*[NumExprs];
703 std::copy(exprs, exprs + NumExprs, Exprs);
706 std::copy(constraints, constraints + NumExprs, Constraints);
709 std::copy(clobbers, clobbers + NumClobbers, Clobbers);
719 :
AsmStmt(MSAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
720 numinputs, clobbers.size()), LBraceLoc(lbraceloc),
721 EndLoc(endloc), NumAsmToks(asmtoks.size()) {
723 initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
729 size_t size = str.size();
730 char *buffer =
new (
C)
char[size];
731 memcpy(buffer, str.data(), size);
732 return StringRef(buffer, size);
735 void MSAsmStmt::initialize(
const ASTContext &C, StringRef asmstr,
740 assert(NumAsmToks == asmtoks.size());
741 assert(NumClobbers == clobbers.size());
743 unsigned NumExprs = exprs.size();
744 assert(NumExprs == NumOutputs + NumInputs);
745 assert(NumExprs == constraints.size());
749 Exprs =
new (
C)
Stmt*[NumExprs];
750 for (
unsigned i = 0, e = NumExprs; i != e; ++i)
753 AsmToks =
new (
C)
Token[NumAsmToks];
754 for (
unsigned i = 0, e = NumAsmToks; i != e; ++i)
755 AsmToks[i] = asmtoks[i];
757 Constraints =
new (
C) StringRef[NumExprs];
758 for (
unsigned i = 0, e = NumExprs; i != e; ++i) {
762 Clobbers =
new (
C) StringRef[NumClobbers];
763 for (
unsigned i = 0, e = NumClobbers; i != e; ++i) {
772 :
Stmt(ObjCForCollectionStmtClass) {
773 SubExprs[ELEM] = Elem;
774 SubExprs[COLLECTION] = Collect;
775 SubExprs[BODY] = Body;
781 Stmt **CatchStmts,
unsigned NumCatchStmts,
783 :
Stmt(ObjCAtTryStmtClass), AtTryLoc(atTryLoc),
784 NumCatchStmts(NumCatchStmts), HasFinally(atFinallyStmt != nullptr) {
785 Stmt **Stmts = getStmts();
786 Stmts[0] = atTryStmt;
787 for (
unsigned I = 0; I != NumCatchStmts; ++I)
788 Stmts[I + 1] = CatchStmts[I];
791 Stmts[NumCatchStmts + 1] = atFinallyStmt;
798 unsigned NumCatchStmts,
799 Stmt *atFinallyStmt) {
801 (1 + NumCatchStmts + (atFinallyStmt !=
nullptr)) *
sizeof(
Stmt *);
802 void *Mem = Context.
Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
803 return new (Mem)
ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts,
808 unsigned NumCatchStmts,
811 (1 + NumCatchStmts + HasFinally) *
sizeof(
Stmt *);
812 void *Mem = Context.
Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
813 return new (Mem)
ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
827 Size += ((handlers.size() + 1) *
sizeof(
Stmt));
829 void *Mem = C.
Allocate(Size, llvm::alignOf<CXXTryStmt>());
830 return new (Mem)
CXXTryStmt(tryLoc, tryBlock, handlers);
834 unsigned numHandlers) {
836 Size += ((numHandlers + 1) *
sizeof(
Stmt));
838 void *Mem = C.
Allocate(Size, llvm::alignOf<CXXTryStmt>());
839 return new (Mem)
CXXTryStmt(Empty, numHandlers);
844 :
Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
845 Stmt **Stmts =
reinterpret_cast<Stmt **
>(
this + 1);
847 std::copy(handlers.begin(), handlers.end(), Stmts + 1);
854 :
Stmt(CXXForRangeStmtClass), ForLoc(FL),
ColonLoc(CL), RParenLoc(RPL) {
855 SubExprs[RANGE] = Range;
856 SubExprs[BEGINEND] = BeginEndStmt;
857 SubExprs[COND] = Cond;
859 SubExprs[LOOPVAR] = LoopVar;
860 SubExprs[BODY] = Body;
866 assert(RangeDecl &&
"for-range should have a single var decl");
876 assert(LV &&
"No loop variable in CXXForRangeStmt");
877 return cast<VarDecl>(LV);
886 :
Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL)
889 SubExprs[COND] = cond;
890 SubExprs[THEN] = then;
891 SubExprs[ELSE] = elsev;
898 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
904 SubExprs[VAR] =
nullptr;
916 :
Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
918 SubExprs[INIT] = Init;
920 SubExprs[COND] = Cond;
922 SubExprs[BODY] = Body;
926 if (!SubExprs[CONDVAR])
929 DeclStmt *DS = cast<DeclStmt>(SubExprs[CONDVAR]);
935 SubExprs[CONDVAR] =
nullptr;
945 :
Stmt(SwitchStmtClass), FirstCase(nullptr,
false) {
947 SubExprs[COND] = cond;
948 SubExprs[BODY] =
nullptr;
955 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
961 SubExprs[VAR] =
nullptr;
971 if (isa<CaseStmt>(
this))
978 :
Stmt(WhileStmtClass) {
980 SubExprs[COND] = cond;
981 SubExprs[BODY] = body;
989 DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
995 SubExprs[VAR] =
nullptr;
1007 dyn_cast<AddrLabelExpr>(
getTarget()->IgnoreParenImpCasts()))
1008 return E->getLabel();
1014 return cast_or_null<Expr>(RetExpr);
1017 return cast_or_null<Expr>(RetExpr);
1020 SEHTryStmt::SEHTryStmt(
bool IsCXXTry,
1024 :
Stmt(SEHTryStmtClass),
1028 Children[TRY] = TryBlock;
1029 Children[HANDLER] = Handler;
1035 return new(
C)
SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
1049 :
Stmt(SEHExceptStmtClass),
1052 Children[FILTER_EXPR] = FilterExpr;
1053 Children[
BLOCK] = Block;
1063 :
Stmt(SEHFinallyStmtClass),
1077 unsigned FirstCaptureOffset =
1078 llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>());
1080 return reinterpret_cast<Capture *
>(
1081 reinterpret_cast<char *
>(
const_cast<CapturedStmt *
>(
this))
1082 + FirstCaptureOffset);
1090 :
Stmt(CapturedStmtClass), NumCaptures(Captures.size()),
1091 CapDeclAndKind(CD, Kind), TheRecordDecl(RD) {
1092 assert( S &&
"null captured statement");
1093 assert(CD &&
"null captured declaration for captured statement");
1094 assert(RD &&
"null record declaration for captured statement");
1097 Stmt **Stored = getStoredStmts();
1098 for (
unsigned I = 0, N = NumCaptures; I != N; ++I)
1099 *Stored++ = CaptureInits[I];
1105 Capture *Buffer = getStoredCaptures();
1106 std::copy(Captures.begin(), Captures.end(), Buffer);
1109 CapturedStmt::CapturedStmt(EmptyShell Empty,
unsigned NumCaptures)
1110 :
Stmt(CapturedStmtClass, Empty), NumCaptures(NumCaptures),
1111 CapDeclAndKind(nullptr,
CR_Default), TheRecordDecl(nullptr) {
1112 getStoredStmts()[NumCaptures] =
nullptr;
1130 assert(CaptureInits.size() == Captures.size() &&
"wrong number of arguments");
1132 unsigned Size =
sizeof(
CapturedStmt) +
sizeof(
Stmt *) * (Captures.size() + 1);
1133 if (!Captures.empty()) {
1135 Size = llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>());
1136 Size +=
sizeof(
Capture) * Captures.size();
1139 void *Mem = Context.
Allocate(Size);
1140 return new (Mem)
CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
1144 unsigned NumCaptures) {
1146 if (NumCaptures > 0) {
1148 Size = llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>());
1149 Size +=
sizeof(
Capture) * NumCaptures;
1152 void *Mem = Context.
Allocate(Size);
1153 return new (Mem)
CapturedStmt(EmptyShell(), NumCaptures);
1158 return child_range(getStoredStmts(), getStoredStmts() + NumCaptures);
1163 if (!I.capturesVariable())
1169 if (I.getCapturedVar() == Var)
1179 #define OPENMP_CLAUSE(Name, Class) \
1180 case OMPC_ ## Name : return static_cast<Class *>(this)->children();
1181 #include "clang/Basic/OpenMPKinds.def"
1183 llvm_unreachable(
"unknown OMPClause");
1188 "Number of private copies is not the same as the preallocated buffer");
1198 llvm::alignOf<Expr *>()) +
1199 2 *
sizeof(
Expr *) * VL.size());
1203 Clause->setPrivateCopies(PrivateVL);
1210 llvm::alignOf<Expr *>()) +
1211 2 *
sizeof(
Expr *) * N);
1217 "Number of private copies is not the same as the preallocated buffer");
1223 "Number of inits is not the same as the preallocated buffer");
1224 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());
1233 llvm::alignOf<Expr *>()) +
1234 3 *
sizeof(
Expr *) * VL.size());
1238 Clause->setPrivateCopies(PrivateVL);
1239 Clause->setInits(InitVL);
1246 llvm::alignOf<Expr *>()) +
1247 3 *
sizeof(
Expr *) * N);
1253 "Number of private copies is not the same as the preallocated buffer");
1254 std::copy(PrivateCopies.begin(), PrivateCopies.end(),
varlist_end());
1258 assert(SrcExprs.size() ==
varlist_size() &&
"Number of source expressions is "
1259 "not the same as the "
1260 "preallocated buffer");
1261 std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end());
1264 void OMPLastprivateClause::setDestinationExprs(
ArrayRef<Expr *> DstExprs) {
1265 assert(DstExprs.size() ==
varlist_size() &&
"Number of destination "
1266 "expressions is not the same as "
1267 "the preallocated buffer");
1268 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
1271 void OMPLastprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
1273 "Number of assignment expressions is not the same as the preallocated "
1275 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
1276 getDestinationExprs().end());
1284 llvm::alignOf<Expr *>()) +
1285 5 *
sizeof(
Expr *) * VL.size());
1289 Clause->setSourceExprs(SrcExprs);
1290 Clause->setDestinationExprs(DstExprs);
1291 Clause->setAssignmentOps(AssignmentOps);
1298 llvm::alignOf<Expr *>()) +
1299 5 *
sizeof(
Expr *) * N);
1309 llvm::alignOf<Expr *>()) +
1310 sizeof(
Expr *) * VL.size());
1320 llvm::alignOf<Expr *>()) +
1321 sizeof(
Expr *) * N);
1327 "Number of inits is not the same as the preallocated buffer");
1333 "Number of updates is not the same as the preallocated buffer");
1334 std::copy(UL.begin(), UL.end(),
getInits().end());
1339 "Number of final updates is not the same as the preallocated buffer");
1340 std::copy(FL.begin(), FL.end(),
getUpdates().end());
1351 llvm::alignOf<Expr *>()) +
1352 (4 * VL.size() + 2) *
sizeof(
Expr *));
1356 Clause->setInits(IL);
1359 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),
1361 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),
1363 Clause->setStep(Step);
1364 Clause->setCalcStep(CalcStep);
1373 llvm::alignOf<Expr *>()) +
1374 (4 * NumVars + 2) *
sizeof(
Expr *));
1383 llvm::alignOf<Expr *>()) +
1384 sizeof(
Expr *) * (VL.size() + 1));
1387 Clause->setVarRefs(VL);
1388 Clause->setAlignment(A);
1395 llvm::alignOf<Expr *>()) +
1396 sizeof(
Expr *) * (NumVars + 1));
1401 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
1402 "not the same as the "
1403 "preallocated buffer");
1404 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
1408 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
1409 "expressions is not the same as "
1410 "the preallocated buffer");
1411 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
1415 assert(AssignmentOps.size() == varlist_size() &&
1416 "Number of assignment expressions is not the same as the preallocated "
1418 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
1419 getDestinationExprs().end());
1424 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
1425 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
1427 llvm::alignOf<Expr *>()) +
1428 4 *
sizeof(
Expr *) * VL.size());
1431 Clause->setVarRefs(VL);
1432 Clause->setSourceExprs(SrcExprs);
1433 Clause->setDestinationExprs(DstExprs);
1434 Clause->setAssignmentOps(AssignmentOps);
1441 llvm::alignOf<Expr *>()) +
1442 4 *
sizeof(
Expr *) * N);
1447 assert(SrcExprs.size() == varlist_size() &&
"Number of source expressions is "
1448 "not the same as the "
1449 "preallocated buffer");
1450 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());
1453 void OMPCopyprivateClause::setDestinationExprs(
ArrayRef<Expr *> DstExprs) {
1454 assert(DstExprs.size() == varlist_size() &&
"Number of destination "
1455 "expressions is not the same as "
1456 "the preallocated buffer");
1457 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());
1460 void OMPCopyprivateClause::setAssignmentOps(
ArrayRef<Expr *> AssignmentOps) {
1461 assert(AssignmentOps.size() == varlist_size() &&
1462 "Number of assignment expressions is not the same as the preallocated "
1464 std::copy(AssignmentOps.begin(), AssignmentOps.end(),
1465 getDestinationExprs().end());
1470 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
1471 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) {
1473 llvm::alignOf<Expr *>()) +
1474 4 *
sizeof(
Expr *) * VL.size());
1477 Clause->setVarRefs(VL);
1478 Clause->setSourceExprs(SrcExprs);
1479 Clause->setDestinationExprs(DstExprs);
1480 Clause->setAssignmentOps(AssignmentOps);
1487 llvm::alignOf<Expr *>()) +
1488 4 *
sizeof(
Expr *) * N);
1494 "Number of clauses is not the same as the preallocated buffer");
1495 std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
1500 "Number of loop counters is not the same as the collapsed number");
1501 std::copy(A.begin(), A.end(), getCounters().begin());
1506 "Number of counter inits is not the same as the collapsed number");
1507 std::copy(A.begin(), A.end(), getInits().begin());
1512 "Number of counter updates is not the same as the collapsed number");
1513 std::copy(A.begin(), A.end(), getUpdates().begin());
1518 "Number of counter finals is not the same as the collapsed number");
1519 std::copy(A.begin(), A.end(), getFinals().begin());
1525 "Number of LHS expressions is not the same as the preallocated buffer");
1526 std::copy(LHSExprs.begin(), LHSExprs.end(),
varlist_end());
1532 "Number of RHS expressions is not the same as the preallocated buffer");
1533 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());
1537 assert(ReductionOps.size() ==
varlist_size() &&
"Number of reduction "
1538 "expressions is not the same "
1539 "as the preallocated buffer");
1540 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());
1550 llvm::alignOf<Expr *>()) +
1551 4 *
sizeof(
Expr *) * VL.size());
1553 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);
1555 Clause->setLHSExprs(LHSExprs);
1556 Clause->setRHSExprs(RHSExprs);
1557 Clause->setReductionOps(ReductionOps);
1564 llvm::alignOf<Expr *>()) +
1565 4 *
sizeof(
Expr *) * N);
1575 llvm::alignOf<Expr *>()) +
1576 sizeof(
Expr *) * VL.size());
1578 new (Mem)
OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());
1579 Clause->setVarRefs(VL);
1585 llvm::alignOf<Expr *>()) +
1586 sizeof(
Expr *) * N);
1596 llvm::alignOf<Expr *>()) +
1597 sizeof(
Expr *) * VL.size());
1600 Clause->setVarRefs(VL);
1601 Clause->setDependencyKind(DepKind);
1602 Clause->setDependencyLoc(DepLoc);
1603 Clause->setColonLoc(ColonLoc);
1609 llvm::alignOf<Expr *>()) +
1610 sizeof(
Expr *) * N);
1620 assert(!++I &&
"There are at least 2 clauses of the specified kind");
1631 Stmt *AssociatedStmt) {
1633 llvm::alignOf<OMPClause *>());
1644 unsigned NumClauses,
1647 llvm::alignOf<OMPClause *>());
1659 llvm::alignOf<OMPClause *>());
1682 unsigned NumClauses,
1683 unsigned CollapsedNum,
1686 llvm::alignOf<OMPClause *>());
1699 llvm::alignOf<OMPClause *>());
1704 new (Mem)
OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1729 unsigned NumClauses,
1730 unsigned CollapsedNum,
1733 llvm::alignOf<OMPClause *>());
1746 llvm::alignOf<OMPClause *>());
1776 unsigned NumClauses,
1777 unsigned CollapsedNum,
1780 llvm::alignOf<OMPClause *>());
1791 llvm::alignOf<OMPClause *>());
1802 unsigned NumClauses,
1805 llvm::alignOf<OMPClause *>());
1814 Stmt *AssociatedStmt) {
1816 llvm::alignOf<Stmt *>());
1826 llvm::alignOf<Stmt *>());
1835 Stmt *AssociatedStmt) {
1837 llvm::alignOf<OMPClause *>());
1848 unsigned NumClauses,
1851 llvm::alignOf<OMPClause *>());
1860 Stmt *AssociatedStmt) {
1862 llvm::alignOf<Stmt *>());
1872 llvm::alignOf<Stmt *>());
1881 llvm::alignOf<Stmt *>());
1892 llvm::alignOf<Stmt *>());
1902 llvm::alignOf<OMPClause *>());
1933 unsigned CollapsedNum, EmptyShell) {
1935 llvm::alignOf<OMPClause *>());
1947 llvm::alignOf<OMPClause *>());
1949 Size +
sizeof(
OMPClause *) * Clauses.size() +
1952 StartLoc, EndLoc, CollapsedNum, Clauses.size());
1978 unsigned NumClauses,
1979 unsigned CollapsedNum, EmptyShell) {
1981 llvm::alignOf<OMPClause *>());
1983 Size +
sizeof(
OMPClause *) * NumClauses +
1992 llvm::alignOf<OMPClause *>());
2004 unsigned NumClauses, EmptyShell) {
2006 llvm::alignOf<OMPClause *>());
2016 Stmt *AssociatedStmt) {
2018 llvm::alignOf<OMPClause *>());
2029 unsigned NumClauses,
2032 llvm::alignOf<OMPClause *>());
2084 Stmt *AssociatedStmt) {
2086 llvm::alignOf<Stmt *>());
2097 llvm::alignOf<Stmt *>());
2105 unsigned Size = llvm::RoundUpToAlignment(
2110 Dir->setCancelRegion(CancelRegion);
2116 unsigned Size = llvm::RoundUpToAlignment(
2127 llvm::alignOf<Stmt *>());
2130 Dir->setCancelRegion(CancelRegion);
2137 llvm::alignOf<Stmt *>());
2147 llvm::alignOf<OMPClause *>());
2156 unsigned NumClauses,
2159 llvm::alignOf<OMPClause *>());
2167 Stmt *AssociatedStmt) {
2169 llvm::alignOf<Stmt *>());
2179 llvm::alignOf<Stmt *>());
2187 Expr *E,
Expr *UE,
bool IsXLHSInRHSPart,
bool IsPostfixUpdate) {
2189 llvm::alignOf<OMPClause *>());
2191 5 *
sizeof(
Stmt *));
2199 Dir->setUpdateExpr(UE);
2200 Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
2201 Dir->IsPostfixUpdate = IsPostfixUpdate;
2206 unsigned NumClauses,
2209 llvm::alignOf<OMPClause *>());
2219 Stmt *AssociatedStmt) {
2221 llvm::alignOf<OMPClause *>());
2232 unsigned NumClauses,
2235 llvm::alignOf<OMPClause *>());
2245 Stmt *AssociatedStmt) {
2247 llvm::alignOf<OMPClause *>());
2258 unsigned NumClauses,
2261 llvm::alignOf<OMPClause *>());
static OMPPrivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL)
Creates clause with a list of variables VL.
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Expr * NLB
Update of LowerBound for statically sheduled 'omp for' loops.
SourceLocation getLocEnd() const LLVM_READONLY
void setConditionVariable(const ASTContext &C, VarDecl *V)
static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
Defines the clang::ASTContext interface.
SmallVector< Expr *, 4 > Finals
Final loop counter values for GodeGen.
This represents '#pragma omp master' directive.
SourceLocation getEnd() const
SmallVector< Expr *, 4 > Updates
Expressions for loop counters update for CodeGen.
This represents '#pragma omp task' directive.
void setEnsureUpperBound(Expr *EUB)
static OMPSectionDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt)
Creates directive.
unsigned getNumOutputs() const
static LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
static OMPMasterDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
This represents clause 'copyin' in the '#pragma omp ...' directives.
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
const OMPClause * getSingleClause(OpenMPClauseKind K) const
Gets a single clause of the specified kind K associated with the current directive iff there is only ...
IdentifierInfo * getIdentifier() const
static OMPTaskwaitDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
void setLastIteration(Expr *LI)
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const Expr * getOutputExpr(unsigned i) const
static OMPCopyprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
This represents '#pragma omp for simd' directive.
Expr * EUB
EnsureUpperBound – expression LB = min(LB, NumIterations).
static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
static OMPCopyinClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.
static OMPSectionsDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
Represents an attribute applied to a statement.
void setUpperBoundVariable(Expr *UB)
GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, IdentifierInfo **names, StringLiteral **constraints, Expr **exprs, StringLiteral *asmstr, unsigned numclobbers, StringLiteral **clobbers, SourceLocation rparenloc)
static CapturedStmt * Create(const ASTContext &Context, Stmt *S, CapturedRegionKind Kind, ArrayRef< Capture > Captures, ArrayRef< Expr * > CaptureInits, CapturedDecl *CD, RecordDecl *RD)
static OMPAtomicDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V, Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate)
Creates directive with a list of Clauses and 'x', 'v' and 'expr' parts of the atomic construct (see S...
CXXForRangeStmt(DeclStmt *Range, DeclStmt *BeginEnd, Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body, SourceLocation FL, SourceLocation CL, SourceLocation RPL)
void setNextLowerBound(Expr *NLB)
const Expr * getInit() const
This represents '#pragma omp parallel for' directive.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
void setConditionVariable(const ASTContext &C, VarDecl *V)
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
void setInputExpr(unsigned i, Expr *E)
void setIsLastIterVariable(Expr *IL)
void setInputExpr(unsigned i, Expr *E)
static OMPParallelForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
This represents clause 'private' in the '#pragma omp ...' directives.
static OMPParallelDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for N clauses.
This represents implicit clause 'flush' for the '#pragma omp flush' directive. This clause does not e...
Defines the Objective-C statement AST node classes.
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the clang::Expr interface and subclasses for C++ expressions.
Expr * LastIteration
Loop last iteration number.
static struct StmtClassNameTable StmtClassInfo[Stmt::lastStmtConstant+1]
bool isOutputPlusConstraint(unsigned i) const
void setFinals(ArrayRef< Expr * > A)
static OMPTargetDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPSharedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents '#pragma omp parallel' directive.
unsigned getNumInputs() const
static OMPFirstprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL, ArrayRef< Expr * > InitVL)
Creates clause with a list of variables VL.
SourceLocation getLocEnd() const LLVM_READONLY
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
static OMPCancelDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
This represents clause 'lastprivate' in the '#pragma omp ...' directives.
void setUpdates(ArrayRef< Expr * > UL)
Sets the list of update expressions for linear variables.
void Deallocate(void *Ptr) const
static OMPFlushDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp barrier' directive.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This represents '#pragma omp critical' directive.
This represents clause 'copyprivate' in the '#pragma omp ...' directives.
SwitchStmt(const ASTContext &C, VarDecl *Var, Expr *cond)
StringRef getOutputConstraint(unsigned i) const
const TargetInfo & getTargetInfo() const
const LangOptions & getLangOpts() const
void setCounters(ArrayRef< Expr * > A)
void setFinals(ArrayRef< Expr * > FL)
Sets the list of final update expressions for linear variables.
StringRef getClobber(unsigned i) const
Expr * getOutputExpr(unsigned i)
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt * > handlers)
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
This represents '#pragma omp cancellation point' directive.
static OMPReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps)
Creates clause with a list of variables VL.
This represents '#pragma omp teams' directive.
Expr * CalcLastIteration
Calculation of last iteration.
This represents clause 'reduction' in the '#pragma omp ...' directives.
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
StringLiteral * getClobberStringLiteral(unsigned i)
static OMPTaskyieldDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
This represents the body of a CapturedStmt, and serves as its DeclContext.
static SEHTryStmt * Create(const ASTContext &C, bool isCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Expr * NUB
Update of UpperBound for statically sheduled 'omp for' loops.
Expr * Cond
Loop condition.
Expr * PreCond
Loop pre-condition.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
static OMPSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
The expressions built for the OpenMP loop CodeGen for the whole collapsed loop nest.
static OMPTaskgroupDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Describes the capture of either a variable, or 'this', or variable-length array type.
This represents '#pragma omp taskgroup' directive.
static OMPSingleDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents clause 'aligned' in the '#pragma omp ...' directives.
Stmt * getHandler() const
static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
StringRef getInputConstraint(unsigned i) const
bool hasNoAsmVariants() const
Return true if {|} are normal characters in the asm string.
Expr * IterationVarRef
Loop iteration variable.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
static OMPTeamsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTargetDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
Exposes information about the current target.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
LabelDecl * getDecl() const
static OMPSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
const Expr * getInputExpr(unsigned i) const
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
static unsigned numLoopChildren(unsigned CollapsedNum, OpenMPDirectiveKind Kind)
Children number.
ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body, SourceLocation FCL, SourceLocation RPL)
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
static OMPMasterDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt)
Creates directive.
LabelDecl * getConstantTarget()
void setInits(ArrayRef< Expr * > IL)
Sets the list of the initial values for linear variables.
OpenMPClauseKind
OpenMP clauses.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
StringRef getInputName(unsigned i) const
static StringRef copyIntoContext(const ASTContext &C, StringRef str)
This represents '#pragma omp for' directive.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
void setAssociatedStmt(Stmt *S)
Set the associated statement for the directive.
void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)
Set list of helper expressions, required for generation of private copies of original lastprivate var...
Expr * getInputExpr(unsigned i)
Expr * getOutputExpr(unsigned i)
static OMPParallelForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
This represents '#pragma omp cancel' directive.
This represents clause 'firstprivate' in the '#pragma omp ...' directives.
StringRef getInputConstraint(unsigned i) const
The result type of a method or function.
unsigned getNumClauses() const
Get number of clauses.
static OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
static OMPTaskDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target) const
This represents '#pragma omp flush' directive.
This represents '#pragma omp parallel for simd' directive.
static SEHFinallyStmt * Create(const ASTContext &C, SourceLocation FinallyLoc, Stmt *Block)
Expr * ST
Stride - local variable passed to runtime.
static OMPParallelForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
void setLowerBoundVariable(Expr *LB)
static OMPSectionDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
const StringLiteral * getAsmString() const
This captures a statement into a function. For example, the following pragma annotated compound state...
SmallVector< Expr *, 4 > Counters
Counters Loop counters.
static OMPCriticalDirective * Create(const ASTContext &C, const DeclarationNameInfo &Name, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt)
Creates directive.
This represents '#pragma omp single' directive.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void setIterationVariable(Expr *IV)
static OMPOrderedDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
clang::OMPLinearClause OMPVarListClause getInits()
static OMPCancelDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Creates directive.
static OMPTaskDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPTeamsDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
void setVarRefs(ArrayRef< Expr * > VL)
Sets the list of variables for this clause.
static ObjCAtTryStmt * CreateEmpty(const ASTContext &Context, unsigned NumCatchStmts, bool HasFinally)
unsigned getCollapsedNumber() const
Get number of collapsed loops.
OpenMPDirectiveKind
OpenMP directives.
This represents clause 'shared' in the '#pragma omp ...' directives.
MSAsmStmt(const ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc, bool issimple, bool isvolatile, ArrayRef< Token > asmtoks, unsigned numoutputs, unsigned numinputs, ArrayRef< StringRef > constraints, ArrayRef< Expr * > exprs, StringRef asmstr, ArrayRef< StringRef > clobbers, SourceLocation endloc)
static OMPAtomicDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
This represents '#pragma omp taskwait' directive.
void setConditionVariable(const ASTContext &C, VarDecl *V)
This is a basic class for representing single OpenMP clause.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
This represents '#pragma omp target' directive.
Expr * getInputExpr(unsigned i)
SourceLocation getBegin() const
void setClauses(ArrayRef< OMPClause * > Clauses)
Sets the list of variables for this clause.
static OMPAlignedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Expr *A)
Creates clause with a list of variables VL and alignment A.
StringRef getOutputName(unsigned i) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
This represents '#pragma omp ordered' directive.
Expr * LB
LowerBound - local variable passed to runtime.
static OMPCriticalDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
Expr * Init
Loop iteration variable init.
const Decl * getSingleDecl() const
static OMPParallelForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
AddrLabelExpr - The GNU address of label extension, representing &&label.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
static OMPForDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
CompoundStmt(const ASTContext &C, ArrayRef< Stmt * > Stmts, SourceLocation LB, SourceLocation RB)
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
SmallVector< Expr *, 4 > Inits
Expressions for loop counters inits for CodeGen.
static OMPParallelSectionsDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
This represents '#pragma omp section' directive.
This represents '#pragma omp simd' directive.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
QualType getCaughtType() const
StringRef getString() const
This represents clause 'linear' in the '#pragma omp ...' directives.
static LLVM_ATTRIBUTE_UNUSED void check_implementations()
const Expr * getRetValue() const
This represents '#pragma omp atomic' directive.
static OMPSharedClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static OMPOrderedDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt)
Creates directive.
static OMPForSimdDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
static OMPForDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
void setConditionVariable(const ASTContext &C, VarDecl *V)
static OMPBarrierDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
This file defines OpenMP AST classes for executable directives and clauses.
filtered_clause_iterator< ClauseKindFilter > getClausesOfKind(OpenMPClauseKind Kind) const
static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
int getNamedOperand(StringRef SymbolicName) const
Expr * Inc
Loop increment.
static OMPForSimdDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs)
Creates directive with a list of Clauses.
unsigned getNumPlusOperands() const
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP)
StringRef getClobber(unsigned i) const
static OMPSingleDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
SourceManager & getSourceManager()
DeclStmt * getRangeStmt()
SourceLocation getLocEnd() const LLVM_READONLY
IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL=SourceLocation(), Stmt *elsev=nullptr)
static OMPTaskyieldDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Creates directive.
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Expr * UB
UpperBound - local variable passed to runtime.
void setStrideVariable(Expr *ST)
varlist_iterator varlist_end()
static OMPParallelSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
VarDecl * getLoopVariable()
static OMPBarrierDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Creates directive.
void setUpdates(ArrayRef< Expr * > A)
void * Allocate(size_t Size, unsigned Align=8) const
Represents Objective-C's @try ... @catch ... @finally statement.
static OMPSectionsDirective * CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell)
Creates an empty directive with the place for NumClauses clauses.
Defines the clang::TargetInfo interface.
static OMPTaskgroupDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt)
Creates directive.
void setPreCond(Expr *PC)
StringRef getOutputConstraint(unsigned i) const
static OMPParallelDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses, Stmt *AssociatedStmt)
Creates directive with a list of Clauses.
static OMPTaskwaitDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)
Creates directive.
This represents '#pragma omp sections' directive.
const Stmt * getTryBody() const
Retrieve the @try body.
void setNextUpperBound(Expr *NUB)
CapturedRegionKind
The different kinds of captured statement.
DeclStmt * getLoopVarStmt()
static StmtClassNameTable & getStmtInfoTableEntry(Stmt::StmtClass E)
Expr * IL
IsLastIteration - local flag variable passed to runtime.
A trivial tuple used to represent a source range.
This represents '#pragma omp taskyield' directive.
static OMPCancellationPointDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Creates directive.
static OMPFlushDirective * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef< OMPClause * > Clauses)
Creates directive with a list of Clauses.
This represents '#pragma omp parallel sections' directive.
void setCalcLastIteration(Expr *CLI)
const char * getName() const
static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
SourceLocation ColonLoc
Location of ':'.
void setStmts(const ASTContext &C, Stmt **Stmts, unsigned NumStmts)
static SEHExceptStmt * Create(const ASTContext &C, SourceLocation ExceptLoc, Expr *FilterExpr, Stmt *Block)
unsigned varlist_size() const
This class handles loading and caching of source files into memory.
void setInits(ArrayRef< Expr * > A)
static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)
Attr - This represents one attribute.
static OMPCancellationPointDirective * CreateEmpty(const ASTContext &C, EmptyShell)
Creates an empty directive.
SEHFinallyStmt * getFinallyHandler() const
#define BLOCK(DERIVED, BASE)
static OMPLastprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)
Creates clause with a list of variables VL.