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/Frontend/OpenMP/OMPVersion.h"
39#include "llvm/Support/Casting.h"
40#include "llvm/Support/Compiler.h"
41#include "llvm/Support/TrailingObjects.h"
69 : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
110template <OpenMPClauseKind ClauseKind>
117 :
OMPClause(ClauseKind, StartLoc, EndLoc) {}
139 return T->getClauseKind() == ClauseKind;
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); }
189 return T->getClauseKind() == ClauseKind;
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) {}
298 return static_cast<T *
>(
this)->
template getTrailingObjectsNonStrict<Expr *>(
304 assert(VL.size() == NumVars &&
305 "Number of variables is not the same as the preallocated buffer");
334 return static_cast<const T *
>(
this)
335 ->
template getTrailingObjectsNonStrict<Expr *>(NumVars);
360 :
OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc),
379 return static_cast<T *
>(
this)
380 ->
template getTrailingObjectsNonStrict<OpenMPDirectiveKind>(
NumKinds);
386 "Number of directive kinds is not the same as the preallocated buffer");
437class OMPAlignClause final
464 static OMPAlignClause *
Create(
const ASTContext &
C, Expr *A,
465 SourceLocation StartLoc,
466 SourceLocation LParenLoc,
467 SourceLocation EndLoc);
481class OMPAllocateClause final
482 :
public OMPVarListClause<OMPAllocateClause>,
483 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
485 friend OMPVarListClause;
486 friend TrailingObjects;
490 Expr *Allocator =
nullptr;
493 Expr *Alignment =
nullptr;
504 enum { FIRST, SECOND, NUM_MODIFIERS };
514 Modifiers[FIRST] = M;
520 void setSecondAllocateModifier(OpenMPAllocateClauseModifier M) {
521 Modifiers[SECOND] = M;
525 void setFirstAllocateModifierLoc(SourceLocation Loc) {
526 ModifiersLoc[FIRST] = Loc;
530 void setSecondAllocateModifierLoc(SourceLocation Loc) {
531 ModifiersLoc[SECOND] = Loc;
544 OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
545 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
547 SourceLocation Modifier1Loc,
549 SourceLocation Modifier2Loc, SourceLocation EndLoc,
551 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
552 LParenLoc, EndLoc, N),
553 Allocator(Allocator), Alignment(Alignment), ColonLoc(ColonLoc) {
554 Modifiers[FIRST] = Modifier1;
555 Modifiers[SECOND] = Modifier2;
556 ModifiersLoc[FIRST] = Modifier1Loc;
557 ModifiersLoc[SECOND] = Modifier2Loc;
563 explicit OMPAllocateClause(
unsigned N)
564 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
565 SourceLocation(), SourceLocation(),
566 SourceLocation(), N) {
572 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
574 void setAllocator(Expr *A) { Allocator = A; }
576 AllocatorModifier = AM;
578 void setAlignment(Expr *A) { Alignment = A; }
592 static OMPAllocateClause *
593 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
594 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
597 SourceLocation EndLoc, ArrayRef<Expr *> VL);
607 return AllocatorModifier;
612 return Modifiers[FIRST];
617 return ModifiersLoc[FIRST];
622 return Modifiers[SECOND];
627 return ModifiersLoc[SECOND];
634 return AllocatorModifierLoc;
649 return const_cast<OMPAllocateClause *
>(
this)->
children();
660 return T->getClauseKind() == llvm::omp::OMPC_allocate;
678 Stmt *Condition =
nullptr;
690 void setCondition(
Expr *Cond) { Condition = Cond; }
696 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
699 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
720 ColonLoc(ColonLoc), NameModifier(NameModifier),
721 NameModifierLoc(NameModifierLoc) {
760 return T->getClauseKind() == llvm::omp::OMPC_if;
830class OMPNumThreadsClause final
833 private llvm::TrailingObjects<OMPNumThreadsClause, Expr *> {
835 friend TrailingObjects;
840 enum { PRESCRIPTIVENESS, DIMS, NUM_MODIFIERS };
847 SourceLocation ModifiersLoc[NUM_MODIFIERS];
856 OMPNumThreadsClause(
const ASTContext &
C, SourceLocation StartLoc,
857 SourceLocation LParenLoc, SourceLocation EndLoc,
859 : OMPVarListClause<OMPNumThreadsClause>(
llvm::omp::OMPC_num_threads,
860 StartLoc, LParenLoc, EndLoc, N),
866 explicit OMPNumThreadsClause(
unsigned N)
868 llvm::omp::OMPC_num_threads, SourceLocation(), SourceLocation(),
869 SourceLocation(), N),
879 Modifiers[PRESCRIPTIVENESS] = M;
883 void setPrescriptivenessModifierLoc(SourceLocation Loc) {
884 ModifiersLoc[PRESCRIPTIVENESS] = Loc;
888 void setDimsModifierLoc(SourceLocation Loc) { ModifiersLoc[DIMS] = Loc; }
891 void setDimsModifierExpr(Expr *E) { *
varlist_end() = E; }
909 static OMPNumThreadsClause *
911 SourceLocation StartLoc, SourceLocation LParenLoc,
912 SourceLocation EndLoc, ArrayRef<Expr *> VL,
915 SourceLocation PrescriptivenessModifierLoc,
916 SourceLocation DimsModifierLoc, Expr *DimsModifierExpr, Stmt *PreInit);
922 static OMPNumThreadsClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
927 return const_cast<OMPNumThreadsClause *
>(
this)->
getNumThreads();
932 return Modifiers[PRESCRIPTIVENESS];
936 return ModifiersLoc[PRESCRIPTIVENESS];
941 return Modifiers[DIMS];
948 return Modifiers[DIMS] == OMPC_NUMTHREADS_dims;
965 return const_cast<OMPNumThreadsClause *
>(
this)->
children();
976 return T->getClauseKind() == llvm::omp::OMPC_num_threads;
1058class OMPSizesClause final
1060 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1062 friend class llvm::TrailingObjects<OMPSizesClause,
Expr *>;
1071 explicit OMPSizesClause(
int NumSizes)
1073 NumSizes(NumSizes) {}
1104 return getTrailingObjects(NumSizes);
1110 assert(VL.size() == NumSizes);
1117 reinterpret_cast<Stmt **
>(Sizes.end()));
1122 reinterpret_cast<Stmt *
const *
>(Sizes.end()));
1133 return T->getClauseKind() == llvm::omp::OMPC_sizes;
1143class OMPCountsClause final
1145 private llvm::TrailingObjects<OMPCountsClause, Expr *> {
1147 friend class llvm::TrailingObjects<OMPCountsClause,
Expr *>;
1153 unsigned NumCounts = 0;
1156 std::optional<unsigned> OmpFillIndex;
1162 explicit OMPCountsClause(
int NumCounts)
1164 NumCounts(NumCounts) {}
1168 void setOmpFillIndex(std::optional<unsigned> Idx) { OmpFillIndex = Idx; }
1169 void setOmpFillLoc(SourceLocation Loc) { OmpFillLoc = Loc; }
1172 void setCountsRefs(ArrayRef<Expr *> VL) {
1173 assert(VL.size() == NumCounts);
1185 static OMPCountsClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1186 SourceLocation LParenLoc,
1187 SourceLocation EndLoc, ArrayRef<Expr *> Counts,
1188 std::optional<unsigned> FillIdx,
1189 SourceLocation FillLoc);
1195 static OMPCountsClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumCounts);
1209 return getTrailingObjects(NumCounts);
1212 return getTrailingObjects(NumCounts);
1218 reinterpret_cast<Stmt **
>(Counts.end()));
1223 reinterpret_cast<Stmt *
const *
>(Counts.end()));
1233 return T->getClauseKind() == llvm::omp::OMPC_counts;
1245class OMPPermutationClause final
1247 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1260 assert(VL.size() == NumLoops &&
"Expecting one expression per loop");
1261 llvm::copy(VL, getTrailingObjects());
1268 NumLoops(NumLoops) {}
1278 static OMPPermutationClause *
1307 reinterpret_cast<Stmt **
>(Args.end()));
1312 reinterpret_cast<Stmt *
const *
>(Args.end()));
1323 return T->getClauseKind() == llvm::omp::OMPC_permutation;
1373 enum { FirstExpr, CountExpr, NumArgs };
1374 Stmt *Args[NumArgs] = {
nullptr,
nullptr};
1377 void setFirst(Expr *E) { Args[FirstExpr] = E; }
1380 void setCount(Expr *E) { Args[CountExpr] = E; }
1383 explicit OMPLoopRangeClause()
1384 :
OMPClause(llvm::omp::OMPC_looprange, {}, {}) {}
1388 static OMPLoopRangeClause *
1389 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
1390 SourceLocation FirstLoc, SourceLocation CountLoc,
1391 SourceLocation EndLoc, Expr *
First, Expr *Count);
1394 static OMPLoopRangeClause *
CreateEmpty(
const ASTContext &
C);
1424 return T->getClauseKind() == llvm::omp::OMPC_looprange;
1445 explicit OMPPartialClause() :
OMPClause(
llvm::omp::OMPC_partial, {}, {}) {}
1448 void setFactor(Expr *E) { Factor = E; }
1451 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1461 static OMPPartialClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1462 SourceLocation LParenLoc,
1463 SourceLocation EndLoc, Expr *Factor);
1468 static OMPPartialClause *
CreateEmpty(
const ASTContext &
C);
1489 return T->getClauseKind() == llvm::omp::OMPC_partial;
1543 llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
1557 void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
1562 void setDefaultKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1565 void setDefaultVariableCategory(OpenMPDefaultClauseVariableCategory VC) {
1569 void setDefaultVariableCategoryLocation(SourceLocation VCLoc) {
1570 this->VCLoc = VCLoc;
1586 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), VC(VC), VCLoc(VCLoc) {}
1625 return T->getClauseKind() == llvm::omp::OMPC_default;
1656 void setThreadsetKindLoc(
SourceLocation KLoc) { KindLoc = KLoc; }
1670 LParenLoc(LParenLoc), Kind(A), KindLoc(ALoc) {}
1705 return T->getClauseKind() == llvm::omp::OMPC_threadset;
1720class OMPTransparentClause final
1723 friend class OMPClauseReader;
1726 SourceLocation LParenLoc;
1729 Expr *ImpexType =
nullptr;
1732 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1734 void setImpexTypeKind(Expr *E) { ImpexType = E; }
1746 OMPTransparentClause(Expr *ImpexTypeKind, Stmt *HelperValStmt,
1747 OpenMPDirectiveKind CaptureRegion,
1748 SourceLocation StartLoc, SourceLocation LParenLoc,
1749 SourceLocation EndLoc)
1750 : OMPOneStmtClause(ImpexTypeKind, StartLoc, LParenLoc, EndLoc),
1751 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
1752 ImpexType(ImpexTypeKind) {
1753 setPreInitStmt(HelperValStmt, CaptureRegion);
1757 OMPTransparentClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
1760 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1763 Expr *getImpexType()
const {
return ImpexType; }
1766 return child_range(
reinterpret_cast<Stmt **
>(&ImpexType),
1767 reinterpret_cast<Stmt **
>(&ImpexType) + 1);
1770 const_child_range
children()
const {
1771 return const_cast<OMPTransparentClause *
>(
this)->
children();
1775 return child_range(child_iterator(), child_iterator());
1778 return const_child_range(const_child_iterator(), const_child_iterator());
1781 static bool classof(
const OMPClause *T) {
1782 return T->getClauseKind() == llvm::omp::OMPC_transparent;
1794class OMPProcBindClause :
public OMPClause {
1795 friend class OMPClauseReader;
1798 SourceLocation LParenLoc;
1801 llvm::omp::ProcBindKind
Kind = llvm::omp::OMP_PROC_BIND_unknown;
1804 SourceLocation KindKwLoc;
1809 void setProcBindKind(llvm::omp::ProcBindKind K) {
Kind = K; }
1814 void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1825 OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
1826 SourceLocation StartLoc, SourceLocation LParenLoc,
1827 SourceLocation EndLoc)
1828 : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc),
1829 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1833 : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(),
1834 SourceLocation()) {}
1837 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1840 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1843 llvm::omp::ProcBindKind getProcBindKind()
const {
return Kind; }
1846 SourceLocation getProcBindKindKwLoc()
const {
return KindKwLoc; }
1849 return child_range(child_iterator(), child_iterator());
1852 const_child_range
children()
const {
1853 return const_child_range(const_child_iterator(), const_child_iterator());
1857 return child_range(child_iterator(), child_iterator());
1860 return const_child_range(const_child_iterator(), const_child_iterator());
1863 static bool classof(
const OMPClause *T) {
1864 return T->getClauseKind() == llvm::omp::OMPC_proc_bind;
1876class OMPUnifiedAddressClause final
1879 friend class OMPClauseReader;
1884 OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
1885 : OMPNoChildClause(StartLoc, EndLoc) {}
1888 OMPUnifiedAddressClause() : OMPNoChildClause() {}
1899class OMPUnifiedSharedMemoryClause final :
public OMPClause {
1901 friend class OMPClauseReader;
1906 OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
1907 : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1910 OMPUnifiedSharedMemoryClause()
1911 : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(),
1912 SourceLocation()) {}
1915 return child_range(child_iterator(), child_iterator());
1918 const_child_range
children()
const {
1919 return const_child_range(const_child_iterator(), const_child_iterator());
1923 return child_range(child_iterator(), child_iterator());
1926 return const_child_range(const_child_iterator(), const_child_iterator());
1929 static bool classof(
const OMPClause *T) {
1930 return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
1942class OMPReverseOffloadClause final :
public OMPClause {
1944 friend class OMPClauseReader;
1949 OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
1950 : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
1953 OMPReverseOffloadClause()
1954 : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(),
1955 SourceLocation()) {}
1958 return child_range(child_iterator(), child_iterator());
1961 const_child_range
children()
const {
1962 return const_child_range(const_child_iterator(), const_child_iterator());
1966 return child_range(child_iterator(), child_iterator());
1969 return const_child_range(const_child_iterator(), const_child_iterator());
1972 static bool classof(
const OMPClause *T) {
1973 return T->getClauseKind() == llvm::omp::OMPC_reverse_offload;
1985class OMPDynamicAllocatorsClause final :
public OMPClause {
1987 friend class OMPClauseReader;
1992 OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
1993 : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
1996 OMPDynamicAllocatorsClause()
1997 : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(),
1998 SourceLocation()) {}
2001 return child_range(child_iterator(), child_iterator());
2004 const_child_range
children()
const {
2005 return const_child_range(const_child_iterator(), const_child_iterator());
2009 return child_range(child_iterator(), child_iterator());
2012 return const_child_range(const_child_iterator(), const_child_iterator());
2015 static bool classof(
const OMPClause *T) {
2016 return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
2028class OMPAtomicDefaultMemOrderClause final :
public OMPClause {
2029 friend class OMPClauseReader;
2032 SourceLocation LParenLoc;
2039 SourceLocation KindKwLoc;
2044 void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
2051 void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
2064 OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
2065 SourceLocation ALoc, SourceLocation StartLoc,
2066 SourceLocation LParenLoc,
2067 SourceLocation EndLoc)
2068 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
2069 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2072 OMPAtomicDefaultMemOrderClause()
2073 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(),
2074 SourceLocation()) {}
2077 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2080 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2088 SourceLocation getAtomicDefaultMemOrderKindKwLoc()
const {
return KindKwLoc; }
2091 return child_range(child_iterator(), child_iterator());
2094 const_child_range
children()
const {
2095 return const_child_range(const_child_iterator(), const_child_iterator());
2099 return child_range(child_iterator(), child_iterator());
2102 return const_child_range(const_child_iterator(), const_child_iterator());
2105 static bool classof(
const OMPClause *T) {
2106 return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
2118class OMPSelfMapsClause final :
public OMPClause {
2120 friend class OMPClauseReader;
2125 OMPSelfMapsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2126 : OMPClause(llvm::omp::OMPC_self_maps, StartLoc, EndLoc) {}
2130 : OMPClause(llvm::omp::OMPC_self_maps, SourceLocation(),
2131 SourceLocation()) {}
2134 return child_range(child_iterator(), child_iterator());
2137 const_child_range
children()
const {
2138 return const_child_range(const_child_iterator(), const_child_iterator());
2142 return child_range(child_iterator(), child_iterator());
2145 return const_child_range(const_child_iterator(), const_child_iterator());
2148 static bool classof(
const OMPClause *T) {
2149 return T->getClauseKind() == llvm::omp::OMPC_self_maps;
2160class OMPAtClause final :
public OMPClause {
2161 friend class OMPClauseReader;
2164 SourceLocation LParenLoc;
2170 SourceLocation KindKwLoc;
2175 void setAtKind(OpenMPAtClauseKind K) {
Kind = K; }
2180 void setAtKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2183 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2193 OMPAtClause(OpenMPAtClauseKind A, SourceLocation ALoc,
2194 SourceLocation StartLoc, SourceLocation LParenLoc,
2195 SourceLocation EndLoc)
2196 : OMPClause(llvm::omp::OMPC_at, StartLoc, EndLoc), LParenLoc(LParenLoc),
2197 Kind(A), KindKwLoc(ALoc) {}
2201 : OMPClause(llvm::omp::OMPC_at, SourceLocation(), SourceLocation()) {}
2204 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2210 SourceLocation getAtKindKwLoc()
const {
return KindKwLoc; }
2213 return child_range(child_iterator(), child_iterator());
2216 const_child_range
children()
const {
2217 return const_child_range(const_child_iterator(), const_child_iterator());
2221 return child_range(child_iterator(), child_iterator());
2224 return const_child_range(const_child_iterator(), const_child_iterator());
2227 static bool classof(
const OMPClause *T) {
2228 return T->getClauseKind() == llvm::omp::OMPC_at;
2240class OMPSeverityClause final :
public OMPClause {
2241 friend class OMPClauseReader;
2244 SourceLocation LParenLoc;
2250 SourceLocation KindKwLoc;
2255 void setSeverityKind(OpenMPSeverityClauseKind K) {
Kind = K; }
2260 void setSeverityKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2263 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2273 OMPSeverityClause(OpenMPSeverityClauseKind A, SourceLocation ALoc,
2274 SourceLocation StartLoc, SourceLocation LParenLoc,
2275 SourceLocation EndLoc)
2276 : OMPClause(llvm::omp::OMPC_severity, StartLoc, EndLoc),
2277 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2281 : OMPClause(llvm::omp::OMPC_severity, SourceLocation(),
2282 SourceLocation()) {}
2285 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2291 SourceLocation getSeverityKindKwLoc()
const {
return KindKwLoc; }
2294 return child_range(child_iterator(), child_iterator());
2297 const_child_range
children()
const {
2298 return const_child_range(const_child_iterator(), const_child_iterator());
2302 return child_range(child_iterator(), child_iterator());
2305 return const_child_range(const_child_iterator(), const_child_iterator());
2308 static bool classof(
const OMPClause *T) {
2309 return T->getClauseKind() == llvm::omp::OMPC_severity;
2321class OMPMessageClause final
2324 friend class OMPClauseReader;
2327 void setMessageString(Expr *MS) { setStmt(MS); }
2339 OMPMessageClause(Expr *MS, Stmt *HelperMS, OpenMPDirectiveKind CaptureRegion,
2340 SourceLocation StartLoc, SourceLocation LParenLoc,
2341 SourceLocation EndLoc)
2342 : OMPOneStmtClause(MS, StartLoc, LParenLoc, EndLoc),
2343 OMPClauseWithPreInit(this) {
2344 setPreInitStmt(HelperMS, CaptureRegion);
2348 OMPMessageClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
2351 Expr *getMessageString()
const {
return getStmtAs<Expr>(); }
2354 std::optional<std::string> tryEvaluateString(ASTContext &Ctx)
const {
2355 if (Expr *MessageExpr = getMessageString())
2356 return MessageExpr->tryEvaluateString(Ctx);
2357 return std::nullopt;
2369 friend class OMPClauseReader;
2372 SourceLocation LParenLoc;
2378 enum {FIRST, SECOND, NUM_MODIFIERS};
2382 SourceLocation ModifiersLoc[NUM_MODIFIERS];
2385 SourceLocation KindLoc;
2388 SourceLocation CommaLoc;
2391 Expr *ChunkSize =
nullptr;
2396 void setScheduleKind(OpenMPScheduleClauseKind K) {
Kind = K; }
2401 void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) {
2402 Modifiers[FIRST] = M;
2408 void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) {
2409 Modifiers[SECOND] = M;
2413 void setFirstScheduleModifierLoc(SourceLocation Loc) {
2414 ModifiersLoc[FIRST] = Loc;
2418 void setSecondScheduleModifierLoc(SourceLocation Loc) {
2419 ModifiersLoc[SECOND] = Loc;
2425 void setScheduleModifer(OpenMPScheduleClauseModifier M) {
2426 if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown)
2427 Modifiers[FIRST] = M;
2429 assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown);
2430 Modifiers[SECOND] = M;
2437 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2442 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
2447 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
2452 void setChunkSize(Expr *E) { ChunkSize = E; }
2470 OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2471 SourceLocation KLoc, SourceLocation CommaLoc,
2472 SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
2473 Expr *ChunkSize, Stmt *HelperChunkSize,
2474 OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
2475 OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
2476 : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc),
2477 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
Kind(
Kind),
2478 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
2479 setPreInitStmt(HelperChunkSize);
2480 Modifiers[FIRST] = M1;
2481 Modifiers[SECOND] = M2;
2482 ModifiersLoc[FIRST] = M1Loc;
2483 ModifiersLoc[SECOND] = M2Loc;
2487 explicit OMPScheduleClause()
2488 : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()),
2489 OMPClauseWithPreInit(this) {
2499 return Modifiers[FIRST];
2504 return Modifiers[SECOND];
2508 SourceLocation getLParenLoc() {
return LParenLoc; }
2511 SourceLocation getScheduleKindLoc() {
return KindLoc; }
2514 SourceLocation getFirstScheduleModifierLoc()
const {
2515 return ModifiersLoc[FIRST];
2519 SourceLocation getSecondScheduleModifierLoc()
const {
2520 return ModifiersLoc[SECOND];
2524 SourceLocation getCommaLoc() {
return CommaLoc; }
2527 Expr *getChunkSize() {
return ChunkSize; }
2530 const Expr *getChunkSize()
const {
return ChunkSize; }
2533 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
2534 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
2537 const_child_range
children()
const {
2538 return const_cast<OMPScheduleClause *
>(
this)->
children();
2542 return child_range(child_iterator(), child_iterator());
2545 return const_child_range(const_child_iterator(), const_child_iterator());
2548 static bool classof(
const OMPClause *T) {
2549 return T->getClauseKind() == llvm::omp::OMPC_schedule;
2560class OMPOrderedClause final
2562 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
2563 friend class OMPClauseReader;
2564 friend TrailingObjects;
2567 SourceLocation LParenLoc;
2570 Stmt *NumForLoops =
nullptr;
2573 unsigned NumberOfLoops = 0;
2582 OMPOrderedClause(Expr *Num,
unsigned NumLoops, SourceLocation StartLoc,
2583 SourceLocation LParenLoc, SourceLocation EndLoc)
2584 : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc),
2585 LParenLoc(LParenLoc), NumForLoops(
Num), NumberOfLoops(NumLoops) {}
2588 explicit OMPOrderedClause(
unsigned NumLoops)
2589 : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()),
2590 NumberOfLoops(NumLoops) {}
2593 void setNumForLoops(Expr *Num) { NumForLoops =
Num; }
2603 static OMPOrderedClause *
Create(
const ASTContext &C, Expr *Num,
2604 unsigned NumLoops, SourceLocation StartLoc,
2605 SourceLocation LParenLoc,
2606 SourceLocation EndLoc);
2609 static OMPOrderedClause*
CreateEmpty(
const ASTContext &C,
unsigned NumLoops);
2612 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2615 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2618 Expr *getNumForLoops()
const {
return cast_or_null<Expr>(NumForLoops); }
2621 void setLoopNumIterations(
unsigned NumLoop, Expr *NumIterations);
2623 ArrayRef<Expr *> getLoopNumIterations()
const;
2626 void setLoopCounter(
unsigned NumLoop, Expr *Counter);
2628 Expr *getLoopCounter(
unsigned NumLoop);
2629 const Expr *getLoopCounter(
unsigned NumLoop)
const;
2631 child_range
children() {
return child_range(&NumForLoops, &NumForLoops + 1); }
2633 const_child_range
children()
const {
2634 return const_child_range(&NumForLoops, &NumForLoops + 1);
2638 return child_range(child_iterator(), child_iterator());
2641 return const_child_range(const_child_iterator(), const_child_iterator());
2644 static bool classof(
const OMPClause *T) {
2645 return T->getClauseKind() == llvm::omp::OMPC_ordered;
2656class OMPNowaitClause final :
public OMPClause {
2657 friend class OMPClauseReader;
2660 SourceLocation LParenLoc;
2666 void setCondition(Expr *Cond) {
Condition = Cond; }
2675 OMPNowaitClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
2676 SourceLocation EndLoc)
2677 : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
2678 LParenLoc(LParenLoc),
Condition(Cond) {}
2682 : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
2685 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2688 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2691 Expr *getCondition()
const {
return cast_or_null<Expr>(Condition); }
2695 return child_range(&Condition, &Condition + 1);
2696 return child_range(child_iterator(), child_iterator());
2699 const_child_range
children()
const {
2701 return const_child_range(&Condition, &Condition + 1);
2702 return const_child_range(const_child_iterator(), const_child_iterator());
2707 return const_cast<OMPNowaitClause *
>(
this)->
used_children();
2710 static bool classof(
const OMPClause *T) {
2711 return T->getClauseKind() == llvm::omp::OMPC_nowait;
2721class OMPUntiedClause :
public OMPClause {
2727 OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2728 : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {}
2732 : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), SourceLocation()) {}
2735 return child_range(child_iterator(), child_iterator());
2738 const_child_range
children()
const {
2739 return const_child_range(const_child_iterator(), const_child_iterator());
2743 return child_range(child_iterator(), child_iterator());
2746 return const_child_range(const_child_iterator(), const_child_iterator());
2749 static bool classof(
const OMPClause *T) {
2750 return T->getClauseKind() == llvm::omp::OMPC_untied;
2761class OMPMergeableClause :
public OMPClause {
2767 OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
2768 : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {}
2771 OMPMergeableClause()
2772 : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(),
2773 SourceLocation()) {}
2776 return child_range(child_iterator(), child_iterator());
2779 const_child_range
children()
const {
2780 return const_child_range(const_child_iterator(), const_child_iterator());
2784 return child_range(child_iterator(), child_iterator());
2787 return const_child_range(const_child_iterator(), const_child_iterator());
2790 static bool classof(
const OMPClause *T) {
2791 return T->getClauseKind() == llvm::omp::OMPC_mergeable;
2802class OMPAbsentClause final
2804 private llvm::TrailingObjects<OMPAbsentClause, OpenMPDirectiveKind> {
2805 friend OMPDirectiveListClause;
2806 friend TrailingObjects;
2814 OMPAbsentClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2815 SourceLocation EndLoc,
unsigned NumKinds)
2816 : OMPDirectiveListClause<OMPAbsentClause>(
2817 llvm::omp::OMPC_absent, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2820 OMPAbsentClause(
unsigned NumKinds)
2821 : OMPDirectiveListClause<OMPAbsentClause>(
2822 llvm::omp::OMPC_absent, SourceLocation(), SourceLocation(),
2823 SourceLocation(), NumKinds) {}
2826 static OMPAbsentClause *
Create(
const ASTContext &C,
2827 ArrayRef<OpenMPDirectiveKind> DKVec,
2828 SourceLocation Loc, SourceLocation LLoc,
2829 SourceLocation RLoc);
2831 static OMPAbsentClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2833 static bool classof(
const OMPClause *C) {
2834 return C->getClauseKind() == llvm::omp::OMPC_absent;
2845class OMPContainsClause final
2847 private llvm::TrailingObjects<OMPContainsClause, OpenMPDirectiveKind> {
2848 friend OMPDirectiveListClause;
2849 friend TrailingObjects;
2857 OMPContainsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2858 SourceLocation EndLoc,
unsigned NumKinds)
2859 : OMPDirectiveListClause<OMPContainsClause>(
2860 llvm::omp::OMPC_contains, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2863 OMPContainsClause(
unsigned NumKinds)
2864 : OMPDirectiveListClause<OMPContainsClause>(
2865 llvm::omp::OMPC_contains, SourceLocation(), SourceLocation(),
2866 SourceLocation(), NumKinds) {}
2869 static OMPContainsClause *
Create(
const ASTContext &C,
2870 ArrayRef<OpenMPDirectiveKind> DKVec,
2871 SourceLocation Loc, SourceLocation LLoc,
2872 SourceLocation RLoc);
2874 static OMPContainsClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2876 static bool classof(
const OMPClause *C) {
2877 return C->getClauseKind() == llvm::omp::OMPC_contains;
2888class OMPHoldsClause final
2890 friend class OMPClauseReader;
2897 OMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc,
2898 SourceLocation EndLoc)
2899 : OMPOneStmtClause(E, StartLoc, LParenLoc, EndLoc) {}
2902 OMPHoldsClause() : OMPOneStmtClause() {}
2904 Expr *getExpr()
const {
return getStmtAs<Expr>(); }
2905 void setExpr(Expr *E) { setStmt(E); }
2915class OMPNoOpenMPClause final
2922 OMPNoOpenMPClause(SourceLocation StartLoc, SourceLocation EndLoc)
2923 : OMPNoChildClause(StartLoc, EndLoc) {}
2926 OMPNoOpenMPClause() : OMPNoChildClause() {}
2937class OMPNoOpenMPRoutinesClause final
2944 OMPNoOpenMPRoutinesClause(SourceLocation StartLoc, SourceLocation EndLoc)
2945 : OMPNoChildClause(StartLoc, EndLoc) {}
2948 OMPNoOpenMPRoutinesClause() : OMPNoChildClause() {}
2959class OMPNoOpenMPConstructsClause final
2966 OMPNoOpenMPConstructsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2967 : OMPNoChildClause(StartLoc, EndLoc) {}
2970 OMPNoOpenMPConstructsClause() : OMPNoChildClause() {}
2981class OMPNoParallelismClause final
2988 OMPNoParallelismClause(SourceLocation StartLoc, SourceLocation EndLoc)
2989 : OMPNoChildClause(StartLoc, EndLoc) {}
2992 OMPNoParallelismClause() : OMPNoChildClause() {}
3007 OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
3008 : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {}
3012 : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {}
3015 return child_range(child_iterator(), child_iterator());
3018 const_child_range
children()
const {
3019 return const_child_range(const_child_iterator(), const_child_iterator());
3023 return child_range(child_iterator(), child_iterator());
3026 return const_child_range(const_child_iterator(), const_child_iterator());
3029 static bool classof(
const OMPClause *T) {
3030 return T->getClauseKind() == llvm::omp::OMPC_read;
3040class OMPWriteClause :
public OMPClause {
3046 OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
3047 : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {}
3051 : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {}
3054 return child_range(child_iterator(), child_iterator());
3057 const_child_range
children()
const {
3058 return const_child_range(const_child_iterator(), const_child_iterator());
3062 return child_range(child_iterator(), child_iterator());
3065 return const_child_range(const_child_iterator(), const_child_iterator());
3068 static bool classof(
const OMPClause *T) {
3069 return T->getClauseKind() == llvm::omp::OMPC_write;
3080class OMPUpdateClause :
public OMPClause {
3086 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
3087 : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc) {}
3091 : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()) {}
3094 return child_range(child_iterator(), child_iterator());
3097 const_child_range
children()
const {
3098 return const_child_range(const_child_iterator(), const_child_iterator());
3102 return child_range(child_iterator(), child_iterator());
3105 return const_child_range(const_child_iterator(), const_child_iterator());
3108 static bool classof(
const OMPClause *T) {
3109 return T->getClauseKind() == llvm::omp::OMPC_update;
3121class OMPUpdateDependObjectsClause final
3123 private llvm::TrailingObjects<OMPUpdateDependObjectsClause,
3124 SourceLocation, OpenMPDependClauseKind> {
3125 friend class OMPClauseReader;
3126 friend TrailingObjects;
3130 size_t numTrailingObjects(OverloadToken<SourceLocation>)
const {
3136 void setLParenLoc(SourceLocation Loc) {
3137 *getTrailingObjects<SourceLocation>() = Loc;
3141 void setArgumentLoc(SourceLocation Loc) {
3142 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
3146 void setDependencyKind(OpenMPDependClauseKind DK) {
3147 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
3154 OMPUpdateDependObjectsClause(SourceLocation StartLoc, SourceLocation EndLoc)
3155 : OMPClause(llvm::omp::OMPC_update_depend_objects, StartLoc, EndLoc) {}
3158 OMPUpdateDependObjectsClause()
3159 : OMPClause(llvm::omp::OMPC_update_depend_objects, SourceLocation(),
3160 SourceLocation()) {}
3171 static OMPUpdateDependObjectsClause *
3172 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3173 SourceLocation ArgumentLoc, OpenMPDependClauseKind DK,
3174 SourceLocation EndLoc);
3179 static OMPUpdateDependObjectsClause *
CreateEmpty(
const ASTContext &C);
3182 return child_range(child_iterator(), child_iterator());
3185 const_child_range
children()
const {
3186 return const_child_range(const_child_iterator(), const_child_iterator());
3190 return child_range(child_iterator(), child_iterator());
3193 return const_child_range(const_child_iterator(), const_child_iterator());
3197 SourceLocation getLParenLoc()
const {
3198 return *getTrailingObjects<SourceLocation>();
3202 SourceLocation getArgumentLoc()
const {
3203 return *std::next(getTrailingObjects<SourceLocation>(), 1);
3208 return *getTrailingObjects<OpenMPDependClauseKind>();
3211 static bool classof(
const OMPClause *T) {
3212 return T->getClauseKind() == llvm::omp::OMPC_update_depend_objects;
3223class OMPCaptureClause :
public OMPClause {
3229 OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
3230 : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {}
3234 : OMPClause(llvm::omp::OMPC_capture, SourceLocation(), SourceLocation()) {
3238 return child_range(child_iterator(), child_iterator());
3241 const_child_range
children()
const {
3242 return const_child_range(const_child_iterator(), const_child_iterator());
3246 return child_range(child_iterator(), child_iterator());
3249 return const_child_range(const_child_iterator(), const_child_iterator());
3252 static bool classof(
const OMPClause *T) {
3253 return T->getClauseKind() == llvm::omp::OMPC_capture;
3264class OMPCompareClause final :
public OMPClause {
3270 OMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
3271 : OMPClause(llvm::omp::OMPC_compare, StartLoc, EndLoc) {}
3275 : OMPClause(llvm::omp::OMPC_compare, SourceLocation(), SourceLocation()) {
3279 return child_range(child_iterator(), child_iterator());
3282 const_child_range
children()
const {
3283 return const_child_range(const_child_iterator(), const_child_iterator());
3287 return child_range(child_iterator(), child_iterator());
3290 return const_child_range(const_child_iterator(), const_child_iterator());
3293 static bool classof(
const OMPClause *T) {
3294 return T->getClauseKind() == llvm::omp::OMPC_compare;
3305class OMPSeqCstClause :
public OMPClause {
3311 OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
3312 : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {}
3316 : OMPClause(llvm::omp::OMPC_seq_cst, SourceLocation(), SourceLocation()) {
3320 return child_range(child_iterator(), child_iterator());
3323 const_child_range
children()
const {
3324 return const_child_range(const_child_iterator(), const_child_iterator());
3328 return child_range(child_iterator(), child_iterator());
3331 return const_child_range(const_child_iterator(), const_child_iterator());
3334 static bool classof(
const OMPClause *T) {
3335 return T->getClauseKind() == llvm::omp::OMPC_seq_cst;
3346class OMPAcqRelClause final :
public OMPClause {
3352 OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
3353 : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {}
3357 : OMPClause(llvm::omp::OMPC_acq_rel, SourceLocation(), SourceLocation()) {
3361 return child_range(child_iterator(), child_iterator());
3364 const_child_range
children()
const {
3365 return const_child_range(const_child_iterator(), const_child_iterator());
3369 return child_range(child_iterator(), child_iterator());
3372 return const_child_range(const_child_iterator(), const_child_iterator());
3375 static bool classof(
const OMPClause *T) {
3376 return T->getClauseKind() == llvm::omp::OMPC_acq_rel;
3387class OMPAcquireClause final :
public OMPClause {
3393 OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
3394 : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {}
3398 : OMPClause(llvm::omp::OMPC_acquire, SourceLocation(), SourceLocation()) {
3402 return child_range(child_iterator(), child_iterator());
3405 const_child_range
children()
const {
3406 return const_child_range(const_child_iterator(), const_child_iterator());
3410 return child_range(child_iterator(), child_iterator());
3413 return const_child_range(const_child_iterator(), const_child_iterator());
3416 static bool classof(
const OMPClause *T) {
3417 return T->getClauseKind() == llvm::omp::OMPC_acquire;
3428class OMPReleaseClause final :
public OMPClause {
3434 OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
3435 : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {}
3439 : OMPClause(llvm::omp::OMPC_release, SourceLocation(), SourceLocation()) {
3443 return child_range(child_iterator(), child_iterator());
3446 const_child_range
children()
const {
3447 return const_child_range(const_child_iterator(), const_child_iterator());
3451 return child_range(child_iterator(), child_iterator());
3454 return const_child_range(const_child_iterator(), const_child_iterator());
3457 static bool classof(
const OMPClause *T) {
3458 return T->getClauseKind() == llvm::omp::OMPC_release;
3469class OMPRelaxedClause final :
public OMPClause {
3475 OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
3476 : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {}
3480 : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) {
3484 return child_range(child_iterator(), child_iterator());
3487 const_child_range
children()
const {
3488 return const_child_range(const_child_iterator(), const_child_iterator());
3492 return child_range(child_iterator(), child_iterator());
3495 return const_child_range(const_child_iterator(), const_child_iterator());
3498 static bool classof(
const OMPClause *T) {
3499 return T->getClauseKind() == llvm::omp::OMPC_relaxed;
3510class OMPWeakClause final :
public OMPClause {
3516 OMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
3517 : OMPClause(llvm::omp::OMPC_weak, StartLoc, EndLoc) {}
3521 : OMPClause(llvm::omp::OMPC_weak, SourceLocation(), SourceLocation()) {}
3524 return child_range(child_iterator(), child_iterator());
3527 const_child_range
children()
const {
3528 return const_child_range(const_child_iterator(), const_child_iterator());
3532 return child_range(child_iterator(), child_iterator());
3535 return const_child_range(const_child_iterator(), const_child_iterator());
3538 static bool classof(
const OMPClause *T) {
3539 return T->getClauseKind() == llvm::omp::OMPC_weak;
3550class OMPFailClause final :
public OMPClause {
3555 SourceLocation FailParameterLoc;
3556 SourceLocation LParenLoc;
3558 friend class OMPClauseReader;
3561 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
3564 void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
3567 void setFailParameter(OpenMPClauseKind FailParameter) {
3568 this->FailParameter = FailParameter;
3570 "Invalid fail clause parameter");
3578 OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
3579 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
3581 OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
3582 SourceLocation StartLoc, SourceLocation LParenLoc,
3583 SourceLocation EndLoc)
3584 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
3585 FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
3587 setFailParameter(FailParameter);
3592 : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
3595 return child_range(child_iterator(), child_iterator());
3598 const_child_range
children()
const {
3599 return const_child_range(const_child_iterator(), const_child_iterator());
3603 return child_range(child_iterator(), child_iterator());
3606 return const_child_range(const_child_iterator(), const_child_iterator());
3609 static bool classof(
const OMPClause *T) {
3610 return T->getClauseKind() == llvm::omp::OMPC_fail;
3614 SourceLocation getLParenLoc()
const {
3620 SourceLocation getFailParameterLoc()
const {
return FailParameterLoc; }
3633class OMPPrivateClause final
3635 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
3636 friend class OMPClauseReader;
3637 friend OMPVarListClause;
3638 friend TrailingObjects;
3646 OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3647 SourceLocation EndLoc,
unsigned N)
3648 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private, StartLoc,
3649 LParenLoc, EndLoc, N) {}
3654 explicit OMPPrivateClause(
unsigned N)
3655 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private,
3656 SourceLocation(), SourceLocation(),
3657 SourceLocation(), N) {}
3662 void setPrivateCopies(ArrayRef<Expr *> VL);
3666 MutableArrayRef<Expr *> getPrivateCopies() {
3667 return {varlist_end(), varlist_size()};
3669 ArrayRef<const Expr *> getPrivateCopies()
const {
3670 return {varlist_end(), varlist_size()};
3682 static OMPPrivateClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
3683 SourceLocation LParenLoc,
3684 SourceLocation EndLoc, ArrayRef<Expr *> VL,
3685 ArrayRef<Expr *> PrivateVL);
3691 static OMPPrivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3693 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3694 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3695 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3696 using private_copies_const_range =
3697 llvm::iterator_range<private_copies_const_iterator>;
3699 private_copies_range private_copies() {
return getPrivateCopies(); }
3701 private_copies_const_range private_copies()
const {
3702 return getPrivateCopies();
3706 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3707 reinterpret_cast<Stmt **
>(varlist_end()));
3710 const_child_range
children()
const {
3711 return const_cast<OMPPrivateClause *
>(
this)->
children();
3715 return child_range(child_iterator(), child_iterator());
3718 return const_child_range(const_child_iterator(), const_child_iterator());
3721 static bool classof(
const OMPClause *T) {
3722 return T->getClauseKind() == llvm::omp::OMPC_private;
3734class OMPFirstprivateClause final
3737 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
3738 friend class OMPClauseReader;
3739 friend OMPVarListClause;
3740 friend TrailingObjects;
3748 OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3749 SourceLocation EndLoc,
unsigned N)
3750 : OMPVarListClause<OMPFirstprivateClause>(llvm::omp::OMPC_firstprivate,
3751 StartLoc, LParenLoc, EndLoc, N),
3752 OMPClauseWithPreInit(this) {}
3757 explicit OMPFirstprivateClause(
unsigned N)
3758 : OMPVarListClause<OMPFirstprivateClause>(
3759 llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(),
3760 SourceLocation(), N),
3761 OMPClauseWithPreInit(this) {}
3766 void setPrivateCopies(ArrayRef<Expr *> VL);
3770 MutableArrayRef<Expr *> getPrivateCopies() {
3771 return {varlist_end(), varlist_size()};
3773 ArrayRef<const Expr *> getPrivateCopies()
const {
3774 return {varlist_end(), varlist_size()};
3780 void setInits(ArrayRef<Expr *> VL);
3784 MutableArrayRef<Expr *>
getInits() {
3785 return {getPrivateCopies().end(), varlist_size()};
3787 ArrayRef<const Expr *>
getInits()
const {
3788 return {getPrivateCopies().end(), varlist_size()};
3805 static OMPFirstprivateClause *
3806 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3807 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
3808 ArrayRef<Expr *> InitVL, Stmt *PreInit);
3814 static OMPFirstprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3816 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3817 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3818 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3819 using private_copies_const_range =
3820 llvm::iterator_range<private_copies_const_iterator>;
3822 private_copies_range private_copies() {
return getPrivateCopies(); }
3823 private_copies_const_range private_copies()
const {
3824 return getPrivateCopies();
3829 using inits_range = llvm::iterator_range<inits_iterator>;
3836 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3837 reinterpret_cast<Stmt **
>(varlist_end()));
3840 const_child_range
children()
const {
3841 return const_cast<OMPFirstprivateClause *
>(
this)->
children();
3845 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3846 reinterpret_cast<Stmt **
>(varlist_end()));
3849 return const_cast<OMPFirstprivateClause *
>(
this)->
used_children();
3852 static bool classof(
const OMPClause *T) {
3853 return T->getClauseKind() == llvm::omp::OMPC_firstprivate;
3865class OMPLastprivateClause final
3868 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
3885 friend class OMPClauseReader;
3886 friend OMPVarListClause;
3887 friend TrailingObjects;
3892 SourceLocation LPKindLoc;
3894 SourceLocation ColonLoc;
3902 OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3903 SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
3904 SourceLocation LPKindLoc, SourceLocation ColonLoc,
3906 : OMPVarListClause<OMPLastprivateClause>(llvm::omp::OMPC_lastprivate,
3907 StartLoc, LParenLoc, EndLoc, N),
3908 OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
3909 ColonLoc(ColonLoc) {}
3914 explicit OMPLastprivateClause(
unsigned N)
3915 : OMPVarListClause<OMPLastprivateClause>(
3916 llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(),
3917 SourceLocation(), N),
3918 OMPClauseWithPostUpdate(this) {}
3922 MutableArrayRef<Expr *> getPrivateCopies() {
3923 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3925 ArrayRef<const Expr *> getPrivateCopies()
const {
3926 return {varlist_end(), varlist_size()};
3933 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
3936 MutableArrayRef<Expr *> getSourceExprs() {
3937 return {getPrivateCopies().end(), varlist_size()};
3939 ArrayRef<const Expr *> getSourceExprs()
const {
3940 return {getPrivateCopies().end(), varlist_size()};
3947 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
3950 MutableArrayRef<Expr *> getDestinationExprs() {
3951 return {getSourceExprs().end(), varlist_size()};
3953 ArrayRef<const Expr *> getDestinationExprs()
const {
3954 return {getSourceExprs().end(), varlist_size()};
3960 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
3963 MutableArrayRef<Expr *> getAssignmentOps() {
3964 return {getDestinationExprs().end(), varlist_size()};
3966 ArrayRef<const Expr *> getAssignmentOps()
const {
3967 return {getDestinationExprs().end(), varlist_size()};
3971 void setKind(OpenMPLastprivateModifier Kind) { LPKind =
Kind; }
3973 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
3975 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4005 static OMPLastprivateClause *
4006 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4007 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4008 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
4009 OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
4010 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
4016 static OMPLastprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4021 SourceLocation getKindLoc()
const {
return LPKindLoc; }
4023 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4025 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4026 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4027 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4028 using helper_expr_const_range =
4029 llvm::iterator_range<helper_expr_const_iterator>;
4033 void setPrivateCopies(ArrayRef<Expr *> PrivateCopies);
4035 helper_expr_const_range private_copies()
const {
return getPrivateCopies(); }
4037 helper_expr_range private_copies() {
return getPrivateCopies(); }
4039 helper_expr_const_range source_exprs()
const {
return getSourceExprs(); }
4041 helper_expr_range source_exprs() {
return getSourceExprs(); }
4043 helper_expr_const_range destination_exprs()
const {
4044 return getDestinationExprs();
4047 helper_expr_range destination_exprs() {
return getDestinationExprs(); }
4049 helper_expr_const_range assignment_ops()
const {
return getAssignmentOps(); }
4051 helper_expr_range assignment_ops() {
return getAssignmentOps(); }
4054 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4055 reinterpret_cast<Stmt **
>(varlist_end()));
4058 const_child_range
children()
const {
4059 return const_cast<OMPLastprivateClause *
>(
this)->
children();
4063 return child_range(child_iterator(), child_iterator());
4066 return const_child_range(const_child_iterator(), const_child_iterator());
4069 static bool classof(
const OMPClause *T) {
4070 return T->getClauseKind() == llvm::omp::OMPC_lastprivate;
4081class OMPSharedClause final
4083 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
4084 friend OMPVarListClause;
4085 friend TrailingObjects;
4093 OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4094 SourceLocation EndLoc,
unsigned N)
4095 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared, StartLoc,
4096 LParenLoc, EndLoc, N) {}
4101 explicit OMPSharedClause(
unsigned N)
4102 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared,
4103 SourceLocation(), SourceLocation(),
4104 SourceLocation(), N) {}
4114 static OMPSharedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
4115 SourceLocation LParenLoc,
4116 SourceLocation EndLoc, ArrayRef<Expr *> VL);
4122 static OMPSharedClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4125 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4126 reinterpret_cast<Stmt **
>(varlist_end()));
4129 const_child_range
children()
const {
4130 return const_cast<OMPSharedClause *
>(
this)->
children();
4134 return child_range(child_iterator(), child_iterator());
4137 return const_child_range(const_child_iterator(), const_child_iterator());
4140 static bool classof(
const OMPClause *T) {
4141 return T->getClauseKind() == llvm::omp::OMPC_shared;
4153class OMPReductionClause final
4156 private llvm::TrailingObjects<OMPReductionClause, Expr *, bool> {
4157 friend class OMPClauseReader;
4158 friend OMPVarListClause;
4159 friend TrailingObjects;
4166 OMPC_ORIGINAL_SHARING_default;
4169 SourceLocation ModifierLoc;
4172 SourceLocation ColonLoc;
4175 NestedNameSpecifierLoc QualifierLoc;
4178 DeclarationNameInfo NameInfo;
4190 OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4191 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4192 SourceLocation EndLoc,
4193 OpenMPReductionClauseModifier Modifier,
4194 OpenMPOriginalSharingModifier OriginalSharingModifier,
4195 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4196 const DeclarationNameInfo &NameInfo)
4197 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4198 StartLoc, LParenLoc, EndLoc, N),
4199 OMPClauseWithPostUpdate(this), Modifier(Modifier),
4200 OriginalSharingModifier(OriginalSharingModifier),
4201 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
4202 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4207 explicit OMPReductionClause(
unsigned N)
4208 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4209 SourceLocation(), SourceLocation(),
4210 SourceLocation(), N),
4211 OMPClauseWithPostUpdate(this) {}
4214 void setModifier(OpenMPReductionClauseModifier M) { Modifier = M; }
4217 void setOriginalSharingModifier(OpenMPOriginalSharingModifier M) {
4218 OriginalSharingModifier = M;
4225 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4228 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4231 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4240 return {varlist_end(), varlist_size()};
4243 return {varlist_end(), varlist_size()};
4249 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4252 MutableArrayRef<Expr *> getLHSExprs() {
4255 ArrayRef<const Expr *> getLHSExprs()
const {
4264 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4267 void setPrivateVariableReductionFlags(ArrayRef<bool> Flags) {
4268 assert(Flags.size() == varlist_size() &&
4269 "Number of private flags does not match vars");
4270 llvm::copy(Flags, getTrailingObjects<bool>());
4274 MutableArrayRef<bool> getPrivateVariableReductionFlags() {
4275 return getTrailingObjects<bool>(varlist_size());
4277 ArrayRef<bool> getPrivateVariableReductionFlags()
const {
4278 return getTrailingObjects<bool>(varlist_size());
4282 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
4283 return varlist_size() * (Modifier == OMPC_REDUCTION_inscan ? 8 : 5);
4287 size_t numTrailingObjects(OverloadToken<bool>)
const {
4288 return varlist_size();
4292 MutableArrayRef<Expr *> getRHSExprs() {
4293 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
4295 ArrayRef<const Expr *> getRHSExprs()
const {
4296 return {getLHSExprs().end(), varlist_size()};
4303 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4306 MutableArrayRef<Expr *> getReductionOps() {
4307 return {getRHSExprs().end(), varlist_size()};
4309 ArrayRef<const Expr *> getReductionOps()
const {
4310 return {getRHSExprs().end(), varlist_size()};
4315 void setInscanCopyOps(ArrayRef<Expr *> Ops);
4318 MutableArrayRef<Expr *> getInscanCopyOps() {
4319 return {getReductionOps().end(), varlist_size()};
4321 ArrayRef<const Expr *> getInscanCopyOps()
const {
4322 return {getReductionOps().end(), varlist_size()};
4326 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
4329 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
4330 return {getInscanCopyOps().end(), varlist_size()};
4332 ArrayRef<const Expr *> getInscanCopyArrayTemps()
const {
4333 return {getInscanCopyOps().end(), varlist_size()};
4337 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
4340 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
4341 return {getInscanCopyArrayTemps().end(), varlist_size()};
4343 ArrayRef<const Expr *> getInscanCopyArrayElems()
const {
4344 return {getInscanCopyArrayTemps().end(), varlist_size()};
4388 static OMPReductionClause *
4389 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4390 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4391 SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier,
4392 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
4393 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4394 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4395 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
4396 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
4397 Stmt *PreInit, Expr *PostUpdate, ArrayRef<bool> IsPrivateVarReduction,
4398 OpenMPOriginalSharingModifier OriginalSharingModifier);
4405 static OMPReductionClause *
4407 OpenMPReductionClauseModifier Modifier);
4414 return OriginalSharingModifier;
4421 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4424 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4427 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4429 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4430 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4431 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4432 using helper_expr_const_range =
4433 llvm::iterator_range<helper_expr_const_iterator>;
4434 using helper_flag_iterator = MutableArrayRef<bool>::iterator;
4435 using helper_flag_const_iterator = ArrayRef<bool>::iterator;
4436 using helper_flag_range = llvm::iterator_range<helper_flag_iterator>;
4437 using helper_flag_const_range =
4438 llvm::iterator_range<helper_flag_const_iterator>;
4444 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4446 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4448 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4450 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4452 helper_flag_const_range private_var_reduction_flags()
const {
4453 return getPrivateVariableReductionFlags();
4456 helper_flag_range private_var_reduction_flags() {
4457 return getPrivateVariableReductionFlags();
4460 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4462 helper_expr_range reduction_ops() {
return getReductionOps(); }
4464 helper_expr_const_range copy_ops()
const {
return getInscanCopyOps(); }
4466 helper_expr_range copy_ops() {
return getInscanCopyOps(); }
4468 helper_expr_const_range copy_array_temps()
const {
4469 return getInscanCopyArrayTemps();
4472 helper_expr_range copy_array_temps() {
return getInscanCopyArrayTemps(); }
4474 helper_expr_const_range copy_array_elems()
const {
4475 return getInscanCopyArrayElems();
4478 helper_expr_range copy_array_elems() {
return getInscanCopyArrayElems(); }
4481 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4482 reinterpret_cast<Stmt **
>(varlist_end()));
4485 const_child_range
children()
const {
4486 return const_cast<OMPReductionClause *
>(
this)->
children();
4490 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4491 reinterpret_cast<Stmt **
>(varlist_end()));
4494 return const_cast<OMPReductionClause *
>(
this)->
used_children();
4497 static bool classof(
const OMPClause *T) {
4498 return T->getClauseKind() == llvm::omp::OMPC_reduction;
4510class OMPTaskReductionClause final
4513 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
4514 friend class OMPClauseReader;
4515 friend OMPVarListClause;
4516 friend TrailingObjects;
4519 SourceLocation ColonLoc;
4522 NestedNameSpecifierLoc QualifierLoc;
4525 DeclarationNameInfo NameInfo;
4536 OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4537 SourceLocation ColonLoc, SourceLocation EndLoc,
4538 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4539 const DeclarationNameInfo &NameInfo)
4540 : OMPVarListClause<OMPTaskReductionClause>(
4541 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
4542 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4543 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4548 explicit OMPTaskReductionClause(
unsigned N)
4549 : OMPVarListClause<OMPTaskReductionClause>(
4550 llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(),
4551 SourceLocation(), N),
4552 OMPClauseWithPostUpdate(this) {}
4555 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4558 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4561 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4569 return {varlist_end(), varlist_size()};
4572 return {varlist_end(), varlist_size()};
4578 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4581 MutableArrayRef<Expr *> getLHSExprs() {
4584 ArrayRef<const Expr *> getLHSExprs()
const {
4592 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4595 MutableArrayRef<Expr *> getRHSExprs() {
4596 return {getLHSExprs().end(), varlist_size()};
4598 ArrayRef<const Expr *> getRHSExprs()
const {
4599 return {getLHSExprs().end(), varlist_size()};
4606 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4609 MutableArrayRef<Expr *> getReductionOps() {
4610 return {getRHSExprs().end(), varlist_size()};
4612 ArrayRef<const Expr *> getReductionOps()
const {
4613 return {getRHSExprs().end(), varlist_size()};
4649 static OMPTaskReductionClause *
4650 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4651 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4652 NestedNameSpecifierLoc QualifierLoc,
4653 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4654 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4655 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
4661 static OMPTaskReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4664 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4667 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4670 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4672 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4673 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4674 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4675 using helper_expr_const_range =
4676 llvm::iterator_range<helper_expr_const_iterator>;
4682 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4684 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4686 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4688 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4690 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4692 helper_expr_range reduction_ops() {
return getReductionOps(); }
4695 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4696 reinterpret_cast<Stmt **
>(varlist_end()));
4699 const_child_range
children()
const {
4700 return const_cast<OMPTaskReductionClause *
>(
this)->
children();
4704 return child_range(child_iterator(), child_iterator());
4707 return const_child_range(const_child_iterator(), const_child_iterator());
4710 static bool classof(
const OMPClause *T) {
4711 return T->getClauseKind() == llvm::omp::OMPC_task_reduction;
4722class OMPInReductionClause final
4725 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
4726 friend class OMPClauseReader;
4727 friend OMPVarListClause;
4728 friend TrailingObjects;
4731 SourceLocation ColonLoc;
4734 NestedNameSpecifierLoc QualifierLoc;
4737 DeclarationNameInfo NameInfo;
4748 OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4749 SourceLocation ColonLoc, SourceLocation EndLoc,
4750 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4751 const DeclarationNameInfo &NameInfo)
4752 : OMPVarListClause<OMPInReductionClause>(llvm::omp::OMPC_in_reduction,
4753 StartLoc, LParenLoc, EndLoc, N),
4754 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4755 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4760 explicit OMPInReductionClause(
unsigned N)
4761 : OMPVarListClause<OMPInReductionClause>(
4762 llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(),
4763 SourceLocation(), N),
4764 OMPClauseWithPostUpdate(this) {}
4767 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4770 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4773 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4781 return {varlist_end(), varlist_size()};
4784 return {varlist_end(), varlist_size()};
4790 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4793 MutableArrayRef<Expr *> getLHSExprs() {
4796 ArrayRef<const Expr *> getLHSExprs()
const {
4804 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4807 MutableArrayRef<Expr *> getRHSExprs() {
4808 return {getLHSExprs().end(), varlist_size()};
4810 ArrayRef<const Expr *> getRHSExprs()
const {
4811 return {getLHSExprs().end(), varlist_size()};
4818 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4821 MutableArrayRef<Expr *> getReductionOps() {
4822 return {getRHSExprs().end(), varlist_size()};
4824 ArrayRef<const Expr *> getReductionOps()
const {
4825 return {getRHSExprs().end(), varlist_size()};
4829 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
4832 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
4833 return {getReductionOps().end(), varlist_size()};
4835 ArrayRef<const Expr *> getTaskgroupDescriptors()
const {
4836 return {getReductionOps().end(), varlist_size()};
4874 static OMPInReductionClause *
4875 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4876 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4877 NestedNameSpecifierLoc QualifierLoc,
4878 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4879 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4880 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
4881 Stmt *PreInit, Expr *PostUpdate);
4887 static OMPInReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4890 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4893 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4896 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4898 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4899 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4900 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4901 using helper_expr_const_range =
4902 llvm::iterator_range<helper_expr_const_iterator>;
4908 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4910 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4912 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4914 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4916 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4918 helper_expr_range reduction_ops() {
return getReductionOps(); }
4920 helper_expr_const_range taskgroup_descriptors()
const {
4921 return getTaskgroupDescriptors();
4924 helper_expr_range taskgroup_descriptors() {
4925 return getTaskgroupDescriptors();
4929 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4930 reinterpret_cast<Stmt **
>(varlist_end()));
4933 const_child_range
children()
const {
4934 return const_cast<OMPInReductionClause *
>(
this)->
children();
4938 return child_range(child_iterator(), child_iterator());
4941 return const_child_range(const_child_iterator(), const_child_iterator());
4944 static bool classof(
const OMPClause *T) {
4945 return T->getClauseKind() == llvm::omp::OMPC_in_reduction;
4957class OMPLinearClause final
4960 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
4961 friend class OMPClauseReader;
4962 friend OMPVarListClause;
4963 friend TrailingObjects;
4969 SourceLocation ModifierLoc;
4972 SourceLocation ColonLoc;
4975 SourceLocation StepModifierLoc;
4978 void setStep(Expr *Step) { *(
getFinals().end()) = Step; }
4981 void setCalcStep(Expr *CalcStep) { *(
getFinals().end() + 1) = CalcStep; }
4991 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4992 OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
4993 SourceLocation ColonLoc, SourceLocation StepModifierLoc,
4994 SourceLocation EndLoc,
unsigned NumVars)
4995 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
4996 LParenLoc, EndLoc, NumVars),
4997 OMPClauseWithPostUpdate(this), Modifier(Modifier),
4998 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
4999 StepModifierLoc(StepModifierLoc) {}
5004 explicit OMPLinearClause(
unsigned NumVars)
5005 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear,
5006 SourceLocation(), SourceLocation(),
5007 SourceLocation(), NumVars),
5008 OMPClauseWithPostUpdate(this) {}
5023 return {varlist_end(), varlist_size()};
5026 return {varlist_end(), varlist_size()};
5033 return {getPrivates().end(), varlist_size()};
5038 return {
getInits().end(), varlist_size()};
5041 return {getInits().end(), varlist_size()};
5049 return {getUpdates().end(), varlist_size()};
5054 return {
getFinals().end() + 2, varlist_size() + 1};
5057 return {getFinals().end() + 2, varlist_size() + 1};
5089 static OMPLinearClause *
5131 const Expr *getStep()
const {
return *(getFinals().end()); }
5137 const Expr *getCalcStep()
const {
return *(getFinals().end() + 1); }
5157 privates_const_range privates()
const {
return getPrivates(); }
5166 inits_const_range inits()
const {
return getInits(); }
5175 updates_const_range updates()
const {
return getUpdates(); }
5184 finals_const_range finals()
const {
return getFinals(); }
5189 llvm::iterator_range<used_expressions_iterator>;
5191 llvm::iterator_range<used_expressions_const_iterator>;
5197 used_expressions_const_range used_expressions()
const {
5198 return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
5202 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5203 reinterpret_cast<Stmt **
>(varlist_end()));
5206 const_child_range children()
const {
5207 return const_cast<OMPLinearClause *
>(
this)->children();
5213 return const_cast<OMPLinearClause *
>(
this)->
used_children();
5217 return T->getClauseKind() == llvm::omp::OMPC_linear;
5229class OMPAlignedClause final
5230 :
public OMPVarListClause<OMPAlignedClause>,
5231 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
5233 friend OMPVarListClause;
5234 friend TrailingObjects;
5237 SourceLocation ColonLoc;
5240 void setAlignment(Expr *A) { *varlist_end() = A; }
5250 SourceLocation ColonLoc, SourceLocation EndLoc,
5253 LParenLoc, EndLoc, NumVars),
5254 ColonLoc(ColonLoc) {}
5259 explicit OMPAlignedClause(
unsigned NumVars)
5260 : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned,
5261 SourceLocation(), SourceLocation(),
5262 SourceLocation(), NumVars) {}
5274 static OMPAlignedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5275 SourceLocation LParenLoc,
5276 SourceLocation ColonLoc,
5277 SourceLocation EndLoc, ArrayRef<Expr *> VL,
5284 static OMPAlignedClause *
CreateEmpty(
const ASTContext &C,
unsigned NumVars);
5299 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5300 reinterpret_cast<Stmt **
>(varlist_end()));
5304 return const_cast<OMPAlignedClause *
>(
this)->
children();
5308 return child_range(child_iterator(), child_iterator());
5311 return const_child_range(const_child_iterator(), const_child_iterator());
5315 return T->getClauseKind() == llvm::omp::OMPC_aligned;
5326class OMPCopyinClause final
5327 :
public OMPVarListClause<OMPCopyinClause>,
5328 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
5343 friend OMPVarListClause;
5344 friend TrailingObjects;
5352 OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5353 SourceLocation EndLoc,
unsigned N)
5354 : OMPVarListClause<OMPCopyinClause>(
llvm::omp::OMPC_copyin, StartLoc,
5355 LParenLoc, EndLoc, N) {}
5362 SourceLocation(), SourceLocation(),
5363 SourceLocation(), N) {}
5368 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5371 MutableArrayRef<Expr *> getSourceExprs() {
5372 return {varlist_end(), varlist_size()};
5374 ArrayRef<const Expr *> getSourceExprs()
const {
5375 return {varlist_end(), varlist_size()};
5381 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5384 MutableArrayRef<Expr *> getDestinationExprs() {
5385 return {getSourceExprs().end(), varlist_size()};
5387 ArrayRef<const Expr *> getDestinationExprs()
const {
5388 return {getSourceExprs().end(), varlist_size()};
5395 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5398 MutableArrayRef<Expr *> getAssignmentOps() {
5399 return {getDestinationExprs().end(), varlist_size()};
5401 ArrayRef<const Expr *> getAssignmentOps()
const {
5402 return {getDestinationExprs().end(), varlist_size()};
5427 static OMPCopyinClause *
5428 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5429 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5430 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5436 static OMPCopyinClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5442 llvm::iterator_range<helper_expr_const_iterator>;
5449 return getDestinationExprs();
5459 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5460 reinterpret_cast<Stmt **
>(varlist_end()));
5464 return const_cast<OMPCopyinClause *
>(
this)->
children();
5468 return child_range(child_iterator(), child_iterator());
5471 return const_child_range(const_child_iterator(), const_child_iterator());
5475 return T->getClauseKind() == llvm::omp::OMPC_copyin;
5487class OMPCopyprivateClause final
5488 :
public OMPVarListClause<OMPCopyprivateClause>,
5489 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
5491 friend OMPVarListClause;
5492 friend TrailingObjects;
5500 OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5501 SourceLocation EndLoc,
unsigned N)
5502 : OMPVarListClause<OMPCopyprivateClause>(
llvm::omp::OMPC_copyprivate,
5503 StartLoc, LParenLoc, EndLoc, N) {
5511 llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(),
5512 SourceLocation(), N) {}
5517 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5520 MutableArrayRef<Expr *> getSourceExprs() {
5521 return {varlist_end(), varlist_size()};
5523 ArrayRef<const Expr *> getSourceExprs()
const {
5524 return {varlist_end(), varlist_size()};
5530 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5533 MutableArrayRef<Expr *> getDestinationExprs() {
5534 return {getSourceExprs().end(), varlist_size()};
5536 ArrayRef<const Expr *> getDestinationExprs()
const {
5537 return {getSourceExprs().end(), varlist_size()};
5544 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5547 MutableArrayRef<Expr *> getAssignmentOps() {
5548 return {getDestinationExprs().end(), varlist_size()};
5550 ArrayRef<const Expr *> getAssignmentOps()
const {
5551 return {getDestinationExprs().end(), varlist_size()};
5575 static OMPCopyprivateClause *
5576 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5577 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5578 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5584 static OMPCopyprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5590 llvm::iterator_range<helper_expr_const_iterator>;
5597 return getDestinationExprs();
5607 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5608 reinterpret_cast<Stmt **
>(varlist_end()));
5612 return const_cast<OMPCopyprivateClause *
>(
this)->
children();
5616 return child_range(child_iterator(), child_iterator());
5619 return const_child_range(const_child_iterator(), const_child_iterator());
5623 return T->getClauseKind() == llvm::omp::OMPC_copyprivate;
5639class OMPFlushClause final
5640 :
public OMPVarListClause<OMPFlushClause>,
5641 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
5642 friend OMPVarListClause;
5643 friend TrailingObjects;
5651 OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5652 SourceLocation EndLoc,
unsigned N)
5653 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush, StartLoc,
5654 LParenLoc, EndLoc, N) {}
5659 explicit OMPFlushClause(
unsigned N)
5660 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush,
5661 SourceLocation(), SourceLocation(),
5662 SourceLocation(), N) {}
5672 static OMPFlushClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5673 SourceLocation LParenLoc, SourceLocation EndLoc,
5683 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5684 reinterpret_cast<Stmt **
>(varlist_end()));
5688 return const_cast<OMPFlushClause *
>(
this)->
children();
5692 return child_range(child_iterator(), child_iterator());
5695 return const_child_range(const_child_iterator(), const_child_iterator());
5699 return T->getClauseKind() == llvm::omp::OMPC_flush;
5719 SourceLocation LParenLoc;
5722 Expr *Depobj =
nullptr;
5729 OMPDepobjClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5730 SourceLocation EndLoc)
5732 LParenLoc(LParenLoc) {}
5737 :
OMPClause(
llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {}
5739 void setDepobj(Expr *E) { Depobj = E; }
5742 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
5752 static OMPDepobjClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5753 SourceLocation LParenLoc,
5754 SourceLocation EndLoc, Expr *Depobj);
5759 static OMPDepobjClause *
CreateEmpty(
const ASTContext &C);
5769 return child_range(
reinterpret_cast<Stmt **
>(&Depobj),
5770 reinterpret_cast<Stmt **
>(&Depobj) + 1);
5774 return const_cast<OMPDepobjClause *
>(
this)->
children();
5778 return child_range(child_iterator(), child_iterator());
5781 return const_child_range(const_child_iterator(), const_child_iterator());
5785 return T->getClauseKind() == llvm::omp::OMPC_depobj;
5797class OMPDependClause final
5798 :
public OMPVarListClause<OMPDependClause>,
5799 private llvm::TrailingObjects<OMPDependClause, Expr *> {
5801 friend OMPVarListClause;
5802 friend TrailingObjects;
5807 OpenMPDependClauseKind
DepKind = OMPC_DEPEND_unknown;
5824 unsigned NumLoops = 0;
5834 OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5835 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
5836 : OMPVarListClause<OMPDependClause>(
llvm::omp::OMPC_depend, StartLoc,
5837 LParenLoc, EndLoc, N),
5838 NumLoops(NumLoops) {}
5847 SourceLocation(), SourceLocation(),
5848 SourceLocation(), N),
5849 NumLoops(NumLoops) {}
5852 void setDependencyKind(OpenMPDependClauseKind K) {
Data.DepKind = K; }
5855 void setDependencyLoc(SourceLocation Loc) {
Data.DepLoc = Loc; }
5861 void setOmpAllMemoryLoc(SourceLocation Loc) {
Data.OmpAllMemoryLoc = Loc; }
5877 static OMPDependClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5878 SourceLocation LParenLoc,
5879 SourceLocation EndLoc, DependDataTy Data,
5880 Expr *DepModifier, ArrayRef<Expr *> VL,
5889 static OMPDependClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
5905 Expr *getModifier();
5907 return const_cast<OMPDependClause *
>(
this)->
getModifier();
5915 void setLoopData(
unsigned NumLoop, Expr *Cnt);
5918 Expr *getLoopData(
unsigned NumLoop);
5919 const Expr *getLoopData(
unsigned NumLoop)
const;
5922 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5923 reinterpret_cast<Stmt **
>(varlist_end()));
5927 return const_cast<OMPDependClause *
>(
this)->
children();
5931 return child_range(child_iterator(), child_iterator());
5934 return const_child_range(const_child_iterator(), const_child_iterator());
5938 return T->getClauseKind() == llvm::omp::OMPC_depend;
5954 SourceLocation LParenLoc;
5957 OpenMPDeviceClauseModifier Modifier = OMPC_DEVICE_unknown;
5960 SourceLocation ModifierLoc;
5963 Stmt *Device =
nullptr;
5968 void setDevice(Expr *E) { Device = E; }
5971 void setModifier(OpenMPDeviceClauseModifier M) { Modifier = M; }
5988 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
5989 SourceLocation LParenLoc, SourceLocation ModifierLoc,
5990 SourceLocation EndLoc)
5993 ModifierLoc(ModifierLoc), Device(E) {
5994 setPreInitStmt(HelperE, CaptureRegion);
5999 :
OMPClause(
llvm::omp::OMPC_device, SourceLocation(), SourceLocation()),
6020 child_range
children() {
return child_range(&Device, &Device + 1); }
6023 return const_child_range(&Device, &Device + 1);
6027 return child_range(child_iterator(), child_iterator());
6030 return const_child_range(const_child_iterator(), const_child_iterator());
6034 return T->getClauseKind() == llvm::omp::OMPC_device;
6075 :
OMPClause(
llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {}
6078 return child_range(child_iterator(), child_iterator());
6082 return const_child_range(const_child_iterator(), const_child_iterator());
6086 return child_range(child_iterator(), child_iterator());
6089 return const_child_range(const_child_iterator(), const_child_iterator());
6093 return T->getClauseKind() == llvm::omp::OMPC_simd;
6110 llvm::PointerIntPair<Expr *, 1, bool> AssociatedExpressionNonContiguousPr;
6115 ValueDecl *AssociatedDeclaration =
nullptr;
6120 ValueDecl *AssociatedDeclaration,
6121 bool IsNonContiguous)
6122 : AssociatedExpressionNonContiguousPr(AssociatedExpression,
6124 AssociatedDeclaration(
6125 AssociatedDeclaration
6130 return AssociatedExpressionNonContiguousPr.getPointer();
6134 return AssociatedExpressionNonContiguousPr.getInt();
6138 return AssociatedDeclaration;
6142 return AssociatedExpressionNonContiguousPr ==
6143 Other.AssociatedExpressionNonContiguousPr &&
6144 AssociatedDeclaration == Other.AssociatedDeclaration;
6184 static QualType getComponentExprElementType(
const Expr *Exp);
6244 static std::pair<const Expr *, std::optional<size_t>>
6245 findAttachPtrExpr(MappableExprComponentListRef Components,
6246 OpenMPDirectiveKind CurDirKind);
6251 getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists);
6287 unsigned NumUniqueDeclarations;
6290 unsigned NumComponentLists;
6293 unsigned NumComponents;
6298 const bool SupportsMapper;
6301 NestedNameSpecifierLoc MapperQualifierLoc;
6304 DeclarationNameInfo MapperIdInfo;
6326 OpenMPClauseKind K,
const OMPVarListLocTy &Locs,
6328 NestedNameSpecifierLoc *MapperQualifierLocPtr =
nullptr,
6329 DeclarationNameInfo *MapperIdInfoPtr =
nullptr)
6330 : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc,
6332 NumUniqueDeclarations(Sizes.NumUniqueDeclarations),
6333 NumComponentLists(Sizes.NumComponentLists),
6334 NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) {
6335 if (MapperQualifierLocPtr)
6336 MapperQualifierLoc = *MapperQualifierLocPtr;
6337 if (MapperIdInfoPtr)
6338 MapperIdInfo = *MapperIdInfoPtr;
6344 return static_cast<T *
>(
this)
6345 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6346 NumUniqueDeclarations);
6352 return static_cast<const T *
>(
this)
6353 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6354 NumUniqueDeclarations);
6360 assert(UDs.size() == NumUniqueDeclarations &&
6361 "Unexpected amount of unique declarations.");
6368 return static_cast<T *
>(
this)
6369 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6375 return static_cast<const T *
>(
this)
6376 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6382 assert(DNLs.size() == NumUniqueDeclarations &&
6383 "Unexpected amount of list numbers.");
6390 return MutableArrayRef<unsigned>(
6391 static_cast<T *
>(
this)
6392 ->
template getTrailingObjectsNonStrict<unsigned>() +
6393 NumUniqueDeclarations,
6401 static_cast<const T *
>(
this)
6402 ->
template getTrailingObjectsNonStrict<unsigned>() +
6403 NumUniqueDeclarations,
6410 assert(CLSs.size() == NumComponentLists &&
6411 "Unexpected amount of component lists.");
6417 return static_cast<T *
>(
this)
6418 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6424 return static_cast<const T *
>(
this)
6425 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6434 assert(Components.size() == NumComponents &&
6435 "Unexpected amount of component lists.");
6436 assert(CLSs.size() == NumComponentLists &&
6437 "Unexpected amount of list sizes.");
6448 NumUniqueDeclarations &&
6449 "Unexpected number of mappable expression info entries!");
6451 "Unexpected total number of components!");
6452 assert(Declarations.size() == ComponentLists.size() &&
6453 "Declaration and component lists size is not consistent!");
6454 assert(Declarations.size() == NumComponentLists &&
6455 "Unexpected declaration and component lists size!");
6460 llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>>
6463 auto CI = ComponentLists.begin();
6464 for (
auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE;
6466 assert(!CI->empty() &&
"Invalid component list!");
6467 ComponentListMap[*DI].push_back(*CI);
6473 auto UDI = UniqueDeclarations.begin();
6476 auto DNLI = DeclNumLists.begin();
6479 auto CLSI = ComponentListSizes.begin();
6482 auto CI = Components.begin();
6485 unsigned PrevSize = 0u;
6488 for (
auto &M : ComponentListMap) {
6505 PrevSize += C.size();
6512 CI = llvm::copy(C, CI);
6519 MapperQualifierLoc = NNSL;
6524 MapperIdInfo = MapperId;
6530 assert(SupportsMapper &&
6531 "Must be a clause that is possible to have user-defined mappers");
6532 return MutableArrayRef<Expr *>(
6533 static_cast<T *
>(
this)->
template getTrailingObjects<Expr *>() +
6534 OMPVarListClause<T>::varlist_size(),
6535 OMPVarListClause<T>::varlist_size());
6541 assert(SupportsMapper &&
6542 "Must be a clause that is possible to have user-defined mappers");
6544 static_cast<const T *
>(
this)->
template getTrailingObjects<Expr *>() +
6545 OMPVarListClause<T>::varlist_size(),
6546 OMPVarListClause<T>::varlist_size());
6552 assert(DMDs.size() == OMPVarListClause<T>::varlist_size() &&
6553 "Unexpected number of user-defined mappers.");
6554 assert(SupportsMapper &&
6555 "Must be a clause that is possible to have user-defined mappers");
6572 return MapperQualifierLoc;
6581 :
public llvm::iterator_adaptor_base<
6582 const_component_lists_iterator,
6583 MappableExprComponentListRef::const_iterator,
6584 std::forward_iterator_tag, MappableComponent, ptrdiff_t,
6585 MappableComponent, MappableComponent> {
6593 const bool SupportsMapper;
6599 unsigned RemainingLists = 0;
6603 unsigned PrevListSize = 0;
6611 MappableExprComponentListRef::const_iterator End;
6621 Components.begin()),
6622 DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()),
6623 SupportsMapper(SupportsMapper),
6624 ListSizeCur(CumulativeListSizes.begin()),
6625 ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) {
6626 assert(UniqueDecls.size() == DeclsListNum.size() &&
6627 "Inconsistent number of declarations and list sizes!");
6628 if (!DeclsListNum.empty())
6629 RemainingLists = *NumListsCur;
6631 MapperCur = Mappers.begin();
6642 CumulativeListSizes, Components,
6643 SupportsMapper, Mappers) {
6647 for (; DeclCur != UniqueDecls.end(); ++DeclCur, ++NumListsCur) {
6648 if (*DeclCur == Declaration)
6651 assert(*NumListsCur > 0 &&
"No lists associated with declaration??");
6655 std::advance(ListSizeCur, *NumListsCur - 1);
6656 PrevListSize = *ListSizeCur;
6665 if (ListSizeCur == CumulativeListSizes.end()) {
6667 RemainingLists = 0u;
6673 RemainingLists = *NumListsCur;
6676 ListSizeEnd = ListSizeCur;
6677 std::advance(ListSizeEnd, RemainingLists);
6681 std::advance(this->I, PrevListSize);
6689 assert(ListSizeCur != ListSizeEnd &&
"Invalid iterator!");
6690 const ValueDecl *Mapper =
nullptr;
6691 if (SupportsMapper && *MapperCur)
6692 Mapper = cast<ValueDecl>(cast<DeclRefExpr>(*MapperCur)->getDecl());
6693 return std::make_tuple(
6706 assert(ListSizeCur != ListSizeEnd && RemainingLists &&
6707 "Invalid iterator!");
6711 if (std::next(ListSizeCur) == ListSizeEnd) {
6715 std::advance(this->I, *ListSizeCur - PrevListSize);
6716 PrevListSize = *ListSizeCur;
6719 if (!(--RemainingLists)) {
6722 RemainingLists = *NumListsCur;
6723 assert(RemainingLists &&
"No lists in the following declaration??");
6735 llvm::iterator_range<const_component_lists_iterator>;
6749 SupportsMapper, {});
6757 const_component_lists_iterator
6780 llvm::iterator_range<const_all_num_lists_iterator>;
6788 llvm::iterator_range<const_all_lists_sizes_iterator>;
6796 llvm::iterator_range<const_all_components_iterator>;
6806 llvm::iterator_range<mapperlist_const_iterator>;
6832class OMPMapClause final :
public OMPMappableExprListClause<OMPMapClause>,
6833 private llvm::TrailingObjects<
6834 OMPMapClause, Expr *, ValueDecl *, unsigned,
6835 OMPClauseMappableExprCommon::MappableComponent> {
6837 friend OMPMappableExprListClause;
6838 friend OMPVarListClause;
6839 friend TrailingObjects;
6843 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
6846 return 2 * varlist_size() + 1;
6848 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
6849 return getUniqueDeclarationsNum();
6851 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
6852 return getUniqueDeclarationsNum() + getTotalComponentListNum();
6864 SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers];
6870 bool MapTypeIsImplicit =
false;
6873 SourceLocation MapLoc;
6876 SourceLocation ColonLoc;
6898 explicit OMPMapClause(ArrayRef<OpenMPMapModifierKind> MapModifiers,
6899 ArrayRef<SourceLocation> MapModifiersLoc,
6900 NestedNameSpecifierLoc MapperQualifierLoc,
6901 DeclarationNameInfo MapperIdInfo,
6902 OpenMPMapClauseKind MapType,
bool MapTypeIsImplicit,
6903 SourceLocation MapLoc,
const OMPVarListLocTy &Locs,
6904 const OMPMappableExprListSizeTy &Sizes)
6905 : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
6906 true, &MapperQualifierLoc,
6908 MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
6909 assert(std::size(MapTypeModifiers) == MapModifiers.size() &&
6910 "Unexpected number of map type modifiers.");
6911 llvm::copy(MapModifiers, std::begin(MapTypeModifiers));
6913 assert(std::size(MapTypeModifiersLoc) == MapModifiersLoc.size() &&
6914 "Unexpected number of map type modifier locations.");
6915 llvm::copy(MapModifiersLoc, std::begin(MapTypeModifiersLoc));
6925 explicit OMPMapClause(
const OMPMappableExprListSizeTy &Sizes)
6926 : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes,
6933 void setMapTypeModifier(
unsigned I, OpenMPMapModifierKind T) {
6934 assert(I < NumberOfOMPMapClauseModifiers &&
6935 "Unexpected index to store map type modifier, exceeds array size.");
6936 MapTypeModifiers[I] =
T;
6943 void setMapTypeModifierLoc(
unsigned I, SourceLocation TLoc) {
6944 assert(I < NumberOfOMPMapClauseModifiers &&
6945 "Index to store map type modifier location exceeds array size.");
6946 MapTypeModifiersLoc[I] = TLoc;
6952 void setMapType(OpenMPMapClauseKind T) { MapType =
T; }
6957 void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; }
6960 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
6963 void setIteratorModifier(Expr *IteratorModifier) {
6964 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
6988 static OMPMapClause *
6989 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
6990 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
6991 MappableExprComponentListsRef ComponentLists,
6992 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
6993 ArrayRef<OpenMPMapModifierKind> MapModifiers,
6994 ArrayRef<SourceLocation> MapModifiersLoc,
6995 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId,
6996 OpenMPMapClauseKind Type,
bool TypeIsImplicit, SourceLocation TypeLoc);
7008 static OMPMapClause *
CreateEmpty(
const ASTContext &C,
7009 const OMPMappableExprListSizeTy &Sizes);
7013 return getTrailingObjects<Expr *>()[2 * varlist_size()];
7017 OpenMPMapClauseKind
getMapType() const LLVM_READONLY {
return MapType; }
7030 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7031 "Requested modifier exceeds the total number of modifiers.");
7032 return MapTypeModifiers[Cnt];
7040 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7041 "Requested modifier location exceeds total number of modifiers.");
7042 return MapTypeModifiersLoc[Cnt];
7047 return MapTypeModifiers;
7052 return MapTypeModifiersLoc;
7056 SourceLocation
getMapLoc() const LLVM_READONLY {
return MapLoc; }
7063 reinterpret_cast<Stmt **
>(varlist_begin()),
7064 reinterpret_cast<Stmt **
>(varlist_end()));
7068 return const_cast<OMPMapClause *
>(
this)->
children();
7072 if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_tofrom)
7073 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7074 reinterpret_cast<Stmt **
>(varlist_end()));
7075 return child_range(child_iterator(), child_iterator());
7083 return T->getClauseKind() == llvm::omp::OMPC_map;
7116class OMPNumTeamsClause final
7117 :
public OMPVarListClause<OMPNumTeamsClause>,
7119 private llvm::TrailingObjects<OMPNumTeamsClause, Expr *> {
7121 friend OMPVarListClause;
7122 friend TrailingObjects;
7125 OpenMPNumTeamsClauseModifier Modifier = OMPC_NUMTEAMS_unknown;
7128 SourceLocation ModifierLoc;
7130 OMPNumTeamsClause(
const ASTContext &C, SourceLocation StartLoc,
7131 SourceLocation LParenLoc, SourceLocation EndLoc,
unsigned N)
7132 : OMPVarListClause(
llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, EndLoc,
7138 : OMPVarListClause(
llvm::omp::OMPC_num_teams, SourceLocation(),
7139 SourceLocation(), SourceLocation(), N),
7143 void setModifier(OpenMPNumTeamsClauseModifier M) { Modifier = M; }
7146 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7163 static OMPNumTeamsClause *
7164 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7165 SourceLocation StartLoc, SourceLocation LParenLoc,
7166 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7167 OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr,
7168 SourceLocation ModifierLoc, Stmt *PreInit);
7174 static OMPNumTeamsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7181 return const_cast<OMPNumTeamsClause *
>(
this)->
getNumTeams();
7195 if (Modifier == OMPC_NUMTEAMS_dims)
7204 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7205 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7209 return const_cast<OMPNumTeamsClause *
>(
this)->
children();
7213 return child_range(child_iterator(), child_iterator());
7216 return const_child_range(const_child_iterator(), const_child_iterator());
7220 return T->getClauseKind() == llvm::omp::OMPC_num_teams;
7246class OMPThreadLimitClause final
7247 :
public OMPVarListClause<OMPThreadLimitClause>,
7249 private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
7251 friend OMPVarListClause;
7252 friend TrailingObjects;
7255 OpenMPThreadLimitClauseModifier Modifier = OMPC_THREADLIMIT_unknown;
7258 SourceLocation ModifierLoc;
7260 OMPThreadLimitClause(
const ASTContext &C, SourceLocation StartLoc,
7261 SourceLocation LParenLoc, SourceLocation EndLoc,
7263 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, StartLoc, LParenLoc,
7269 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, SourceLocation(),
7270 SourceLocation(), SourceLocation(), N),
7274 void setModifier(OpenMPThreadLimitClauseModifier M) { Modifier = M; }
7280 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7294 static OMPThreadLimitClause *
7295 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7296 SourceLocation StartLoc, SourceLocation LParenLoc,
7297 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7298 OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr,
7299 SourceLocation ModifierLoc, Stmt *PreInit);
7305 static OMPThreadLimitClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7312 return const_cast<OMPThreadLimitClause *
>(
this)->
getThreadLimit();
7316 OpenMPThreadLimitClauseModifier
getModifier()
const {
return Modifier; }
7326 if (Modifier == OMPC_THREADLIMIT_dims)
7335 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7336 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7340 return const_cast<OMPThreadLimitClause *
>(
this)->
children();
7344 return child_range(child_iterator(), child_iterator());
7347 return const_child_range(const_child_iterator(), const_child_iterator());
7351 return T->getClauseKind() == llvm::omp::OMPC_thread_limit;
7367 SourceLocation LParenLoc;
7370 Stmt *Priority =
nullptr;
7375 void setPriority(Expr *E) { Priority = E; }
7388 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
7389 SourceLocation LParenLoc, SourceLocation EndLoc)
7392 setPreInitStmt(HelperPriority, CaptureRegion);
7397 :
OMPClause(
llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()),
7412 child_range
children() {
return child_range(&Priority, &Priority + 1); }
7415 return const_child_range(&Priority, &Priority + 1);
7418 child_range used_children();
7424 return T->getClauseKind() == llvm::omp::OMPC_priority;
7440 SourceLocation LParenLoc;
7443 OpenMPGrainsizeClauseModifier Modifier = OMPC_GRAINSIZE_unknown;
7446 SourceLocation ModifierLoc;
7449 Stmt *Grainsize =
nullptr;
7452 void setGrainsize(Expr *Size) { Grainsize = Size; }
7455 void setModifier(OpenMPGrainsizeClauseModifier M) { Modifier = M; }
7473 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7474 SourceLocation StartLoc, SourceLocation LParenLoc,
7475 SourceLocation ModifierLoc, SourceLocation EndLoc)
7478 ModifierLoc(ModifierLoc), Grainsize(Size) {
7479 setPreInitStmt(HelperSize, CaptureRegion);
7498 OpenMPGrainsizeClauseModifier
getModifier()
const {
return Modifier; }
7503 child_range
children() {
return child_range(&Grainsize, &Grainsize + 1); }
7506 return const_child_range(&Grainsize, &Grainsize + 1);
7509 child_range used_children();
7515 return T->getClauseKind() == llvm::omp::OMPC_grainsize;
7536 :
OMPClause(
llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) {
7540 return child_range(child_iterator(), child_iterator());
7544 return const_child_range(const_child_iterator(), const_child_iterator());
7548 return child_range(child_iterator(), child_iterator());
7551 return const_child_range(const_child_iterator(), const_child_iterator());
7555 return T->getClauseKind() == llvm::omp::OMPC_nogroup;
7571 SourceLocation LParenLoc;
7574 OpenMPNumTasksClauseModifier Modifier = OMPC_NUMTASKS_unknown;
7577 SourceLocation ModifierLoc;
7580 Stmt *NumTasks =
nullptr;
7583 void setNumTasks(Expr *Size) { NumTasks = Size; }
7586 void setModifier(OpenMPNumTasksClauseModifier M) { Modifier = M; }
7604 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7605 SourceLocation StartLoc, SourceLocation LParenLoc,
7606 SourceLocation ModifierLoc, SourceLocation EndLoc)
7609 ModifierLoc(ModifierLoc), NumTasks(Size) {
7610 setPreInitStmt(HelperSize, CaptureRegion);
7634 child_range
children() {
return child_range(&NumTasks, &NumTasks + 1); }
7637 return const_child_range(&NumTasks, &NumTasks + 1);
7640 child_range used_children();
7646 return T->getClauseKind() == llvm::omp::OMPC_num_tasks;
7661 SourceLocation LParenLoc;
7664 Stmt *Hint =
nullptr;
7667 void setHint(Expr *H) { Hint = H; }
7677 SourceLocation EndLoc)
7678 :
OMPClause(
llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
7683 :
OMPClause(
llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {}
7692 Expr *
getHint()
const {
return cast_or_null<Expr>(Hint); }
7694 child_range
children() {
return child_range(&Hint, &Hint + 1); }
7697 return const_child_range(&Hint, &Hint + 1);
7701 return child_range(child_iterator(), child_iterator());
7704 return const_child_range(const_child_iterator(), const_child_iterator());
7708 return T->getClauseKind() == llvm::omp::OMPC_hint;
7724 SourceLocation LParenLoc;
7727 OpenMPDistScheduleClauseKind Kind = OMPC_DIST_SCHEDULE_unknown;
7730 SourceLocation KindLoc;
7733 SourceLocation CommaLoc;
7736 Expr *ChunkSize =
nullptr;
7741 void setDistScheduleKind(OpenMPDistScheduleClauseKind K) { Kind = K; }
7746 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7751 void setDistScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7756 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
7761 void setChunkSize(Expr *E) { ChunkSize = E; }
7776 SourceLocation KLoc, SourceLocation CommaLoc,
7777 SourceLocation EndLoc,
7778 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
7779 Stmt *HelperChunkSize)
7780 :
OMPClause(
llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc),
7782 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
7783 setPreInitStmt(HelperChunkSize);
7788 :
OMPClause(
llvm::omp::OMPC_dist_schedule, SourceLocation(),
7811 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
7812 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
7820 return child_range(child_iterator(), child_iterator());
7823 return const_child_range(const_child_iterator(), const_child_iterator());
7827 return T->getClauseKind() == llvm::omp::OMPC_dist_schedule;
7842 SourceLocation LParenLoc;
7845 OpenMPDefaultmapClauseModifier Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown;
7848 SourceLocation ModifierLoc;
7851 OpenMPDefaultmapClauseKind Kind = OMPC_DEFAULTMAP_unknown;
7854 SourceLocation KindLoc;
7859 void setDefaultmapKind(OpenMPDefaultmapClauseKind K) { Kind = K; }
7864 void setDefaultmapModifier(OpenMPDefaultmapClauseModifier M) {
7869 void setDefaultmapModifierLoc(SourceLocation Loc) {
7876 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7881 void setDefaultmapKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7894 SourceLocation MLoc, SourceLocation KLoc,
7895 SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind,
7896 OpenMPDefaultmapClauseModifier M)
7898 LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind),
7904 SourceLocation()) {}
7926 return child_range(child_iterator(), child_iterator());
7930 return const_child_range(const_child_iterator(), const_child_iterator());
7934 return child_range(child_iterator(), child_iterator());
7937 return const_child_range(const_child_iterator(), const_child_iterator());
7941 return T->getClauseKind() == llvm::omp::OMPC_defaultmap;
7953class OMPToClause final :
public OMPMappableExprListClause<OMPToClause>,
7954 private llvm::TrailingObjects<
7955 OMPToClause, Expr *, ValueDecl *, unsigned,
7956 OMPClauseMappableExprCommon::MappableComponent> {
7958 friend OMPMappableExprListClause;
7959 friend OMPVarListClause;
7960 friend TrailingObjects;
7963 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
7964 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
7965 OMPC_MOTION_MODIFIER_unknown};
7968 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
7971 SourceLocation ColonLoc;
7990 NestedNameSpecifierLoc MapperQualifierLoc,
7991 DeclarationNameInfo MapperIdInfo,
7992 const OMPVarListLocTy &Locs,
7995 true, &MapperQualifierLoc,
7997 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
7998 "Unexpected number of motion modifiers.");
7999 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8001 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8002 "Unexpected number of motion modifier locations.");
8003 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8013 explicit OMPToClause(
const OMPMappableExprListSizeTy &Sizes)
8014 : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
8021 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8022 assert(I < NumberOfOMPMotionModifiers &&
8023 "Unexpected index to store motion modifier, exceeds array size.");
8024 MotionModifiers[I] =
T;
8031 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8032 assert(I < NumberOfOMPMotionModifiers &&
8033 "Index to store motion modifier location exceeds array size.");
8034 MotionModifiersLoc[I] = TLoc;
8037 void setIteratorModifier(Expr *IteratorModifier) {
8038 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8041 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8045 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8048 return 2 * varlist_size() + 1;
8050 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8051 return getUniqueDeclarationsNum();
8053 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8054 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8074 static OMPToClause *
8075 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8076 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8077 MappableExprComponentListsRef ComponentLists,
8078 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
8079 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8080 ArrayRef<SourceLocation> MotionModifiersLoc,
8081 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8091 static OMPToClause *
CreateEmpty(
const ASTContext &C,
8092 const OMPMappableExprListSizeTy &Sizes);
8098 assert(Cnt < NumberOfOMPMotionModifiers &&
8099 "Requested modifier exceeds the total number of modifiers.");
8100 return MotionModifiers[Cnt];
8103 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8110 assert(Cnt < NumberOfOMPMotionModifiers &&
8111 "Requested modifier location exceeds total number of modifiers.");
8112 return MotionModifiersLoc[Cnt];
8117 return MotionModifiers;
8122 return MotionModifiersLoc;
8129 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8130 reinterpret_cast<Stmt **
>(varlist_end()));
8134 return const_cast<OMPToClause *
>(
this)->
children();
8138 return child_range(child_iterator(), child_iterator());
8141 return const_child_range(const_child_iterator(), const_child_iterator());
8145 return T->getClauseKind() == llvm::omp::OMPC_to;
8157class OMPFromClause final
8158 :
public OMPMappableExprListClause<OMPFromClause>,
8159 private llvm::TrailingObjects<
8160 OMPFromClause, Expr *, ValueDecl *, unsigned,
8161 OMPClauseMappableExprCommon::MappableComponent> {
8163 friend OMPMappableExprListClause;
8164 friend OMPVarListClause;
8165 friend TrailingObjects;
8168 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
8169 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
8170 OMPC_MOTION_MODIFIER_unknown};
8173 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
8176 SourceLocation ColonLoc;
8195 NestedNameSpecifierLoc MapperQualifierLoc,
8196 DeclarationNameInfo MapperIdInfo,
8197 const OMPVarListLocTy &Locs,
8200 true, &MapperQualifierLoc,
8202 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
8203 "Unexpected number of motion modifiers.");
8204 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8206 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8207 "Unexpected number of motion modifier locations.");
8208 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8218 explicit OMPFromClause(
const OMPMappableExprListSizeTy &Sizes)
8219 : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
8226 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8227 assert(I < NumberOfOMPMotionModifiers &&
8228 "Unexpected index to store motion modifier, exceeds array size.");
8229 MotionModifiers[I] =
T;
8231 void setIteratorModifier(Expr *IteratorModifier) {
8232 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8238 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8239 assert(I < NumberOfOMPMotionModifiers &&
8240 "Index to store motion modifier location exceeds array size.");
8241 MotionModifiersLoc[I] = TLoc;
8245 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8249 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8252 return 2 * varlist_size() + 1;
8254 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8255 return getUniqueDeclarationsNum();
8257 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8258 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8278 static OMPFromClause *
8279 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8280 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8281 MappableExprComponentListsRef ComponentLists,
8282 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorExpr,
8283 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8284 ArrayRef<SourceLocation> MotionModifiersLoc,
8285 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8295 static OMPFromClause *
CreateEmpty(
const ASTContext &C,
8296 const OMPMappableExprListSizeTy &Sizes);
8302 assert(Cnt < NumberOfOMPMotionModifiers &&
8303 "Requested modifier exceeds the total number of modifiers.");
8304 return MotionModifiers[Cnt];
8307 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8314 assert(Cnt < NumberOfOMPMotionModifiers &&
8315 "Requested modifier location exceeds total number of modifiers.");
8316 return MotionModifiersLoc[Cnt];
8321 return MotionModifiers;
8326 return MotionModifiersLoc;
8333 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8334 reinterpret_cast<Stmt **
>(varlist_end()));
8338 return const_cast<OMPFromClause *
>(
this)->
children();
8342 return child_range(child_iterator(), child_iterator());
8345 return const_child_range(const_child_iterator(), const_child_iterator());
8349 return T->getClauseKind() == llvm::omp::OMPC_from;
8361class OMPUseDevicePtrClause final
8362 :
public OMPMappableExprListClause<OMPUseDevicePtrClause>,
8363 private llvm::TrailingObjects<
8364 OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned,
8365 OMPClauseMappableExprCommon::MappableComponent> {
8367 friend OMPMappableExprListClause;
8368 friend OMPVarListClause;
8369 friend TrailingObjects;
8372 OpenMPUseDevicePtrFallbackModifier FallbackModifier =
8373 OMPC_USE_DEVICE_PTR_FALLBACK_unknown;
8376 SourceLocation FallbackModifierLoc;
8390 explicit OMPUseDevicePtrClause(
8392 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8393 SourceLocation FallbackModifierLoc)
8394 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_ptr, Locs, Sizes),
8395 FallbackModifier(FallbackModifier),
8396 FallbackModifierLoc(FallbackModifierLoc) {}
8407 OMPVarListLocTy(), Sizes) {}
8411 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8412 return 3 * varlist_size();
8414 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8415 return getUniqueDeclarationsNum();
8417 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8418 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8424 void setPrivateCopies(ArrayRef<Expr *> VL);
8428 MutableArrayRef<Expr *> getPrivateCopies() {
8429 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
8431 ArrayRef<const Expr *> getPrivateCopies()
const {
8432 return {varlist_end(), varlist_size()};
8438 void setInits(ArrayRef<Expr *> VL);
8442 MutableArrayRef<Expr *>
getInits() {
8443 return {getPrivateCopies().end(), varlist_size()};
8445 ArrayRef<const Expr *>
getInits()
const {
8446 return {getPrivateCopies().end(), varlist_size()};
8450 void setFallbackModifier(OpenMPUseDevicePtrFallbackModifier M) {
8451 FallbackModifier = M;
8455 void setFallbackModifierLoc(SourceLocation Loc) { FallbackModifierLoc = Loc; }
8471 static OMPUseDevicePtrClause *
8472 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8473 ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
8474 ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations,
8475 MappableExprComponentListsRef ComponentLists,
8476 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8477 SourceLocation FallbackModifierLoc);
8487 static OMPUseDevicePtrClause *
8488 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8492 return FallbackModifier;
8502 llvm::iterator_range<private_copies_const_iterator>;
8507 return getPrivateCopies();
8520 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8521 reinterpret_cast<Stmt **
>(varlist_end()));
8525 return const_cast<OMPUseDevicePtrClause *
>(
this)->
children();
8529 return child_range(child_iterator(), child_iterator());
8532 return const_child_range(const_child_iterator(), const_child_iterator());
8536 return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr;
8548class OMPUseDeviceAddrClause final
8549 :
public OMPMappableExprListClause<OMPUseDeviceAddrClause>,
8550 private llvm::TrailingObjects<
8551 OMPUseDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8552 OMPClauseMappableExprCommon::MappableComponent> {
8554 friend OMPMappableExprListClause;
8555 friend OMPVarListClause;
8556 friend TrailingObjects;
8568 explicit OMPUseDeviceAddrClause(
const OMPVarListLocTy &Locs,
8570 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_addr, Locs,
8582 OMPVarListLocTy(), Sizes) {}
8586 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8587 return varlist_size();
8589 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8590 return getUniqueDeclarationsNum();
8592 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8593 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8606 static OMPUseDeviceAddrClause *
8607 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8608 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8609 MappableExprComponentListsRef ComponentLists);
8619 static OMPUseDeviceAddrClause *
8620 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8623 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8624 reinterpret_cast<Stmt **
>(varlist_end()));
8628 return const_cast<OMPUseDeviceAddrClause *
>(
this)->
children();
8632 return child_range(child_iterator(), child_iterator());
8635 return const_child_range(const_child_iterator(), const_child_iterator());
8639 return T->getClauseKind() == llvm::omp::OMPC_use_device_addr;
8651class OMPIsDevicePtrClause final
8652 :
public OMPMappableExprListClause<OMPIsDevicePtrClause>,
8653 private llvm::TrailingObjects<
8654 OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned,
8655 OMPClauseMappableExprCommon::MappableComponent> {
8657 friend OMPMappableExprListClause;
8658 friend OMPVarListClause;
8659 friend TrailingObjects;
8671 explicit OMPIsDevicePtrClause(
const OMPVarListLocTy &Locs,
8673 : OMPMappableExprListClause(
llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {}
8684 OMPVarListLocTy(), Sizes) {}
8688 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8689 return varlist_size();
8691 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8692 return getUniqueDeclarationsNum();
8694 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8695 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8708 static OMPIsDevicePtrClause *
8709 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8710 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8711 MappableExprComponentListsRef ComponentLists);
8721 static OMPIsDevicePtrClause *
8722 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8725 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8726 reinterpret_cast<Stmt **
>(varlist_end()));
8730 return const_cast<OMPIsDevicePtrClause *
>(
this)->
children();
8734 return child_range(child_iterator(), child_iterator());
8737 return const_child_range(const_child_iterator(), const_child_iterator());
8741 return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr;
8753class OMPHasDeviceAddrClause final
8754 :
public OMPMappableExprListClause<OMPHasDeviceAddrClause>,
8755 private llvm::TrailingObjects<
8756 OMPHasDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8757 OMPClauseMappableExprCommon::MappableComponent> {
8759 friend OMPMappableExprListClause;
8760 friend OMPVarListClause;
8761 friend TrailingObjects;
8773 explicit OMPHasDeviceAddrClause(
const OMPVarListLocTy &Locs,
8775 : OMPMappableExprListClause(
llvm::omp::OMPC_has_device_addr, Locs,
8787 OMPVarListLocTy(), Sizes) {}
8791 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8792 return varlist_size();
8794 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8795 return getUniqueDeclarationsNum();
8797 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8798 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8811 static OMPHasDeviceAddrClause *
8812 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8813 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8814 MappableExprComponentListsRef ComponentLists);
8824 static OMPHasDeviceAddrClause *
8825 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8828 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8829 reinterpret_cast<Stmt **
>(varlist_end()));
8833 return const_cast<OMPHasDeviceAddrClause *
>(
this)->
children();
8837 return child_range(child_iterator(), child_iterator());
8840 return const_child_range(const_child_iterator(), const_child_iterator());
8844 return T->getClauseKind() == llvm::omp::OMPC_has_device_addr;
8855class OMPNontemporalClause final
8856 :
public OMPVarListClause<OMPNontemporalClause>,
8857 private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
8859 friend OMPVarListClause;
8860 friend TrailingObjects;
8868 OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8869 SourceLocation EndLoc,
unsigned N)
8870 : OMPVarListClause<OMPNontemporalClause>(
llvm::omp::OMPC_nontemporal,
8871 StartLoc, LParenLoc, EndLoc, N) {
8879 llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(),
8880 SourceLocation(), N) {}
8884 MutableArrayRef<Expr *> getPrivateRefs() {
8885 return {varlist_end(), varlist_size()};
8887 ArrayRef<const Expr *> getPrivateRefs()
const {
8888 return {varlist_end(), varlist_size()};
8899 static OMPNontemporalClause *
8900 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
8901 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8907 static OMPNontemporalClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
8911 void setPrivateRefs(ArrayRef<Expr *> VL);
8914 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8915 reinterpret_cast<Stmt **
>(varlist_end()));
8919 return const_cast<OMPNontemporalClause *
>(
this)->
children();
8923 return child_range(
reinterpret_cast<Stmt **
>(getPrivateRefs().begin()),
8924 reinterpret_cast<Stmt **
>(getPrivateRefs().end()));
8928 return const_cast<OMPNontemporalClause *
>(
this)->
private_refs();
8932 return child_range(child_iterator(), child_iterator());
8935 return const_child_range(const_child_iterator(), const_child_iterator());
8939 return T->getClauseKind() == llvm::omp::OMPC_nontemporal;
8954 SourceLocation LParenLoc;
8957 OpenMPOrderClauseKind Kind = OMPC_ORDER_unknown;
8960 SourceLocation KindKwLoc;
8963 OpenMPOrderClauseModifier Modifier = OMPC_ORDER_MODIFIER_unknown;
8966 SourceLocation ModifierKwLoc;
8971 void setKind(OpenMPOrderClauseKind K) { Kind = K; }
8976 void setKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
8981 void setModifier(OpenMPOrderClauseModifier M) { Modifier = M; }
8986 void setModifierKwLoc(SourceLocation MLoc) { ModifierKwLoc = MLoc; }
8999 SourceLocation StartLoc, SourceLocation LParenLoc,
9000 SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
9001 SourceLocation MLoc)
9003 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
9004 ModifierKwLoc(MLoc) {}
9008 :
OMPClause(
llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {}
9017 OpenMPOrderClauseKind
getKind()
const {
return Kind; }
9029 return child_range(child_iterator(), child_iterator());
9033 return const_child_range(const_child_iterator(), const_child_iterator());
9037 return child_range(child_iterator(), child_iterator());
9040 return const_child_range(const_child_iterator(), const_child_iterator());
9044 return T->getClauseKind() == llvm::omp::OMPC_order;
9053class OMPInitClause final
9054 :
public OMPVarListClause<OMPInitClause>,
9055 private llvm::TrailingObjects<OMPInitClause, Expr *, unsigned> {
9057 friend OMPVarListClause;
9058 friend TrailingObjects;
9061 SourceLocation VarLoc;
9063 bool IsTarget =
false;
9064 bool IsTargetSync =
false;
9065 bool HasPreferAttrs =
false;
9069 unsigned NumAttrs = 0;
9086 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
9087 return varlist_size() + NumAttrs;
9089 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
9090 return getNumPrefs();
9093 void setInteropVar(Expr *E) { varlist_begin()[0] = E; }
9095 void setIsTarget(
bool V) { IsTarget =
V; }
9097 void setIsTargetSync(
bool V) { IsTargetSync =
V; }
9099 void setHasPreferAttrs(
bool V) { HasPreferAttrs =
V; }
9101 void setAttrs(ArrayRef<unsigned> Counts, ArrayRef<Expr *> Attrs);
9104 unsigned getNumPrefs()
const {
return varlist_size() - 1; }
9108 ArrayRef<unsigned> getAttrEnds()
const {
9109 return getTrailingObjects<unsigned>(getNumPrefs());
9113 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9124 OMPInitClause(
bool IsTarget,
bool IsTargetSync, SourceLocation StartLoc,
9125 SourceLocation LParenLoc, SourceLocation VarLoc,
9126 SourceLocation EndLoc,
unsigned N)
9127 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, StartLoc,
9128 LParenLoc, EndLoc, N),
9129 VarLoc(VarLoc), IsTarget(IsTarget), IsTargetSync(IsTargetSync) {}
9132 OMPInitClause(
unsigned N)
9133 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, SourceLocation(),
9134 SourceLocation(), SourceLocation(), N) {
9156 OMPInteropInfo &InteropInfo,
9157 SourceLocation StartLoc,
9158 SourceLocation LParenLoc, SourceLocation VarLoc,
9159 SourceLocation EndLoc);
9194 reinterpret_cast<Stmt **
>(varlist_begin()),
9195 reinterpret_cast<Stmt **
>(varlist_begin() + varlist_size() + NumAttrs));
9199 return const_cast<OMPInitClause *
>(
this)->
children();
9203 return child_range(child_iterator(), child_iterator());
9206 return const_child_range(const_child_iterator(), const_child_iterator());
9212 unsigned N = getNumPrefs();
9213 Expr *
const *E = getTrailingObjects<Expr *>();
9215 return llvm::map_range(llvm::seq<unsigned>(0, N), [=](
unsigned I) {
9216 unsigned Start = (I == 0) ? 0 : Ends[I - 1];
9218 const_cast<Expr *
>(E[1 + I]),
9225 return T->getClauseKind() == llvm::omp::OMPC_init;
9238 SourceLocation LParenLoc;
9241 SourceLocation VarLoc;
9244 Stmt *InteropVar =
nullptr;
9247 void setInteropVar(Expr *E) { InteropVar = E; }
9250 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9253 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9264 SourceLocation LParenLoc, SourceLocation VarLoc,
9265 SourceLocation EndLoc)
9266 :
OMPClause(
llvm::omp::OMPC_use, StartLoc, EndLoc), LParenLoc(LParenLoc),
9267 VarLoc(VarLoc), InteropVar(InteropVar) {}
9271 :
OMPClause(
llvm::omp::OMPC_use, SourceLocation(), SourceLocation()) {}
9282 child_range
children() {
return child_range(&InteropVar, &InteropVar + 1); }
9285 return const_child_range(&InteropVar, &InteropVar + 1);
9289 return child_range(child_iterator(), child_iterator());
9292 return const_child_range(const_child_iterator(), const_child_iterator());
9296 return T->getClauseKind() == llvm::omp::OMPC_use;
9313 SourceLocation LParenLoc;
9316 SourceLocation VarLoc;
9319 Stmt *InteropVar =
nullptr;
9322 void setInteropVar(Expr *E) { InteropVar = E; }
9325 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9328 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9339 SourceLocation LParenLoc, SourceLocation VarLoc,
9340 SourceLocation EndLoc)
9342 LParenLoc(LParenLoc), VarLoc(VarLoc), InteropVar(InteropVar) {}
9353 :
OMPClause(
llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) {
9367 return child_range(&InteropVar, &InteropVar + 1);
9368 return child_range(child_iterator(), child_iterator());
9373 return const_child_range(&InteropVar, &InteropVar + 1);
9374 return const_child_range(const_child_iterator(), const_child_iterator());
9378 return child_range(child_iterator(), child_iterator());
9381 return const_child_range(const_child_iterator(), const_child_iterator());
9385 return T->getClauseKind() == llvm::omp::OMPC_destroy;
9402 void setCondition(Expr *Cond) { setStmt(Cond); }
9415 OpenMPDirectiveKind CaptureRegion,
9416 SourceLocation StartLoc, SourceLocation LParenLoc,
9417 SourceLocation EndLoc)
9420 setPreInitStmt(HelperCond, CaptureRegion);
9429 child_range used_children();
9448 void setCondition(Expr *Cond) { setStmt(Cond); }
9461 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9462 SourceLocation LParenLoc, SourceLocation EndLoc)
9465 setPreInitStmt(HelperCond, CaptureRegion);
9474 child_range used_children();
9492 void setEventHandler(Expr *E) { setStmt(E); }
9502 SourceLocation EndLoc)
9519class OMPInclusiveClause final
9520 :
public OMPVarListClause<OMPInclusiveClause>,
9521 private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
9523 friend OMPVarListClause;
9524 friend TrailingObjects;
9532 OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9533 SourceLocation EndLoc,
unsigned N)
9534 : OMPVarListClause<OMPInclusiveClause>(
llvm::omp::OMPC_inclusive,
9535 StartLoc, LParenLoc, EndLoc, N) {}
9542 SourceLocation(), SourceLocation(),
9543 SourceLocation(), N) {}
9553 static OMPInclusiveClause *
Create(
const ASTContext &C,
9554 SourceLocation StartLoc,
9555 SourceLocation LParenLoc,
9556 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9562 static OMPInclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9565 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9566 reinterpret_cast<Stmt **
>(varlist_end()));
9570 return const_cast<OMPInclusiveClause *
>(
this)->
children();
9574 return child_range(child_iterator(), child_iterator());
9577 return const_child_range(const_child_iterator(), const_child_iterator());
9581 return T->getClauseKind() == llvm::omp::OMPC_inclusive;
9592class OMPExclusiveClause final
9593 :
public OMPVarListClause<OMPExclusiveClause>,
9594 private llvm::TrailingObjects<OMPExclusiveClause, Expr *> {
9596 friend OMPVarListClause;
9597 friend TrailingObjects;
9605 OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9606 SourceLocation EndLoc,
unsigned N)
9607 : OMPVarListClause<OMPExclusiveClause>(
llvm::omp::OMPC_exclusive,
9608 StartLoc, LParenLoc, EndLoc, N) {}
9615 SourceLocation(), SourceLocation(),
9616 SourceLocation(), N) {}
9626 static OMPExclusiveClause *
Create(
const ASTContext &C,
9627 SourceLocation StartLoc,
9628 SourceLocation LParenLoc,
9629 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9635 static OMPExclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9638 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9639 reinterpret_cast<Stmt **
>(varlist_end()));
9643 return const_cast<OMPExclusiveClause *
>(
this)->
children();
9647 return child_range(child_iterator(), child_iterator());
9650 return const_child_range(const_child_iterator(), const_child_iterator());
9654 return T->getClauseKind() == llvm::omp::OMPC_exclusive;
9666class OMPUsesAllocatorsClause final
9668 private llvm::TrailingObjects<OMPUsesAllocatorsClause, Expr *,
9683 friend TrailingObjects;
9685 enum class ExprOffsets {
9691 enum class ParenLocsOffsets {
9698 SourceLocation LParenLoc;
9700 unsigned NumOfAllocators = 0;
9708 OMPUsesAllocatorsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9709 SourceLocation EndLoc,
unsigned N)
9710 : OMPClause(llvm::omp::OMPC_uses_allocators, StartLoc, EndLoc),
9711 LParenLoc(LParenLoc), NumOfAllocators(N) {}
9716 explicit OMPUsesAllocatorsClause(
unsigned N)
9717 : OMPClause(llvm::omp::OMPC_uses_allocators, SourceLocation(),
9719 NumOfAllocators(N) {}
9721 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
9722 return NumOfAllocators *
static_cast<int>(ExprOffsets::Total);
9726 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9729 void setAllocatorsData(ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9739 static OMPUsesAllocatorsClause *
9740 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
9741 SourceLocation EndLoc, ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9747 static OMPUsesAllocatorsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9760 Stmt **Begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
9761 return child_range(Begin, Begin + NumOfAllocators *
9762 static_cast<int>(ExprOffsets::Total));
9765 Stmt *
const *Begin =
9766 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
9767 return const_child_range(
9768 Begin, Begin + NumOfAllocators *
static_cast<int>(ExprOffsets::Total));
9772 return child_range(child_iterator(), child_iterator());
9775 return const_child_range(const_child_iterator(), const_child_iterator());
9779 return T->getClauseKind() == llvm::omp::OMPC_uses_allocators;
9792class OMPAffinityClause final
9793 :
public OMPVarListClause<OMPAffinityClause>,
9794 private llvm::TrailingObjects<OMPAffinityClause, Expr *> {
9796 friend OMPVarListClause;
9797 friend TrailingObjects;
9800 SourceLocation ColonLoc;
9809 OMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9810 SourceLocation ColonLoc, SourceLocation EndLoc,
unsigned N)
9811 : OMPVarListClause<OMPAffinityClause>(
llvm::omp::OMPC_affinity, StartLoc,
9812 LParenLoc, EndLoc, N) {}
9819 SourceLocation(), SourceLocation(),
9820 SourceLocation(), N) {}
9823 void setModifier(Expr *E) { getTrailingObjects()[varlist_size()] = E; }
9826 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
9837 static OMPAffinityClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
9838 SourceLocation LParenLoc,
9839 SourceLocation ColonLoc,
9840 SourceLocation EndLoc, Expr *Modifier,
9841 ArrayRef<Expr *> Locators);
9847 static OMPAffinityClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9851 Expr *
getModifier()
const {
return getTrailingObjects()[varlist_size()]; }
9859 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9860 reinterpret_cast<Stmt **
>(varlist_end() + Offset));
9864 return const_cast<OMPAffinityClause *
>(
this)->
children();
9868 return child_range(child_iterator(), child_iterator());
9871 return const_child_range(const_child_iterator(), const_child_iterator());
9875 return T->getClauseKind() == llvm::omp::OMPC_affinity;
9892 void setThreadID(Expr *TID) { setStmt(TID); }
9905 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9906 SourceLocation LParenLoc, SourceLocation EndLoc)
9909 setPreInitStmt(HelperE, CaptureRegion);
9931 SourceLocation LParenLoc;
9934 OpenMPBindClauseKind Kind = OMPC_BIND_unknown;
9937 SourceLocation KindLoc;
9940 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9943 void setBindKind(OpenMPBindClauseKind K) { Kind = K; }
9946 void setBindKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
9955 OMPBindClause(OpenMPBindClauseKind K, SourceLocation KLoc,
9956 SourceLocation StartLoc, SourceLocation LParenLoc,
9957 SourceLocation EndLoc)
9958 : OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc),
Kind(K),
9962 OMPBindClause() : OMPNoChildClause() {}
9973 static OMPBindClause *
Create(
const ASTContext &C, OpenMPBindClauseKind K,
9974 SourceLocation KLoc, SourceLocation StartLoc,
9975 SourceLocation LParenLoc, SourceLocation EndLoc);
9980 static OMPBindClause *
CreateEmpty(
const ASTContext &C);
9994template<
class ImplClass,
template <
typename>
class Ptr,
typename RetTy>
9997#define PTR(CLASS) Ptr<CLASS>
9998#define DISPATCH(CLASS) \
9999 return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
10001#define GEN_CLANG_CLAUSE_CLASS
10002#define CLAUSE_CLASS(Enum, Str, Class) \
10003 RetTy Visit##Class(PTR(Class) S) { \
10004 return static_cast<ImplClass *>(this)->VisitOMPClause(S); \
10006#include "llvm/Frontend/OpenMP/OMP.inc"
10010 switch (S->getClauseKind()) {
10011#define GEN_CLANG_CLAUSE_CLASS
10012#define CLAUSE_CLASS(Enum, Str, Class) \
10013 case llvm::omp::Clause::Enum: \
10015#define CLAUSE_NO_CLASS(Enum, Str) \
10016 case llvm::omp::Clause::Enum: \
10018#include "llvm/Frontend/OpenMP/OMP.inc"
10027template <
typename T>
using const_ptr = std::add_pointer_t<std::add_const_t<T>>;
10029template <
class ImplClass,
typename RetTy =
void>
10032template<
class ImplClass,
typename RetTy =
void>
10038 const PrintingPolicy &Policy;
10039 llvm::omp::Version Version;
10042 template <
typename T>
void VisitOMPClauseList(T *Node,
char StartSym);
10044 template <
typename T>
void VisitOMPMotionClause(T *Node);
10048 llvm::omp::Version OpenMPVersion)
10049 : OS(OS), Policy(Policy), Version(OpenMPVersion) {}
10051#define GEN_CLANG_CLAUSE_CLASS
10052#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
10053#include "llvm/Frontend/OpenMP/OMP.inc"
10057 llvm::omp::TraitProperty
Kind = llvm::omp::TraitProperty::invalid;
10066 llvm::omp::TraitSelector
Kind = llvm::omp::TraitSelector::invalid;
10071 llvm::omp::TraitSet
Kind = llvm::omp::TraitSet::invalid;
10080class OMPTraitInfo {
10087 OMPTraitInfo(StringRef MangledName);
10093 llvm::function_ref<
bool(Expr *&,
bool )> Cond) {
10095 return llvm::any_of(
10097 return Cond(Selector.ScoreOrCondition,
10099 llvm::omp::TraitSelector::user_condition);
10109 void getAsVariantMatchInfo(
ASTContext &ASTCtx,
10110 llvm::omp::VariantMatchInfo &VMI)
const;
10113 std::string getMangledName()
const;
10118 if (Set.Kind != llvm::omp::TraitSet::implementation)
10121 if (Selector.
Kind != llvm::omp::TraitSelector::implementation_extension)
10124 if (Property.Kind == TP)
10133 void print(llvm::raw_ostream &OS,
const PrintingPolicy &Policy)
const;
10142 const FunctionDecl *CurrentFunctionDecl,
10154 llvm::StringMap<bool> FeatureMap;
10160class OMPChildren final
10161 :
private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
10162 friend TrailingObjects;
10168 unsigned NumClauses = 0;
10170 unsigned NumChildren = 0;
10172 bool HasAssociatedStmt =
false;
10176 size_t numTrailingObjects(OverloadToken<OMPClause *>)
const {
10182 OMPChildren(
unsigned NumClauses,
unsigned NumChildren,
bool HasAssociatedStmt)
10183 : NumClauses(NumClauses), NumChildren(NumChildren),
10184 HasAssociatedStmt(HasAssociatedStmt) {}
10186 static size_t size(
unsigned NumClauses,
bool HasAssociatedStmt,
10187 unsigned NumChildren);
10189 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses);
10190 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses, Stmt *S,
10191 unsigned NumChildren = 0);
10192 static OMPChildren *
CreateEmpty(
void *Mem,
unsigned NumClauses,
10193 bool HasAssociatedStmt =
false,
10194 unsigned NumChildren = 0);
10203 getTrailingObjects<Stmt *>()[NumChildren] = S;
10219 assert(HasAssociatedStmt &&
10220 "Expected directive with the associated statement.");
10221 return getTrailingObjects<Stmt *>()[NumChildren];
10226 return getTrailingObjects<OMPClause *>(NumClauses);
10229 return const_cast<OMPChildren *
>(
this)->
getClauses();
10236 const CapturedStmt *
10239 assert(llvm::is_contained(CaptureRegions, RegionKind) &&
10240 "RegionKind not found in OpenMP CaptureRegions.");
10242 for (
auto ThisCaptureRegion : CaptureRegions) {
10243 if (ThisCaptureRegion == RegionKind)
10245 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10247 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
10254 assert(!CaptureRegions.empty() &&
10255 "At least one captured statement must be provided.");
10257 for (
unsigned Level = CaptureRegions.size(); Level > 1; --Level)
10258 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10262 const CapturedStmt *
10268 MutableArrayRef<Stmt *> getChildren();
10270 return const_cast<OMPChildren *
>(
this)->
getChildren();
10274 assert(HasAssociatedStmt &&
10275 "Expected directive with the associated statement.");
10279 S = CS->getCapturedStmt();
10280 CS = dyn_cast<CapturedStmt>(S);
10287 return const_cast<OMPChildren *
>(
this)->
getRawStmt();
10291 if (!HasAssociatedStmt)
10292 return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator());
10293 return Stmt::child_range(&getTrailingObjects<Stmt *>()[NumChildren],
10294 &getTrailingObjects<Stmt *>()[NumChildren + 1]);
10305 :
public OMPOneStmtClause<llvm::omp::OMPC_ompx_dyn_cgroup_mem, OMPClause>,
10310 void setSize(Expr *E) { setStmt(E); }
10322 OpenMPDirectiveKind CaptureRegion,
10323 SourceLocation StartLoc, SourceLocation LParenLoc,
10324 SourceLocation EndLoc)
10327 setPreInitStmt(HelperSize, CaptureRegion);
10350 SourceLocation LParenLoc;
10353 enum { SIMPLE, FALLBACK, NUM_MODIFIERS };
10354 unsigned Modifiers[NUM_MODIFIERS];
10357 SourceLocation ModifiersLoc[NUM_MODIFIERS];
10360 Expr *Size =
nullptr;
10365 void setDynGroupprivateModifier(OpenMPDynGroupprivateClauseModifier M) {
10366 Modifiers[SIMPLE] = M;
10372 void setDynGroupprivateFallbackModifier(
10373 OpenMPDynGroupprivateClauseFallbackModifier M) {
10374 Modifiers[FALLBACK] = M;
10378 void setDynGroupprivateModifierLoc(SourceLocation Loc) {
10379 ModifiersLoc[SIMPLE] = Loc;
10383 void setDynGroupprivateFallbackModifierLoc(SourceLocation Loc) {
10384 ModifiersLoc[FALLBACK] = Loc;
10390 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
10395 void setSize(Expr *E) {
Size = E; }
10409 SourceLocation EndLoc, Expr *Size, Stmt *HelperSize,
10410 OpenMPDirectiveKind CaptureRegion,
10411 OpenMPDynGroupprivateClauseModifier M1,
10412 SourceLocation M1Loc,
10413 OpenMPDynGroupprivateClauseFallbackModifier M2,
10414 SourceLocation M2Loc)
10415 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
10417 setPreInitStmt(HelperSize, CaptureRegion);
10418 Modifiers[SIMPLE] = M1;
10419 Modifiers[FALLBACK] = M2;
10420 ModifiersLoc[SIMPLE] = M1Loc;
10421 ModifiersLoc[FALLBACK] = M2Loc;
10426 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
10429 Modifiers[SIMPLE] = OMPC_DYN_GROUPPRIVATE_unknown;
10430 Modifiers[FALLBACK] = OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown;
10435 return static_cast<OpenMPDynGroupprivateClauseModifier
>(Modifiers[SIMPLE]);
10439 OpenMPDynGroupprivateClauseFallbackModifier
10441 return static_cast<OpenMPDynGroupprivateClauseFallbackModifier
>(
10442 Modifiers[FALLBACK]);
10450 return ModifiersLoc[SIMPLE];
10455 return ModifiersLoc[FALLBACK];
10465 return child_range(
reinterpret_cast<Stmt **
>(&Size),
10466 reinterpret_cast<Stmt **
>(&Size) + 1);
10474 return child_range(child_iterator(), child_iterator());
10477 return const_child_range(const_child_iterator(), const_child_iterator());
10481 return T->getClauseKind() == llvm::omp::OMPC_dyn_groupprivate;
10493class OMPDoacrossClause final
10494 :
public OMPVarListClause<OMPDoacrossClause>,
10495 private llvm::TrailingObjects<OMPDoacrossClause, Expr *> {
10497 friend OMPVarListClause;
10498 friend TrailingObjects;
10501 OpenMPDoacrossClauseModifier DepType = OMPC_DOACROSS_unknown;
10504 SourceLocation DepLoc;
10507 SourceLocation ColonLoc;
10510 unsigned NumLoops = 0;
10519 OMPDoacrossClause(SourceLocation StartLoc, SourceLocation LParenLoc,
10520 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
10521 : OMPVarListClause<OMPDoacrossClause>(
llvm::omp::OMPC_doacross, StartLoc,
10522 LParenLoc, EndLoc, N),
10523 NumLoops(NumLoops) {}
10531 SourceLocation(), SourceLocation(),
10532 SourceLocation(), N),
10533 NumLoops(NumLoops) {}
10536 void setDependenceType(OpenMPDoacrossClauseModifier M) { DepType = M; }
10539 void setDependenceLoc(SourceLocation Loc) { DepLoc = Loc; }
10542 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
10556 static OMPDoacrossClause *
10557 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
10558 SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType,
10559 SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL,
10560 unsigned NumLoops);
10567 static OMPDoacrossClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
10568 unsigned NumLoops);
10583 void setLoopData(
unsigned NumLoop, Expr *Cnt);
10586 Expr *getLoopData(
unsigned NumLoop);
10587 const Expr *getLoopData(
unsigned NumLoop)
const;
10590 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
10591 reinterpret_cast<Stmt **
>(varlist_end()));
10595 return const_cast<OMPDoacrossClause *
>(
this)->
children();
10599 return child_range(child_iterator(), child_iterator());
10602 return const_child_range(const_child_iterator(), const_child_iterator());
10606 return T->getClauseKind() == llvm::omp::OMPC_doacross;
10621 SourceLocation LParenLoc;
10634 SourceLocation LParenLoc, SourceLocation EndLoc)
10635 :
OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Attrs(Attrs) {
10654 Attrs.append(NewAttrs.begin(), NewAttrs.end());
Forward declaration of all AST node types.
static Decl::Kind getKind(const Decl *D)
static const Decl * getCanonicalDecl(const Decl *D)
static void print(llvm::raw_ostream &OS, const T &V, const Context &Ctx, QualType Ty)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
std::add_pointer_t< std::add_const_t< T > > const_ptr
Defines some OpenMP-specific enums and functions.
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents clause 'affinity' in the 'pragma omp task'-based directives.
friend class OMPClauseReader
Expr * getModifier()
Gets affinity modifier.
child_range used_children()
SourceLocation getColonLoc() const
Gets the location of ':' symbol.
const_child_range children() const
Expr * getModifier() const
static bool classof(const OMPClause *T)
const_child_range used_children() const
This represents clause 'aligned' in the 'pragma omp ...' directives.
friend class OMPClauseReader
void setColonLoc(SourceLocation Loc)
Sets the location of ':'.
SourceLocation getColonLoc() const
Returns the location of ':'.
const Expr * getAlignment() const
Returns alignment.
const_child_range children() const
static bool classof(const OMPClause *T)
Expr * getAlignment()
Returns alignment.
child_range used_children()
const_child_range used_children() const
friend class OMPClauseReader
SourceLocation getBindKindLoc() const
Returns location of clause kind.
SourceLocation getLParenLoc() const
Returns the location of '('.
OpenMPBindClauseKind getBindKind() const
Returns kind of the clause.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
friend class OMPClauseReader
void setChildren(ArrayRef< Stmt * > Children)
Stmt::child_range getAssociatedStmtAsRange()
MutableArrayRef< OMPClause * > getClauses()
Get the clauses storage.
void setClauses(ArrayRef< OMPClause * > Clauses)
Sets the list of variables for this clause.
friend class OMPDeclarativeDirective
bool hasAssociatedStmt() const
const CapturedStmt * getInnermostCapturedStmt(ArrayRef< OpenMPDirectiveKind > CaptureRegions) const
ArrayRef< Stmt * > getChildren() const
void setAssociatedStmt(Stmt *S)
Set associated statement.
const Stmt * getRawStmt() const
unsigned getNumChildren() const
CapturedStmt * getInnermostCapturedStmt(ArrayRef< OpenMPDirectiveKind > CaptureRegions)
Get innermost captured statement for the construct.
friend class OMPExecutableDirective
const Stmt * getAssociatedStmt() const
Returns statement associated with the directive.
ArrayRef< OMPClause * > getClauses() const
MutableArrayRef< Stmt * > getChildren()
const CapturedStmt * getCapturedStmt(OpenMPDirectiveKind RegionKind, ArrayRef< OpenMPDirectiveKind > CaptureRegions) const
Returns the captured statement associated with the component region within the (combined) directive.
Stmt * getAssociatedStmt()
unsigned getNumClauses() const
Class that represents a component of a mappable expression. E.g. for an expression S....
bool isNonContiguous() const
bool operator==(const MappableComponent &Other) const
MappableComponent(Expr *AssociatedExpression, ValueDecl *AssociatedDeclaration, bool IsNonContiguous)
MappableComponent()=default
ValueDecl * getAssociatedDeclaration() const
Expr * getAssociatedExpression() const
Struct that defines common infrastructure to handle mappable expressions used in OpenMP clauses.
static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl * > Declarations)
static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)
friend llvm::hash_code hash_value(const MappableComponent &MC)
ArrayRef< MappableExprComponentList > MappableExprComponentListsRef
SmallVector< MappableComponent, 8 > MappableExprComponentList
ArrayRef< MappableComponent > MappableExprComponentListRef
SmallVector< MappableExprComponentList, 8 > MappableExprComponentLists
OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy, llvm::omp::Version OpenMPVersion)
This class implements a simple visitor for OMPClause subclasses.
RetTy VisitOMPClause(PTR(OMPClause) Node)
RetTy Visit(PTR(OMPClause) S)
This represents clause 'copyin' in the 'pragma omp ...' directives.
friend class OMPClauseReader
llvm::iterator_range< helper_expr_iterator > helper_expr_range
helper_expr_const_range assignment_ops() const
ArrayRef< const Expr * >::iterator helper_expr_const_iterator
helper_expr_range assignment_ops()
helper_expr_range source_exprs()
helper_expr_const_range source_exprs() const
MutableArrayRef< Expr * >::iterator helper_expr_iterator
const_child_range children() const
static bool classof(const OMPClause *T)
helper_expr_range destination_exprs()
child_range used_children()
llvm::iterator_range< helper_expr_const_iterator > helper_expr_const_range
const_child_range used_children() const
helper_expr_const_range destination_exprs() const
This represents clause 'copyprivate' in the 'pragma omp ...' directives.
llvm::iterator_range< helper_expr_iterator > helper_expr_range
friend class OMPClauseReader
const_child_range used_children() const
helper_expr_range destination_exprs()
helper_expr_range source_exprs()
const_child_range children() const
llvm::iterator_range< helper_expr_const_iterator > helper_expr_const_range
child_range used_children()
static bool classof(const OMPClause *T)
helper_expr_const_range destination_exprs() const
ArrayRef< const Expr * >::iterator helper_expr_const_iterator
MutableArrayRef< Expr * >::iterator helper_expr_iterator
helper_expr_const_range source_exprs() const
helper_expr_range assignment_ops()
helper_expr_const_range assignment_ops() const
friend class OMPClauseReader
const_child_range children() const
OMPDefaultmapClause()
Build an empty clause.
OMPDefaultmapClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KLoc, SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind, OpenMPDefaultmapClauseModifier M)
Build 'defaultmap' clause with defaultmap kind Kind.
static bool classof(const OMPClause *T)
child_range used_children()
SourceLocation getDefaultmapModifierLoc() const
Get the modifier location.
OpenMPDefaultmapClauseKind getDefaultmapKind() const
Get kind of the clause.
const_child_range used_children() const
SourceLocation getDefaultmapKindLoc()
Get kind location.
OpenMPDefaultmapClauseModifier getDefaultmapModifier() const
Get the modifier of the clause.
SourceLocation getLParenLoc()
Get location of '('.
This represents implicit clause 'depend' for the 'pragma omp task' directive.
const_child_range children() const
friend class OMPClauseReader
SourceLocation getDependencyLoc() const
Get dependency type location.
Expr * getModifier()
Return optional depend modifier.
unsigned getNumLoops() const
Get number of loops associated with the clause.
const Expr * getModifier() const
SourceLocation getColonLoc() const
Get colon location.
SourceLocation getOmpAllMemoryLoc() const
Get 'omp_all_memory' location.
const_child_range used_children() const
static bool classof(const OMPClause *T)
OpenMPDependClauseKind getDependencyKind() const
Get dependency type.
child_range used_children()
This represents implicit clause 'depobj' for the 'pragma omp depobj' directive. This clause does not ...
const Expr * getDepobj() const
friend class OMPClauseReader
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range children() const
Expr * getDepobj()
Returns depobj expression associated with the clause.
static bool classof(const OMPClause *T)
const_child_range used_children() const
child_range used_children()
SourceLocation getLParenLoc() const
Returns the location of '('.
OMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Build 'destroy' clause with an interop variable expression InteropVar.
friend class OMPClauseReader
const_child_range children() const
const_child_range used_children() const
static bool classof(const OMPClause *T)
SourceLocation getVarLoc() const
Returns the location of the interop variable.
Expr * getInteropVar() const
Returns the interop variable.
child_range used_children()
OMPDestroyClause()
Build an empty clause.
OMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'destroy' clause.
friend class OMPClauseReader
Expr * getEventHandler() const
Returns event-handler expression.
OMPDetachClause()
Build an empty clause.
OMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'detach' clause with event-handler Evt.
OpenMPDeviceClauseModifier getModifier() const
Gets modifier.
friend class OMPClauseReader
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
child_range used_children()
Expr * getDevice()
Return device number.
OMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Build 'device' clause.
OMPDeviceClause()
Build an empty clause.
SourceLocation getModifierLoc() const
Gets modifier location.
Expr * getDevice() const
Return device number.
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range used_children() const
const_child_range children() const
static bool classof(const OMPClause *T)
SourceLocation getDistScheduleKindLoc()
Get kind location.
friend class OMPClauseReader
OMPDistScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KLoc, SourceLocation CommaLoc, SourceLocation EndLoc, OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, Stmt *HelperChunkSize)
Build 'dist_schedule' clause with schedule kind Kind and chunk size expression ChunkSize.
SourceLocation getLParenLoc()
Get location of '('.
child_range used_children()
const_child_range used_children() const
SourceLocation getCommaLoc()
Get location of ','.
static bool classof(const OMPClause *T)
const_child_range children() const
Expr * getChunkSize()
Get chunk size.
OpenMPDistScheduleClauseKind getDistScheduleKind() const
Get kind of the clause.
OMPDistScheduleClause()
Build an empty clause.
const Expr * getChunkSize() const
Get chunk size.
This represents the 'doacross' clause for the 'pragma omp ordered' directive.
const_child_range children() const
friend class OMPClauseReader
SourceLocation getDependenceLoc() const
Get dependence type location.
SourceLocation getColonLoc() const
Get colon location.
OpenMPDoacrossClauseModifier getDependenceType() const
Get dependence type.
static bool classof(const OMPClause *T)
const_child_range used_children() const
child_range used_children()
unsigned getNumLoops() const
Get number of loops associated with the clause.
child_range used_children()
friend class OMPClauseReader
OMPDynGroupprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, OpenMPDynGroupprivateClauseModifier M1, SourceLocation M1Loc, OpenMPDynGroupprivateClauseFallbackModifier M2, SourceLocation M2Loc)
Build 'dyn_groupprivate' clause with a size expression Size.
static bool classof(const OMPClause *T)
const Expr * getSize() const
Get size.
Expr * getSize()
Get size.
SourceLocation getLParenLoc()
Get location of '('.
OpenMPDynGroupprivateClauseFallbackModifier getDynGroupprivateFallbackModifier() const
Get the second modifier of the clause.
OMPDynGroupprivateClause()
Build an empty clause.
SourceLocation getDynGroupprivateFallbackModifierLoc() const
Get the second modifier location.
SourceLocation getDynGroupprivateModifierLoc() const
Get the first modifier location.
OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier() const
Get the first modifier of the clause.
const_child_range children() const
const_child_range used_children() const
This represents clause 'exclusive' in the 'pragma omp scan' directive.
const_child_range children() const
friend class OMPClauseReader
static bool classof(const OMPClause *T)
child_range used_children()
const_child_range used_children() const
OMPFilterClause()
Build an empty clause.
friend class OMPClauseReader
Expr * getThreadID() const
Return thread identifier.
Expr * getThreadID()
Return thread identifier.
OMPFilterClause(Expr *ThreadID, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'filter' clause with thread-id ThreadID.
static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with N variables.
static bool classof(const OMPClause *T)
child_range used_children()
const_child_range used_children() const
const_child_range children() const
static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)
Creates clause with a list of variables VL.
This represents clause 'from' in the 'pragma omp ...' directives.
const_child_range children() const
friend class OMPClauseReader
const_child_range used_children() const
child_range used_children()
ArrayRef< SourceLocation > getMotionModifiersLoc() const LLVM_READONLY
Fetches ArrayRef of location of motion-modifiers.
static bool classof(const OMPClause *T)
ArrayRef< OpenMPMotionModifierKind > getMotionModifiers() const LLVM_READONLY
Fetches ArrayRef of motion-modifiers.
SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY
Fetches the motion-modifier location at 'Cnt' index of array of modifiers' locations.
SourceLocation getColonLoc() const
Get colon location.
Expr * getIteratorModifier() const
OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY
Fetches the motion-modifier at 'Cnt' index of array of modifiers.
const_child_range children() const
OpenMPGrainsizeClauseModifier getModifier() const
Gets modifier.
friend class OMPClauseReader
OMPGrainsizeClause()
Build an empty clause.
SourceLocation getModifierLoc() const
Gets modifier location.
const_child_range used_children() const
Expr * getGrainsize() const
Return safe iteration space distance.
child_range used_children()
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
static bool classof(const OMPClause *T)
SourceLocation getLParenLoc() const
Returns the location of '('.
OMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Build 'grainsize' clause.
This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.
static bool classof(const OMPClause *T)
friend class OMPClauseReader
const_child_range used_children() const
const_child_range children() const
child_range used_children()
SourceLocation getLParenLoc() const
Returns the location of '('.
friend class OMPClauseReader
child_range used_children()
OMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'hint' clause with expression Hint.
Expr * getHint() const
Returns number of threads.
const_child_range used_children() const
const_child_range children() const
static bool classof(const OMPClause *T)
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
OMPHintClause()
Build an empty clause.
This represents clause 'inclusive' in the 'pragma omp scan' directive.
const_child_range children() const
friend class OMPClauseReader
static bool classof(const OMPClause *T)
const_child_range used_children() const
child_range used_children()
bool getIsTarget() const
Returns true is interop-type 'target' is used.
friend class OMPClauseReader
ArrayRef< Expr * > attrs() const
All attr() exprs across every pref-spec, in pref-spec order (flat block).
static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned NumPrefs, unsigned NumAttrs)
Creates an empty clause sized for NumPrefs pref-specs and NumAttrs total attr() exprs across them.
const_child_range children() const
bool hasPreferAttrs() const
Returns true if OMP 6.0 {fr/attr} syntax is used.
child_range used_children()
Expr * getInteropVar()
Returns the interop variable.
const_child_range used_children() const
static OMPInitClause * Create(const ASTContext &C, Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Creates a fully specified clause.
SourceLocation getVarLoc() const
Returns the location of the interop variable.
bool getIsTargetSync() const
Returns true is interop-type 'targetsync' is used.
const Expr * getInteropVar() const
static bool classof(const OMPClause *T)
auto prefs() const
Returns a range of PrefView objects, one per preference-specification, each carrying the fr() express...
This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.
friend class OMPClauseReader
static bool classof(const OMPClause *T)
child_range used_children()
const_child_range children() const
const_child_range used_children() const
OpenMPMapClauseKind getMapType() const LLVM_READONLY
Fetches mapping kind for the clause.
friend class OMPClauseReader
const_child_range children() const
OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier at 'Cnt' index of array of modifiers.
SourceLocation getMapTypeModifierLoc(unsigned Cnt) const LLVM_READONLY
Fetches the map-type-modifier location at 'Cnt' index of array of modifiers' locations.
SourceLocation getMapLoc() const LLVM_READONLY
Fetches location of clause mapping kind.
child_range used_children()
ArrayRef< SourceLocation > getMapTypeModifiersLoc() const LLVM_READONLY
Fetches ArrayRef of location of map-type-modifiers.
static bool classof(const OMPClause *T)
SourceLocation getColonLoc() const
Get colon location.
ArrayRef< OpenMPMapModifierKind > getMapTypeModifiers() const LLVM_READONLY
Fetches ArrayRef of map-type-modifiers.
const_child_range used_children() const
bool isImplicitMapType() const LLVM_READONLY
Is this an implicit map type? We have to capture 'IsMapTypeImplicit' from the parser for more informa...
Expr * getIteratorModifier()
Fetches Expr * of iterator modifier.
Iterator that browse the components by lists. It also allows browsing components of a single declarat...
std::tuple< const ValueDecl *, MappableExprComponentListRef, const ValueDecl * > operator->() const
std::tuple< const ValueDecl *, MappableExprComponentListRef, const ValueDecl * > operator*() const
const_component_lists_iterator & operator++()
const_component_lists_iterator(const ValueDecl *Declaration, ArrayRef< ValueDecl * > UniqueDecls, ArrayRef< unsigned > DeclsListNum, ArrayRef< unsigned > CumulativeListSizes, MappableExprComponentListRef Components, bool SupportsMapper, ArrayRef< Expr * > Mappers)
Construct an iterator that scan lists for a given declaration Declaration.
const_component_lists_iterator(ArrayRef< ValueDecl * > UniqueDecls, ArrayRef< unsigned > DeclsListNum, ArrayRef< unsigned > CumulativeListSizes, MappableExprComponentListRef Components, bool SupportsMapper, ArrayRef< Expr * > Mappers)
Construct an iterator that scans all lists.
This represents clauses with a list of expressions that are mappable. Examples of these clauses are '...
MutableArrayRef< ValueDecl * > getUniqueDeclsRef()
Get the unique declarations that are in the trailing objects of the class.
const DeclarationNameInfo & getMapperIdInfo() const
Gets the name info for associated user-defined mapper.
const_all_lists_sizes_range all_lists_sizes() const
const_component_lists_range decl_component_lists(const ValueDecl *VD) const
llvm::iterator_range< const_all_components_iterator > const_all_components_range
unsigned getTotalComponentsNum() const
Return the total number of components in all lists derived from the clause.
void setComponents(ArrayRef< MappableComponent > Components, ArrayRef< unsigned > CLSs)
Set the components that are in the trailing objects of the class. This requires the list sizes so tha...
friend class OMPClauseReader
mapperlist_const_iterator mapperlist_end() const
const_component_lists_iterator component_lists_end() const
llvm::iterator_range< const_all_lists_sizes_iterator > const_all_lists_sizes_range
mapperlist_iterator mapperlist_begin()
ArrayRef< ValueDecl * > getUniqueDeclsRef() const
Get the unique declarations that are in the trailing objects of the class.
mapperlist_iterator mapperlist_end()
ArrayRef< ValueDecl * >::iterator const_all_decls_iterator
Iterators to access all the declarations, number of lists, list sizes, and components.
MutableArrayRef< Expr * >::iterator mapperlist_iterator
ArrayRef< unsigned > getComponentListSizesRef() const
Get the cumulative component lists sizes that are in the trailing objects of the class....
MutableArrayRef< unsigned > getDeclNumListsRef()
Get the number of lists per declaration that are in the trailing objects of the class.
ArrayRef< Expr * > getUDMapperRefs() const
Get the user-defined mappers references that are in the trailing objects of the class.
const_component_lists_range component_lists() const
void setDeclNumLists(ArrayRef< unsigned > DNLs)
Set the number of lists per declaration that are in the trailing objects of the class.
const_all_components_range all_components() const
ArrayRef< unsigned >::iterator const_all_num_lists_iterator
mapperlist_const_range mapperlists() const
OMPMappableExprListClause(OpenMPClauseKind K, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes, bool SupportsMapper=false, NestedNameSpecifierLoc *MapperQualifierLocPtr=nullptr, DeclarationNameInfo *MapperIdInfoPtr=nullptr)
Build a clause for NumUniqueDeclarations declarations, NumComponentLists total component lists,...
ArrayRef< const Expr * >::iterator mapperlist_const_iterator
mapperlist_const_iterator mapperlist_begin() const
void setMapperIdInfo(DeclarationNameInfo MapperId)
Set the name of associated user-defined mapper.
void setUDMapperRefs(ArrayRef< Expr * > DMDs)
Set the user-defined mappers that are in the trailing objects of the class.
void setComponentListSizes(ArrayRef< unsigned > CLSs)
Set the cumulative component lists sizes that are in the trailing objects of the class.
const_all_num_lists_range all_num_lists() const
ArrayRef< unsigned >::iterator const_all_lists_sizes_iterator
unsigned getTotalComponentListNum() const
Return the number of lists derived from the clause expressions.
void setMapperQualifierLoc(NestedNameSpecifierLoc NNSL)
Set the nested name specifier of associated user-defined mapper.
MutableArrayRef< Expr * > getUDMapperRefs()
Get the user-defined mapper references that are in the trailing objects of the class.
unsigned getUniqueDeclarationsNum() const
Return the number of unique base declarations in this clause.
const_component_lists_iterator decl_component_lists_end() const
ArrayRef< unsigned > getDeclNumListsRef() const
Get the number of lists per declaration that are in the trailing objects of the class.
NestedNameSpecifierLoc getMapperQualifierLoc() const
Gets the nested name specifier for associated user-defined mapper.
llvm::iterator_range< const_all_num_lists_iterator > const_all_num_lists_range
mapperlist_range mapperlists()
MutableArrayRef< unsigned > getComponentListSizesRef()
Get the cumulative component lists sizes that are in the trailing objects of the class....
void setClauseInfo(ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)
Fill the clause information from the list of declarations and associated component lists.
MutableArrayRef< MappableComponent > getComponentsRef()
Get the components that are in the trailing objects of the class.
const_component_lists_iterator component_lists_begin() const
Iterators for all component lists.
llvm::iterator_range< const_component_lists_iterator > const_component_lists_range
llvm::iterator_range< mapperlist_const_iterator > mapperlist_const_range
const_component_lists_iterator decl_component_lists_begin(const ValueDecl *VD) const
Iterators for component lists associated with the provided declaration.
ArrayRef< MappableComponent > getComponentsRef() const
Get the components that are in the trailing objects of the class.
llvm::iterator_range< mapperlist_iterator > mapperlist_range
llvm::iterator_range< const_all_decls_iterator > const_all_decls_range
ArrayRef< MappableComponent >::iterator const_all_components_iterator
void setUniqueDecls(ArrayRef< ValueDecl * > UDs)
Set the unique declarations that are in the trailing objects of the class.
const_all_decls_range all_decls() const
friend class OMPClauseReader
OMPNocontextClause()
Build an empty clause.
const_child_range used_children() const
Expr * getCondition() const
Returns condition.
OMPNocontextClause(Expr *Cond, Stmt *HelperCond, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'nocontext' clause with condition Cond.
child_range used_children()
static bool classof(const OMPClause *T)
const_child_range children() const
const_child_range used_children() const
OMPNogroupClause()
Build an empty clause.
OMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'nogroup' clause.
child_range used_children()
This represents clause 'nontemporal' in the 'pragma omp ...' directives.
friend class OMPClauseReader
child_range used_children()
static bool classof(const OMPClause *T)
const_child_range used_children() const
const_child_range children() const
const_child_range private_refs() const
child_range private_refs()
Expr * getCondition() const
Returns condition.
friend class OMPClauseReader
const_child_range used_children() const
child_range used_children()
OMPNovariantsClause()
Build an empty clause.
OMPNovariantsClause(Expr *Cond, Stmt *HelperCond, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'novariants' clause with condition Cond.
friend class OMPClauseReader
const_child_range children() const
SourceLocation getModifierLoc() const
Gets modifier location.
OMPNumTasksClause()
Build an empty clause.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range used_children() const
OpenMPNumTasksClauseModifier getModifier() const
Gets modifier.
OMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Build 'num_tasks' clause.
static bool classof(const OMPClause *T)
child_range used_children()
Expr * getNumTasks() const
Return safe iteration space distance.
This represents 'num_teams' clause in the 'pragma omp ...' directive.
child_range used_children()
friend class OMPClauseReader
const Expr * getDimsModifierExpr() const
Get the expression of the modifier if it is the dims modifier.
ArrayRef< Expr * > getNumTeams()
Return NumTeams expressions.
Expr * getModifierExpr()
Get the expression of the modifier.
static bool classof(const OMPClause *T)
const_child_range children() const
SourceLocation getModifierLoc() const
Get the location of the modifier.
OpenMPNumTeamsClauseModifier getModifier() const
Get the modifier.
const Expr * getModifierExpr() const
Get the expression of the modifier.
ArrayRef< Expr * > getNumTeams() const
Return NumTeams expressions.
const_child_range used_children() const
friend class OMPClauseReader
SourceLocation getLParenLoc() const
Returns the location of '('.
SourceLocation getModifierKwLoc() const
Returns location of clause modifier.
OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier, SourceLocation MLoc)
Build 'order' clause with argument A ('concurrent').
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
SourceLocation getKindKwLoc() const
Returns location of clause kind.
const_child_range used_children() const
static bool classof(const OMPClause *T)
OMPOrderClause()
Build an empty clause.
const_child_range children() const
child_range used_children()
OpenMPOrderClauseKind getKind() const
Returns kind of the clause.
OpenMPOrderClauseModifier getModifier() const
Returns Modifier of the clause.
friend class OMPClauseReader
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
Expr * getPriority() const
Return Priority number.
child_range used_children()
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range used_children() const
OMPPriorityClause(Expr *Priority, Stmt *HelperPriority, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'priority' clause.
OMPPriorityClause()
Build an empty clause.
static bool classof(const OMPClause *T)
const_child_range children() const
Expr * getPriority()
Return Priority number.
OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'simd' clause.
const_child_range used_children() const
const_child_range children() const
OMPSIMDClause()
Build an empty clause.
child_range used_children()
static bool classof(const OMPClause *T)
This represents 'thread_limit' clause in the 'pragma omp ...' directive.
const_child_range children() const
friend class OMPClauseReader
SourceLocation getModifierLoc() const
Get the location of the modifier.
Expr * getModifierExpr()
Get the expression of the modifier.
child_range used_children()
const_child_range used_children() const
ArrayRef< Expr * > getThreadLimit() const
Return ThreadLimit expressions.
const Expr * getDimsModifierExpr() const
Get the expression of the modifier if it is the dims modifier.
ArrayRef< Expr * > getThreadLimit()
Return ThreadLimit expressions.
const Expr * getModifierExpr() const
Get the expression of the modifier.
OpenMPThreadLimitClauseModifier getModifier() const
Get the modifier.
static bool classof(const OMPClause *T)
OMPThreadsClause()
Build an empty clause.
OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'threads' clause.
This represents clause 'to' in the 'pragma omp ...' directives.
ArrayRef< SourceLocation > getMotionModifiersLoc() const LLVM_READONLY
Fetches ArrayRef of location of motion-modifiers.
friend class OMPClauseReader
Expr * getIteratorModifier() const
SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY
Fetches the motion-modifier location at 'Cnt' index of array of modifiers' locations.
ArrayRef< OpenMPMotionModifierKind > getMotionModifiers() const LLVM_READONLY
Fetches ArrayRef of motion-modifiers.
static bool classof(const OMPClause *T)
child_range used_children()
OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY
Fetches the motion-modifier at 'Cnt' index of array of modifiers.
const_child_range used_children() const
const_child_range children() const
SourceLocation getColonLoc() const
Get colon location.
bool isExtensionActive(llvm::omp::TraitProperty TP)
Check the extension trait TP is active.
llvm::SmallVector< OMPTraitSet, 2 > Sets
The outermost level of selector sets.
bool anyScoreOrCondition(llvm::function_ref< bool(Expr *&, bool)> Cond)
friend class OMPClauseReader
static bool classof(const OMPClause *T)
child_range used_children()
SourceLocation getVarLoc() const
Returns the location of the interop variable.
Expr * getInteropVar() const
Returns the interop variable.
OMPUseClause()
Build an empty clause.
const_child_range children() const
const_child_range used_children() const
OMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Build 'use' clause with and interop variable expression InteropVar.
SourceLocation getLParenLoc() const
Returns the location of '('.
This represents clause 'use_device_addr' in the 'pragma omp ...' directives.
friend class OMPClauseReader
const_child_range used_children() const
child_range used_children()
static bool classof(const OMPClause *T)
const_child_range children() const
This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.
SourceLocation getFallbackModifierLoc() const
Get the location of the fallback modifier.
friend class OMPClauseReader
ArrayRef< const Expr * >::iterator inits_const_iterator
static bool classof(const OMPClause *T)
MutableArrayRef< Expr * >::iterator private_copies_iterator
llvm::iterator_range< private_copies_iterator > private_copies_range
llvm::iterator_range< inits_iterator > inits_range
const_child_range used_children() const
child_range used_children()
OpenMPUseDevicePtrFallbackModifier getFallbackModifier() const
Get the fallback modifier for the clause.
const_child_range children() const
private_copies_const_range private_copies() const
private_copies_range private_copies()
MutableArrayRef< Expr * >::iterator inits_iterator
ArrayRef< const Expr * >::iterator private_copies_const_iterator
llvm::iterator_range< inits_const_iterator > inits_const_range
inits_const_range inits() const
llvm::iterator_range< private_copies_const_iterator > private_copies_const_range
friend class OMPClauseReader
const_child_range used_children() const
child_range used_children()
const_child_range children() const
SourceLocation getLParenLoc() const
Returns the location of '('.
static bool classof(const OMPClause *T)
unsigned getNumberOfAllocators() const
Returns number of allocators associated with the clause.
ArrayRef< const Attr * > getAttrs() const
Returned the attributes parsed from this clause.
friend class OMPClauseReader
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
OMPXAttributeClause()
Build an empty clause.
SourceLocation getLParenLoc() const
Returns the location of '('.
OMPXAttributeClause(ArrayRef< const Attr * > Attrs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'ompx_attribute' clause.
OMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'ompx_bare' clause.
OMPXBareClause()=default
Build an empty clause.
friend class OMPClauseReader
Expr * getSize()
Return the size expression.
Expr * getSize() const
Return the size expression.
OMPXDynCGroupMemClause(Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'ompx_dyn_cgroup_mem' clause.
OMPXDynCGroupMemClause()
Build an empty clause.
a trap message and trap category.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
This represents the 'align' clause in the 'pragma omp allocate' directive.
friend class OMPClauseReader
Expr * getAlignment() const
Returns alignment.
This represents clause 'allocate' in the 'pragma omp ...' directives.
const_child_range children() const
friend class OMPClauseReader
SourceLocation getAllocatorModifierLoc() const
Return the location of the modifier.
const_child_range used_children() const
OpenMPAllocateClauseModifier getAllocatorModifier() const
Return 'allocate' modifier.
OpenMPAllocateClauseModifier getSecondAllocateModifier() const
Get the second modifier of the clause.
SourceLocation getColonLoc() const
Returns the location of the ':' delimiter.
Expr * getAlignment() const
Returns the alignment expression or nullptr, if no alignment specified.
OpenMPAllocateClauseModifier getFirstAllocateModifier() const
Get the first modifier of the clause.
Expr * getAllocator() const
Returns the allocator expression or nullptr, if no allocator is specified.
SourceLocation getSecondAllocateModifierLoc() const
Get location of second modifier of the clause.
child_range used_children()
SourceLocation getFirstAllocateModifierLoc() const
Get location of first modifier of the clause.
static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N variables.
static bool classof(const OMPClause *T)
friend class OMPClauseReader
OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'allocator' clause with the given allocator.
OMPAllocatorClause()
Build an empty clause.
Expr * getAllocator() const
Returns allocator.
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
friend class OMPClauseReader
void setPostUpdateExpr(Expr *S)
Set pre-initialization statement for the clause.
static OMPClauseWithPostUpdate * get(OMPClause *C)
Expr * getPostUpdateExpr()
Get post-update expression for the clause.
OMPClauseWithPostUpdate(const OMPClause *This)
const Expr * getPostUpdateExpr() const
Get post-update expression for the clause.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
friend class OMPClauseReader
const Stmt * getPreInitStmt() const
Get pre-initialization statement for the clause.
OMPClauseWithPreInit(const OMPClause *This)
OpenMPDirectiveKind getCaptureRegion() const
Get capture region for the stmt in the clause.
Stmt * getPreInitStmt()
Get pre-initialization statement for the clause.
static OMPClauseWithPreInit * get(OMPClause *C)
void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion=llvm::omp::OMPD_unknown)
Set pre-initialization statement for the clause.
This is a basic class for representing single OpenMP clause.
const_child_range children() const
void setLocStart(SourceLocation Loc)
Sets the starting location of the clause.
static bool classof(const OMPClause *)
SourceLocation getBeginLoc() const
Returns the starting location of the clause.
llvm::iterator_range< const_child_iterator > const_child_range
ConstStmtIterator const_child_iterator
child_range used_children()
Get the iterator range for the expressions used in the clauses.
llvm::iterator_range< child_iterator > child_range
OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc)
void setLocEnd(SourceLocation Loc)
Sets the ending location of the clause.
StmtIterator child_iterator
SourceLocation getEndLoc() const
Returns the ending location of the clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
const_child_range used_children() const
friend class OMPClauseReader
OMPCollapseClause()
Build an empty clause.
Expr * getNumForLoops() const
Return the number of associated for-loops.
OMPCollapseClause(Expr *Num, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'collapse' clause.
static bool classof(const OMPClause *T)
std::optional< unsigned > getOmpFillIndex() const
friend class OMPClauseReader
child_range used_children()
SourceLocation getOmpFillLoc() const
ArrayRef< Expr * > getCountsRefs() const
const_child_range used_children() const
const_child_range children() const
unsigned getNumCounts() const
Returns the number of list items.
static OMPCountsClause * CreateEmpty(const ASTContext &C, unsigned NumCounts)
Build an empty 'counts' AST node for deserialization.
SourceLocation getLParenLoc() const
Returns the location of '('.
MutableArrayRef< Expr * > getCountsRefs()
Returns the count expressions.
friend class OMPClauseReader
const_child_range used_children() const
OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc, OpenMPDefaultClauseVariableCategory VC, SourceLocation VCLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'default' clause with argument A ('none' or 'shared').
SourceLocation getLParenLoc() const
Returns the location of '('.
llvm::omp::DefaultKind getDefaultKind() const
Returns kind of the clause.
SourceLocation getDefaultKindKwLoc() const
Returns location of clause kind.
OpenMPDefaultClauseVariableCategory getDefaultVC() const
static bool classof(const OMPClause *T)
child_range used_children()
const_child_range children() const
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
OMPDefaultClause()
Build an empty clause.
SourceLocation getDefaultVCLoc() const
Class that represents a list of directive kinds (parallel, target, etc.) as used in absent,...
MutableArrayRef< OpenMPDirectiveKind > getDirectiveKinds()
void setDirectiveKinds(ArrayRef< OpenMPDirectiveKind > DK)
SourceLocation getLParenLoc()
const_child_range children() const
unsigned NumKinds
Number of directive kinds listed in the clause.
void setLParenLoc(SourceLocation S)
const_child_range used_children() const
OMPDirectiveListClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned NumKinds)
Build a clause with NumKinds directive kinds.
child_range used_children()
This represents 'final' clause in the 'pragma omp ...' directive.
child_range used_children()
friend class OMPClauseReader
Expr * getCondition() const
Returns condition.
OMPFinalClause(Expr *Cond, Stmt *HelperCond, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'final' clause with condition Cond.
OMPFinalClause()
Build an empty clause.
Representation of the 'full' clause of the 'pragma omp unroll' directive.
friend class OMPClauseReader
static OMPFullClause * CreateEmpty(const ASTContext &C)
Build an empty 'full' AST node for deserialization.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
friend class OMPClauseReader
const_child_range used_children() const
SourceLocation getLParenLoc() const
Returns the location of '('.
SourceLocation getColonLoc() const
Return the location of ':'.
static bool classof(const OMPClause *T)
child_range used_children()
Expr * getCondition() const
Returns condition.
OpenMPDirectiveKind getNameModifier() const
Return directive name modifier associated with the clause.
OMPIfClause()
Build an empty clause.
const_child_range children() const
OMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Cond, Stmt *HelperCond, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Build 'if' clause with condition Cond.
SourceLocation getNameModifierLoc() const
Return the location of directive name modifier.
friend class OMPClauseReader
Expr * getFirst() const
Get looprange 'first' expression.
static OMPLoopRangeClause * CreateEmpty(const ASTContext &C)
Build an empty 'looprange' clause node.
const_child_range used_children() const
void setFirstLoc(SourceLocation Loc)
child_range used_children()
void setCountLoc(SourceLocation Loc)
SourceLocation getFirstLoc() const
SourceLocation getLParenLoc() const
static bool classof(const OMPClause *T)
SourceLocation getCountLoc() const
const_child_range children() const
Expr * getCount() const
Get looprange 'count' expression.
void setLParenLoc(SourceLocation Loc)
friend class OMPClauseReader
SourceLocation getPrescriptivenessModifierLoc() const
Returns the location of the prescriptiveness modifier.
Expr * getDimsModifierExpr()
Returns the dims modifier expression if present.
bool hasDimsModifier() const
Checks if the clause has the dims modifier.
const_child_range used_children() const
const Expr * getDimsModifierExpr() const
Returns the dims modifier expression if present.
OpenMPNumThreadsClauseModifier getDimsModifier() const
Returns the dims modifier.
OpenMPNumThreadsClauseModifier getPrescriptivenessModifier() const
Returns the prescriptiveness modifier.
const_child_range children() const
child_range used_children()
static bool classof(const OMPClause *T)
ArrayRef< Expr * > getNumThreads()
Return NumThreads expressions.
static OMPNumThreadsClause * CreateEmpty(const ASTContext &C, unsigned N)
Creates an empty clause with the place for N expressions.
SourceLocation getDimsModifierLoc() const
Returns the location of the dims modifier.
ArrayRef< Expr * > getNumThreads() const
const_child_range used_children() const
child_range used_children()
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
OMPOneStmtClause(Stmt *S, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static bool classof(const OMPClause *T)
ConstStmtIterator const_child_iterator
const_child_range children() const
StmtIterator child_iterator
llvm::iterator_range< child_iterator > child_range
SourceLocation getLParenLoc() const
Returns the location of '('.
llvm::iterator_range< const_child_iterator > const_child_range
T * getStmtAs() const
Return the associated statement, potentially casted to T.
child_range used_children()
friend class OMPClauseReader
static OMPPartialClause * CreateEmpty(const ASTContext &C)
Build an empty 'partial' AST node for deserialization.
const_child_range used_children() const
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range children() const
static bool classof(const OMPClause *T)
Expr * getFactor() const
Returns the argument of the clause or nullptr if not set.
This class represents the 'permutation' clause in the 'pragma omp interchange' directive.
static bool classof(const OMPClause *T)
friend class OMPClauseReader
ArrayRef< Expr * > getArgsRefs() const
unsigned getNumLoops() const
Returns the number of list items.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
SourceLocation getLParenLoc() const
Returns the location of '('.
child_range used_children()
MutableArrayRef< Expr * > getArgsRefs()
Returns the permutation index expressions.
static OMPPermutationClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)
Build an empty 'permutation' AST node for deserialization.
const_child_range used_children() const
const_child_range children() const
friend class OMPClauseReader
OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'safelen' clause.
Expr * getSafelen() const
Return safe iteration space distance.
OMPSafelenClause()
Build an empty clause.
friend class OMPClauseReader
OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'simdlen' clause.
Expr * getSimdlen() const
Return safe iteration space distance.
OMPSimdlenClause()
Build an empty clause.
This represents the 'sizes' clause in the 'pragma omp tile' directive.
SourceLocation getLParenLoc() const
Returns the location of '('.
friend class OMPClauseReader
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
static bool classof(const OMPClause *T)
const_child_range used_children() const
void setSizesRefs(ArrayRef< Expr * > VL)
Sets the tile size expressions.
unsigned getNumSizes() const
Returns the number of list items.
child_range used_children()
MutableArrayRef< Expr * > getSizesRefs()
Returns the tile size expressions.
ArrayRef< Expr * > getSizesRefs() const
const_child_range children() const
static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)
Build an empty 'sizes' AST node for deserialization.
friend class OMPClauseReader
static bool classof(const OMPClause *T)
OpenMPThreadsetKind getThreadsetKind() const
Returns kind of the clause.
const_child_range children() const
OMPThreadsetClause(OpenMPThreadsetKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'threadset' clause with argument A ('omp_team' or 'omp_pool').
child_range used_children()
const_child_range used_children() const
SourceLocation getThreadsetKindLoc() const
Returns location of clause kind.
SourceLocation getLParenLoc() const
Returns the location of '('.
OMPThreadsetClause()
Build an empty clause.
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
This represents clauses with the list of variables like 'private', 'firstprivate',...
varlist_const_range varlist() const
friend class OMPClauseReader
void setLParenLoc(SourceLocation Loc)
Sets the location of '('.
ArrayRef< const Expr * > getVarRefs() const
Fetches list of all variables in the clause.
OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N)
Build a clause with N variables.
MutableArrayRef< Expr * > getVarRefs()
Fetches list of variables associated with this clause.
varlist_const_iterator varlist_end() const
varlist_iterator varlist_end()
llvm::iterator_range< varlist_const_iterator > varlist_const_range
MutableArrayRef< Expr * >::iterator varlist_iterator
varlist_iterator varlist_begin()
ArrayRef< const Expr * >::iterator varlist_const_iterator
SourceLocation getLParenLoc() const
Returns the location of '('.
bool varlist_empty() const
unsigned varlist_size() const
varlist_const_iterator varlist_begin() const
llvm::iterator_range< varlist_iterator > varlist_range
void setVarRefs(ArrayRef< Expr * > VL)
Sets the list of variables for this clause.
Encodes a location in the source.
Stmt - This represents one statement.
Top level wrappers for InstallAPI frontend operations.
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
OpenMPOriginalSharingModifier
OpenMP 6.0 original sharing modifiers.
ArrayRef< const Expr * >::iterator used_expressions_const_iterator
bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter)
Checks if the parameter to the fail clause in "#pragma atomic compare fail" is restricted only to mem...
MutableArrayRef< Expr * > getFinals()
Sets the list of final update expressions for linear variables.
llvm::iterator_range< inits_iterator > inits_range
privates_range privates()
OpenMPDefaultClauseVariableCategory
OpenMP variable-category for 'default' clause.
MutableArrayRef< Expr * >::iterator privates_iterator
static bool classof(const OMPClause *T)
llvm::iterator_range< finals_const_iterator > finals_const_range
MutableArrayRef< Expr * > getPrivates()
Finals[]; Step; CalcStep; }.
void setFinals(ArrayRef< Expr * > FL)
Sets the list of final update expressions for linear variables.
void setColonLoc(SourceLocation Loc)
Sets the location of ':'.
MutableArrayRef< Expr * >::iterator inits_iterator
OpenMPLinearClauseKind getModifier() const
Return modifier.
llvm::iterator_range< privates_const_iterator > privates_const_range
void setUsedExprs(ArrayRef< Expr * > UE)
Sets the list of used expressions for the linear clause.
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
@ OMPC_SCHEDULE_MODIFIER_unknown
llvm::iterator_range< inits_const_iterator > inits_const_range
llvm::iterator_range< updates_iterator > updates_range
llvm::iterator_range< used_expressions_iterator > used_expressions_range
MutableArrayRef< Expr * >::iterator updates_iterator
SourceLocation getStepModifierLoc() const
Returns the location of 'step' modifier.
const FunctionProtoType * T
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
Expr * getStep()
Returns linear step.
ArrayRef< const Expr * >::iterator updates_const_iterator
child_range used_children()
llvm::iterator_range< privates_iterator > privates_range
void setUpdates(ArrayRef< Expr * > UL)
Sets the list of update expressions for linear variables.
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
void setPrivates(ArrayRef< Expr * > PL)
Sets the list of the copies of original linear variables.
MutableArrayRef< Expr * > getUsedExprs()
Gets the list of used expressions for linear variables.
MutableArrayRef< Expr * >::iterator used_expressions_iterator
void setInits(ArrayRef< Expr * > IL)
Sets the list of the initial values for linear variables.
OpenMPAllocateClauseModifier
OpenMP modifiers for 'allocate' clause.
void setModifierLoc(SourceLocation Loc)
Set modifier location.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
void setStepModifierLoc(SourceLocation Loc)
Sets the location of 'step' modifier.
SourceLocation getColonLoc() const
Returns the location of ':'.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
MutableArrayRef< Expr * > getUpdates()
Sets the list of update expressions for linear variables.
void setModifier(OpenMPLinearClauseKind Kind)
Set modifier.
SourceLocation getModifierLoc() const
Return modifier location.
llvm::iterator_range< used_expressions_const_iterator > used_expressions_const_range
MutableArrayRef< Expr * > getInits()
OpenMPNumThreadsClauseModifier
@ OMPC_NUMTHREADS_unknown
ArrayRef< const Expr * >::iterator privates_const_iterator
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
@ OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
ArrayRef< const Expr * >::iterator finals_const_iterator
MutableArrayRef< Expr * >::iterator finals_iterator
ArrayRef< const Expr * >::iterator inits_const_iterator
used_expressions_range used_expressions()
Expr * getCalcStep()
Returns expression to calculate linear step.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
OpenMPMapModifierKind
OpenMP modifier kind for 'map' clause.
@ OMPC_MAP_MODIFIER_unknown
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
llvm::iterator_range< updates_const_iterator > updates_const_range
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
llvm::iterator_range< finals_iterator > finals_range
OpenMPThreadsetKind
OpenMP modifiers for 'threadset' clause.
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Diagnostic wrappers for TextAPI types for error reporting.
int const char * function
OpenMPDependClauseKind DepKind
Dependency type (one of in, out, inout).
SourceLocation DepLoc
Dependency type location.
SourceLocation ColonLoc
Colon location.
SourceLocation OmpAllMemoryLoc
Location of 'omp_all_memory'.
ArrayRef< Expr * > Attrs
attr() string-literal expressions. Empty for fr-only or OMP 5.1 flat specs.
Expr * Fr
Foreign-runtime-id expression. Null for attr-only specs.
This structure contains all sizes needed for by an OMPMappableExprListClause.
OMPMappableExprListSizeTy(unsigned NumVars, unsigned NumUniqueDeclarations, unsigned NumComponentLists, unsigned NumComponents)
OMPMappableExprListSizeTy()=default
unsigned NumComponents
Total number of expression components.
unsigned NumUniqueDeclarations
Number of unique base declarations.
unsigned NumVars
Number of expressions listed.
unsigned NumComponentLists
Number of component lists.
llvm::omp::TraitProperty Kind
StringRef RawString
The raw string as we parsed it. This is needed for the isa trait set (which accepts anything) and (la...
llvm::omp::TraitSelector Kind
SmallVector< OMPTraitProperty, 1 > Properties
SmallVector< OMPTraitSelector, 2 > Selectors
Data for list of allocators.
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
TargetOMPContext(ASTContext &ASTCtx, std::function< void(StringRef)> &&DiagUnknownTrait, const FunctionDecl *CurrentFunctionDecl, ArrayRef< llvm::omp::TraitProperty > ConstructTraits, int DeviceNum)
bool matchesISATrait(StringRef RawString) const override
See llvm::omp::OMPContext::matchesISATrait.
virtual ~TargetOMPContext()=default
const_child_range used_children() const
static bool classof(const OMPClause *T)
OMPNoChildClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build 'ClauseKind' clause.
child_range used_children()
OMPNoChildClause()
Build an empty clause.
const_child_range children() const
SourceLocation StartLoc
Starting location of the clause (the clause keyword).
SourceLocation LParenLoc
Location of '('.
SourceLocation EndLoc
Ending location of the clause.
OMPVarListLocTy()=default
OMPVarListLocTy(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)