16#ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H
17#define LLVM_CLANG_AST_OPENMPCLAUSE_H
29#include "llvm/ADT/ArrayRef.h"
30#include "llvm/ADT/MapVector.h"
31#include "llvm/ADT/PointerIntPair.h"
32#include "llvm/ADT/SmallVector.h"
33#include "llvm/ADT/iterator.h"
34#include "llvm/ADT/iterator_range.h"
35#include "llvm/Frontend/OpenMP/OMPAssume.h"
36#include "llvm/Frontend/OpenMP/OMPConstants.h"
37#include "llvm/Frontend/OpenMP/OMPContext.h"
38#include "llvm/Support/Casting.h"
39#include "llvm/Support/Compiler.h"
40#include "llvm/Support/TrailingObjects.h"
67 : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
110template <OpenMPClauseKind ClauseKind>
117 :
OMPClause(ClauseKind, StartLoc, EndLoc) {}
143template <OpenMPClauseKind ClauseKind,
class Base>
158 :
Base(ClauseKind, StartLoc, EndLoc), LParenLoc(LParenLoc), S(S) {}
163 template <
typename T> T *
getStmtAs()
const {
return cast_or_null<T>(S); }
199 Stmt *PreInit =
nullptr;
206 assert(
get(This) &&
"get is not tuned for pre-init.");
214 CaptureRegion = ThisRegion;
237 Expr *PostUpdate =
nullptr;
241 assert(
get(This) &&
"get is not tuned for post-update.");
294 :
OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
299 static_cast<T *
>(
this)->
template getTrailingObjects<Expr *>(), NumVars);
304 assert(VL.size() == NumVars &&
305 "Number of variables is not the same as the preallocated buffer");
306 std::copy(VL.begin(), VL.end(),
307 static_cast<T *
>(
this)->template getTrailingObjects<Expr *>());
340 static_cast<const T *
>(
this)->
template getTrailingObjects<Expr *>(),
414 static OMPAlignClause *
Create(
const ASTContext &
C, Expr *A,
415 SourceLocation StartLoc,
416 SourceLocation LParenLoc,
417 SourceLocation EndLoc);
432 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
435 friend TrailingObjects;
439 Expr *Allocator =
nullptr;
455 LParenLoc, EndLoc, N),
456 Allocator(Allocator), ColonLoc(ColonLoc) {}
467 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
469 void setAllocator(Expr *A) { Allocator = A; }
481 static OMPAllocateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
482 SourceLocation LParenLoc, Expr *Allocator,
483 SourceLocation ColonLoc,
484 SourceLocation EndLoc, ArrayRef<Expr *> VL);
534 Stmt *Condition =
nullptr;
552 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
555 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
576 ColonLoc(ColonLoc), NameModifier(NameModifier),
577 NameModifierLoc(NameModifierLoc) {
680 void setNumThreads(
Expr *NThreads) {
setStmt(NThreads); }
788 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
801 NumSizes(NumSizes) {}
833 ->
template getTrailingObjects<Expr *>(),
838 ->
template getTrailingObjects<Expr *>(),
844 assert(VL.size() == NumSizes);
845 std::copy(VL.begin(), VL.end(),
847 ->template getTrailingObjects<Expr *>());
853 reinterpret_cast<Stmt **
>(Sizes.end()));
858 reinterpret_cast<Stmt *
const *
>(Sizes.end()));
920 void setFactor(Expr *E) { Factor = E; }
923 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
933 static OMPPartialClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
934 SourceLocation LParenLoc,
935 SourceLocation EndLoc, Expr *Factor);
940 static OMPPartialClause *
CreateEmpty(
const ASTContext &
C);
1015 llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
1023 void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
1028 void setDefaultKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1042 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1096 llvm::omp::ProcBindKind Kind = llvm::omp::OMP_PROC_BIND_unknown;
1104 void setProcBindKind(llvm::omp::ProcBindKind K) { Kind = K; }
1109 void setProcBindKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1124 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1202 :
OMPClause(
llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1225 return T->
getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
1245 :
OMPClause(
llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
1268 return T->
getClauseKind() == llvm::omp::OMPC_reverse_offload;
1288 :
OMPClause(
llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
1311 return T->
getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
1363 :
OMPClause(
llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
1364 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1401 return T->
getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
1435 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1448 :
OMPClause(
llvm::omp::OMPC_at, StartLoc, EndLoc), LParenLoc(LParenLoc),
1449 Kind(A), KindKwLoc(ALoc) {}
1511 void setSeverityKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1514 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1528 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1578 Stmt *MessageString =
nullptr;
1581 void setMessageString(
Expr *MS) { MessageString = MS; }
1596 LParenLoc(LParenLoc), MessageString(MS) {}
1610 return child_range(&MessageString, &MessageString + 1);
1647 enum {FIRST, SECOND, NUM_MODIFIERS};
1660 Expr *ChunkSize =
nullptr;
1671 Modifiers[FIRST] = M;
1678 Modifiers[SECOND] = M;
1682 void setFirstScheduleModifierLoc(SourceLocation Loc) {
1683 ModifiersLoc[FIRST] = Loc;
1687 void setSecondScheduleModifierLoc(SourceLocation Loc) {
1688 ModifiersLoc[SECOND] = Loc;
1696 Modifiers[FIRST] = M;
1699 Modifiers[SECOND] = M;
1706 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1711 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
1716 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
1721 void setChunkSize(Expr *E) { ChunkSize = E; }
1742 Expr *ChunkSize,
Stmt *HelperChunkSize,
1747 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
1749 Modifiers[FIRST] = M1;
1750 Modifiers[SECOND] = M2;
1751 ModifiersLoc[FIRST] = M1Loc;
1752 ModifiersLoc[SECOND] = M2Loc;
1768 return Modifiers[FIRST];
1773 return Modifiers[SECOND];
1784 return ModifiersLoc[FIRST];
1789 return ModifiersLoc[SECOND];
1803 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
1832 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
1834 friend TrailingObjects;
1840 Stmt *NumForLoops =
nullptr;
1843 unsigned NumberOfLoops = 0;
1855 LParenLoc(LParenLoc), NumForLoops(Num), NumberOfLoops(NumLoops) {}
1860 NumberOfLoops(NumLoops) {}
1863 void setNumForLoops(Expr *Num) { NumForLoops = Num; }
1873 static OMPOrderedClause *
Create(
const ASTContext &
C, Expr *Num,
1874 unsigned NumLoops, SourceLocation StartLoc,
1875 SourceLocation LParenLoc,
1876 SourceLocation EndLoc);
1879 static OMPOrderedClause*
CreateEmpty(
const ASTContext &
C,
unsigned NumLoops);
2111 private llvm::TrailingObjects<OMPUpdateClause, SourceLocation,
2112 OpenMPDependClauseKind> {
2114 friend TrailingObjects;
2117 bool IsExtended =
false;
2121 size_t numTrailingObjects(OverloadToken<SourceLocation>)
const {
2123 return IsExtended ? 2 : 0;
2128 assert(IsExtended &&
"Expected extended clause.");
2129 *getTrailingObjects<SourceLocation>() = Loc;
2133 void setArgumentLoc(SourceLocation Loc) {
2134 assert(IsExtended &&
"Expected extended clause.");
2135 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
2140 assert(IsExtended &&
"Expected extended clause.");
2141 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
2148 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc,
2151 IsExtended(IsExtended) {}
2154 OMPUpdateClause(
bool IsExtended)
2155 :
OMPClause(
llvm::omp::OMPC_update, SourceLocation(), SourceLocation()),
2156 IsExtended(IsExtended) {}
2164 static OMPUpdateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2165 SourceLocation EndLoc);
2175 static OMPUpdateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2176 SourceLocation LParenLoc,
2177 SourceLocation ArgumentLoc,
2179 SourceLocation EndLoc);
2186 static OMPUpdateClause *
CreateEmpty(
const ASTContext &
C,
bool IsExtended);
2208 assert(IsExtended &&
"Expected extended clause.");
2209 return *getTrailingObjects<SourceLocation>();
2214 assert(IsExtended &&
"Expected extended clause.");
2215 return *std::next(getTrailingObjects<SourceLocation>(), 1);
2220 assert(IsExtended &&
"Expected extended clause.");
2221 return *getTrailingObjects<OpenMPDependClauseKind>();
2525 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
2528 friend TrailingObjects;
2539 LParenLoc, EndLoc, N) {}
2552 void setPrivateCopies(ArrayRef<Expr *> VL);
2556 MutableArrayRef<Expr *> getPrivateCopies() {
2559 ArrayRef<const Expr *> getPrivateCopies()
const {
2572 static OMPPrivateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2573 SourceLocation LParenLoc,
2574 SourceLocation EndLoc, ArrayRef<Expr *> VL,
2575 ArrayRef<Expr *> PrivateVL);
2581 static OMPPrivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2587 llvm::iterator_range<private_copies_const_iterator>;
2591 getPrivateCopies().end());
2596 getPrivateCopies().end());
2632 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
2635 friend TrailingObjects;
2646 StartLoc, LParenLoc, EndLoc, N),
2661 void setPrivateCopies(ArrayRef<Expr *> VL);
2665 MutableArrayRef<Expr *> getPrivateCopies() {
2668 ArrayRef<const Expr *> getPrivateCopies()
const {
2675 void setInits(ArrayRef<Expr *> VL);
2679 MutableArrayRef<Expr *> getInits() {
2680 return MutableArrayRef<Expr *>(getPrivateCopies().end(),
varlist_size());
2682 ArrayRef<const Expr *> getInits()
const {
2700 static OMPFirstprivateClause *
2701 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
2702 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
2703 ArrayRef<Expr *> InitVL, Stmt *PreInit);
2709 static OMPFirstprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2715 llvm::iterator_range<private_copies_const_iterator>;
2719 getPrivateCopies().end());
2723 getPrivateCopies().end());
2732 return inits_range(getInits().begin(), getInits().end());
2773 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
2792 friend TrailingObjects;
2812 StartLoc, LParenLoc, EndLoc, N),
2814 ColonLoc(ColonLoc) {}
2827 MutableArrayRef<Expr *> getPrivateCopies() {
2830 ArrayRef<const Expr *> getPrivateCopies()
const {
2838 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
2841 MutableArrayRef<Expr *> getSourceExprs() {
2842 return MutableArrayRef<Expr *>(getPrivateCopies().end(),
varlist_size());
2844 ArrayRef<const Expr *> getSourceExprs()
const {
2852 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
2855 MutableArrayRef<Expr *> getDestinationExprs() {
2856 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
2858 ArrayRef<const Expr *> getDestinationExprs()
const {
2865 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
2868 MutableArrayRef<Expr *> getAssignmentOps() {
2869 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
2871 ArrayRef<const Expr *> getAssignmentOps()
const {
2878 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
2880 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
2910 static OMPLastprivateClause *
2911 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
2912 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
2913 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
2915 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
2921 static OMPLastprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2934 llvm::iterator_range<helper_expr_const_iterator>;
2942 getPrivateCopies().end());
2947 getPrivateCopies().end());
2952 getSourceExprs().end());
2961 getDestinationExprs().end());
2966 getDestinationExprs().end());
2971 getAssignmentOps().end());
2976 getAssignmentOps().end());
3010 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
3012 friend TrailingObjects;
3023 LParenLoc, EndLoc, N) {}
3084 private llvm::TrailingObjects<OMPReductionClause, Expr *> {
3087 friend TrailingObjects;
3121 StartLoc, LParenLoc, EndLoc, N),
3123 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
3124 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3139 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
3142 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3145 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3148 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3153 void setPrivates(ArrayRef<Expr *> Privates);
3156 MutableArrayRef<Expr *> getPrivates() {
3159 ArrayRef<const Expr *> getPrivates()
const {
3166 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3169 MutableArrayRef<Expr *> getLHSExprs() {
3170 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3172 ArrayRef<const Expr *> getLHSExprs()
const {
3181 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3184 MutableArrayRef<Expr *> getRHSExprs() {
3185 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3187 ArrayRef<const Expr *> getRHSExprs()
const {
3195 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3198 MutableArrayRef<Expr *> getReductionOps() {
3199 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3201 ArrayRef<const Expr *> getReductionOps()
const {
3207 void setInscanCopyOps(ArrayRef<Expr *> Ops);
3210 MutableArrayRef<Expr *> getInscanCopyOps() {
3211 return MutableArrayRef<Expr *>(getReductionOps().end(),
varlist_size());
3213 ArrayRef<const Expr *> getInscanCopyOps()
const {
3218 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
3221 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
3222 return MutableArrayRef<Expr *>(getInscanCopyOps().end(),
varlist_size());
3224 ArrayRef<const Expr *> getInscanCopyArrayTemps()
const {
3229 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
3232 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
3233 return MutableArrayRef<Expr *>(getInscanCopyArrayTemps().end(),
3236 ArrayRef<const Expr *> getInscanCopyArrayElems()
const {
3280 static OMPReductionClause *
3281 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3282 SourceLocation ModifierLoc, SourceLocation ColonLoc,
3284 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
3285 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3286 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3287 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
3288 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
3289 Stmt *PreInit, Expr *PostUpdate);
3296 static OMPReductionClause *
3319 llvm::iterator_range<helper_expr_const_iterator>;
3347 getReductionOps().end());
3352 getReductionOps().end());
3357 getInscanCopyOps().end());
3362 getInscanCopyOps().end());
3367 getInscanCopyArrayTemps().end());
3372 getInscanCopyArrayTemps().end());
3377 getInscanCopyArrayElems().end());
3382 getInscanCopyArrayElems().end());
3420 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
3423 friend TrailingObjects;
3448 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
3450 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3462 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3465 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3468 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3472 void setPrivates(ArrayRef<Expr *> Privates);
3475 MutableArrayRef<Expr *> getPrivates() {
3478 ArrayRef<const Expr *> getPrivates()
const {
3485 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3488 MutableArrayRef<Expr *> getLHSExprs() {
3489 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3491 ArrayRef<const Expr *> getLHSExprs()
const {
3499 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3502 MutableArrayRef<Expr *> getRHSExprs() {
3503 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3505 ArrayRef<const Expr *> getRHSExprs()
const {
3513 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3516 MutableArrayRef<Expr *> getReductionOps() {
3517 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3519 ArrayRef<const Expr *> getReductionOps()
const {
3556 static OMPTaskReductionClause *
3557 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3558 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3559 NestedNameSpecifierLoc QualifierLoc,
3560 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3561 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3562 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
3568 static OMPTaskReductionClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
3583 llvm::iterator_range<helper_expr_const_iterator>;
3611 getReductionOps().end());
3616 getReductionOps().end());
3637 return T->
getClauseKind() == llvm::omp::OMPC_task_reduction;
3651 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
3654 friend TrailingObjects;
3679 StartLoc, LParenLoc, EndLoc, N),
3681 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3693 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3696 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3699 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3703 void setPrivates(ArrayRef<Expr *> Privates);
3706 MutableArrayRef<Expr *> getPrivates() {
3709 ArrayRef<const Expr *> getPrivates()
const {
3716 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3719 MutableArrayRef<Expr *> getLHSExprs() {
3720 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3722 ArrayRef<const Expr *> getLHSExprs()
const {
3730 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3733 MutableArrayRef<Expr *> getRHSExprs() {
3734 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3736 ArrayRef<const Expr *> getRHSExprs()
const {
3744 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3747 MutableArrayRef<Expr *> getReductionOps() {
3748 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3750 ArrayRef<const Expr *> getReductionOps()
const {
3755 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
3758 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
3759 return MutableArrayRef<Expr *>(getReductionOps().end(),
varlist_size());
3761 ArrayRef<const Expr *> getTaskgroupDescriptors()
const {
3800 static OMPInReductionClause *
3801 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3802 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3803 NestedNameSpecifierLoc QualifierLoc,
3804 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3805 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3806 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
3807 Stmt *PreInit, Expr *PostUpdate);
3813 static OMPInReductionClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
3828 llvm::iterator_range<helper_expr_const_iterator>;
3856 getReductionOps().end());
3861 getReductionOps().end());
3866 getTaskgroupDescriptors().end());
3871 getTaskgroupDescriptors().end());
3907 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
3910 friend TrailingObjects;
3922 void setStep(
Expr *Step) { *(getFinals().end()) = Step; }
3925 void setCalcStep(
Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; }
3934 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3936 SourceLocation ColonLoc, SourceLocation EndLoc,
3938 : OMPVarListClause<OMPLinearClause>(
llvm::omp::OMPC_linear, StartLoc,
3939 LParenLoc, EndLoc, NumVars),
3940 OMPClauseWithPostUpdate(this), Modifier(Modifier),
3941 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
3946 explicit OMPLinearClause(
unsigned NumVars)
3947 : OMPVarListClause<OMPLinearClause>(
llvm::omp::OMPC_linear,
3948 SourceLocation(), SourceLocation(),
3949 SourceLocation(), NumVars),
3964 MutableArrayRef<Expr *> getPrivates() {
3967 ArrayRef<const Expr *> getPrivates()
const {
3971 MutableArrayRef<Expr *> getInits() {
3972 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3974 ArrayRef<const Expr *> getInits()
const {
3979 MutableArrayRef<Expr *> getUpdates() {
3980 return MutableArrayRef<Expr *>(getInits().end(),
varlist_size());
3982 ArrayRef<const Expr *> getUpdates()
const {
3987 MutableArrayRef<Expr *> getFinals() {
3988 return MutableArrayRef<Expr *>(getUpdates().end(),
varlist_size());
3990 ArrayRef<const Expr *> getFinals()
const {
3995 MutableArrayRef<Expr *> getUsedExprs() {
3996 return MutableArrayRef<Expr *>(getFinals().end() + 2,
varlist_size() + 1);
3998 ArrayRef<const Expr *> getUsedExprs()
const {
4004 void setPrivates(ArrayRef<Expr *> PL);
4008 void setInits(ArrayRef<Expr *> IL);
4030 static OMPLinearClause *
4031 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
4033 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4034 ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep,
4035 Stmt *PreInit, Expr *PostUpdate);
4041 static OMPLinearClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumVars);
4090 return privates_range(getPrivates().begin(), getPrivates().end());
4103 return inits_range(getInits().begin(), getInits().end());
4116 return updates_range(getUpdates().begin(), getUpdates().end());
4129 return finals_range(getFinals().begin(), getFinals().end());
4139 llvm::iterator_range<used_expressions_iterator>;
4141 llvm::iterator_range<used_expressions_const_iterator>;
4144 return finals_range(getUsedExprs().begin(), getUsedExprs().end());
4183 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
4186 friend TrailingObjects;
4205 LParenLoc, EndLoc, NumVars),
4206 ColonLoc(ColonLoc) {}
4211 explicit OMPAlignedClause(
unsigned NumVars)
4212 : OMPVarListClause<OMPAlignedClause>(
llvm::omp::OMPC_aligned,
4213 SourceLocation(), SourceLocation(),
4214 SourceLocation(), NumVars) {}
4226 static OMPAlignedClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
4227 SourceLocation LParenLoc,
4228 SourceLocation ColonLoc,
4229 SourceLocation EndLoc, ArrayRef<Expr *> VL,
4236 static OMPAlignedClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumVars);
4281 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
4297 friend TrailingObjects;
4308 LParenLoc, EndLoc, N) {}
4321 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4324 MutableArrayRef<Expr *> getSourceExprs() {
4327 ArrayRef<const Expr *> getSourceExprs()
const {
4334 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4337 MutableArrayRef<Expr *> getDestinationExprs() {
4338 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
4340 ArrayRef<const Expr *> getDestinationExprs()
const {
4348 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4351 MutableArrayRef<Expr *> getAssignmentOps() {
4352 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
4354 ArrayRef<const Expr *> getAssignmentOps()
const {
4380 static OMPCopyinClause *
4381 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
4382 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4383 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
4389 static OMPCopyinClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
4395 llvm::iterator_range<helper_expr_const_iterator>;
4399 getSourceExprs().end());
4408 getDestinationExprs().end());
4413 getDestinationExprs().end());
4418 getAssignmentOps().end());
4423 getAssignmentOps().end());
4458 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
4461 friend TrailingObjects;
4472 StartLoc, LParenLoc, EndLoc, N) {
4486 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4489 MutableArrayRef<Expr *> getSourceExprs() {
4492 ArrayRef<const Expr *> getSourceExprs()
const {
4499 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4502 MutableArrayRef<Expr *> getDestinationExprs() {
4503 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
4505 ArrayRef<const Expr *> getDestinationExprs()
const {
4513 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4516 MutableArrayRef<Expr *> getAssignmentOps() {
4517 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
4519 ArrayRef<const Expr *> getAssignmentOps()
const {
4544 static OMPCopyprivateClause *
4545 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
4546 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4547 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
4553 static OMPCopyprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
4559 llvm::iterator_range<helper_expr_const_iterator>;
4563 getSourceExprs().end());
4572 getDestinationExprs().end());
4577 getDestinationExprs().end());
4582 getAssignmentOps().end());
4587 getAssignmentOps().end());
4626 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
4628 friend TrailingObjects;
4639 LParenLoc, EndLoc, N) {}
4708 Expr *Depobj =
nullptr;
4718 LParenLoc(LParenLoc) {}
4725 void setDepobj(Expr *E) { Depobj = E; }
4728 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
4738 static OMPDepobjClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
4739 SourceLocation LParenLoc,
4740 SourceLocation EndLoc, Expr *Depobj);
4745 static OMPDepobjClause *
CreateEmpty(
const ASTContext &
C);