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");
470class OMPAllocateClause final
471 :
public OMPVarListClause<OMPAllocateClause>,
472 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
474 friend OMPVarListClause;
475 friend TrailingObjects;
479 Expr *Allocator =
nullptr;
482 Expr *Alignment =
nullptr;
493 enum { FIRST, SECOND, NUM_MODIFIERS };
503 Modifiers[FIRST] = M;
509 void setSecondAllocateModifier(OpenMPAllocateClauseModifier M) {
510 Modifiers[SECOND] = M;
514 void setFirstAllocateModifierLoc(SourceLocation Loc) {
515 ModifiersLoc[FIRST] = Loc;
519 void setSecondAllocateModifierLoc(SourceLocation Loc) {
520 ModifiersLoc[SECOND] = Loc;
533 OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
534 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
536 SourceLocation Modifier1Loc,
538 SourceLocation Modifier2Loc, SourceLocation EndLoc,
540 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
541 LParenLoc, EndLoc, N),
542 Allocator(Allocator), Alignment(Alignment), ColonLoc(ColonLoc) {
543 Modifiers[FIRST] = Modifier1;
544 Modifiers[SECOND] = Modifier2;
545 ModifiersLoc[FIRST] = Modifier1Loc;
546 ModifiersLoc[SECOND] = Modifier2Loc;
552 explicit OMPAllocateClause(
unsigned N)
553 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
554 SourceLocation(), SourceLocation(),
555 SourceLocation(), N) {
561 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
563 void setAllocator(Expr *A) { Allocator = A; }
565 AllocatorModifier = AM;
567 void setAlignment(Expr *A) { Alignment = A; }
581 static OMPAllocateClause *
582 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
583 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
586 SourceLocation EndLoc, ArrayRef<Expr *> VL);
596 return AllocatorModifier;
601 return Modifiers[FIRST];
606 return ModifiersLoc[FIRST];
611 return Modifiers[SECOND];
616 return ModifiersLoc[SECOND];
623 return AllocatorModifierLoc;
638 return const_cast<OMPAllocateClause *
>(
this)->
children();
649 return T->getClauseKind() == llvm::omp::OMPC_allocate;
667 Stmt *Condition =
nullptr;
679 void setCondition(
Expr *Cond) { Condition = Cond; }
685 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
688 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
709 ColonLoc(ColonLoc), NameModifier(NameModifier),
710 NameModifierLoc(NameModifierLoc) {
749 return T->getClauseKind() == llvm::omp::OMPC_if;
819class OMPNumThreadsClause final
822 private llvm::TrailingObjects<OMPNumThreadsClause, Expr *> {
824 friend TrailingObjects;
829 enum { PRESCRIPTIVENESS, DIMS, NUM_MODIFIERS };
836 SourceLocation ModifiersLoc[NUM_MODIFIERS];
845 OMPNumThreadsClause(
const ASTContext &
C, SourceLocation StartLoc,
846 SourceLocation LParenLoc, SourceLocation EndLoc,
848 : OMPVarListClause<OMPNumThreadsClause>(
llvm::omp::OMPC_num_threads,
849 StartLoc, LParenLoc, EndLoc, N),
855 explicit OMPNumThreadsClause(
unsigned N)
857 llvm::omp::OMPC_num_threads, SourceLocation(), SourceLocation(),
858 SourceLocation(), N),
868 Modifiers[PRESCRIPTIVENESS] = M;
872 void setPrescriptivenessModifierLoc(SourceLocation Loc) {
873 ModifiersLoc[PRESCRIPTIVENESS] = Loc;
877 void setDimsModifierLoc(SourceLocation Loc) { ModifiersLoc[DIMS] = Loc; }
880 void setDimsModifierExpr(Expr *E) { *
varlist_end() = E; }
898 static OMPNumThreadsClause *
900 SourceLocation StartLoc, SourceLocation LParenLoc,
901 SourceLocation EndLoc, ArrayRef<Expr *> VL,
904 SourceLocation PrescriptivenessModifierLoc,
905 SourceLocation DimsModifierLoc, Expr *DimsModifierExpr, Stmt *PreInit);
911 static OMPNumThreadsClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
916 return const_cast<OMPNumThreadsClause *
>(
this)->
getNumThreads();
921 return Modifiers[PRESCRIPTIVENESS];
925 return ModifiersLoc[PRESCRIPTIVENESS];
930 return Modifiers[DIMS];
937 return Modifiers[DIMS] == OMPC_NUMTHREADS_dims;
954 return const_cast<OMPNumThreadsClause *
>(
this)->
children();
965 return T->getClauseKind() == llvm::omp::OMPC_num_threads;
1047class OMPSizesClause final
1049 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1051 friend class llvm::TrailingObjects<OMPSizesClause,
Expr *>;
1060 explicit OMPSizesClause(
int NumSizes)
1062 NumSizes(NumSizes) {}
1093 return getTrailingObjects(NumSizes);
1099 assert(VL.size() == NumSizes);
1106 reinterpret_cast<Stmt **
>(Sizes.end()));
1111 reinterpret_cast<Stmt *
const *
>(Sizes.end()));
1122 return T->getClauseKind() == llvm::omp::OMPC_sizes;
1132class OMPCountsClause final
1134 private llvm::TrailingObjects<OMPCountsClause, Expr *> {
1136 friend class llvm::TrailingObjects<OMPCountsClause,
Expr *>;
1142 unsigned NumCounts = 0;
1145 std::optional<unsigned> OmpFillIndex;
1151 explicit OMPCountsClause(
int NumCounts)
1153 NumCounts(NumCounts) {}
1157 void setOmpFillIndex(std::optional<unsigned> Idx) { OmpFillIndex = Idx; }
1158 void setOmpFillLoc(SourceLocation Loc) { OmpFillLoc = Loc; }
1161 void setCountsRefs(ArrayRef<Expr *> VL) {
1162 assert(VL.size() == NumCounts);
1174 static OMPCountsClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1175 SourceLocation LParenLoc,
1176 SourceLocation EndLoc, ArrayRef<Expr *> Counts,
1177 std::optional<unsigned> FillIdx,
1178 SourceLocation FillLoc);
1184 static OMPCountsClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumCounts);
1198 return getTrailingObjects(NumCounts);
1201 return getTrailingObjects(NumCounts);
1207 reinterpret_cast<Stmt **
>(Counts.end()));
1212 reinterpret_cast<Stmt *
const *
>(Counts.end()));
1222 return T->getClauseKind() == llvm::omp::OMPC_counts;
1234class OMPPermutationClause final
1236 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1249 assert(VL.size() == NumLoops &&
"Expecting one expression per loop");
1250 llvm::copy(VL, getTrailingObjects());
1257 NumLoops(NumLoops) {}
1267 static OMPPermutationClause *
1296 reinterpret_cast<Stmt **
>(Args.end()));
1301 reinterpret_cast<Stmt *
const *
>(Args.end()));
1312 return T->getClauseKind() == llvm::omp::OMPC_permutation;
1354 enum { FirstExpr, CountExpr, NumArgs };
1355 Stmt *Args[NumArgs] = {
nullptr,
nullptr};
1358 void setFirst(Expr *E) { Args[FirstExpr] = E; }
1361 void setCount(Expr *E) { Args[CountExpr] = E; }
1369 LParenLoc(LParenLoc), FirstLoc(FirstLoc), CountLoc(CountLoc) {
1406 return T->getClauseKind() == llvm::omp::OMPC_looprange;
1424 Stmt *Factor =
nullptr;
1427 void setFactor(
Expr *E) { Factor = E; }
1442 LParenLoc(LParenLoc), Factor(Factor) {}
1466 return T->getClauseKind() == llvm::omp::OMPC_partial;
1488 Stmt *Depth =
nullptr;
1491 explicit OMPDepthClause() :
OMPClause(
llvm::omp::OMPC_depth, {}, {}) {}
1494 void setDepth(Expr *E) { Depth = E; }
1497 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1509 LParenLoc(LParenLoc), Depth(Depth) {}
1530 return T->getClauseKind() == llvm::omp::OMPC_depth;
1584 llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
1598 void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
1603 void setDefaultKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1606 void setDefaultVariableCategory(OpenMPDefaultClauseVariableCategory VC) {
1610 void setDefaultVariableCategoryLocation(SourceLocation VCLoc) {
1611 this->VCLoc = VCLoc;
1627 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), VC(VC), VCLoc(VCLoc) {}
1666 return T->getClauseKind() == llvm::omp::OMPC_default;
1697 void setThreadsetKindLoc(
SourceLocation KLoc) { KindLoc = KLoc; }
1711 LParenLoc(LParenLoc), Kind(A), KindLoc(ALoc) {}
1746 return T->getClauseKind() == llvm::omp::OMPC_threadset;
1761class OMPTransparentClause final
1764 friend class OMPClauseReader;
1767 SourceLocation LParenLoc;
1770 Expr *ImpexType =
nullptr;
1773 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1775 void setImpexTypeKind(Expr *E) { ImpexType = E; }
1787 OMPTransparentClause(Expr *ImpexTypeKind, Stmt *HelperValStmt,
1788 OpenMPDirectiveKind CaptureRegion,
1789 SourceLocation StartLoc, SourceLocation LParenLoc,
1790 SourceLocation EndLoc)
1791 : OMPOneStmtClause(ImpexTypeKind, StartLoc, LParenLoc, EndLoc),
1792 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
1793 ImpexType(ImpexTypeKind) {
1794 setPreInitStmt(HelperValStmt, CaptureRegion);
1798 OMPTransparentClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
1801 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1804 Expr *getImpexType()
const {
return ImpexType; }
1807 return child_range(
reinterpret_cast<Stmt **
>(&ImpexType),
1808 reinterpret_cast<Stmt **
>(&ImpexType) + 1);
1811 const_child_range
children()
const {
1812 return const_cast<OMPTransparentClause *
>(
this)->
children();
1816 return child_range(child_iterator(), child_iterator());
1819 return const_child_range(const_child_iterator(), const_child_iterator());
1822 static bool classof(
const OMPClause *T) {
1823 return T->getClauseKind() == llvm::omp::OMPC_transparent;
1835class OMPProcBindClause :
public OMPClause {
1836 friend class OMPClauseReader;
1839 SourceLocation LParenLoc;
1842 llvm::omp::ProcBindKind
Kind = llvm::omp::OMP_PROC_BIND_unknown;
1845 SourceLocation KindKwLoc;
1850 void setProcBindKind(llvm::omp::ProcBindKind K) {
Kind = K; }
1855 void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1866 OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
1867 SourceLocation StartLoc, SourceLocation LParenLoc,
1868 SourceLocation EndLoc)
1869 : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc),
1870 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1874 : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(),
1875 SourceLocation()) {}
1878 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1881 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1884 llvm::omp::ProcBindKind getProcBindKind()
const {
return Kind; }
1887 SourceLocation getProcBindKindKwLoc()
const {
return KindKwLoc; }
1890 return child_range(child_iterator(), child_iterator());
1893 const_child_range
children()
const {
1894 return const_child_range(const_child_iterator(), const_child_iterator());
1898 return child_range(child_iterator(), child_iterator());
1901 return const_child_range(const_child_iterator(), const_child_iterator());
1904 static bool classof(
const OMPClause *T) {
1905 return T->getClauseKind() == llvm::omp::OMPC_proc_bind;
1917class OMPUnifiedAddressClause final
1920 friend class OMPClauseReader;
1925 OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
1926 : OMPNoChildClause(StartLoc, EndLoc) {}
1929 OMPUnifiedAddressClause() : OMPNoChildClause() {}
1940class OMPUnifiedSharedMemoryClause final :
public OMPClause {
1942 friend class OMPClauseReader;
1947 OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
1948 : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1951 OMPUnifiedSharedMemoryClause()
1952 : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(),
1953 SourceLocation()) {}
1956 return child_range(child_iterator(), child_iterator());
1959 const_child_range
children()
const {
1960 return const_child_range(const_child_iterator(), const_child_iterator());
1964 return child_range(child_iterator(), child_iterator());
1967 return const_child_range(const_child_iterator(), const_child_iterator());
1970 static bool classof(
const OMPClause *T) {
1971 return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
1983class OMPReverseOffloadClause final :
public OMPClause {
1985 friend class OMPClauseReader;
1990 OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
1991 : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
1994 OMPReverseOffloadClause()
1995 : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(),
1996 SourceLocation()) {}
1999 return child_range(child_iterator(), child_iterator());
2002 const_child_range
children()
const {
2003 return const_child_range(const_child_iterator(), const_child_iterator());
2007 return child_range(child_iterator(), child_iterator());
2010 return const_child_range(const_child_iterator(), const_child_iterator());
2013 static bool classof(
const OMPClause *T) {
2014 return T->getClauseKind() == llvm::omp::OMPC_reverse_offload;
2026class OMPDynamicAllocatorsClause final :
public OMPClause {
2028 friend class OMPClauseReader;
2033 OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2034 : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
2037 OMPDynamicAllocatorsClause()
2038 : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(),
2039 SourceLocation()) {}
2042 return child_range(child_iterator(), child_iterator());
2045 const_child_range
children()
const {
2046 return const_child_range(const_child_iterator(), const_child_iterator());
2050 return child_range(child_iterator(), child_iterator());
2053 return const_child_range(const_child_iterator(), const_child_iterator());
2056 static bool classof(
const OMPClause *T) {
2057 return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
2069class OMPAtomicDefaultMemOrderClause final :
public OMPClause {
2070 friend class OMPClauseReader;
2073 SourceLocation LParenLoc;
2080 SourceLocation KindKwLoc;
2085 void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
2092 void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
2105 OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
2106 SourceLocation ALoc, SourceLocation StartLoc,
2107 SourceLocation LParenLoc,
2108 SourceLocation EndLoc)
2109 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
2110 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2113 OMPAtomicDefaultMemOrderClause()
2114 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(),
2115 SourceLocation()) {}
2118 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2121 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2129 SourceLocation getAtomicDefaultMemOrderKindKwLoc()
const {
return KindKwLoc; }
2132 return child_range(child_iterator(), child_iterator());
2135 const_child_range
children()
const {
2136 return const_child_range(const_child_iterator(), const_child_iterator());
2140 return child_range(child_iterator(), child_iterator());
2143 return const_child_range(const_child_iterator(), const_child_iterator());
2146 static bool classof(
const OMPClause *T) {
2147 return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
2159class OMPSelfMapsClause final :
public OMPClause {
2161 friend class OMPClauseReader;
2166 OMPSelfMapsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2167 : OMPClause(llvm::omp::OMPC_self_maps, StartLoc, EndLoc) {}
2171 : OMPClause(llvm::omp::OMPC_self_maps, SourceLocation(),
2172 SourceLocation()) {}
2175 return child_range(child_iterator(), child_iterator());
2178 const_child_range
children()
const {
2179 return const_child_range(const_child_iterator(), const_child_iterator());
2183 return child_range(child_iterator(), child_iterator());
2186 return const_child_range(const_child_iterator(), const_child_iterator());
2189 static bool classof(
const OMPClause *T) {
2190 return T->getClauseKind() == llvm::omp::OMPC_self_maps;
2201class OMPAtClause final :
public OMPClause {
2202 friend class OMPClauseReader;
2205 SourceLocation LParenLoc;
2211 SourceLocation KindKwLoc;
2216 void setAtKind(OpenMPAtClauseKind K) {
Kind = K; }
2221 void setAtKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2224 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2234 OMPAtClause(OpenMPAtClauseKind A, SourceLocation ALoc,
2235 SourceLocation StartLoc, SourceLocation LParenLoc,
2236 SourceLocation EndLoc)
2237 : OMPClause(llvm::omp::OMPC_at, StartLoc, EndLoc), LParenLoc(LParenLoc),
2238 Kind(A), KindKwLoc(ALoc) {}
2242 : OMPClause(llvm::omp::OMPC_at, SourceLocation(), SourceLocation()) {}
2245 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2251 SourceLocation getAtKindKwLoc()
const {
return KindKwLoc; }
2254 return child_range(child_iterator(), child_iterator());
2257 const_child_range
children()
const {
2258 return const_child_range(const_child_iterator(), const_child_iterator());
2262 return child_range(child_iterator(), child_iterator());
2265 return const_child_range(const_child_iterator(), const_child_iterator());
2268 static bool classof(
const OMPClause *T) {
2269 return T->getClauseKind() == llvm::omp::OMPC_at;
2281class OMPSeverityClause final :
public OMPClause {
2282 friend class OMPClauseReader;
2285 SourceLocation LParenLoc;
2291 SourceLocation KindKwLoc;
2296 void setSeverityKind(OpenMPSeverityClauseKind K) {
Kind = K; }
2301 void setSeverityKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2304 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2314 OMPSeverityClause(OpenMPSeverityClauseKind A, SourceLocation ALoc,
2315 SourceLocation StartLoc, SourceLocation LParenLoc,
2316 SourceLocation EndLoc)
2317 : OMPClause(llvm::omp::OMPC_severity, StartLoc, EndLoc),
2318 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2322 : OMPClause(llvm::omp::OMPC_severity, SourceLocation(),
2323 SourceLocation()) {}
2326 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2332 SourceLocation getSeverityKindKwLoc()
const {
return KindKwLoc; }
2335 return child_range(child_iterator(), child_iterator());
2338 const_child_range
children()
const {
2339 return const_child_range(const_child_iterator(), const_child_iterator());
2343 return child_range(child_iterator(), child_iterator());
2346 return const_child_range(const_child_iterator(), const_child_iterator());
2349 static bool classof(
const OMPClause *T) {
2350 return T->getClauseKind() == llvm::omp::OMPC_severity;
2362class OMPMessageClause final
2365 friend class OMPClauseReader;
2368 void setMessageString(Expr *MS) { setStmt(MS); }
2380 OMPMessageClause(Expr *MS, Stmt *HelperMS, OpenMPDirectiveKind CaptureRegion,
2381 SourceLocation StartLoc, SourceLocation LParenLoc,
2382 SourceLocation EndLoc)
2383 : OMPOneStmtClause(MS, StartLoc, LParenLoc, EndLoc),
2384 OMPClauseWithPreInit(this) {
2385 setPreInitStmt(HelperMS, CaptureRegion);
2389 OMPMessageClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
2392 Expr *getMessageString()
const {
return getStmtAs<Expr>(); }
2395 std::optional<std::string> tryEvaluateString(ASTContext &Ctx)
const {
2396 if (Expr *MessageExpr = getMessageString())
2397 return MessageExpr->tryEvaluateString(Ctx);
2398 return std::nullopt;
2410 friend class OMPClauseReader;
2413 SourceLocation LParenLoc;
2419 enum {FIRST, SECOND, NUM_MODIFIERS};
2423 SourceLocation ModifiersLoc[NUM_MODIFIERS];
2426 SourceLocation KindLoc;
2429 SourceLocation CommaLoc;
2432 Expr *ChunkSize =
nullptr;
2437 void setScheduleKind(OpenMPScheduleClauseKind K) {
Kind = K; }
2442 void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) {
2443 Modifiers[FIRST] = M;
2449 void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) {
2450 Modifiers[SECOND] = M;
2454 void setFirstScheduleModifierLoc(SourceLocation Loc) {
2455 ModifiersLoc[FIRST] = Loc;
2459 void setSecondScheduleModifierLoc(SourceLocation Loc) {
2460 ModifiersLoc[SECOND] = Loc;
2466 void setScheduleModifer(OpenMPScheduleClauseModifier M) {
2467 if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown)
2468 Modifiers[FIRST] = M;
2470 assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown);
2471 Modifiers[SECOND] = M;
2478 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2483 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
2488 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
2493 void setChunkSize(Expr *E) { ChunkSize = E; }
2511 OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2512 SourceLocation KLoc, SourceLocation CommaLoc,
2513 SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
2514 Expr *ChunkSize, Stmt *HelperChunkSize,
2515 OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
2516 OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
2517 : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc),
2518 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
Kind(
Kind),
2519 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
2520 setPreInitStmt(HelperChunkSize);
2521 Modifiers[FIRST] = M1;
2522 Modifiers[SECOND] = M2;
2523 ModifiersLoc[FIRST] = M1Loc;
2524 ModifiersLoc[SECOND] = M2Loc;
2528 explicit OMPScheduleClause()
2529 : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()),
2530 OMPClauseWithPreInit(this) {
2540 return Modifiers[FIRST];
2545 return Modifiers[SECOND];
2549 SourceLocation getLParenLoc() {
return LParenLoc; }
2552 SourceLocation getScheduleKindLoc() {
return KindLoc; }
2555 SourceLocation getFirstScheduleModifierLoc()
const {
2556 return ModifiersLoc[FIRST];
2560 SourceLocation getSecondScheduleModifierLoc()
const {
2561 return ModifiersLoc[SECOND];
2565 SourceLocation getCommaLoc() {
return CommaLoc; }
2568 Expr *getChunkSize() {
return ChunkSize; }
2571 const Expr *getChunkSize()
const {
return ChunkSize; }
2574 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
2575 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
2578 const_child_range
children()
const {
2579 return const_cast<OMPScheduleClause *
>(
this)->
children();
2583 return child_range(child_iterator(), child_iterator());
2586 return const_child_range(const_child_iterator(), const_child_iterator());
2589 static bool classof(
const OMPClause *T) {
2590 return T->getClauseKind() == llvm::omp::OMPC_schedule;
2601class OMPOrderedClause final
2603 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
2604 friend class OMPClauseReader;
2605 friend TrailingObjects;
2608 SourceLocation LParenLoc;
2611 Stmt *NumForLoops =
nullptr;
2614 unsigned NumberOfLoops = 0;
2623 OMPOrderedClause(Expr *Num,
unsigned NumLoops, SourceLocation StartLoc,
2624 SourceLocation LParenLoc, SourceLocation EndLoc)
2625 : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc),
2626 LParenLoc(LParenLoc), NumForLoops(
Num), NumberOfLoops(NumLoops) {}
2629 explicit OMPOrderedClause(
unsigned NumLoops)
2630 : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()),
2631 NumberOfLoops(NumLoops) {}
2634 void setNumForLoops(Expr *Num) { NumForLoops =
Num; }
2644 static OMPOrderedClause *
Create(
const ASTContext &C, Expr *Num,
2645 unsigned NumLoops, SourceLocation StartLoc,
2646 SourceLocation LParenLoc,
2647 SourceLocation EndLoc);
2650 static OMPOrderedClause*
CreateEmpty(
const ASTContext &C,
unsigned NumLoops);
2653 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2656 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2659 Expr *getNumForLoops()
const {
return cast_or_null<Expr>(NumForLoops); }
2662 void setLoopNumIterations(
unsigned NumLoop, Expr *NumIterations);
2664 ArrayRef<Expr *> getLoopNumIterations()
const;
2667 void setLoopCounter(
unsigned NumLoop, Expr *Counter);
2669 Expr *getLoopCounter(
unsigned NumLoop);
2670 const Expr *getLoopCounter(
unsigned NumLoop)
const;
2672 child_range
children() {
return child_range(&NumForLoops, &NumForLoops + 1); }
2674 const_child_range
children()
const {
2675 return const_child_range(&NumForLoops, &NumForLoops + 1);
2679 return child_range(child_iterator(), child_iterator());
2682 return const_child_range(const_child_iterator(), const_child_iterator());
2685 static bool classof(
const OMPClause *T) {
2686 return T->getClauseKind() == llvm::omp::OMPC_ordered;
2697class OMPNowaitClause final :
public OMPClause {
2698 friend class OMPClauseReader;
2701 SourceLocation LParenLoc;
2707 void setCondition(Expr *Cond) {
Condition = Cond; }
2716 OMPNowaitClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
2717 SourceLocation EndLoc)
2718 : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
2719 LParenLoc(LParenLoc),
Condition(Cond) {}
2723 : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
2726 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2729 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2732 Expr *getCondition()
const {
return cast_or_null<Expr>(Condition); }
2736 return child_range(&Condition, &Condition + 1);
2737 return child_range(child_iterator(), child_iterator());
2740 const_child_range
children()
const {
2742 return const_child_range(&Condition, &Condition + 1);
2743 return const_child_range(const_child_iterator(), const_child_iterator());
2748 return const_cast<OMPNowaitClause *
>(
this)->
used_children();
2751 static bool classof(
const OMPClause *T) {
2752 return T->getClauseKind() == llvm::omp::OMPC_nowait;
2762class OMPUntiedClause :
public OMPClause {
2768 OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2769 : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {}
2773 : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), 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_untied;
2802class OMPMergeableClause :
public OMPClause {
2808 OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
2809 : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {}
2812 OMPMergeableClause()
2813 : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(),
2814 SourceLocation()) {}
2817 return child_range(child_iterator(), child_iterator());
2820 const_child_range
children()
const {
2821 return const_child_range(const_child_iterator(), const_child_iterator());
2825 return child_range(child_iterator(), child_iterator());
2828 return const_child_range(const_child_iterator(), const_child_iterator());
2831 static bool classof(
const OMPClause *T) {
2832 return T->getClauseKind() == llvm::omp::OMPC_mergeable;
2843class OMPAbsentClause final
2845 private llvm::TrailingObjects<OMPAbsentClause, OpenMPDirectiveKind> {
2846 friend OMPDirectiveListClause;
2847 friend TrailingObjects;
2855 OMPAbsentClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2856 SourceLocation EndLoc,
unsigned NumKinds)
2857 : OMPDirectiveListClause<OMPAbsentClause>(
2858 llvm::omp::OMPC_absent, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2861 OMPAbsentClause(
unsigned NumKinds)
2862 : OMPDirectiveListClause<OMPAbsentClause>(
2863 llvm::omp::OMPC_absent, SourceLocation(), SourceLocation(),
2864 SourceLocation(), NumKinds) {}
2867 static OMPAbsentClause *
Create(
const ASTContext &C,
2868 ArrayRef<OpenMPDirectiveKind> DKVec,
2869 SourceLocation Loc, SourceLocation LLoc,
2870 SourceLocation RLoc);
2872 static OMPAbsentClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2874 static bool classof(
const OMPClause *C) {
2875 return C->getClauseKind() == llvm::omp::OMPC_absent;
2886class OMPContainsClause final
2888 private llvm::TrailingObjects<OMPContainsClause, OpenMPDirectiveKind> {
2889 friend OMPDirectiveListClause;
2890 friend TrailingObjects;
2898 OMPContainsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2899 SourceLocation EndLoc,
unsigned NumKinds)
2900 : OMPDirectiveListClause<OMPContainsClause>(
2901 llvm::omp::OMPC_contains, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2904 OMPContainsClause(
unsigned NumKinds)
2905 : OMPDirectiveListClause<OMPContainsClause>(
2906 llvm::omp::OMPC_contains, SourceLocation(), SourceLocation(),
2907 SourceLocation(), NumKinds) {}
2910 static OMPContainsClause *
Create(
const ASTContext &C,
2911 ArrayRef<OpenMPDirectiveKind> DKVec,
2912 SourceLocation Loc, SourceLocation LLoc,
2913 SourceLocation RLoc);
2915 static OMPContainsClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2917 static bool classof(
const OMPClause *C) {
2918 return C->getClauseKind() == llvm::omp::OMPC_contains;
2929class OMPHoldsClause final
2931 friend class OMPClauseReader;
2938 OMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc,
2939 SourceLocation EndLoc)
2940 : OMPOneStmtClause(E, StartLoc, LParenLoc, EndLoc) {}
2943 OMPHoldsClause() : OMPOneStmtClause() {}
2945 Expr *getExpr()
const {
return getStmtAs<Expr>(); }
2946 void setExpr(Expr *E) { setStmt(E); }
2956class OMPNoOpenMPClause final
2963 OMPNoOpenMPClause(SourceLocation StartLoc, SourceLocation EndLoc)
2964 : OMPNoChildClause(StartLoc, EndLoc) {}
2967 OMPNoOpenMPClause() : OMPNoChildClause() {}
2978class OMPNoOpenMPRoutinesClause final
2985 OMPNoOpenMPRoutinesClause(SourceLocation StartLoc, SourceLocation EndLoc)
2986 : OMPNoChildClause(StartLoc, EndLoc) {}
2989 OMPNoOpenMPRoutinesClause() : OMPNoChildClause() {}
3000class OMPNoOpenMPConstructsClause final
3007 OMPNoOpenMPConstructsClause(SourceLocation StartLoc, SourceLocation EndLoc)
3008 : OMPNoChildClause(StartLoc, EndLoc) {}
3011 OMPNoOpenMPConstructsClause() : OMPNoChildClause() {}
3022class OMPNoParallelismClause final
3029 OMPNoParallelismClause(SourceLocation StartLoc, SourceLocation EndLoc)
3030 : OMPNoChildClause(StartLoc, EndLoc) {}
3033 OMPNoParallelismClause() : OMPNoChildClause() {}
3048 OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
3049 : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {}
3053 : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {}
3056 return child_range(child_iterator(), child_iterator());
3059 const_child_range
children()
const {
3060 return const_child_range(const_child_iterator(), const_child_iterator());
3064 return child_range(child_iterator(), child_iterator());
3067 return const_child_range(const_child_iterator(), const_child_iterator());
3070 static bool classof(
const OMPClause *T) {
3071 return T->getClauseKind() == llvm::omp::OMPC_read;
3081class OMPWriteClause :
public OMPClause {
3087 OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
3088 : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {}
3092 : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {}
3095 return child_range(child_iterator(), child_iterator());
3098 const_child_range
children()
const {
3099 return const_child_range(const_child_iterator(), const_child_iterator());
3103 return child_range(child_iterator(), child_iterator());
3106 return const_child_range(const_child_iterator(), const_child_iterator());
3109 static bool classof(
const OMPClause *T) {
3110 return T->getClauseKind() == llvm::omp::OMPC_write;
3121class OMPUpdateClause :
public OMPClause {
3127 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
3128 : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc) {}
3132 : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()) {}
3135 return child_range(child_iterator(), child_iterator());
3138 const_child_range
children()
const {
3139 return const_child_range(const_child_iterator(), const_child_iterator());
3143 return child_range(child_iterator(), child_iterator());
3146 return const_child_range(const_child_iterator(), const_child_iterator());
3149 static bool classof(
const OMPClause *T) {
3150 return T->getClauseKind() == llvm::omp::OMPC_update;
3162class OMPUpdateDependObjectsClause final
3164 private llvm::TrailingObjects<OMPUpdateDependObjectsClause,
3165 SourceLocation, OpenMPDependClauseKind> {
3166 friend class OMPClauseReader;
3167 friend TrailingObjects;
3171 size_t numTrailingObjects(OverloadToken<SourceLocation>)
const {
3177 void setLParenLoc(SourceLocation Loc) {
3178 *getTrailingObjects<SourceLocation>() = Loc;
3182 void setArgumentLoc(SourceLocation Loc) {
3183 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
3187 void setDependencyKind(OpenMPDependClauseKind DK) {
3188 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
3195 OMPUpdateDependObjectsClause(SourceLocation StartLoc, SourceLocation EndLoc)
3196 : OMPClause(llvm::omp::OMPC_update_depend_objects, StartLoc, EndLoc) {}
3199 OMPUpdateDependObjectsClause()
3200 : OMPClause(llvm::omp::OMPC_update_depend_objects, SourceLocation(),
3201 SourceLocation()) {}
3212 static OMPUpdateDependObjectsClause *
3213 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3214 SourceLocation ArgumentLoc, OpenMPDependClauseKind DK,
3215 SourceLocation EndLoc);
3220 static OMPUpdateDependObjectsClause *
CreateEmpty(
const ASTContext &C);
3223 return child_range(child_iterator(), child_iterator());
3226 const_child_range
children()
const {
3227 return const_child_range(const_child_iterator(), const_child_iterator());
3231 return child_range(child_iterator(), child_iterator());
3234 return const_child_range(const_child_iterator(), const_child_iterator());
3238 SourceLocation getLParenLoc()
const {
3239 return *getTrailingObjects<SourceLocation>();
3243 SourceLocation getArgumentLoc()
const {
3244 return *std::next(getTrailingObjects<SourceLocation>(), 1);
3249 return *getTrailingObjects<OpenMPDependClauseKind>();
3252 static bool classof(
const OMPClause *T) {
3253 return T->getClauseKind() == llvm::omp::OMPC_update_depend_objects;
3264class OMPCaptureClause :
public OMPClause {
3270 OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
3271 : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {}
3275 : OMPClause(llvm::omp::OMPC_capture, 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_capture;
3305class OMPCompareClause final :
public OMPClause {
3311 OMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
3312 : OMPClause(llvm::omp::OMPC_compare, StartLoc, EndLoc) {}
3316 : OMPClause(llvm::omp::OMPC_compare, 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_compare;
3346class OMPSeqCstClause :
public OMPClause {
3352 OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
3353 : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {}
3357 : OMPClause(llvm::omp::OMPC_seq_cst, 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_seq_cst;
3387class OMPAcqRelClause final :
public OMPClause {
3393 OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
3394 : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {}
3398 : OMPClause(llvm::omp::OMPC_acq_rel, 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_acq_rel;
3428class OMPAcquireClause final :
public OMPClause {
3434 OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
3435 : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {}
3439 : OMPClause(llvm::omp::OMPC_acquire, 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_acquire;
3469class OMPReleaseClause final :
public OMPClause {
3475 OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
3476 : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {}
3480 : OMPClause(llvm::omp::OMPC_release, 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_release;
3510class OMPRelaxedClause final :
public OMPClause {
3516 OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
3517 : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {}
3521 : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) {
3525 return child_range(child_iterator(), child_iterator());
3528 const_child_range
children()
const {
3529 return const_child_range(const_child_iterator(), const_child_iterator());
3533 return child_range(child_iterator(), child_iterator());
3536 return const_child_range(const_child_iterator(), const_child_iterator());
3539 static bool classof(
const OMPClause *T) {
3540 return T->getClauseKind() == llvm::omp::OMPC_relaxed;
3551class OMPWeakClause final :
public OMPClause {
3557 OMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
3558 : OMPClause(llvm::omp::OMPC_weak, StartLoc, EndLoc) {}
3562 : OMPClause(llvm::omp::OMPC_weak, SourceLocation(), SourceLocation()) {}
3565 return child_range(child_iterator(), child_iterator());
3568 const_child_range
children()
const {
3569 return const_child_range(const_child_iterator(), const_child_iterator());
3573 return child_range(child_iterator(), child_iterator());
3576 return const_child_range(const_child_iterator(), const_child_iterator());
3579 static bool classof(
const OMPClause *T) {
3580 return T->getClauseKind() == llvm::omp::OMPC_weak;
3591class OMPFailClause final :
public OMPClause {
3596 SourceLocation FailParameterLoc;
3597 SourceLocation LParenLoc;
3599 friend class OMPClauseReader;
3602 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
3605 void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
3608 void setFailParameter(OpenMPClauseKind FailParameter) {
3609 this->FailParameter = FailParameter;
3611 "Invalid fail clause parameter");
3619 OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
3620 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
3622 OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
3623 SourceLocation StartLoc, SourceLocation LParenLoc,
3624 SourceLocation EndLoc)
3625 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
3626 FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
3628 setFailParameter(FailParameter);
3633 : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
3636 return child_range(child_iterator(), child_iterator());
3639 const_child_range
children()
const {
3640 return const_child_range(const_child_iterator(), const_child_iterator());
3644 return child_range(child_iterator(), child_iterator());
3647 return const_child_range(const_child_iterator(), const_child_iterator());
3650 static bool classof(
const OMPClause *T) {
3651 return T->getClauseKind() == llvm::omp::OMPC_fail;
3655 SourceLocation getLParenLoc()
const {
3661 SourceLocation getFailParameterLoc()
const {
return FailParameterLoc; }
3674class OMPPrivateClause final
3676 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
3677 friend class OMPClauseReader;
3678 friend OMPVarListClause;
3679 friend TrailingObjects;
3687 OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3688 SourceLocation EndLoc,
unsigned N)
3689 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private, StartLoc,
3690 LParenLoc, EndLoc, N) {}
3695 explicit OMPPrivateClause(
unsigned N)
3696 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private,
3697 SourceLocation(), SourceLocation(),
3698 SourceLocation(), N) {}
3703 void setPrivateCopies(ArrayRef<Expr *> VL);
3707 MutableArrayRef<Expr *> getPrivateCopies() {
3708 return {varlist_end(), varlist_size()};
3710 ArrayRef<const Expr *> getPrivateCopies()
const {
3711 return {varlist_end(), varlist_size()};
3723 static OMPPrivateClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
3724 SourceLocation LParenLoc,
3725 SourceLocation EndLoc, ArrayRef<Expr *> VL,
3726 ArrayRef<Expr *> PrivateVL);
3732 static OMPPrivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3734 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3735 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3736 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3737 using private_copies_const_range =
3738 llvm::iterator_range<private_copies_const_iterator>;
3740 private_copies_range private_copies() {
return getPrivateCopies(); }
3742 private_copies_const_range private_copies()
const {
3743 return getPrivateCopies();
3747 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3748 reinterpret_cast<Stmt **
>(varlist_end()));
3751 const_child_range
children()
const {
3752 return const_cast<OMPPrivateClause *
>(
this)->
children();
3756 return child_range(child_iterator(), child_iterator());
3759 return const_child_range(const_child_iterator(), const_child_iterator());
3762 static bool classof(
const OMPClause *T) {
3763 return T->getClauseKind() == llvm::omp::OMPC_private;
3775class OMPFirstprivateClause final
3778 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
3779 friend class OMPClauseReader;
3780 friend OMPVarListClause;
3781 friend TrailingObjects;
3789 OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3790 SourceLocation EndLoc,
unsigned N)
3791 : OMPVarListClause<OMPFirstprivateClause>(llvm::omp::OMPC_firstprivate,
3792 StartLoc, LParenLoc, EndLoc, N),
3793 OMPClauseWithPreInit(this) {}
3798 explicit OMPFirstprivateClause(
unsigned N)
3799 : OMPVarListClause<OMPFirstprivateClause>(
3800 llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(),
3801 SourceLocation(), N),
3802 OMPClauseWithPreInit(this) {}
3807 void setPrivateCopies(ArrayRef<Expr *> VL);
3811 MutableArrayRef<Expr *> getPrivateCopies() {
3812 return {varlist_end(), varlist_size()};
3814 ArrayRef<const Expr *> getPrivateCopies()
const {
3815 return {varlist_end(), varlist_size()};
3821 void setInits(ArrayRef<Expr *> VL);
3825 MutableArrayRef<Expr *>
getInits() {
3826 return {getPrivateCopies().end(), varlist_size()};
3828 ArrayRef<const Expr *>
getInits()
const {
3829 return {getPrivateCopies().end(), varlist_size()};
3846 static OMPFirstprivateClause *
3847 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3848 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
3849 ArrayRef<Expr *> InitVL, Stmt *PreInit);
3855 static OMPFirstprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3857 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3858 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3859 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3860 using private_copies_const_range =
3861 llvm::iterator_range<private_copies_const_iterator>;
3863 private_copies_range private_copies() {
return getPrivateCopies(); }
3864 private_copies_const_range private_copies()
const {
3865 return getPrivateCopies();
3870 using inits_range = llvm::iterator_range<inits_iterator>;
3877 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3878 reinterpret_cast<Stmt **
>(varlist_end()));
3881 const_child_range
children()
const {
3882 return const_cast<OMPFirstprivateClause *
>(
this)->
children();
3886 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3887 reinterpret_cast<Stmt **
>(varlist_end()));
3890 return const_cast<OMPFirstprivateClause *
>(
this)->
used_children();
3893 static bool classof(
const OMPClause *T) {
3894 return T->getClauseKind() == llvm::omp::OMPC_firstprivate;
3906class OMPLastprivateClause final
3909 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
3926 friend class OMPClauseReader;
3927 friend OMPVarListClause;
3928 friend TrailingObjects;
3933 SourceLocation LPKindLoc;
3935 SourceLocation ColonLoc;
3943 OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3944 SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
3945 SourceLocation LPKindLoc, SourceLocation ColonLoc,
3947 : OMPVarListClause<OMPLastprivateClause>(llvm::omp::OMPC_lastprivate,
3948 StartLoc, LParenLoc, EndLoc, N),
3949 OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
3950 ColonLoc(ColonLoc) {}
3955 explicit OMPLastprivateClause(
unsigned N)
3956 : OMPVarListClause<OMPLastprivateClause>(
3957 llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(),
3958 SourceLocation(), N),
3959 OMPClauseWithPostUpdate(this) {}
3963 MutableArrayRef<Expr *> getPrivateCopies() {
3964 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3966 ArrayRef<const Expr *> getPrivateCopies()
const {
3967 return {varlist_end(), varlist_size()};
3974 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
3977 MutableArrayRef<Expr *> getSourceExprs() {
3978 return {getPrivateCopies().end(), varlist_size()};
3980 ArrayRef<const Expr *> getSourceExprs()
const {
3981 return {getPrivateCopies().end(), varlist_size()};
3988 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
3991 MutableArrayRef<Expr *> getDestinationExprs() {
3992 return {getSourceExprs().end(), varlist_size()};
3994 ArrayRef<const Expr *> getDestinationExprs()
const {
3995 return {getSourceExprs().end(), varlist_size()};
4001 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4004 MutableArrayRef<Expr *> getAssignmentOps() {
4005 return {getDestinationExprs().end(), varlist_size()};
4007 ArrayRef<const Expr *> getAssignmentOps()
const {
4008 return {getDestinationExprs().end(), varlist_size()};
4012 void setKind(OpenMPLastprivateModifier Kind) { LPKind =
Kind; }
4014 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
4016 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4046 static OMPLastprivateClause *
4047 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4048 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4049 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
4050 OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
4051 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
4057 static OMPLastprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4062 SourceLocation getKindLoc()
const {
return LPKindLoc; }
4064 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4066 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4067 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4068 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4069 using helper_expr_const_range =
4070 llvm::iterator_range<helper_expr_const_iterator>;
4074 void setPrivateCopies(ArrayRef<Expr *> PrivateCopies);
4076 helper_expr_const_range private_copies()
const {
return getPrivateCopies(); }
4078 helper_expr_range private_copies() {
return getPrivateCopies(); }
4080 helper_expr_const_range source_exprs()
const {
return getSourceExprs(); }
4082 helper_expr_range source_exprs() {
return getSourceExprs(); }
4084 helper_expr_const_range destination_exprs()
const {
4085 return getDestinationExprs();
4088 helper_expr_range destination_exprs() {
return getDestinationExprs(); }
4090 helper_expr_const_range assignment_ops()
const {
return getAssignmentOps(); }
4092 helper_expr_range assignment_ops() {
return getAssignmentOps(); }
4095 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4096 reinterpret_cast<Stmt **
>(varlist_end()));
4099 const_child_range
children()
const {
4100 return const_cast<OMPLastprivateClause *
>(
this)->
children();
4104 return child_range(child_iterator(), child_iterator());
4107 return const_child_range(const_child_iterator(), const_child_iterator());
4110 static bool classof(
const OMPClause *T) {
4111 return T->getClauseKind() == llvm::omp::OMPC_lastprivate;
4122class OMPSharedClause final
4124 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
4125 friend OMPVarListClause;
4126 friend TrailingObjects;
4134 OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4135 SourceLocation EndLoc,
unsigned N)
4136 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared, StartLoc,
4137 LParenLoc, EndLoc, N) {}
4142 explicit OMPSharedClause(
unsigned N)
4143 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared,
4144 SourceLocation(), SourceLocation(),
4145 SourceLocation(), N) {}
4155 static OMPSharedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
4156 SourceLocation LParenLoc,
4157 SourceLocation EndLoc, ArrayRef<Expr *> VL);
4163 static OMPSharedClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4166 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4167 reinterpret_cast<Stmt **
>(varlist_end()));
4170 const_child_range
children()
const {
4171 return const_cast<OMPSharedClause *
>(
this)->
children();
4175 return child_range(child_iterator(), child_iterator());
4178 return const_child_range(const_child_iterator(), const_child_iterator());
4181 static bool classof(
const OMPClause *T) {
4182 return T->getClauseKind() == llvm::omp::OMPC_shared;
4194class OMPReductionClause final
4197 private llvm::TrailingObjects<OMPReductionClause, Expr *, bool> {
4198 friend class OMPClauseReader;
4199 friend OMPVarListClause;
4200 friend TrailingObjects;
4207 OMPC_ORIGINAL_SHARING_default;
4210 SourceLocation ModifierLoc;
4213 SourceLocation ColonLoc;
4216 NestedNameSpecifierLoc QualifierLoc;
4219 DeclarationNameInfo NameInfo;
4231 OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4232 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4233 SourceLocation EndLoc,
4234 OpenMPReductionClauseModifier Modifier,
4235 OpenMPOriginalSharingModifier OriginalSharingModifier,
4236 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4237 const DeclarationNameInfo &NameInfo)
4238 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4239 StartLoc, LParenLoc, EndLoc, N),
4240 OMPClauseWithPostUpdate(this), Modifier(Modifier),
4241 OriginalSharingModifier(OriginalSharingModifier),
4242 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
4243 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4248 explicit OMPReductionClause(
unsigned N)
4249 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4250 SourceLocation(), SourceLocation(),
4251 SourceLocation(), N),
4252 OMPClauseWithPostUpdate(this) {}
4255 void setModifier(OpenMPReductionClauseModifier M) { Modifier = M; }
4258 void setOriginalSharingModifier(OpenMPOriginalSharingModifier M) {
4259 OriginalSharingModifier = M;
4266 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4269 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4272 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4281 return {varlist_end(), varlist_size()};
4284 return {varlist_end(), varlist_size()};
4290 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4293 MutableArrayRef<Expr *> getLHSExprs() {
4296 ArrayRef<const Expr *> getLHSExprs()
const {
4305 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4308 void setPrivateVariableReductionFlags(ArrayRef<bool> Flags) {
4309 assert(Flags.size() == varlist_size() &&
4310 "Number of private flags does not match vars");
4311 llvm::copy(Flags, getTrailingObjects<bool>());
4315 MutableArrayRef<bool> getPrivateVariableReductionFlags() {
4316 return getTrailingObjects<bool>(varlist_size());
4318 ArrayRef<bool> getPrivateVariableReductionFlags()
const {
4319 return getTrailingObjects<bool>(varlist_size());
4323 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
4324 return varlist_size() * (Modifier == OMPC_REDUCTION_inscan ? 8 : 5);
4328 size_t numTrailingObjects(OverloadToken<bool>)
const {
4329 return varlist_size();
4333 MutableArrayRef<Expr *> getRHSExprs() {
4334 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
4336 ArrayRef<const Expr *> getRHSExprs()
const {
4337 return {getLHSExprs().end(), varlist_size()};
4344 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4347 MutableArrayRef<Expr *> getReductionOps() {
4348 return {getRHSExprs().end(), varlist_size()};
4350 ArrayRef<const Expr *> getReductionOps()
const {
4351 return {getRHSExprs().end(), varlist_size()};
4356 void setInscanCopyOps(ArrayRef<Expr *> Ops);
4359 MutableArrayRef<Expr *> getInscanCopyOps() {
4360 return {getReductionOps().end(), varlist_size()};
4362 ArrayRef<const Expr *> getInscanCopyOps()
const {
4363 return {getReductionOps().end(), varlist_size()};
4367 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
4370 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
4371 return {getInscanCopyOps().end(), varlist_size()};
4373 ArrayRef<const Expr *> getInscanCopyArrayTemps()
const {
4374 return {getInscanCopyOps().end(), varlist_size()};
4378 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
4381 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
4382 return {getInscanCopyArrayTemps().end(), varlist_size()};
4384 ArrayRef<const Expr *> getInscanCopyArrayElems()
const {
4385 return {getInscanCopyArrayTemps().end(), varlist_size()};
4429 static OMPReductionClause *
4430 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4431 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4432 SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier,
4433 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
4434 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4435 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4436 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
4437 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
4438 Stmt *PreInit, Expr *PostUpdate, ArrayRef<bool> IsPrivateVarReduction,
4439 OpenMPOriginalSharingModifier OriginalSharingModifier);
4446 static OMPReductionClause *
4448 OpenMPReductionClauseModifier Modifier);
4455 return OriginalSharingModifier;
4462 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4465 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4468 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4470 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4471 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4472 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4473 using helper_expr_const_range =
4474 llvm::iterator_range<helper_expr_const_iterator>;
4475 using helper_flag_iterator = MutableArrayRef<bool>::iterator;
4476 using helper_flag_const_iterator = ArrayRef<bool>::iterator;
4477 using helper_flag_range = llvm::iterator_range<helper_flag_iterator>;
4478 using helper_flag_const_range =
4479 llvm::iterator_range<helper_flag_const_iterator>;
4485 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4487 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4489 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4491 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4493 helper_flag_const_range private_var_reduction_flags()
const {
4494 return getPrivateVariableReductionFlags();
4497 helper_flag_range private_var_reduction_flags() {
4498 return getPrivateVariableReductionFlags();
4501 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4503 helper_expr_range reduction_ops() {
return getReductionOps(); }
4505 helper_expr_const_range copy_ops()
const {
return getInscanCopyOps(); }
4507 helper_expr_range copy_ops() {
return getInscanCopyOps(); }
4509 helper_expr_const_range copy_array_temps()
const {
4510 return getInscanCopyArrayTemps();
4513 helper_expr_range copy_array_temps() {
return getInscanCopyArrayTemps(); }
4515 helper_expr_const_range copy_array_elems()
const {
4516 return getInscanCopyArrayElems();
4519 helper_expr_range copy_array_elems() {
return getInscanCopyArrayElems(); }
4522 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4523 reinterpret_cast<Stmt **
>(varlist_end()));
4526 const_child_range
children()
const {
4527 return const_cast<OMPReductionClause *
>(
this)->
children();
4531 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4532 reinterpret_cast<Stmt **
>(varlist_end()));
4535 return const_cast<OMPReductionClause *
>(
this)->
used_children();
4538 static bool classof(
const OMPClause *T) {
4539 return T->getClauseKind() == llvm::omp::OMPC_reduction;
4551class OMPTaskReductionClause final
4554 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
4555 friend class OMPClauseReader;
4556 friend OMPVarListClause;
4557 friend TrailingObjects;
4560 SourceLocation ColonLoc;
4563 NestedNameSpecifierLoc QualifierLoc;
4566 DeclarationNameInfo NameInfo;
4577 OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4578 SourceLocation ColonLoc, SourceLocation EndLoc,
4579 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4580 const DeclarationNameInfo &NameInfo)
4581 : OMPVarListClause<OMPTaskReductionClause>(
4582 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
4583 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4584 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4589 explicit OMPTaskReductionClause(
unsigned N)
4590 : OMPVarListClause<OMPTaskReductionClause>(
4591 llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(),
4592 SourceLocation(), N),
4593 OMPClauseWithPostUpdate(this) {}
4596 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4599 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4602 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4610 return {varlist_end(), varlist_size()};
4613 return {varlist_end(), varlist_size()};
4619 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4622 MutableArrayRef<Expr *> getLHSExprs() {
4625 ArrayRef<const Expr *> getLHSExprs()
const {
4633 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4636 MutableArrayRef<Expr *> getRHSExprs() {
4637 return {getLHSExprs().end(), varlist_size()};
4639 ArrayRef<const Expr *> getRHSExprs()
const {
4640 return {getLHSExprs().end(), varlist_size()};
4647 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4650 MutableArrayRef<Expr *> getReductionOps() {
4651 return {getRHSExprs().end(), varlist_size()};
4653 ArrayRef<const Expr *> getReductionOps()
const {
4654 return {getRHSExprs().end(), varlist_size()};
4690 static OMPTaskReductionClause *
4691 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4692 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4693 NestedNameSpecifierLoc QualifierLoc,
4694 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4695 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4696 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
4702 static OMPTaskReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4705 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4708 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4711 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4713 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4714 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4715 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4716 using helper_expr_const_range =
4717 llvm::iterator_range<helper_expr_const_iterator>;
4723 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4725 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4727 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4729 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4731 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4733 helper_expr_range reduction_ops() {
return getReductionOps(); }
4736 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4737 reinterpret_cast<Stmt **
>(varlist_end()));
4740 const_child_range
children()
const {
4741 return const_cast<OMPTaskReductionClause *
>(
this)->
children();
4745 return child_range(child_iterator(), child_iterator());
4748 return const_child_range(const_child_iterator(), const_child_iterator());
4751 static bool classof(
const OMPClause *T) {
4752 return T->getClauseKind() == llvm::omp::OMPC_task_reduction;
4763class OMPInReductionClause final
4766 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
4767 friend class OMPClauseReader;
4768 friend OMPVarListClause;
4769 friend TrailingObjects;
4772 SourceLocation ColonLoc;
4775 NestedNameSpecifierLoc QualifierLoc;
4778 DeclarationNameInfo NameInfo;
4789 OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4790 SourceLocation ColonLoc, SourceLocation EndLoc,
4791 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4792 const DeclarationNameInfo &NameInfo)
4793 : OMPVarListClause<OMPInReductionClause>(llvm::omp::OMPC_in_reduction,
4794 StartLoc, LParenLoc, EndLoc, N),
4795 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4796 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4801 explicit OMPInReductionClause(
unsigned N)
4802 : OMPVarListClause<OMPInReductionClause>(
4803 llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(),
4804 SourceLocation(), N),
4805 OMPClauseWithPostUpdate(this) {}
4808 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4811 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4814 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4822 return {varlist_end(), varlist_size()};
4825 return {varlist_end(), varlist_size()};
4831 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4834 MutableArrayRef<Expr *> getLHSExprs() {
4837 ArrayRef<const Expr *> getLHSExprs()
const {
4845 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4848 MutableArrayRef<Expr *> getRHSExprs() {
4849 return {getLHSExprs().end(), varlist_size()};
4851 ArrayRef<const Expr *> getRHSExprs()
const {
4852 return {getLHSExprs().end(), varlist_size()};
4859 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4862 MutableArrayRef<Expr *> getReductionOps() {
4863 return {getRHSExprs().end(), varlist_size()};
4865 ArrayRef<const Expr *> getReductionOps()
const {
4866 return {getRHSExprs().end(), varlist_size()};
4870 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
4873 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
4874 return {getReductionOps().end(), varlist_size()};
4876 ArrayRef<const Expr *> getTaskgroupDescriptors()
const {
4877 return {getReductionOps().end(), varlist_size()};
4915 static OMPInReductionClause *
4916 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4917 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4918 NestedNameSpecifierLoc QualifierLoc,
4919 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4920 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4921 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
4922 Stmt *PreInit, Expr *PostUpdate);
4928 static OMPInReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4931 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4934 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4937 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4939 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4940 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4941 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4942 using helper_expr_const_range =
4943 llvm::iterator_range<helper_expr_const_iterator>;
4949 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4951 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4953 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4955 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4957 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4959 helper_expr_range reduction_ops() {
return getReductionOps(); }
4961 helper_expr_const_range taskgroup_descriptors()
const {
4962 return getTaskgroupDescriptors();
4965 helper_expr_range taskgroup_descriptors() {
4966 return getTaskgroupDescriptors();
4970 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4971 reinterpret_cast<Stmt **
>(varlist_end()));
4974 const_child_range
children()
const {
4975 return const_cast<OMPInReductionClause *
>(
this)->
children();
4979 return child_range(child_iterator(), child_iterator());
4982 return const_child_range(const_child_iterator(), const_child_iterator());
4985 static bool classof(
const OMPClause *T) {
4986 return T->getClauseKind() == llvm::omp::OMPC_in_reduction;
4998class OMPLinearClause final
5001 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
5002 friend class OMPClauseReader;
5003 friend OMPVarListClause;
5004 friend TrailingObjects;
5010 SourceLocation ModifierLoc;
5013 SourceLocation ColonLoc;
5016 SourceLocation StepModifierLoc;
5019 void setStep(Expr *Step) { *(
getFinals().end()) = Step; }
5022 void setCalcStep(Expr *CalcStep) { *(
getFinals().end() + 1) = CalcStep; }
5032 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5033 OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
5034 SourceLocation ColonLoc, SourceLocation StepModifierLoc,
5035 SourceLocation EndLoc,
unsigned NumVars)
5036 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
5037 LParenLoc, EndLoc, NumVars),
5038 OMPClauseWithPostUpdate(this), Modifier(Modifier),
5039 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
5040 StepModifierLoc(StepModifierLoc) {}
5045 explicit OMPLinearClause(
unsigned NumVars)
5046 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear,
5047 SourceLocation(), SourceLocation(),
5048 SourceLocation(), NumVars),
5049 OMPClauseWithPostUpdate(this) {}
5064 return {varlist_end(), varlist_size()};
5067 return {varlist_end(), varlist_size()};
5074 return {getPrivates().end(), varlist_size()};
5079 return {
getInits().end(), varlist_size()};
5082 return {getInits().end(), varlist_size()};
5090 return {getUpdates().end(), varlist_size()};
5095 return {
getFinals().end() + 2, varlist_size() + 1};
5098 return {getFinals().end() + 2, varlist_size() + 1};
5130 static OMPLinearClause *
5172 const Expr *getStep()
const {
return *(getFinals().end()); }
5178 const Expr *getCalcStep()
const {
return *(getFinals().end() + 1); }
5198 privates_const_range privates()
const {
return getPrivates(); }
5207 inits_const_range inits()
const {
return getInits(); }
5216 updates_const_range updates()
const {
return getUpdates(); }
5225 finals_const_range finals()
const {
return getFinals(); }
5230 llvm::iterator_range<used_expressions_iterator>;
5232 llvm::iterator_range<used_expressions_const_iterator>;
5238 used_expressions_const_range used_expressions()
const {
5239 return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
5243 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5244 reinterpret_cast<Stmt **
>(varlist_end()));
5247 const_child_range children()
const {
5248 return const_cast<OMPLinearClause *
>(
this)->children();
5254 return const_cast<OMPLinearClause *
>(
this)->
used_children();
5258 return T->getClauseKind() == llvm::omp::OMPC_linear;
5270class OMPAlignedClause final
5271 :
public OMPVarListClause<OMPAlignedClause>,
5272 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
5274 friend OMPVarListClause;
5275 friend TrailingObjects;
5278 SourceLocation ColonLoc;
5281 void setAlignment(Expr *A) { *varlist_end() = A; }
5291 SourceLocation ColonLoc, SourceLocation EndLoc,
5294 LParenLoc, EndLoc, NumVars),
5295 ColonLoc(ColonLoc) {}
5300 explicit OMPAlignedClause(
unsigned NumVars)
5301 : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned,
5302 SourceLocation(), SourceLocation(),
5303 SourceLocation(), NumVars) {}
5315 static OMPAlignedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5316 SourceLocation LParenLoc,
5317 SourceLocation ColonLoc,
5318 SourceLocation EndLoc, ArrayRef<Expr *> VL,
5325 static OMPAlignedClause *
CreateEmpty(
const ASTContext &C,
unsigned NumVars);
5340 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5341 reinterpret_cast<Stmt **
>(varlist_end()));
5345 return const_cast<OMPAlignedClause *
>(
this)->
children();
5349 return child_range(child_iterator(), child_iterator());
5352 return const_child_range(const_child_iterator(), const_child_iterator());
5356 return T->getClauseKind() == llvm::omp::OMPC_aligned;
5367class OMPCopyinClause final
5368 :
public OMPVarListClause<OMPCopyinClause>,
5369 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
5384 friend OMPVarListClause;
5385 friend TrailingObjects;
5393 OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5394 SourceLocation EndLoc,
unsigned N)
5395 : OMPVarListClause<OMPCopyinClause>(
llvm::omp::OMPC_copyin, StartLoc,
5396 LParenLoc, EndLoc, N) {}
5403 SourceLocation(), SourceLocation(),
5404 SourceLocation(), N) {}
5409 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5412 MutableArrayRef<Expr *> getSourceExprs() {
5413 return {varlist_end(), varlist_size()};
5415 ArrayRef<const Expr *> getSourceExprs()
const {
5416 return {varlist_end(), varlist_size()};
5422 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5425 MutableArrayRef<Expr *> getDestinationExprs() {
5426 return {getSourceExprs().end(), varlist_size()};
5428 ArrayRef<const Expr *> getDestinationExprs()
const {
5429 return {getSourceExprs().end(), varlist_size()};
5436 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5439 MutableArrayRef<Expr *> getAssignmentOps() {
5440 return {getDestinationExprs().end(), varlist_size()};
5442 ArrayRef<const Expr *> getAssignmentOps()
const {
5443 return {getDestinationExprs().end(), varlist_size()};
5468 static OMPCopyinClause *
5469 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5470 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5471 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5477 static OMPCopyinClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5483 llvm::iterator_range<helper_expr_const_iterator>;
5490 return getDestinationExprs();
5500 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5501 reinterpret_cast<Stmt **
>(varlist_end()));
5505 return const_cast<OMPCopyinClause *
>(
this)->
children();
5509 return child_range(child_iterator(), child_iterator());
5512 return const_child_range(const_child_iterator(), const_child_iterator());
5516 return T->getClauseKind() == llvm::omp::OMPC_copyin;
5528class OMPCopyprivateClause final
5529 :
public OMPVarListClause<OMPCopyprivateClause>,
5530 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
5532 friend OMPVarListClause;
5533 friend TrailingObjects;
5541 OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5542 SourceLocation EndLoc,
unsigned N)
5543 : OMPVarListClause<OMPCopyprivateClause>(
llvm::omp::OMPC_copyprivate,
5544 StartLoc, LParenLoc, EndLoc, N) {
5552 llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(),
5553 SourceLocation(), N) {}
5558 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5561 MutableArrayRef<Expr *> getSourceExprs() {
5562 return {varlist_end(), varlist_size()};
5564 ArrayRef<const Expr *> getSourceExprs()
const {
5565 return {varlist_end(), varlist_size()};
5571 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5574 MutableArrayRef<Expr *> getDestinationExprs() {
5575 return {getSourceExprs().end(), varlist_size()};
5577 ArrayRef<const Expr *> getDestinationExprs()
const {
5578 return {getSourceExprs().end(), varlist_size()};
5585 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5588 MutableArrayRef<Expr *> getAssignmentOps() {
5589 return {getDestinationExprs().end(), varlist_size()};
5591 ArrayRef<const Expr *> getAssignmentOps()
const {
5592 return {getDestinationExprs().end(), varlist_size()};
5616 static OMPCopyprivateClause *
5617 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5618 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5619 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5625 static OMPCopyprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5631 llvm::iterator_range<helper_expr_const_iterator>;
5638 return getDestinationExprs();
5648 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5649 reinterpret_cast<Stmt **
>(varlist_end()));
5653 return const_cast<OMPCopyprivateClause *
>(
this)->
children();
5657 return child_range(child_iterator(), child_iterator());
5660 return const_child_range(const_child_iterator(), const_child_iterator());
5664 return T->getClauseKind() == llvm::omp::OMPC_copyprivate;
5680class OMPFlushClause final
5681 :
public OMPVarListClause<OMPFlushClause>,
5682 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
5683 friend OMPVarListClause;
5684 friend TrailingObjects;
5692 OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5693 SourceLocation EndLoc,
unsigned N)
5694 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush, StartLoc,
5695 LParenLoc, EndLoc, N) {}
5700 explicit OMPFlushClause(
unsigned N)
5701 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush,
5702 SourceLocation(), SourceLocation(),
5703 SourceLocation(), N) {}
5713 static OMPFlushClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5714 SourceLocation LParenLoc, SourceLocation EndLoc,
5724 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5725 reinterpret_cast<Stmt **
>(varlist_end()));
5729 return const_cast<OMPFlushClause *
>(
this)->
children();
5733 return child_range(child_iterator(), child_iterator());
5736 return const_child_range(const_child_iterator(), const_child_iterator());
5740 return T->getClauseKind() == llvm::omp::OMPC_flush;
5760 SourceLocation LParenLoc;
5763 Expr *Depobj =
nullptr;
5765 void setDepobj(Expr *E) { Depobj = E; }
5768 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
5778 SourceLocation EndLoc, Expr *Depobj)
5780 LParenLoc(LParenLoc), Depobj(Depobj) {}
5784 :
OMPClause(
llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {}
5794 return child_range(
reinterpret_cast<Stmt **
>(&Depobj),
5795 reinterpret_cast<Stmt **
>(&Depobj) + 1);
5803 return child_range(child_iterator(), child_iterator());
5806 return const_child_range(const_child_iterator(), const_child_iterator());
5810 return T->getClauseKind() == llvm::omp::OMPC_depobj;
5822class OMPDependClause final
5823 :
public OMPVarListClause<OMPDependClause>,
5824 private llvm::TrailingObjects<OMPDependClause, Expr *> {
5826 friend OMPVarListClause;
5827 friend TrailingObjects;
5832 OpenMPDependClauseKind
DepKind = OMPC_DEPEND_unknown;
5849 unsigned NumLoops = 0;
5859 OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5860 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
5861 : OMPVarListClause<OMPDependClause>(
llvm::omp::OMPC_depend, StartLoc,
5862 LParenLoc, EndLoc, N),
5863 NumLoops(NumLoops) {}
5872 SourceLocation(), SourceLocation(),
5873 SourceLocation(), N),
5874 NumLoops(NumLoops) {}
5877 void setDependencyKind(OpenMPDependClauseKind K) {
Data.DepKind = K; }
5880 void setDependencyLoc(SourceLocation Loc) {
Data.DepLoc = Loc; }
5886 void setOmpAllMemoryLoc(SourceLocation Loc) {
Data.OmpAllMemoryLoc = Loc; }
5902 static OMPDependClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5903 SourceLocation LParenLoc,
5904 SourceLocation EndLoc, DependDataTy Data,
5905 Expr *DepModifier, ArrayRef<Expr *> VL,
5914 static OMPDependClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
5930 Expr *getModifier();
5932 return const_cast<OMPDependClause *
>(
this)->
getModifier();
5940 void setLoopData(
unsigned NumLoop, Expr *Cnt);
5943 Expr *getLoopData(
unsigned NumLoop);
5944 const Expr *getLoopData(
unsigned NumLoop)
const;
5947 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5948 reinterpret_cast<Stmt **
>(varlist_end()));
5952 return const_cast<OMPDependClause *
>(
this)->
children();
5956 return child_range(child_iterator(), child_iterator());
5959 return const_child_range(const_child_iterator(), const_child_iterator());
5963 return T->getClauseKind() == llvm::omp::OMPC_depend;
5979 SourceLocation LParenLoc;
5982 OpenMPDeviceClauseModifier Modifier = OMPC_DEVICE_unknown;
5985 SourceLocation ModifierLoc;
5988 Stmt *Device =
nullptr;
5993 void setDevice(Expr *E) { Device = E; }
5996 void setModifier(OpenMPDeviceClauseModifier M) { Modifier = M; }
6013 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
6014 SourceLocation LParenLoc, SourceLocation ModifierLoc,
6015 SourceLocation EndLoc)
6018 ModifierLoc(ModifierLoc), Device(E) {
6019 setPreInitStmt(HelperE, CaptureRegion);
6024 :
OMPClause(
llvm::omp::OMPC_device, SourceLocation(), SourceLocation()),
6045 child_range
children() {
return child_range(&Device, &Device + 1); }
6048 return const_child_range(&Device, &Device + 1);
6052 return child_range(child_iterator(), child_iterator());
6055 return const_child_range(const_child_iterator(), const_child_iterator());
6059 return T->getClauseKind() == llvm::omp::OMPC_device;
6100 :
OMPClause(
llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {}
6103 return child_range(child_iterator(), child_iterator());
6107 return const_child_range(const_child_iterator(), const_child_iterator());
6111 return child_range(child_iterator(), child_iterator());
6114 return const_child_range(const_child_iterator(), const_child_iterator());
6118 return T->getClauseKind() == llvm::omp::OMPC_simd;
6135 llvm::PointerIntPair<Expr *, 1, bool> AssociatedExpressionNonContiguousPr;
6140 ValueDecl *AssociatedDeclaration =
nullptr;
6145 ValueDecl *AssociatedDeclaration,
6146 bool IsNonContiguous)
6147 : AssociatedExpressionNonContiguousPr(AssociatedExpression,
6149 AssociatedDeclaration(
6150 AssociatedDeclaration
6155 return AssociatedExpressionNonContiguousPr.getPointer();
6159 return AssociatedExpressionNonContiguousPr.getInt();
6163 return AssociatedDeclaration;
6167 return AssociatedExpressionNonContiguousPr ==
6168 Other.AssociatedExpressionNonContiguousPr &&
6169 AssociatedDeclaration == Other.AssociatedDeclaration;
6209 static QualType getComponentExprElementType(
const Expr *Exp);
6269 static std::pair<const Expr *, std::optional<size_t>>
6270 findAttachPtrExpr(MappableExprComponentListRef Components,
6271 OpenMPDirectiveKind CurDirKind);
6276 getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists);
6312 unsigned NumUniqueDeclarations;
6315 unsigned NumComponentLists;
6318 unsigned NumComponents;
6323 const bool SupportsMapper;
6326 NestedNameSpecifierLoc MapperQualifierLoc;
6329 DeclarationNameInfo MapperIdInfo;
6351 OpenMPClauseKind K,
const OMPVarListLocTy &Locs,
6353 NestedNameSpecifierLoc *MapperQualifierLocPtr =
nullptr,
6354 DeclarationNameInfo *MapperIdInfoPtr =
nullptr)
6355 : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc,
6357 NumUniqueDeclarations(Sizes.NumUniqueDeclarations),
6358 NumComponentLists(Sizes.NumComponentLists),
6359 NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) {
6360 if (MapperQualifierLocPtr)
6361 MapperQualifierLoc = *MapperQualifierLocPtr;
6362 if (MapperIdInfoPtr)
6363 MapperIdInfo = *MapperIdInfoPtr;
6369 return static_cast<T *
>(
this)
6370 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6371 NumUniqueDeclarations);
6377 return static_cast<const T *
>(
this)
6378 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6379 NumUniqueDeclarations);
6385 assert(UDs.size() == NumUniqueDeclarations &&
6386 "Unexpected amount of unique declarations.");
6393 return static_cast<T *
>(
this)
6394 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6400 return static_cast<const T *
>(
this)
6401 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6407 assert(DNLs.size() == NumUniqueDeclarations &&
6408 "Unexpected amount of list numbers.");
6415 return MutableArrayRef<unsigned>(
6416 static_cast<T *
>(
this)
6417 ->
template getTrailingObjectsNonStrict<unsigned>() +
6418 NumUniqueDeclarations,
6426 static_cast<const T *
>(
this)
6427 ->
template getTrailingObjectsNonStrict<unsigned>() +
6428 NumUniqueDeclarations,
6435 assert(CLSs.size() == NumComponentLists &&
6436 "Unexpected amount of component lists.");
6442 return static_cast<T *
>(
this)
6443 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6449 return static_cast<const T *
>(
this)
6450 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6459 assert(Components.size() == NumComponents &&
6460 "Unexpected amount of component lists.");
6461 assert(CLSs.size() == NumComponentLists &&
6462 "Unexpected amount of list sizes.");
6473 NumUniqueDeclarations &&
6474 "Unexpected number of mappable expression info entries!");
6476 "Unexpected total number of components!");
6477 assert(Declarations.size() == ComponentLists.size() &&
6478 "Declaration and component lists size is not consistent!");
6479 assert(Declarations.size() == NumComponentLists &&
6480 "Unexpected declaration and component lists size!");
6485 llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>>
6488 auto CI = ComponentLists.begin();
6489 for (
auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE;
6491 assert(!CI->empty() &&
"Invalid component list!");
6492 ComponentListMap[*DI].push_back(*CI);
6498 auto UDI = UniqueDeclarations.begin();
6501 auto DNLI = DeclNumLists.begin();
6504 auto CLSI = ComponentListSizes.begin();
6507 auto CI = Components.begin();
6510 unsigned PrevSize = 0u;
6513 for (
auto &M : ComponentListMap) {
6530 PrevSize += C.size();
6537 CI = llvm::copy(C, CI);
6544 MapperQualifierLoc = NNSL;
6549 MapperIdInfo = MapperId;
6555 assert(SupportsMapper &&
6556 "Must be a clause that is possible to have user-defined mappers");
6557 return MutableArrayRef<Expr *>(
6558 static_cast<T *
>(
this)->
template getTrailingObjects<Expr *>() +
6559 OMPVarListClause<T>::varlist_size(),
6560 OMPVarListClause<T>::varlist_size());
6566 assert(SupportsMapper &&
6567 "Must be a clause that is possible to have user-defined mappers");
6569 static_cast<const T *
>(
this)->
template getTrailingObjects<Expr *>() +
6570 OMPVarListClause<T>::varlist_size(),
6571 OMPVarListClause<T>::varlist_size());
6577 assert(DMDs.size() == OMPVarListClause<T>::varlist_size() &&
6578 "Unexpected number of user-defined mappers.");
6579 assert(SupportsMapper &&
6580 "Must be a clause that is possible to have user-defined mappers");
6597 return MapperQualifierLoc;
6606 :
public llvm::iterator_adaptor_base<
6607 const_component_lists_iterator,
6608 MappableExprComponentListRef::const_iterator,
6609 std::forward_iterator_tag, MappableComponent, ptrdiff_t,
6610 MappableComponent, MappableComponent> {
6618 const bool SupportsMapper;
6624 unsigned RemainingLists = 0;
6628 unsigned PrevListSize = 0;
6636 MappableExprComponentListRef::const_iterator End;
6646 Components.begin()),
6647 DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()),
6648 SupportsMapper(SupportsMapper),
6649 ListSizeCur(CumulativeListSizes.begin()),
6650 ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) {
6651 assert(UniqueDecls.size() == DeclsListNum.size() &&
6652 "Inconsistent number of declarations and list sizes!");
6653 if (!DeclsListNum.empty())
6654 RemainingLists = *NumListsCur;
6656 MapperCur = Mappers.begin();
6667 CumulativeListSizes, Components,
6668 SupportsMapper, Mappers) {
6672 for (; DeclCur != UniqueDecls.end(); ++DeclCur, ++NumListsCur) {
6673 if (*DeclCur == Declaration)
6676 assert(*NumListsCur > 0 &&
"No lists associated with declaration??");
6680 std::advance(ListSizeCur, *NumListsCur - 1);
6681 PrevListSize = *ListSizeCur;
6690 if (ListSizeCur == CumulativeListSizes.end()) {
6692 RemainingLists = 0u;
6698 RemainingLists = *NumListsCur;
6701 ListSizeEnd = ListSizeCur;
6702 std::advance(ListSizeEnd, RemainingLists);
6706 std::advance(this->I, PrevListSize);
6714 assert(ListSizeCur != ListSizeEnd &&
"Invalid iterator!");
6715 const ValueDecl *Mapper =
nullptr;
6716 if (SupportsMapper && *MapperCur)
6717 Mapper = cast<ValueDecl>(cast<DeclRefExpr>(*MapperCur)->getDecl());
6718 return std::make_tuple(
6731 assert(ListSizeCur != ListSizeEnd && RemainingLists &&
6732 "Invalid iterator!");
6736 if (std::next(ListSizeCur) == ListSizeEnd) {
6740 std::advance(this->I, *ListSizeCur - PrevListSize);
6741 PrevListSize = *ListSizeCur;
6744 if (!(--RemainingLists)) {
6747 RemainingLists = *NumListsCur;
6748 assert(RemainingLists &&
"No lists in the following declaration??");
6760 llvm::iterator_range<const_component_lists_iterator>;
6774 SupportsMapper, {});
6782 const_component_lists_iterator
6805 llvm::iterator_range<const_all_num_lists_iterator>;
6813 llvm::iterator_range<const_all_lists_sizes_iterator>;
6821 llvm::iterator_range<const_all_components_iterator>;
6831 llvm::iterator_range<mapperlist_const_iterator>;
6857class OMPMapClause final :
public OMPMappableExprListClause<OMPMapClause>,
6858 private llvm::TrailingObjects<
6859 OMPMapClause, Expr *, ValueDecl *, unsigned,
6860 OMPClauseMappableExprCommon::MappableComponent> {
6862 friend OMPMappableExprListClause;
6863 friend OMPVarListClause;
6864 friend TrailingObjects;
6868 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
6871 return 2 * varlist_size() + 1;
6873 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
6874 return getUniqueDeclarationsNum();
6876 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
6877 return getUniqueDeclarationsNum() + getTotalComponentListNum();
6889 SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers];
6895 bool MapTypeIsImplicit =
false;
6898 SourceLocation MapLoc;
6901 SourceLocation ColonLoc;
6923 explicit OMPMapClause(ArrayRef<OpenMPMapModifierKind> MapModifiers,
6924 ArrayRef<SourceLocation> MapModifiersLoc,
6925 NestedNameSpecifierLoc MapperQualifierLoc,
6926 DeclarationNameInfo MapperIdInfo,
6927 OpenMPMapClauseKind MapType,
bool MapTypeIsImplicit,
6928 SourceLocation MapLoc,
const OMPVarListLocTy &Locs,
6929 const OMPMappableExprListSizeTy &Sizes)
6930 : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
6931 true, &MapperQualifierLoc,
6933 MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
6934 assert(std::size(MapTypeModifiers) == MapModifiers.size() &&
6935 "Unexpected number of map type modifiers.");
6936 llvm::copy(MapModifiers, std::begin(MapTypeModifiers));
6938 assert(std::size(MapTypeModifiersLoc) == MapModifiersLoc.size() &&
6939 "Unexpected number of map type modifier locations.");
6940 llvm::copy(MapModifiersLoc, std::begin(MapTypeModifiersLoc));
6950 explicit OMPMapClause(
const OMPMappableExprListSizeTy &Sizes)
6951 : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes,
6958 void setMapTypeModifier(
unsigned I, OpenMPMapModifierKind T) {
6959 assert(I < NumberOfOMPMapClauseModifiers &&
6960 "Unexpected index to store map type modifier, exceeds array size.");
6961 MapTypeModifiers[I] =
T;
6968 void setMapTypeModifierLoc(
unsigned I, SourceLocation TLoc) {
6969 assert(I < NumberOfOMPMapClauseModifiers &&
6970 "Index to store map type modifier location exceeds array size.");
6971 MapTypeModifiersLoc[I] = TLoc;
6977 void setMapType(OpenMPMapClauseKind T) { MapType =
T; }
6982 void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; }
6985 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
6988 void setIteratorModifier(Expr *IteratorModifier) {
6989 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
7013 static OMPMapClause *
7014 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
7015 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
7016 MappableExprComponentListsRef ComponentLists,
7017 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
7018 ArrayRef<OpenMPMapModifierKind> MapModifiers,
7019 ArrayRef<SourceLocation> MapModifiersLoc,
7020 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId,
7021 OpenMPMapClauseKind Type,
bool TypeIsImplicit, SourceLocation TypeLoc);
7033 static OMPMapClause *
CreateEmpty(
const ASTContext &C,
7034 const OMPMappableExprListSizeTy &Sizes);
7038 return getTrailingObjects<Expr *>()[2 * varlist_size()];
7042 OpenMPMapClauseKind
getMapType() const LLVM_READONLY {
return MapType; }
7055 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7056 "Requested modifier exceeds the total number of modifiers.");
7057 return MapTypeModifiers[Cnt];
7065 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7066 "Requested modifier location exceeds total number of modifiers.");
7067 return MapTypeModifiersLoc[Cnt];
7072 return MapTypeModifiers;
7077 return MapTypeModifiersLoc;
7081 SourceLocation
getMapLoc() const LLVM_READONLY {
return MapLoc; }
7088 reinterpret_cast<Stmt **
>(varlist_begin()),
7089 reinterpret_cast<Stmt **
>(varlist_end()));
7093 return const_cast<OMPMapClause *
>(
this)->
children();
7097 if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_tofrom)
7098 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7099 reinterpret_cast<Stmt **
>(varlist_end()));
7100 return child_range(child_iterator(), child_iterator());
7108 return T->getClauseKind() == llvm::omp::OMPC_map;
7141class OMPNumTeamsClause final
7142 :
public OMPVarListClause<OMPNumTeamsClause>,
7144 private llvm::TrailingObjects<OMPNumTeamsClause, Expr *> {
7146 friend OMPVarListClause;
7147 friend TrailingObjects;
7150 OpenMPNumTeamsClauseModifier Modifier = OMPC_NUMTEAMS_unknown;
7153 SourceLocation ModifierLoc;
7155 OMPNumTeamsClause(
const ASTContext &C, SourceLocation StartLoc,
7156 SourceLocation LParenLoc, SourceLocation EndLoc,
unsigned N)
7157 : OMPVarListClause(
llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, EndLoc,
7163 : OMPVarListClause(
llvm::omp::OMPC_num_teams, SourceLocation(),
7164 SourceLocation(), SourceLocation(), N),
7168 void setModifier(OpenMPNumTeamsClauseModifier M) { Modifier = M; }
7171 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7188 static OMPNumTeamsClause *
7189 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7190 SourceLocation StartLoc, SourceLocation LParenLoc,
7191 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7192 OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr,
7193 SourceLocation ModifierLoc, Stmt *PreInit);
7199 static OMPNumTeamsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7206 return const_cast<OMPNumTeamsClause *
>(
this)->
getNumTeams();
7220 if (Modifier == OMPC_NUMTEAMS_dims)
7229 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7230 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7234 return const_cast<OMPNumTeamsClause *
>(
this)->
children();
7238 return child_range(child_iterator(), child_iterator());
7241 return const_child_range(const_child_iterator(), const_child_iterator());
7245 return T->getClauseKind() == llvm::omp::OMPC_num_teams;
7271class OMPThreadLimitClause final
7272 :
public OMPVarListClause<OMPThreadLimitClause>,
7274 private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
7276 friend OMPVarListClause;
7277 friend TrailingObjects;
7280 OpenMPThreadLimitClauseModifier Modifier = OMPC_THREADLIMIT_unknown;
7283 SourceLocation ModifierLoc;
7285 OMPThreadLimitClause(
const ASTContext &C, SourceLocation StartLoc,
7286 SourceLocation LParenLoc, SourceLocation EndLoc,
7288 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, StartLoc, LParenLoc,
7294 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, SourceLocation(),
7295 SourceLocation(), SourceLocation(), N),
7299 void setModifier(OpenMPThreadLimitClauseModifier M) { Modifier = M; }
7305 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7319 static OMPThreadLimitClause *
7320 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7321 SourceLocation StartLoc, SourceLocation LParenLoc,
7322 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7323 OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr,
7324 SourceLocation ModifierLoc, Stmt *PreInit);
7330 static OMPThreadLimitClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7337 return const_cast<OMPThreadLimitClause *
>(
this)->
getThreadLimit();
7341 OpenMPThreadLimitClauseModifier
getModifier()
const {
return Modifier; }
7351 if (Modifier == OMPC_THREADLIMIT_dims)
7360 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7361 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7365 return const_cast<OMPThreadLimitClause *
>(
this)->
children();
7369 return child_range(child_iterator(), child_iterator());
7372 return const_child_range(const_child_iterator(), const_child_iterator());
7376 return T->getClauseKind() == llvm::omp::OMPC_thread_limit;
7392 SourceLocation LParenLoc;
7395 Stmt *Priority =
nullptr;
7400 void setPriority(Expr *E) { Priority = E; }
7413 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
7414 SourceLocation LParenLoc, SourceLocation EndLoc)
7417 setPreInitStmt(HelperPriority, CaptureRegion);
7422 :
OMPClause(
llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()),
7437 child_range
children() {
return child_range(&Priority, &Priority + 1); }
7440 return const_child_range(&Priority, &Priority + 1);
7443 child_range used_children();
7449 return T->getClauseKind() == llvm::omp::OMPC_priority;
7465 SourceLocation LParenLoc;
7468 OpenMPGrainsizeClauseModifier Modifier = OMPC_GRAINSIZE_unknown;
7471 SourceLocation ModifierLoc;
7474 Stmt *Grainsize =
nullptr;
7477 void setGrainsize(Expr *Size) { Grainsize = Size; }
7480 void setModifier(OpenMPGrainsizeClauseModifier M) { Modifier = M; }
7498 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7499 SourceLocation StartLoc, SourceLocation LParenLoc,
7500 SourceLocation ModifierLoc, SourceLocation EndLoc)
7503 ModifierLoc(ModifierLoc), Grainsize(Size) {
7504 setPreInitStmt(HelperSize, CaptureRegion);
7523 OpenMPGrainsizeClauseModifier
getModifier()
const {
return Modifier; }
7528 child_range
children() {
return child_range(&Grainsize, &Grainsize + 1); }
7531 return const_child_range(&Grainsize, &Grainsize + 1);
7534 child_range used_children();
7540 return T->getClauseKind() == llvm::omp::OMPC_grainsize;
7561 :
OMPClause(
llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) {
7565 return child_range(child_iterator(), child_iterator());
7569 return const_child_range(const_child_iterator(), const_child_iterator());
7573 return child_range(child_iterator(), child_iterator());
7576 return const_child_range(const_child_iterator(), const_child_iterator());
7580 return T->getClauseKind() == llvm::omp::OMPC_nogroup;
7596 SourceLocation LParenLoc;
7599 OpenMPNumTasksClauseModifier Modifier = OMPC_NUMTASKS_unknown;
7602 SourceLocation ModifierLoc;
7605 Stmt *NumTasks =
nullptr;
7608 void setNumTasks(Expr *Size) { NumTasks = Size; }
7611 void setModifier(OpenMPNumTasksClauseModifier M) { Modifier = M; }
7629 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7630 SourceLocation StartLoc, SourceLocation LParenLoc,
7631 SourceLocation ModifierLoc, SourceLocation EndLoc)
7634 ModifierLoc(ModifierLoc), NumTasks(Size) {
7635 setPreInitStmt(HelperSize, CaptureRegion);
7659 child_range
children() {
return child_range(&NumTasks, &NumTasks + 1); }
7662 return const_child_range(&NumTasks, &NumTasks + 1);
7665 child_range used_children();
7671 return T->getClauseKind() == llvm::omp::OMPC_num_tasks;
7686 SourceLocation LParenLoc;
7689 Stmt *Hint =
nullptr;
7692 void setHint(Expr *H) { Hint = H; }
7702 SourceLocation EndLoc)
7703 :
OMPClause(
llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
7708 :
OMPClause(
llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {}
7717 Expr *
getHint()
const {
return cast_or_null<Expr>(Hint); }
7719 child_range
children() {
return child_range(&Hint, &Hint + 1); }
7722 return const_child_range(&Hint, &Hint + 1);
7726 return child_range(child_iterator(), child_iterator());
7729 return const_child_range(const_child_iterator(), const_child_iterator());
7733 return T->getClauseKind() == llvm::omp::OMPC_hint;
7749 SourceLocation LParenLoc;
7752 OpenMPDistScheduleClauseKind Kind = OMPC_DIST_SCHEDULE_unknown;
7755 SourceLocation KindLoc;
7758 SourceLocation CommaLoc;
7761 Expr *ChunkSize =
nullptr;
7766 void setDistScheduleKind(OpenMPDistScheduleClauseKind K) { Kind = K; }
7771 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7776 void setDistScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7781 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
7786 void setChunkSize(Expr *E) { ChunkSize = E; }
7801 SourceLocation KLoc, SourceLocation CommaLoc,
7802 SourceLocation EndLoc,
7803 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
7804 Stmt *HelperChunkSize)
7805 :
OMPClause(
llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc),
7807 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
7808 setPreInitStmt(HelperChunkSize);
7813 :
OMPClause(
llvm::omp::OMPC_dist_schedule, SourceLocation(),
7836 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
7837 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
7845 return child_range(child_iterator(), child_iterator());
7848 return const_child_range(const_child_iterator(), const_child_iterator());
7852 return T->getClauseKind() == llvm::omp::OMPC_dist_schedule;
7867 SourceLocation LParenLoc;
7870 OpenMPDefaultmapClauseModifier Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown;
7873 SourceLocation ModifierLoc;
7876 OpenMPDefaultmapClauseKind Kind = OMPC_DEFAULTMAP_unknown;
7879 SourceLocation KindLoc;
7884 void setDefaultmapKind(OpenMPDefaultmapClauseKind K) { Kind = K; }
7889 void setDefaultmapModifier(OpenMPDefaultmapClauseModifier M) {
7894 void setDefaultmapModifierLoc(SourceLocation Loc) {
7901 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7906 void setDefaultmapKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7919 SourceLocation MLoc, SourceLocation KLoc,
7920 SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind,
7921 OpenMPDefaultmapClauseModifier M)
7923 LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind),
7929 SourceLocation()) {}
7951 return child_range(child_iterator(), child_iterator());
7955 return const_child_range(const_child_iterator(), const_child_iterator());
7959 return child_range(child_iterator(), child_iterator());
7962 return const_child_range(const_child_iterator(), const_child_iterator());
7966 return T->getClauseKind() == llvm::omp::OMPC_defaultmap;
7978class OMPToClause final :
public OMPMappableExprListClause<OMPToClause>,
7979 private llvm::TrailingObjects<
7980 OMPToClause, Expr *, ValueDecl *, unsigned,
7981 OMPClauseMappableExprCommon::MappableComponent> {
7983 friend OMPMappableExprListClause;
7984 friend OMPVarListClause;
7985 friend TrailingObjects;
7988 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
7989 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
7990 OMPC_MOTION_MODIFIER_unknown};
7993 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
7996 SourceLocation ColonLoc;
8015 NestedNameSpecifierLoc MapperQualifierLoc,
8016 DeclarationNameInfo MapperIdInfo,
8017 const OMPVarListLocTy &Locs,
8020 true, &MapperQualifierLoc,
8022 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
8023 "Unexpected number of motion modifiers.");
8024 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8026 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8027 "Unexpected number of motion modifier locations.");
8028 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8038 explicit OMPToClause(
const OMPMappableExprListSizeTy &Sizes)
8039 : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
8046 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8047 assert(I < NumberOfOMPMotionModifiers &&
8048 "Unexpected index to store motion modifier, exceeds array size.");
8049 MotionModifiers[I] =
T;
8056 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8057 assert(I < NumberOfOMPMotionModifiers &&
8058 "Index to store motion modifier location exceeds array size.");
8059 MotionModifiersLoc[I] = TLoc;
8062 void setIteratorModifier(Expr *IteratorModifier) {
8063 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8066 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8070 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8073 return 2 * varlist_size() + 1;
8075 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8076 return getUniqueDeclarationsNum();
8078 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8079 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8099 static OMPToClause *
8100 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8101 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8102 MappableExprComponentListsRef ComponentLists,
8103 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
8104 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8105 ArrayRef<SourceLocation> MotionModifiersLoc,
8106 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8116 static OMPToClause *
CreateEmpty(
const ASTContext &C,
8117 const OMPMappableExprListSizeTy &Sizes);
8123 assert(Cnt < NumberOfOMPMotionModifiers &&
8124 "Requested modifier exceeds the total number of modifiers.");
8125 return MotionModifiers[Cnt];
8128 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8135 assert(Cnt < NumberOfOMPMotionModifiers &&
8136 "Requested modifier location exceeds total number of modifiers.");
8137 return MotionModifiersLoc[Cnt];
8142 return MotionModifiers;
8147 return MotionModifiersLoc;
8154 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8155 reinterpret_cast<Stmt **
>(varlist_end()));
8159 return const_cast<OMPToClause *
>(
this)->
children();
8163 return child_range(child_iterator(), child_iterator());
8166 return const_child_range(const_child_iterator(), const_child_iterator());
8170 return T->getClauseKind() == llvm::omp::OMPC_to;
8182class OMPFromClause final
8183 :
public OMPMappableExprListClause<OMPFromClause>,
8184 private llvm::TrailingObjects<
8185 OMPFromClause, Expr *, ValueDecl *, unsigned,
8186 OMPClauseMappableExprCommon::MappableComponent> {
8188 friend OMPMappableExprListClause;
8189 friend OMPVarListClause;
8190 friend TrailingObjects;
8193 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
8194 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
8195 OMPC_MOTION_MODIFIER_unknown};
8198 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
8201 SourceLocation ColonLoc;
8220 NestedNameSpecifierLoc MapperQualifierLoc,
8221 DeclarationNameInfo MapperIdInfo,
8222 const OMPVarListLocTy &Locs,
8225 true, &MapperQualifierLoc,
8227 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
8228 "Unexpected number of motion modifiers.");
8229 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8231 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8232 "Unexpected number of motion modifier locations.");
8233 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8243 explicit OMPFromClause(
const OMPMappableExprListSizeTy &Sizes)
8244 : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
8251 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8252 assert(I < NumberOfOMPMotionModifiers &&
8253 "Unexpected index to store motion modifier, exceeds array size.");
8254 MotionModifiers[I] =
T;
8256 void setIteratorModifier(Expr *IteratorModifier) {
8257 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8263 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8264 assert(I < NumberOfOMPMotionModifiers &&
8265 "Index to store motion modifier location exceeds array size.");
8266 MotionModifiersLoc[I] = TLoc;
8270 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8274 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8277 return 2 * varlist_size() + 1;
8279 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8280 return getUniqueDeclarationsNum();
8282 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8283 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8303 static OMPFromClause *
8304 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8305 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8306 MappableExprComponentListsRef ComponentLists,
8307 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorExpr,
8308 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8309 ArrayRef<SourceLocation> MotionModifiersLoc,
8310 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8320 static OMPFromClause *
CreateEmpty(
const ASTContext &C,
8321 const OMPMappableExprListSizeTy &Sizes);
8327 assert(Cnt < NumberOfOMPMotionModifiers &&
8328 "Requested modifier exceeds the total number of modifiers.");
8329 return MotionModifiers[Cnt];
8332 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8339 assert(Cnt < NumberOfOMPMotionModifiers &&
8340 "Requested modifier location exceeds total number of modifiers.");
8341 return MotionModifiersLoc[Cnt];
8346 return MotionModifiers;
8351 return MotionModifiersLoc;
8358 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8359 reinterpret_cast<Stmt **
>(varlist_end()));
8363 return const_cast<OMPFromClause *
>(
this)->
children();
8367 return child_range(child_iterator(), child_iterator());
8370 return const_child_range(const_child_iterator(), const_child_iterator());
8374 return T->getClauseKind() == llvm::omp::OMPC_from;
8386class OMPUseDevicePtrClause final
8387 :
public OMPMappableExprListClause<OMPUseDevicePtrClause>,
8388 private llvm::TrailingObjects<
8389 OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned,
8390 OMPClauseMappableExprCommon::MappableComponent> {
8392 friend OMPMappableExprListClause;
8393 friend OMPVarListClause;
8394 friend TrailingObjects;
8397 OpenMPUseDevicePtrFallbackModifier FallbackModifier =
8398 OMPC_USE_DEVICE_PTR_FALLBACK_unknown;
8401 SourceLocation FallbackModifierLoc;
8415 explicit OMPUseDevicePtrClause(
8417 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8418 SourceLocation FallbackModifierLoc)
8419 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_ptr, Locs, Sizes),
8420 FallbackModifier(FallbackModifier),
8421 FallbackModifierLoc(FallbackModifierLoc) {}
8432 OMPVarListLocTy(), Sizes) {}
8436 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8437 return 3 * varlist_size();
8439 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8440 return getUniqueDeclarationsNum();
8442 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8443 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8449 void setPrivateCopies(ArrayRef<Expr *> VL);
8453 MutableArrayRef<Expr *> getPrivateCopies() {
8454 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
8456 ArrayRef<const Expr *> getPrivateCopies()
const {
8457 return {varlist_end(), varlist_size()};
8463 void setInits(ArrayRef<Expr *> VL);
8467 MutableArrayRef<Expr *>
getInits() {
8468 return {getPrivateCopies().end(), varlist_size()};
8470 ArrayRef<const Expr *>
getInits()
const {
8471 return {getPrivateCopies().end(), varlist_size()};
8475 void setFallbackModifier(OpenMPUseDevicePtrFallbackModifier M) {
8476 FallbackModifier = M;
8480 void setFallbackModifierLoc(SourceLocation Loc) { FallbackModifierLoc = Loc; }
8496 static OMPUseDevicePtrClause *
8497 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8498 ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
8499 ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations,
8500 MappableExprComponentListsRef ComponentLists,
8501 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8502 SourceLocation FallbackModifierLoc);
8512 static OMPUseDevicePtrClause *
8513 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8517 return FallbackModifier;
8527 llvm::iterator_range<private_copies_const_iterator>;
8532 return getPrivateCopies();
8545 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8546 reinterpret_cast<Stmt **
>(varlist_end()));
8550 return const_cast<OMPUseDevicePtrClause *
>(
this)->
children();
8554 return child_range(child_iterator(), child_iterator());
8557 return const_child_range(const_child_iterator(), const_child_iterator());
8561 return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr;
8573class OMPUseDeviceAddrClause final
8574 :
public OMPMappableExprListClause<OMPUseDeviceAddrClause>,
8575 private llvm::TrailingObjects<
8576 OMPUseDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8577 OMPClauseMappableExprCommon::MappableComponent> {
8579 friend OMPMappableExprListClause;
8580 friend OMPVarListClause;
8581 friend TrailingObjects;
8593 explicit OMPUseDeviceAddrClause(
const OMPVarListLocTy &Locs,
8595 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_addr, Locs,
8607 OMPVarListLocTy(), Sizes) {}
8611 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8612 return varlist_size();
8614 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8615 return getUniqueDeclarationsNum();
8617 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8618 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8631 static OMPUseDeviceAddrClause *
8632 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8633 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8634 MappableExprComponentListsRef ComponentLists);
8644 static OMPUseDeviceAddrClause *
8645 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8648 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8649 reinterpret_cast<Stmt **
>(varlist_end()));
8653 return const_cast<OMPUseDeviceAddrClause *
>(
this)->
children();
8657 return child_range(child_iterator(), child_iterator());
8660 return const_child_range(const_child_iterator(), const_child_iterator());
8664 return T->getClauseKind() == llvm::omp::OMPC_use_device_addr;
8676class OMPIsDevicePtrClause final
8677 :
public OMPMappableExprListClause<OMPIsDevicePtrClause>,
8678 private llvm::TrailingObjects<
8679 OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned,
8680 OMPClauseMappableExprCommon::MappableComponent> {
8682 friend OMPMappableExprListClause;
8683 friend OMPVarListClause;
8684 friend TrailingObjects;
8696 explicit OMPIsDevicePtrClause(
const OMPVarListLocTy &Locs,
8698 : OMPMappableExprListClause(
llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {}
8709 OMPVarListLocTy(), Sizes) {}
8713 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8714 return varlist_size();
8716 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8717 return getUniqueDeclarationsNum();
8719 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8720 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8733 static OMPIsDevicePtrClause *
8734 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8735 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8736 MappableExprComponentListsRef ComponentLists);
8746 static OMPIsDevicePtrClause *
8747 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8750 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8751 reinterpret_cast<Stmt **
>(varlist_end()));
8755 return const_cast<OMPIsDevicePtrClause *
>(
this)->
children();
8759 return child_range(child_iterator(), child_iterator());
8762 return const_child_range(const_child_iterator(), const_child_iterator());
8766 return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr;
8778class OMPHasDeviceAddrClause final
8779 :
public OMPMappableExprListClause<OMPHasDeviceAddrClause>,
8780 private llvm::TrailingObjects<
8781 OMPHasDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8782 OMPClauseMappableExprCommon::MappableComponent> {
8784 friend OMPMappableExprListClause;
8785 friend OMPVarListClause;
8786 friend TrailingObjects;
8798 explicit OMPHasDeviceAddrClause(
const OMPVarListLocTy &Locs,
8800 : OMPMappableExprListClause(
llvm::omp::OMPC_has_device_addr, Locs,
8812 OMPVarListLocTy(), Sizes) {}
8816 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8817 return varlist_size();
8819 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8820 return getUniqueDeclarationsNum();
8822 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8823 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8836 static OMPHasDeviceAddrClause *
8837 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8838 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8839 MappableExprComponentListsRef ComponentLists);
8849 static OMPHasDeviceAddrClause *
8850 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8853 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8854 reinterpret_cast<Stmt **
>(varlist_end()));
8858 return const_cast<OMPHasDeviceAddrClause *
>(
this)->
children();
8862 return child_range(child_iterator(), child_iterator());
8865 return const_child_range(const_child_iterator(), const_child_iterator());
8869 return T->getClauseKind() == llvm::omp::OMPC_has_device_addr;
8880class OMPNontemporalClause final
8881 :
public OMPVarListClause<OMPNontemporalClause>,
8882 private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
8884 friend OMPVarListClause;
8885 friend TrailingObjects;
8893 OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8894 SourceLocation EndLoc,
unsigned N)
8895 : OMPVarListClause<OMPNontemporalClause>(
llvm::omp::OMPC_nontemporal,
8896 StartLoc, LParenLoc, EndLoc, N) {
8904 llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(),
8905 SourceLocation(), N) {}
8909 MutableArrayRef<Expr *> getPrivateRefs() {
8910 return {varlist_end(), varlist_size()};
8912 ArrayRef<const Expr *> getPrivateRefs()
const {
8913 return {varlist_end(), varlist_size()};
8924 static OMPNontemporalClause *
8925 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
8926 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8932 static OMPNontemporalClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
8936 void setPrivateRefs(ArrayRef<Expr *> VL);
8939 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8940 reinterpret_cast<Stmt **
>(varlist_end()));
8944 return const_cast<OMPNontemporalClause *
>(
this)->
children();
8948 return child_range(
reinterpret_cast<Stmt **
>(getPrivateRefs().begin()),
8949 reinterpret_cast<Stmt **
>(getPrivateRefs().end()));
8953 return const_cast<OMPNontemporalClause *
>(
this)->
private_refs();
8957 return child_range(child_iterator(), child_iterator());
8960 return const_child_range(const_child_iterator(), const_child_iterator());
8964 return T->getClauseKind() == llvm::omp::OMPC_nontemporal;
8979 SourceLocation LParenLoc;
8982 OpenMPOrderClauseKind Kind = OMPC_ORDER_unknown;
8985 SourceLocation KindKwLoc;
8988 OpenMPOrderClauseModifier Modifier = OMPC_ORDER_MODIFIER_unknown;
8991 SourceLocation ModifierKwLoc;
8996 void setKind(OpenMPOrderClauseKind K) { Kind = K; }
9001 void setKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
9006 void setModifier(OpenMPOrderClauseModifier M) { Modifier = M; }
9011 void setModifierKwLoc(SourceLocation MLoc) { ModifierKwLoc = MLoc; }
9024 SourceLocation StartLoc, SourceLocation LParenLoc,
9025 SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
9026 SourceLocation MLoc)
9028 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
9029 ModifierKwLoc(MLoc) {}
9033 :
OMPClause(
llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {}
9042 OpenMPOrderClauseKind
getKind()
const {
return Kind; }
9054 return child_range(child_iterator(), child_iterator());
9058 return const_child_range(const_child_iterator(), const_child_iterator());
9062 return child_range(child_iterator(), child_iterator());
9065 return const_child_range(const_child_iterator(), const_child_iterator());
9069 return T->getClauseKind() == llvm::omp::OMPC_order;
9078class OMPInitClause final
9079 :
public OMPVarListClause<OMPInitClause>,
9080 private llvm::TrailingObjects<OMPInitClause, Expr *, unsigned> {
9082 friend OMPVarListClause;
9083 friend TrailingObjects;
9086 SourceLocation VarLoc;
9088 bool IsTarget =
false;
9089 bool IsTargetSync =
false;
9090 bool HasPreferAttrs =
false;
9094 unsigned NumAttrs = 0;
9111 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
9112 return varlist_size() + NumAttrs;
9114 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
9115 return getNumPrefs();
9118 void setInteropVar(Expr *E) { varlist_begin()[0] = E; }
9120 void setIsTarget(
bool V) { IsTarget =
V; }
9122 void setIsTargetSync(
bool V) { IsTargetSync =
V; }
9124 void setHasPreferAttrs(
bool V) { HasPreferAttrs =
V; }
9126 void setAttrs(ArrayRef<unsigned> Counts, ArrayRef<Expr *> Attrs);
9129 unsigned getNumPrefs()
const {
return varlist_size() - 1; }
9133 ArrayRef<unsigned> getAttrEnds()
const {
9134 return getTrailingObjects<unsigned>(getNumPrefs());
9138 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9149 OMPInitClause(
bool IsTarget,
bool IsTargetSync, SourceLocation StartLoc,
9150 SourceLocation LParenLoc, SourceLocation VarLoc,
9151 SourceLocation EndLoc,
unsigned N)
9152 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, StartLoc,
9153 LParenLoc, EndLoc, N),
9154 VarLoc(VarLoc), IsTarget(IsTarget), IsTargetSync(IsTargetSync) {}
9157 OMPInitClause(
unsigned N)
9158 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, SourceLocation(),
9159 SourceLocation(), SourceLocation(), N) {
9181 OMPInteropInfo &InteropInfo,
9182 SourceLocation StartLoc,
9183 SourceLocation LParenLoc, SourceLocation VarLoc,
9184 SourceLocation EndLoc);
9219 reinterpret_cast<Stmt **
>(varlist_begin()),
9220 reinterpret_cast<Stmt **
>(varlist_begin() + varlist_size() + NumAttrs));
9224 return const_cast<OMPInitClause *
>(
this)->
children();
9228 return child_range(child_iterator(), child_iterator());
9231 return const_child_range(const_child_iterator(), const_child_iterator());
9237 unsigned N = getNumPrefs();
9238 Expr *
const *E = getTrailingObjects<Expr *>();
9240 return llvm::map_range(llvm::seq<unsigned>(0, N), [
this, E,
9242 unsigned Start = (I == 0) ? 0 : Ends[I - 1];
9244 const_cast<Expr *
>(E[1 + I]),
9251 return T->getClauseKind() == llvm::omp::OMPC_init;
9264 SourceLocation LParenLoc;
9267 SourceLocation VarLoc;
9270 Stmt *InteropVar =
nullptr;
9273 void setInteropVar(Expr *E) { InteropVar = E; }
9276 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9279 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9290 SourceLocation LParenLoc, SourceLocation VarLoc,
9291 SourceLocation EndLoc)
9292 :
OMPClause(
llvm::omp::OMPC_use, StartLoc, EndLoc), LParenLoc(LParenLoc),
9293 VarLoc(VarLoc), InteropVar(InteropVar) {}
9297 :
OMPClause(
llvm::omp::OMPC_use, SourceLocation(), SourceLocation()) {}
9308 child_range
children() {
return child_range(&InteropVar, &InteropVar + 1); }
9311 return const_child_range(&InteropVar, &InteropVar + 1);
9315 return child_range(child_iterator(), child_iterator());
9318 return const_child_range(const_child_iterator(), const_child_iterator());
9322 return T->getClauseKind() == llvm::omp::OMPC_use;
9339 SourceLocation LParenLoc;
9342 SourceLocation VarLoc;
9345 Stmt *InteropVar =
nullptr;
9348 void setInteropVar(Expr *E) { InteropVar = E; }
9351 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9354 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9365 SourceLocation LParenLoc, SourceLocation VarLoc,
9366 SourceLocation EndLoc)
9368 LParenLoc(LParenLoc), VarLoc(VarLoc), InteropVar(InteropVar) {}
9379 :
OMPClause(
llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) {
9393 return child_range(&InteropVar, &InteropVar + 1);
9394 return child_range(child_iterator(), child_iterator());
9399 return const_child_range(&InteropVar, &InteropVar + 1);
9400 return const_child_range(const_child_iterator(), const_child_iterator());
9404 return child_range(child_iterator(), child_iterator());
9407 return const_child_range(const_child_iterator(), const_child_iterator());
9411 return T->getClauseKind() == llvm::omp::OMPC_destroy;
9428 void setCondition(Expr *Cond) { setStmt(Cond); }
9441 OpenMPDirectiveKind CaptureRegion,
9442 SourceLocation StartLoc, SourceLocation LParenLoc,
9443 SourceLocation EndLoc)
9446 setPreInitStmt(HelperCond, CaptureRegion);
9455 child_range used_children();
9474 void setCondition(Expr *Cond) { setStmt(Cond); }
9487 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9488 SourceLocation LParenLoc, SourceLocation EndLoc)
9491 setPreInitStmt(HelperCond, CaptureRegion);
9500 child_range used_children();
9518 void setEventHandler(Expr *E) { setStmt(E); }
9528 SourceLocation EndLoc)
9545class OMPInclusiveClause final
9546 :
public OMPVarListClause<OMPInclusiveClause>,
9547 private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
9549 friend OMPVarListClause;
9550 friend TrailingObjects;
9558 OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9559 SourceLocation EndLoc,
unsigned N)
9560 : OMPVarListClause<OMPInclusiveClause>(
llvm::omp::OMPC_inclusive,
9561 StartLoc, LParenLoc, EndLoc, N) {}
9568 SourceLocation(), SourceLocation(),
9569 SourceLocation(), N) {}
9579 static OMPInclusiveClause *
Create(
const ASTContext &C,
9580 SourceLocation StartLoc,
9581 SourceLocation LParenLoc,
9582 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9588 static OMPInclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9591 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9592 reinterpret_cast<Stmt **
>(varlist_end()));
9596 return const_cast<OMPInclusiveClause *
>(
this)->
children();
9600 return child_range(child_iterator(), child_iterator());
9603 return const_child_range(const_child_iterator(), const_child_iterator());
9607 return T->getClauseKind() == llvm::omp::OMPC_inclusive;
9618class OMPExclusiveClause final
9619 :
public OMPVarListClause<OMPExclusiveClause>,
9620 private llvm::TrailingObjects<OMPExclusiveClause, Expr *> {
9622 friend OMPVarListClause;
9623 friend TrailingObjects;
9631 OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9632 SourceLocation EndLoc,
unsigned N)
9633 : OMPVarListClause<OMPExclusiveClause>(
llvm::omp::OMPC_exclusive,
9634 StartLoc, LParenLoc, EndLoc, N) {}
9641 SourceLocation(), SourceLocation(),
9642 SourceLocation(), N) {}
9652 static OMPExclusiveClause *
Create(
const ASTContext &C,
9653 SourceLocation StartLoc,
9654 SourceLocation LParenLoc,
9655 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9661 static OMPExclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9664 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9665 reinterpret_cast<Stmt **
>(varlist_end()));
9669 return const_cast<OMPExclusiveClause *
>(
this)->
children();
9673 return child_range(child_iterator(), child_iterator());
9676 return const_child_range(const_child_iterator(), const_child_iterator());
9680 return T->getClauseKind() == llvm::omp::OMPC_exclusive;
9692class OMPUsesAllocatorsClause final
9694 private llvm::TrailingObjects<OMPUsesAllocatorsClause, Expr *,
9709 friend TrailingObjects;
9711 enum class ExprOffsets {
9717 enum class ParenLocsOffsets {
9724 SourceLocation LParenLoc;
9726 unsigned NumOfAllocators = 0;
9734 OMPUsesAllocatorsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9735 SourceLocation EndLoc,
unsigned N)
9736 : OMPClause(llvm::omp::OMPC_uses_allocators, StartLoc, EndLoc),
9737 LParenLoc(LParenLoc), NumOfAllocators(N) {}
9742 explicit OMPUsesAllocatorsClause(
unsigned N)
9743 : OMPClause(llvm::omp::OMPC_uses_allocators, SourceLocation(),
9745 NumOfAllocators(N) {}
9747 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
9748 return NumOfAllocators *
static_cast<int>(ExprOffsets::Total);
9752 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9755 void setAllocatorsData(ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9765 static OMPUsesAllocatorsClause *
9766 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
9767 SourceLocation EndLoc, ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9773 static OMPUsesAllocatorsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9786 Stmt **Begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
9787 return child_range(Begin, Begin + NumOfAllocators *
9788 static_cast<int>(ExprOffsets::Total));
9791 Stmt *
const *Begin =
9792 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
9793 return const_child_range(
9794 Begin, Begin + NumOfAllocators *
static_cast<int>(ExprOffsets::Total));
9798 return child_range(child_iterator(), child_iterator());
9801 return const_child_range(const_child_iterator(), const_child_iterator());
9805 return T->getClauseKind() == llvm::omp::OMPC_uses_allocators;
9818class OMPAffinityClause final
9819 :
public OMPVarListClause<OMPAffinityClause>,
9820 private llvm::TrailingObjects<OMPAffinityClause, Expr *> {
9822 friend OMPVarListClause;
9823 friend TrailingObjects;
9826 SourceLocation ColonLoc;
9835 OMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9836 SourceLocation ColonLoc, SourceLocation EndLoc,
unsigned N)
9837 : OMPVarListClause<OMPAffinityClause>(
llvm::omp::OMPC_affinity, StartLoc,
9838 LParenLoc, EndLoc, N) {}
9845 SourceLocation(), SourceLocation(),
9846 SourceLocation(), N) {}
9849 void setModifier(Expr *E) { getTrailingObjects()[varlist_size()] = E; }
9852 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
9863 static OMPAffinityClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
9864 SourceLocation LParenLoc,
9865 SourceLocation ColonLoc,
9866 SourceLocation EndLoc, Expr *Modifier,
9867 ArrayRef<Expr *> Locators);
9873 static OMPAffinityClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9877 Expr *
getModifier()
const {
return getTrailingObjects()[varlist_size()]; }
9885 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9886 reinterpret_cast<Stmt **
>(varlist_end() + Offset));
9890 return const_cast<OMPAffinityClause *
>(
this)->
children();
9894 return child_range(child_iterator(), child_iterator());
9897 return const_child_range(const_child_iterator(), const_child_iterator());
9901 return T->getClauseKind() == llvm::omp::OMPC_affinity;
9918 void setThreadID(Expr *TID) { setStmt(TID); }
9931 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9932 SourceLocation LParenLoc, SourceLocation EndLoc)
9935 setPreInitStmt(HelperE, CaptureRegion);
9957 SourceLocation LParenLoc;
9960 OpenMPBindClauseKind Kind = OMPC_BIND_unknown;
9963 SourceLocation KindLoc;
9966 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9969 void setBindKind(OpenMPBindClauseKind K) { Kind = K; }
9972 void setBindKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
9983 SourceLocation StartLoc, SourceLocation LParenLoc,
9984 SourceLocation EndLoc)
10003template<
class ImplClass,
template <
typename>
class Ptr,
typename RetTy>
10006#define PTR(CLASS) Ptr<CLASS>
10007#define DISPATCH(CLASS) \
10008 return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
10010#define GEN_CLANG_CLAUSE_CLASS
10011#define CLAUSE_CLASS(Enum, Str, Class) \
10012 RetTy Visit##Class(PTR(Class) S) { \
10013 return static_cast<ImplClass *>(this)->VisitOMPClause(S); \
10015#include "llvm/Frontend/OpenMP/OMP.inc"
10019 switch (S->getClauseKind()) {
10020#define GEN_CLANG_CLAUSE_CLASS
10021#define CLAUSE_CLASS(Enum, Str, Class) \
10022 case llvm::omp::Clause::Enum: \
10024#define CLAUSE_NO_CLASS(Enum, Str) \
10025 case llvm::omp::Clause::Enum: \
10027#include "llvm/Frontend/OpenMP/OMP.inc"
10036template <
typename T>
using const_ptr = std::add_pointer_t<std::add_const_t<T>>;
10038template <
class ImplClass,
typename RetTy =
void>
10041template<
class ImplClass,
typename RetTy =
void>
10047 const PrintingPolicy &Policy;
10048 llvm::omp::Version Version;
10051 template <
typename T>
void VisitOMPClauseList(T *Node,
char StartSym);
10053 template <
typename T>
void VisitOMPMotionClause(T *Node);
10057 llvm::omp::Version OpenMPVersion)
10058 : OS(OS), Policy(Policy), Version(OpenMPVersion) {}
10060#define GEN_CLANG_CLAUSE_CLASS
10061#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
10062#include "llvm/Frontend/OpenMP/OMP.inc"
10066 llvm::omp::TraitProperty
Kind = llvm::omp::TraitProperty::invalid;
10075 llvm::omp::TraitSelector
Kind = llvm::omp::TraitSelector::invalid;
10080 llvm::omp::TraitSet
Kind = llvm::omp::TraitSet::invalid;
10089class OMPTraitInfo {
10096 OMPTraitInfo(StringRef MangledName);
10102 llvm::function_ref<
bool(Expr *&,
bool )> Cond) {
10104 return llvm::any_of(
10106 return Cond(Selector.ScoreOrCondition,
10108 llvm::omp::TraitSelector::user_condition);
10118 void getAsVariantMatchInfo(
ASTContext &ASTCtx,
10119 llvm::omp::VariantMatchInfo &VMI)
const;
10122 std::string getMangledName()
const;
10127 if (Set.Kind != llvm::omp::TraitSet::implementation)
10130 if (Selector.
Kind != llvm::omp::TraitSelector::implementation_extension)
10133 if (Property.Kind == TP)
10142 void print(llvm::raw_ostream &OS,
const PrintingPolicy &Policy)
const;
10151 const FunctionDecl *CurrentFunctionDecl,
10163 llvm::StringMap<bool> FeatureMap;
10169class OMPChildren final
10170 :
private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
10171 friend TrailingObjects;
10177 unsigned NumClauses = 0;
10179 unsigned NumChildren = 0;
10181 bool HasAssociatedStmt =
false;
10185 size_t numTrailingObjects(OverloadToken<OMPClause *>)
const {
10191 OMPChildren(
unsigned NumClauses,
unsigned NumChildren,
bool HasAssociatedStmt)
10192 : NumClauses(NumClauses), NumChildren(NumChildren),
10193 HasAssociatedStmt(HasAssociatedStmt) {}
10195 static size_t size(
unsigned NumClauses,
bool HasAssociatedStmt,
10196 unsigned NumChildren);
10198 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses);
10199 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses, Stmt *S,
10200 unsigned NumChildren = 0);
10201 static OMPChildren *
CreateEmpty(
void *Mem,
unsigned NumClauses,
10202 bool HasAssociatedStmt =
false,
10203 unsigned NumChildren = 0);
10212 getTrailingObjects<Stmt *>()[NumChildren] = S;
10228 assert(HasAssociatedStmt &&
10229 "Expected directive with the associated statement.");
10230 return getTrailingObjects<Stmt *>()[NumChildren];
10235 return getTrailingObjects<OMPClause *>(NumClauses);
10238 return const_cast<OMPChildren *
>(
this)->
getClauses();
10245 const CapturedStmt *
10248 assert(llvm::is_contained(CaptureRegions, RegionKind) &&
10249 "RegionKind not found in OpenMP CaptureRegions.");
10251 for (
auto ThisCaptureRegion : CaptureRegions) {
10252 if (ThisCaptureRegion == RegionKind)
10254 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10256 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
10263 assert(!CaptureRegions.empty() &&
10264 "At least one captured statement must be provided.");
10266 for (
unsigned Level = CaptureRegions.size(); Level > 1; --Level)
10267 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10271 const CapturedStmt *
10277 MutableArrayRef<Stmt *> getChildren();
10279 return const_cast<OMPChildren *
>(
this)->
getChildren();
10283 assert(HasAssociatedStmt &&
10284 "Expected directive with the associated statement.");
10288 S = CS->getCapturedStmt();
10289 CS = dyn_cast<CapturedStmt>(S);
10296 return const_cast<OMPChildren *
>(
this)->
getRawStmt();
10300 if (!HasAssociatedStmt)
10301 return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator());
10302 return Stmt::child_range(&getTrailingObjects<Stmt *>()[NumChildren],
10303 &getTrailingObjects<Stmt *>()[NumChildren + 1]);
10314 :
public OMPOneStmtClause<llvm::omp::OMPC_ompx_dyn_cgroup_mem, OMPClause>,
10319 void setSize(Expr *E) { setStmt(E); }
10331 OpenMPDirectiveKind CaptureRegion,
10332 SourceLocation StartLoc, SourceLocation LParenLoc,
10333 SourceLocation EndLoc)
10336 setPreInitStmt(HelperSize, CaptureRegion);
10359 SourceLocation LParenLoc;
10362 enum { SIMPLE, FALLBACK, NUM_MODIFIERS };
10363 unsigned Modifiers[NUM_MODIFIERS];
10366 SourceLocation ModifiersLoc[NUM_MODIFIERS];
10369 Expr *Size =
nullptr;
10374 void setDynGroupprivateModifier(OpenMPDynGroupprivateClauseModifier M) {
10375 Modifiers[SIMPLE] = M;
10381 void setDynGroupprivateFallbackModifier(
10382 OpenMPDynGroupprivateClauseFallbackModifier M) {
10383 Modifiers[FALLBACK] = M;
10387 void setDynGroupprivateModifierLoc(SourceLocation Loc) {
10388 ModifiersLoc[SIMPLE] = Loc;
10392 void setDynGroupprivateFallbackModifierLoc(SourceLocation Loc) {
10393 ModifiersLoc[FALLBACK] = Loc;
10399 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
10404 void setSize(Expr *E) {
Size = E; }
10418 SourceLocation EndLoc, Expr *Size, Stmt *HelperSize,
10419 OpenMPDirectiveKind CaptureRegion,
10420 OpenMPDynGroupprivateClauseModifier M1,
10421 SourceLocation M1Loc,
10422 OpenMPDynGroupprivateClauseFallbackModifier M2,
10423 SourceLocation M2Loc)
10424 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
10426 setPreInitStmt(HelperSize, CaptureRegion);
10427 Modifiers[SIMPLE] = M1;
10428 Modifiers[FALLBACK] = M2;
10429 ModifiersLoc[SIMPLE] = M1Loc;
10430 ModifiersLoc[FALLBACK] = M2Loc;
10435 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
10438 Modifiers[SIMPLE] = OMPC_DYN_GROUPPRIVATE_unknown;
10439 Modifiers[FALLBACK] = OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown;
10444 return static_cast<OpenMPDynGroupprivateClauseModifier
>(Modifiers[SIMPLE]);
10448 OpenMPDynGroupprivateClauseFallbackModifier
10450 return static_cast<OpenMPDynGroupprivateClauseFallbackModifier
>(
10451 Modifiers[FALLBACK]);
10459 return ModifiersLoc[SIMPLE];
10464 return ModifiersLoc[FALLBACK];
10474 return child_range(
reinterpret_cast<Stmt **
>(&Size),
10475 reinterpret_cast<Stmt **
>(&Size) + 1);
10483 return child_range(child_iterator(), child_iterator());
10486 return const_child_range(const_child_iterator(), const_child_iterator());
10490 return T->getClauseKind() == llvm::omp::OMPC_dyn_groupprivate;
10502class OMPDoacrossClause final
10503 :
public OMPVarListClause<OMPDoacrossClause>,
10504 private llvm::TrailingObjects<OMPDoacrossClause, Expr *> {
10506 friend OMPVarListClause;
10507 friend TrailingObjects;
10510 OpenMPDoacrossClauseModifier DepType = OMPC_DOACROSS_unknown;
10513 SourceLocation DepLoc;
10516 SourceLocation ColonLoc;
10519 unsigned NumLoops = 0;
10528 OMPDoacrossClause(SourceLocation StartLoc, SourceLocation LParenLoc,
10529 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
10530 : OMPVarListClause<OMPDoacrossClause>(
llvm::omp::OMPC_doacross, StartLoc,
10531 LParenLoc, EndLoc, N),
10532 NumLoops(NumLoops) {}
10540 SourceLocation(), SourceLocation(),
10541 SourceLocation(), N),
10542 NumLoops(NumLoops) {}
10545 void setDependenceType(OpenMPDoacrossClauseModifier M) { DepType = M; }
10548 void setDependenceLoc(SourceLocation Loc) { DepLoc = Loc; }
10551 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
10565 static OMPDoacrossClause *
10566 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
10567 SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType,
10568 SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL,
10569 unsigned NumLoops);
10576 static OMPDoacrossClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
10577 unsigned NumLoops);
10592 void setLoopData(
unsigned NumLoop, Expr *Cnt);
10595 Expr *getLoopData(
unsigned NumLoop);
10596 const Expr *getLoopData(
unsigned NumLoop)
const;
10599 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
10600 reinterpret_cast<Stmt **
>(varlist_end()));
10604 return const_cast<OMPDoacrossClause *
>(
this)->
children();
10608 return child_range(child_iterator(), child_iterator());
10611 return const_child_range(const_child_iterator(), const_child_iterator());
10615 return T->getClauseKind() == llvm::omp::OMPC_doacross;
10630 SourceLocation LParenLoc;
10643 SourceLocation LParenLoc, SourceLocation EndLoc)
10644 :
OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Attrs(Attrs) {
10663 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.
OMPBindClause(OpenMPBindClauseKind K, SourceLocation KLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'bind' clause with kind K ('teams', 'parallel', or 'thread').
OMPBindClause()
Build an empty clause.
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()
const Expr * getDepobj() const
friend class OMPClauseReader
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range children() const
OMPDepobjClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depobj)
Build a 'depobj' clause.
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()
OMPDepobjClause()
Build an empty clause.
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.
friend class OMPClauseReader
OMPAlignClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Build 'align' clause with the given alignment.
Expr * getAlignment() const
Returns alignment.
OMPAlignClause()
Build an empty clause.
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
friend class OMPClauseReader
const_child_range children() const
Expr * getDepth() const
Returns the depth expression or nullptr if not set.
const_child_range used_children() const
OMPDepthClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depth)
Build an AST node for a 'depth' clause.
static bool classof(const OMPClause *T)
child_range used_children()
SourceLocation getLParenLoc() const
Returns the location of '('.
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.
OMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Build an AST node for a 'full' clause.
OMPFullClause()
Build an empty clause.
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
OMPLoopRangeClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc, Expr *First, Expr *Count)
Build a 'looprange' clause.
Expr * getFirst() const
Get looprange 'first' expression.
const_child_range used_children() const
OMPLoopRangeClause()
Build an empty clause for deserialization.
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
const_child_range used_children() const
OMPPartialClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Factor)
Build an AST node for a 'partial' clause.
SourceLocation getLParenLoc() const
Returns the location of '('.
const_child_range children() const
static bool classof(const OMPClause *T)
OMPPartialClause()
Build an empty clause.
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)