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) {}
116 Stmt *PreInit =
nullptr;
123 assert(
get(
This) &&
"get is not tuned for pre-init.");
131 CaptureRegion = ThisRegion;
154 Expr *PostUpdate =
nullptr;
158 assert(
get(
This) &&
"get is not tuned for post-update.");
211 :
OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
216 static_cast<T *
>(
this)->
template getTrailingObjects<Expr *>(), NumVars);
221 assert(VL.size() == NumVars &&
222 "Number of variables is not the same as the preallocated buffer");
223 std::copy(VL.begin(), VL.end(),
224 static_cast<T *
>(
this)->template getTrailingObjects<Expr *>());
256 return llvm::makeArrayRef(
257 static_cast<const T *
>(
this)->
template getTrailingObjects<Expr *>(),
277 Stmt *Allocator =
nullptr;
280 void setAllocator(
Expr *A) { Allocator = A; }
292 LParenLoc(LParenLoc), Allocator(A) {}
342 Stmt *Alignment =
nullptr;
345 void setAlignment(
Expr *A) { Alignment = A; }
356 OMPAlignClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc,
357 SourceLocation EndLoc)
359 LParenLoc(LParenLoc), Alignment(A) {}
363 :
OMPClause(
llvm::omp::OMPC_align, SourceLocation(), SourceLocation()) {}
372 static OMPAlignClause *
Create(
const ASTContext &
C, Expr *A,
373 SourceLocation StartLoc,
374 SourceLocation LParenLoc,
375 SourceLocation EndLoc);
410 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
413 friend TrailingObjects;
417 Expr *Allocator =
nullptr;
433 LParenLoc, EndLoc, N),
434 Allocator(Allocator), ColonLoc(ColonLoc) {}
445 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
447 void setAllocator(Expr *A) { Allocator = A; }
459 static OMPAllocateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
460 SourceLocation LParenLoc, Expr *Allocator,
461 SourceLocation ColonLoc,
462 SourceLocation EndLoc, ArrayRef<Expr *> VL);
512 Stmt *Condition =
nullptr;
530 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
533 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
554 ColonLoc(ColonLoc), NameModifier(NameModifier),
555 NameModifierLoc(NameModifierLoc) {
613 Stmt *Condition =
nullptr;
682 Stmt *NumThreads =
nullptr;
685 void setNumThreads(
Expr *NThreads) { NumThreads = NThreads; }
703 NumThreads(NumThreads) {
759 Stmt *Safelen =
nullptr;
762 void setSafelen(
Expr *Len) { Safelen = Len; }
773 LParenLoc(LParenLoc), Safelen(Len) {}
825 Stmt *Simdlen =
nullptr;
828 void setSimdlen(
Expr *Len) { Simdlen = Len; }
839 LParenLoc(LParenLoc), Simdlen(Len) {}
882 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
895 NumSizes(NumSizes) {}
927 ->
template getTrailingObjects<Expr *>(),
932 ->
template getTrailingObjects<Expr *>(),
938 assert(VL.size() == NumSizes);
939 std::copy(VL.begin(), VL.end(),
941 ->template getTrailingObjects<Expr *>());
947 reinterpret_cast<Stmt **
>(Sizes.end()));
952 reinterpret_cast<Stmt *
const *
>(Sizes.end()));
985 static OMPFullClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
986 SourceLocation EndLoc);
1030 void setFactor(Expr *E) { Factor = E; }
1033 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1043 static OMPPartialClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1044 SourceLocation LParenLoc,
1045 SourceLocation EndLoc, Expr *Factor);
1050 static OMPPartialClause *
CreateEmpty(
const ASTContext &
C);
1093 Stmt *NumForLoops =
nullptr;
1096 void setNumForLoops(
Expr *Num) { NumForLoops = Num; }
1108 LParenLoc(LParenLoc), NumForLoops(Num) {}
1156 llvm::omp::DefaultKind
Kind = llvm::omp::OMP_DEFAULT_unknown;
1164 void setDefaultKind(llvm::omp::DefaultKind K) {
Kind = K; }
1169 void setDefaultKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1183 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1237 llvm::omp::ProcBindKind
Kind = llvm::omp::OMP_PROC_BIND_unknown;
1245 void setProcBindKind(llvm::omp::ProcBindKind K) {
Kind = K; }
1250 void setProcBindKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1265 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1320 :
OMPClause(
llvm::omp::OMPC_unified_address, StartLoc, EndLoc) {}
1343 return T->
getClauseKind() == llvm::omp::OMPC_unified_address;
1363 :
OMPClause(
llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1386 return T->
getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
1406 :
OMPClause(
llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
1429 return T->
getClauseKind() == llvm::omp::OMPC_reverse_offload;
1449 :
OMPClause(
llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
1472 return T->
getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
1524 :
OMPClause(
llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
1525 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1562 return T->
getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
1583 enum {FIRST, SECOND, NUM_MODIFIERS};
1596 Expr *ChunkSize =
nullptr;
1607 Modifiers[FIRST] = M;
1614 Modifiers[SECOND] = M;
1618 void setFirstScheduleModifierLoc(SourceLocation Loc) {
1619 ModifiersLoc[FIRST] = Loc;
1623 void setSecondScheduleModifierLoc(SourceLocation Loc) {
1624 ModifiersLoc[SECOND] = Loc;
1632 Modifiers[FIRST] = M;
1635 Modifiers[SECOND] = M;
1642 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1647 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
1652 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
1657 void setChunkSize(Expr *E) { ChunkSize = E; }
1678 Expr *ChunkSize,
Stmt *HelperChunkSize,
1683 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
1685 Modifiers[FIRST] = M1;
1686 Modifiers[SECOND] = M2;
1687 ModifiersLoc[FIRST] = M1Loc;
1688 ModifiersLoc[SECOND] = M2Loc;
1704 return Modifiers[FIRST];
1709 return Modifiers[SECOND];
1720 return ModifiersLoc[FIRST];
1725 return ModifiersLoc[SECOND];
1739 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
1768 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
1770 friend TrailingObjects;
1776 Stmt *NumForLoops =
nullptr;
1779 unsigned NumberOfLoops = 0;
1791 LParenLoc(LParenLoc), NumForLoops(Num), NumberOfLoops(NumLoops) {}
1796 NumberOfLoops(NumLoops) {}
1799 void setNumForLoops(Expr *Num) { NumForLoops = Num; }
1809 static OMPOrderedClause *
Create(
const ASTContext &
C, Expr *Num,
1810 unsigned NumLoops, SourceLocation StartLoc,
1811 SourceLocation LParenLoc,
1812 SourceLocation EndLoc);
1815 static OMPOrderedClause*
CreateEmpty(
const ASTContext &
C,
unsigned NumLoops);
2069 private llvm::TrailingObjects<OMPUpdateClause, SourceLocation,
2070 OpenMPDependClauseKind> {
2072 friend TrailingObjects;
2075 bool IsExtended =
false;
2079 size_t numTrailingObjects(OverloadToken<SourceLocation>)
const {
2081 return IsExtended ? 2 : 0;
2086 assert(IsExtended &&
"Expected extended clause.");
2087 *getTrailingObjects<SourceLocation>() = Loc;
2091 void setArgumentLoc(SourceLocation Loc) {
2092 assert(IsExtended &&
"Expected extended clause.");
2093 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
2098 assert(IsExtended &&
"Expected extended clause.");
2099 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
2106 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc,
2109 IsExtended(IsExtended) {}
2112 OMPUpdateClause(
bool IsExtended)
2113 :
OMPClause(
llvm::omp::OMPC_update, SourceLocation(), SourceLocation()),
2114 IsExtended(IsExtended) {}
2122 static OMPUpdateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2123 SourceLocation EndLoc);
2133 static OMPUpdateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2134 SourceLocation LParenLoc,
2135 SourceLocation ArgumentLoc,
2137 SourceLocation EndLoc);
2144 static OMPUpdateClause *
CreateEmpty(
const ASTContext &
C,
bool IsExtended);
2166 assert(IsExtended &&
"Expected extended clause.");
2167 return *getTrailingObjects<SourceLocation>();
2172 assert(IsExtended &&
"Expected extended clause.");
2173 return *std::next(getTrailingObjects<SourceLocation>(), 1);
2178 assert(IsExtended &&
"Expected extended clause.");
2179 return *getTrailingObjects<OpenMPDependClauseKind>();
2483 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
2486 friend TrailingObjects;
2497 LParenLoc, EndLoc, N) {}
2510 void setPrivateCopies(ArrayRef<Expr *> VL);
2514 MutableArrayRef<Expr *> getPrivateCopies() {
2517 ArrayRef<const Expr *> getPrivateCopies()
const {
2530 static OMPPrivateClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
2531 SourceLocation LParenLoc,
2532 SourceLocation EndLoc, ArrayRef<Expr *> VL,
2533 ArrayRef<Expr *> PrivateVL);
2539 static OMPPrivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2545 llvm::iterator_range<private_copies_const_iterator>;
2549 getPrivateCopies().end());
2554 getPrivateCopies().end());
2590 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
2593 friend TrailingObjects;
2604 StartLoc, LParenLoc, EndLoc, N),
2619 void setPrivateCopies(ArrayRef<Expr *> VL);
2623 MutableArrayRef<Expr *> getPrivateCopies() {
2626 ArrayRef<const Expr *> getPrivateCopies()
const {
2633 void setInits(ArrayRef<Expr *> VL);
2637 MutableArrayRef<Expr *> getInits() {
2638 return MutableArrayRef<Expr *>(getPrivateCopies().end(),
varlist_size());
2640 ArrayRef<const Expr *> getInits()
const {
2641 return llvm::makeArrayRef(getPrivateCopies().end(),
varlist_size());
2658 static OMPFirstprivateClause *
2659 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
2660 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
2661 ArrayRef<Expr *> InitVL, Stmt *PreInit);
2667 static OMPFirstprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2673 llvm::iterator_range<private_copies_const_iterator>;
2677 getPrivateCopies().end());
2681 getPrivateCopies().end());
2690 return inits_range(getInits().begin(), getInits().end());
2731 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
2750 friend TrailingObjects;
2770 StartLoc, LParenLoc, EndLoc, N),
2772 ColonLoc(ColonLoc) {}
2785 MutableArrayRef<Expr *> getPrivateCopies() {
2788 ArrayRef<const Expr *> getPrivateCopies()
const {
2796 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
2799 MutableArrayRef<Expr *> getSourceExprs() {
2800 return MutableArrayRef<Expr *>(getPrivateCopies().end(),
varlist_size());
2802 ArrayRef<const Expr *> getSourceExprs()
const {
2803 return llvm::makeArrayRef(getPrivateCopies().end(),
varlist_size());
2810 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
2813 MutableArrayRef<Expr *> getDestinationExprs() {
2814 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
2816 ArrayRef<const Expr *> getDestinationExprs()
const {
2817 return llvm::makeArrayRef(getSourceExprs().end(),
varlist_size());
2823 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
2826 MutableArrayRef<Expr *> getAssignmentOps() {
2827 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
2829 ArrayRef<const Expr *> getAssignmentOps()
const {
2830 return llvm::makeArrayRef(getDestinationExprs().end(),
varlist_size());
2836 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
2838 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
2868 static OMPLastprivateClause *
2869 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
2870 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
2871 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
2873 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
2879 static OMPLastprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
2892 llvm::iterator_range<helper_expr_const_iterator>;
2900 getPrivateCopies().end());
2905 getPrivateCopies().end());
2910 getSourceExprs().end());
2919 getDestinationExprs().end());
2924 getDestinationExprs().end());
2929 getAssignmentOps().end());
2934 getAssignmentOps().end());
2968 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
2970 friend TrailingObjects;
2981 LParenLoc, EndLoc, N) {}
3042 private llvm::TrailingObjects<OMPReductionClause, Expr *> {
3045 friend TrailingObjects;
3079 StartLoc, LParenLoc, EndLoc, N),
3081 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
3082 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3097 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
3100 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3103 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3106 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3111 void setPrivates(ArrayRef<Expr *> Privates);
3114 MutableArrayRef<Expr *> getPrivates() {
3117 ArrayRef<const Expr *> getPrivates()
const {
3124 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3127 MutableArrayRef<Expr *> getLHSExprs() {
3128 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3130 ArrayRef<const Expr *> getLHSExprs()
const {
3131 return llvm::makeArrayRef(getPrivates().end(),
varlist_size());
3139 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3142 MutableArrayRef<Expr *> getRHSExprs() {
3143 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3145 ArrayRef<const Expr *> getRHSExprs()
const {
3146 return llvm::makeArrayRef(getLHSExprs().end(),
varlist_size());
3153 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3156 MutableArrayRef<Expr *> getReductionOps() {
3157 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3159 ArrayRef<const Expr *> getReductionOps()
const {
3160 return llvm::makeArrayRef(getRHSExprs().end(),
varlist_size());
3165 void setInscanCopyOps(ArrayRef<Expr *> Ops);
3168 MutableArrayRef<Expr *> getInscanCopyOps() {
3169 return MutableArrayRef<Expr *>(getReductionOps().end(),
varlist_size());
3171 ArrayRef<const Expr *> getInscanCopyOps()
const {
3172 return llvm::makeArrayRef(getReductionOps().end(),
varlist_size());
3176 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
3179 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
3180 return MutableArrayRef<Expr *>(getInscanCopyOps().end(),
varlist_size());
3182 ArrayRef<const Expr *> getInscanCopyArrayTemps()
const {
3183 return llvm::makeArrayRef(getInscanCopyOps().end(),
varlist_size());
3187 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
3190 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
3191 return MutableArrayRef<Expr *>(getInscanCopyArrayTemps().end(),
3194 ArrayRef<const Expr *> getInscanCopyArrayElems()
const {
3195 return llvm::makeArrayRef(getInscanCopyArrayTemps().end(),
varlist_size());
3238 static OMPReductionClause *
3239 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3240 SourceLocation ModifierLoc, SourceLocation ColonLoc,
3242 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
3243 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3244 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3245 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
3246 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
3247 Stmt *PreInit, Expr *PostUpdate);
3254 static OMPReductionClause *
3277 llvm::iterator_range<helper_expr_const_iterator>;
3305 getReductionOps().end());
3310 getReductionOps().end());
3315 getInscanCopyOps().end());
3320 getInscanCopyOps().end());
3325 getInscanCopyArrayTemps().end());
3330 getInscanCopyArrayTemps().end());
3335 getInscanCopyArrayElems().end());
3340 getInscanCopyArrayElems().end());
3378 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
3381 friend TrailingObjects;
3406 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
3408 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3420 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3423 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3426 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3430 void setPrivates(ArrayRef<Expr *> Privates);
3433 MutableArrayRef<Expr *> getPrivates() {
3436 ArrayRef<const Expr *> getPrivates()
const {
3443 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3446 MutableArrayRef<Expr *> getLHSExprs() {
3447 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3449 ArrayRef<const Expr *> getLHSExprs()
const {
3450 return llvm::makeArrayRef(getPrivates().end(),
varlist_size());
3457 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3460 MutableArrayRef<Expr *> getRHSExprs() {
3461 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3463 ArrayRef<const Expr *> getRHSExprs()
const {
3464 return llvm::makeArrayRef(getLHSExprs().end(),
varlist_size());
3471 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3474 MutableArrayRef<Expr *> getReductionOps() {
3475 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3477 ArrayRef<const Expr *> getReductionOps()
const {
3478 return llvm::makeArrayRef(getRHSExprs().end(),
varlist_size());
3514 static OMPTaskReductionClause *
3515 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3516 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3517 NestedNameSpecifierLoc QualifierLoc,
3518 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3519 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3520 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
3526 static OMPTaskReductionClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
3541 llvm::iterator_range<helper_expr_const_iterator>;
3569 getReductionOps().end());
3574 getReductionOps().end());
3595 return T->
getClauseKind() == llvm::omp::OMPC_task_reduction;
3609 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
3612 friend TrailingObjects;
3637 StartLoc, LParenLoc, EndLoc, N),
3639 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3651 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3654 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3657 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3661 void setPrivates(ArrayRef<Expr *> Privates);
3664 MutableArrayRef<Expr *> getPrivates() {
3667 ArrayRef<const Expr *> getPrivates()
const {
3674 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3677 MutableArrayRef<Expr *> getLHSExprs() {
3678 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3680 ArrayRef<const Expr *> getLHSExprs()
const {
3681 return llvm::makeArrayRef(getPrivates().end(),
varlist_size());
3688 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3691 MutableArrayRef<Expr *> getRHSExprs() {
3692 return MutableArrayRef<Expr *>(getLHSExprs().end(),
varlist_size());
3694 ArrayRef<const Expr *> getRHSExprs()
const {
3695 return llvm::makeArrayRef(getLHSExprs().end(),
varlist_size());
3702 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3705 MutableArrayRef<Expr *> getReductionOps() {
3706 return MutableArrayRef<Expr *>(getRHSExprs().end(),
varlist_size());
3708 ArrayRef<const Expr *> getReductionOps()
const {
3709 return llvm::makeArrayRef(getRHSExprs().end(),
varlist_size());
3713 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
3716 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
3717 return MutableArrayRef<Expr *>(getReductionOps().end(),
varlist_size());
3719 ArrayRef<const Expr *> getTaskgroupDescriptors()
const {
3720 return llvm::makeArrayRef(getReductionOps().end(),
varlist_size());
3758 static OMPInReductionClause *
3759 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3760 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3761 NestedNameSpecifierLoc QualifierLoc,
3762 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3763 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3764 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
3765 Stmt *PreInit, Expr *PostUpdate);
3771 static OMPInReductionClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
3786 llvm::iterator_range<helper_expr_const_iterator>;
3814 getReductionOps().end());
3819 getReductionOps().end());
3824 getTaskgroupDescriptors().end());
3829 getTaskgroupDescriptors().end());
3865 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
3868 friend TrailingObjects;
3880 void setStep(
Expr *Step) { *(getFinals().end()) = Step; }
3883 void setCalcStep(
Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; }
3892 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3894 SourceLocation ColonLoc, SourceLocation EndLoc,
3896 : OMPVarListClause<OMPLinearClause>(
llvm::omp::OMPC_linear, StartLoc,
3897 LParenLoc, EndLoc, NumVars),
3899 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
3904 explicit OMPLinearClause(
unsigned NumVars)
3905 : OMPVarListClause<OMPLinearClause>(
llvm::omp::OMPC_linear,
3906 SourceLocation(), SourceLocation(),
3907 SourceLocation(), NumVars),
3922 MutableArrayRef<Expr *> getPrivates() {
3925 ArrayRef<const Expr *> getPrivates()
const {
3929 MutableArrayRef<Expr *> getInits() {
3930 return MutableArrayRef<Expr *>(getPrivates().end(),
varlist_size());
3932 ArrayRef<const Expr *> getInits()
const {
3933 return llvm::makeArrayRef(getPrivates().end(),
varlist_size());
3937 MutableArrayRef<Expr *> getUpdates() {
3938 return MutableArrayRef<Expr *>(getInits().end(),
varlist_size());
3940 ArrayRef<const Expr *> getUpdates()
const {
3941 return llvm::makeArrayRef(getInits().end(),
varlist_size());
3945 MutableArrayRef<Expr *> getFinals() {
3946 return MutableArrayRef<Expr *>(getUpdates().end(),
varlist_size());
3948 ArrayRef<const Expr *> getFinals()
const {
3949 return llvm::makeArrayRef(getUpdates().end(),
varlist_size());
3953 MutableArrayRef<Expr *> getUsedExprs() {
3954 return MutableArrayRef<Expr *>(getFinals().end() + 2,
varlist_size() + 1);
3956 ArrayRef<const Expr *> getUsedExprs()
const {
3957 return llvm::makeArrayRef(getFinals().end() + 2,
varlist_size() + 1);
3962 void setPrivates(ArrayRef<Expr *> PL);
3966 void setInits(ArrayRef<Expr *> IL);
3988 static OMPLinearClause *
3989 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
3991 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3992 ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep,
3993 Stmt *PreInit, Expr *PostUpdate);
3999 static OMPLinearClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumVars);
4048 return privates_range(getPrivates().begin(), getPrivates().end());
4061 return inits_range(getInits().begin(), getInits().end());
4074 return updates_range(getUpdates().begin(), getUpdates().end());
4087 return finals_range(getFinals().begin(), getFinals().end());
4097 llvm::iterator_range<used_expressions_iterator>;
4099 llvm::iterator_range<used_expressions_const_iterator>;
4102 return finals_range(getUsedExprs().begin(), getUsedExprs().end());
4141 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
4144 friend TrailingObjects;
4163 LParenLoc, EndLoc, NumVars),
4164 ColonLoc(ColonLoc) {}
4169 explicit OMPAlignedClause(
unsigned NumVars)
4170 : OMPVarListClause<OMPAlignedClause>(
llvm::omp::OMPC_aligned,
4171 SourceLocation(), SourceLocation(),
4172 SourceLocation(), NumVars) {}
4184 static OMPAlignedClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
4185 SourceLocation LParenLoc,
4186 SourceLocation ColonLoc,
4187 SourceLocation EndLoc, ArrayRef<Expr *> VL,
4194 static OMPAlignedClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumVars);
4239 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
4255 friend TrailingObjects;
4266 LParenLoc, EndLoc, N) {}
4279 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4282 MutableArrayRef<Expr *> getSourceExprs() {
4285 ArrayRef<const Expr *> getSourceExprs()
const {
4292 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4295 MutableArrayRef<Expr *> getDestinationExprs() {
4296 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
4298 ArrayRef<const Expr *> getDestinationExprs()
const {
4299 return llvm::makeArrayRef(getSourceExprs().end(),
varlist_size());
4306 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4309 MutableArrayRef<Expr *> getAssignmentOps() {
4310 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
4312 ArrayRef<const Expr *> getAssignmentOps()
const {
4313 return llvm::makeArrayRef(getDestinationExprs().end(),
varlist_size());
4338 static OMPCopyinClause *
4339 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
4340 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4341 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
4347 static OMPCopyinClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
4353 llvm::iterator_range<helper_expr_const_iterator>;
4357 getSourceExprs().end());
4366 getDestinationExprs().end());
4371 getDestinationExprs().end());
4376 getAssignmentOps().end());
4381 getAssignmentOps().end());
4416 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
4419 friend TrailingObjects;
4430 StartLoc, LParenLoc, EndLoc, N) {
4444 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4447 MutableArrayRef<Expr *> getSourceExprs() {
4450 ArrayRef<const Expr *> getSourceExprs()
const {
4457 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4460 MutableArrayRef<Expr *> getDestinationExprs() {
4461 return MutableArrayRef<Expr *>(getSourceExprs().end(),
varlist_size());
4463 ArrayRef<const Expr *> getDestinationExprs()
const {
4464 return llvm::makeArrayRef(getSourceExprs().end(),
varlist_size());
4471 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4474 MutableArrayRef<Expr *> getAssignmentOps() {
4475 return MutableArrayRef<Expr *>(getDestinationExprs().end(),
varlist_size());
4477 ArrayRef<const Expr *> getAssignmentOps()
const {
4478 return llvm::makeArrayRef(getDestinationExprs().end(),
varlist_size());
4502 static OMPCopyprivateClause *
4503 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
4504 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4505 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
4511 static OMPCopyprivateClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
4517 llvm::iterator_range<helper_expr_const_iterator>;
4521 getSourceExprs().end());
4530 getDestinationExprs().end());
4535 getDestinationExprs().end());
4540 getAssignmentOps().end());
4545 getAssignmentOps().end());
4584 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
4586 friend TrailingObjects;
4597 LParenLoc, EndLoc, N) {}
4666 Expr *Depobj =
nullptr;
4676 LParenLoc(LParenLoc) {}
4683 void setDepobj(Expr *E) { Depobj = E; }
4686 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
4696 static OMPDepobjClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
4697 SourceLocation LParenLoc,
4698 SourceLocation EndLoc, Expr *Depobj);
4703 static OMPDepobjClause *
CreateEmpty(
const ASTContext &
C);
4714 reinterpret_cast<Stmt **
>(&Depobj) + 1);
4744 private llvm::TrailingObjects<OMPDependClause, Expr *> {
4747 friend TrailingObjects;
4759 unsigned NumLoops = 0;
4772 LParenLoc, EndLoc, N),
4773 NumLoops(NumLoops) {}
4784 NumLoops(NumLoops) {}
4790 void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; }
4793 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4796 void setModifier(Expr *DepModifier);
4811 static OMPDependClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
4812 SourceLocation LParenLoc,
4813 SourceLocation EndLoc, Expr *DepModifier,
4815 SourceLocation DepLoc, SourceLocation ColonLoc,
4816 ArrayRef<Expr *> VL,
unsigned NumLoops);
4824 static OMPDependClause *
CreateEmpty(
const ASTContext &
C,
unsigned N,
4896 Stmt *Device =
nullptr;
4901 void setDevice(
Expr *E) { Device = E; }
4907 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
4926 ModifierLoc(ModifierLoc), Device(E) {