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"
74class OMPAdjustArgsDescriptor final
75 :
private llvm::TrailingObjects<OMPAdjustArgsDescriptor,
77 friend TrailingObjects;
91 static OMPAdjustArgsDescriptor *
97 return {getTrailingObjects(), NumItems};
118 : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
159template <OpenMPClauseKind ClauseKind>
166 :
OMPClause(ClauseKind, StartLoc, EndLoc) {}
188 return T->getClauseKind() == ClauseKind;
192template <OpenMPClauseKind ClauseKind,
class Base>
207 :
Base(ClauseKind, StartLoc, EndLoc), LParenLoc(LParenLoc), S(S) {}
212 template <
typename T>
T *
getStmtAs()
const {
return cast_or_null<T>(S); }
238 return T->getClauseKind() == ClauseKind;
248 Stmt *PreInit =
nullptr;
255 assert(
get(
This) &&
"get is not tuned for pre-init.");
263 CaptureRegion = ThisRegion;
286 Expr *PostUpdate =
nullptr;
290 assert(
get(
This) &&
"get is not tuned for post-update.");
343 :
OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
347 return static_cast<T *
>(
this)->
template getTrailingObjectsNonStrict<Expr *>(
353 assert(VL.size() == NumVars &&
354 "Number of variables is not the same as the preallocated buffer");
383 return static_cast<const T *
>(
this)
384 ->
template getTrailingObjectsNonStrict<Expr *>(NumVars);
409 :
OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc),
428 return static_cast<T *
>(
this)
429 ->
template getTrailingObjectsNonStrict<OpenMPDirectiveKind>(
NumKinds);
435 "Number of directive kinds is not the same as the preallocated buffer");
519class OMPAllocateClause final
520 :
public OMPVarListClause<OMPAllocateClause>,
521 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
523 friend OMPVarListClause;
524 friend TrailingObjects;
528 Expr *Allocator =
nullptr;
531 Expr *Alignment =
nullptr;
542 enum { FIRST, SECOND, NUM_MODIFIERS };
552 Modifiers[FIRST] = M;
558 void setSecondAllocateModifier(OpenMPAllocateClauseModifier M) {
559 Modifiers[SECOND] = M;
563 void setFirstAllocateModifierLoc(SourceLocation Loc) {
564 ModifiersLoc[FIRST] = Loc;
568 void setSecondAllocateModifierLoc(SourceLocation Loc) {
569 ModifiersLoc[SECOND] = Loc;
582 OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
583 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
585 SourceLocation Modifier1Loc,
587 SourceLocation Modifier2Loc, SourceLocation EndLoc,
589 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
590 LParenLoc, EndLoc, N),
591 Allocator(Allocator), Alignment(Alignment), ColonLoc(ColonLoc) {
592 Modifiers[FIRST] = Modifier1;
593 Modifiers[SECOND] = Modifier2;
594 ModifiersLoc[FIRST] = Modifier1Loc;
595 ModifiersLoc[SECOND] = Modifier2Loc;
601 explicit OMPAllocateClause(
unsigned N)
602 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
603 SourceLocation(), SourceLocation(),
604 SourceLocation(), N) {
610 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
612 void setAllocator(Expr *A) { Allocator = A; }
614 AllocatorModifier = AM;
616 void setAlignment(Expr *A) { Alignment = A; }
630 static OMPAllocateClause *
631 Create(
const ASTContext &
C, SourceLocation StartLoc, SourceLocation LParenLoc,
632 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
635 SourceLocation EndLoc, ArrayRef<Expr *> VL);
645 return AllocatorModifier;
650 return Modifiers[FIRST];
655 return ModifiersLoc[FIRST];
660 return Modifiers[SECOND];
665 return ModifiersLoc[SECOND];
672 return AllocatorModifierLoc;
687 return const_cast<OMPAllocateClause *
>(
this)->
children();
698 return T->getClauseKind() == llvm::omp::OMPC_allocate;
716 Stmt *Condition =
nullptr;
728 void setCondition(
Expr *Cond) { Condition = Cond; }
734 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
737 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
758 ColonLoc(ColonLoc), NameModifier(NameModifier),
759 NameModifierLoc(NameModifierLoc) {
798 return T->getClauseKind() == llvm::omp::OMPC_if;
868class OMPNumThreadsClause final
871 private llvm::TrailingObjects<OMPNumThreadsClause, Expr *> {
873 friend TrailingObjects;
878 enum { PRESCRIPTIVENESS, DIMS, NUM_MODIFIERS };
885 SourceLocation ModifiersLoc[NUM_MODIFIERS];
894 OMPNumThreadsClause(
const ASTContext &
C, SourceLocation StartLoc,
895 SourceLocation LParenLoc, SourceLocation EndLoc,
897 : OMPVarListClause<OMPNumThreadsClause>(
llvm::omp::OMPC_num_threads,
898 StartLoc, LParenLoc, EndLoc, N),
904 explicit OMPNumThreadsClause(
unsigned N)
906 llvm::omp::OMPC_num_threads, SourceLocation(), SourceLocation(),
907 SourceLocation(), N),
917 Modifiers[PRESCRIPTIVENESS] = M;
921 void setPrescriptivenessModifierLoc(SourceLocation Loc) {
922 ModifiersLoc[PRESCRIPTIVENESS] = Loc;
926 void setDimsModifierLoc(SourceLocation Loc) { ModifiersLoc[DIMS] = Loc; }
929 void setDimsModifierExpr(Expr *E) { *
varlist_end() = E; }
947 static OMPNumThreadsClause *
949 SourceLocation StartLoc, SourceLocation LParenLoc,
950 SourceLocation EndLoc, ArrayRef<Expr *> VL,
953 SourceLocation PrescriptivenessModifierLoc,
954 SourceLocation DimsModifierLoc, Expr *DimsModifierExpr, Stmt *PreInit);
960 static OMPNumThreadsClause *
CreateEmpty(
const ASTContext &
C,
unsigned N);
965 return const_cast<OMPNumThreadsClause *
>(
this)->
getNumThreads();
970 return Modifiers[PRESCRIPTIVENESS];
974 return ModifiersLoc[PRESCRIPTIVENESS];
979 return Modifiers[DIMS];
986 return Modifiers[DIMS] == OMPC_NUMTHREADS_dims;
1003 return const_cast<OMPNumThreadsClause *
>(
this)->
children();
1014 return T->getClauseKind() == llvm::omp::OMPC_num_threads;
1096class OMPSizesClause final
1098 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1100 friend class llvm::TrailingObjects<OMPSizesClause,
Expr *>;
1109 explicit OMPSizesClause(
int NumSizes)
1111 NumSizes(NumSizes) {}
1142 return getTrailingObjects(NumSizes);
1148 assert(VL.size() == NumSizes);
1155 reinterpret_cast<Stmt **
>(Sizes.end()));
1160 reinterpret_cast<Stmt *
const *
>(Sizes.end()));
1171 return T->getClauseKind() == llvm::omp::OMPC_sizes;
1181class OMPCountsClause final
1183 private llvm::TrailingObjects<OMPCountsClause, Expr *> {
1185 friend class llvm::TrailingObjects<OMPCountsClause,
Expr *>;
1191 unsigned NumCounts = 0;
1194 std::optional<unsigned> OmpFillIndex;
1200 explicit OMPCountsClause(
int NumCounts)
1202 NumCounts(NumCounts) {}
1206 void setOmpFillIndex(std::optional<unsigned> Idx) { OmpFillIndex = Idx; }
1207 void setOmpFillLoc(SourceLocation Loc) { OmpFillLoc = Loc; }
1210 void setCountsRefs(ArrayRef<Expr *> VL) {
1211 assert(VL.size() == NumCounts);
1223 static OMPCountsClause *
Create(
const ASTContext &
C, SourceLocation StartLoc,
1224 SourceLocation LParenLoc,
1225 SourceLocation EndLoc, ArrayRef<Expr *> Counts,
1226 std::optional<unsigned> FillIdx,
1227 SourceLocation FillLoc);
1233 static OMPCountsClause *
CreateEmpty(
const ASTContext &
C,
unsigned NumCounts);
1247 return getTrailingObjects(NumCounts);
1250 return getTrailingObjects(NumCounts);
1256 reinterpret_cast<Stmt **
>(Counts.end()));
1261 reinterpret_cast<Stmt *
const *
>(Counts.end()));
1271 return T->getClauseKind() == llvm::omp::OMPC_counts;
1283class OMPPermutationClause final
1285 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1298 assert(VL.size() == NumLoops &&
"Expecting one expression per loop");
1299 llvm::copy(VL, getTrailingObjects());
1306 NumLoops(NumLoops) {}
1316 static OMPPermutationClause *
1345 reinterpret_cast<Stmt **
>(Args.end()));
1350 reinterpret_cast<Stmt *
const *
>(Args.end()));
1361 return T->getClauseKind() == llvm::omp::OMPC_permutation;
1403 enum { FirstExpr, CountExpr, NumArgs };
1404 Stmt *Args[NumArgs] = {
nullptr,
nullptr};
1407 void setFirst(Expr *E) { Args[FirstExpr] = E; }
1410 void setCount(Expr *E) { Args[CountExpr] = E; }
1418 LParenLoc(LParenLoc), FirstLoc(FirstLoc), CountLoc(CountLoc) {
1455 return T->getClauseKind() == llvm::omp::OMPC_looprange;
1473 Stmt *Factor =
nullptr;
1476 void setFactor(
Expr *E) { Factor = E; }
1491 LParenLoc(LParenLoc), Factor(Factor) {}
1515 return T->getClauseKind() == llvm::omp::OMPC_partial;
1537 Stmt *Depth =
nullptr;
1540 explicit OMPDepthClause() :
OMPClause(
llvm::omp::OMPC_depth, {}, {}) {}
1543 void setDepth(Expr *E) { Depth = E; }
1546 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1558 LParenLoc(LParenLoc), Depth(Depth) {}
1579 return T->getClauseKind() == llvm::omp::OMPC_depth;
1633 llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
1647 void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
1652 void setDefaultKindKwLoc(
SourceLocation KLoc) { KindKwLoc = KLoc; }
1655 void setDefaultVariableCategory(OpenMPDefaultClauseVariableCategory VC) {
1659 void setDefaultVariableCategoryLocation(SourceLocation VCLoc) {
1660 this->VCLoc = VCLoc;
1676 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), VC(VC), VCLoc(VCLoc) {}
1715 return T->getClauseKind() == llvm::omp::OMPC_default;
1746 void setThreadsetKindLoc(
SourceLocation KLoc) { KindLoc = KLoc; }
1760 LParenLoc(LParenLoc), Kind(A), KindLoc(ALoc) {}
1795 return T->getClauseKind() == llvm::omp::OMPC_threadset;
1810class OMPTransparentClause final
1813 friend class OMPClauseReader;
1816 SourceLocation LParenLoc;
1819 Expr *ImpexType =
nullptr;
1822 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1824 void setImpexTypeKind(Expr *E) { ImpexType = E; }
1836 OMPTransparentClause(Expr *ImpexTypeKind, Stmt *HelperValStmt,
1837 OpenMPDirectiveKind CaptureRegion,
1838 SourceLocation StartLoc, SourceLocation LParenLoc,
1839 SourceLocation EndLoc)
1840 : OMPOneStmtClause(ImpexTypeKind, StartLoc, LParenLoc, EndLoc),
1841 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
1842 ImpexType(ImpexTypeKind) {
1843 setPreInitStmt(HelperValStmt, CaptureRegion);
1847 OMPTransparentClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
1850 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1853 Expr *getImpexType()
const {
return ImpexType; }
1856 return child_range(
reinterpret_cast<Stmt **
>(&ImpexType),
1857 reinterpret_cast<Stmt **
>(&ImpexType) + 1);
1860 const_child_range
children()
const {
1861 return const_cast<OMPTransparentClause *
>(
this)->
children();
1865 return child_range(child_iterator(), child_iterator());
1868 return const_child_range(const_child_iterator(), const_child_iterator());
1871 static bool classof(
const OMPClause *T) {
1872 return T->getClauseKind() == llvm::omp::OMPC_transparent;
1884class OMPProcBindClause :
public OMPClause {
1885 friend class OMPClauseReader;
1888 SourceLocation LParenLoc;
1891 llvm::omp::ProcBindKind
Kind = llvm::omp::OMP_PROC_BIND_unknown;
1894 SourceLocation KindKwLoc;
1899 void setProcBindKind(llvm::omp::ProcBindKind K) {
Kind = K; }
1904 void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1915 OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
1916 SourceLocation StartLoc, SourceLocation LParenLoc,
1917 SourceLocation EndLoc)
1918 : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc),
1919 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
1923 : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(),
1924 SourceLocation()) {}
1927 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1930 SourceLocation getLParenLoc()
const {
return LParenLoc; }
1933 llvm::omp::ProcBindKind getProcBindKind()
const {
return Kind; }
1936 SourceLocation getProcBindKindKwLoc()
const {
return KindKwLoc; }
1939 return child_range(child_iterator(), child_iterator());
1942 const_child_range
children()
const {
1943 return const_child_range(const_child_iterator(), const_child_iterator());
1947 return child_range(child_iterator(), child_iterator());
1950 return const_child_range(const_child_iterator(), const_child_iterator());
1953 static bool classof(
const OMPClause *T) {
1954 return T->getClauseKind() == llvm::omp::OMPC_proc_bind;
1966class OMPUnifiedAddressClause final
1969 friend class OMPClauseReader;
1974 OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
1975 : OMPNoChildClause(StartLoc, EndLoc) {}
1978 OMPUnifiedAddressClause() : OMPNoChildClause() {}
1989class OMPUnifiedSharedMemoryClause final :
public OMPClause {
1991 friend class OMPClauseReader;
1996 OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
1997 : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
2000 OMPUnifiedSharedMemoryClause()
2001 : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(),
2002 SourceLocation()) {}
2005 return child_range(child_iterator(), child_iterator());
2008 const_child_range
children()
const {
2009 return const_child_range(const_child_iterator(), const_child_iterator());
2013 return child_range(child_iterator(), child_iterator());
2016 return const_child_range(const_child_iterator(), const_child_iterator());
2019 static bool classof(
const OMPClause *T) {
2020 return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
2032class OMPReverseOffloadClause final :
public OMPClause {
2034 friend class OMPClauseReader;
2039 OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
2040 : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
2043 OMPReverseOffloadClause()
2044 : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(),
2045 SourceLocation()) {}
2048 return child_range(child_iterator(), child_iterator());
2051 const_child_range
children()
const {
2052 return const_child_range(const_child_iterator(), const_child_iterator());
2056 return child_range(child_iterator(), child_iterator());
2059 return const_child_range(const_child_iterator(), const_child_iterator());
2062 static bool classof(
const OMPClause *T) {
2063 return T->getClauseKind() == llvm::omp::OMPC_reverse_offload;
2075class OMPDynamicAllocatorsClause final :
public OMPClause {
2077 friend class OMPClauseReader;
2082 OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2083 : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
2086 OMPDynamicAllocatorsClause()
2087 : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(),
2088 SourceLocation()) {}
2091 return child_range(child_iterator(), child_iterator());
2094 const_child_range
children()
const {
2095 return const_child_range(const_child_iterator(), const_child_iterator());
2099 return child_range(child_iterator(), child_iterator());
2102 return const_child_range(const_child_iterator(), const_child_iterator());
2105 static bool classof(
const OMPClause *T) {
2106 return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
2118class OMPAtomicDefaultMemOrderClause final :
public OMPClause {
2119 friend class OMPClauseReader;
2122 SourceLocation LParenLoc;
2129 SourceLocation KindKwLoc;
2134 void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
2141 void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
2154 OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
2155 SourceLocation ALoc, SourceLocation StartLoc,
2156 SourceLocation LParenLoc,
2157 SourceLocation EndLoc)
2158 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
2159 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2162 OMPAtomicDefaultMemOrderClause()
2163 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(),
2164 SourceLocation()) {}
2167 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2170 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2178 SourceLocation getAtomicDefaultMemOrderKindKwLoc()
const {
return KindKwLoc; }
2181 return child_range(child_iterator(), child_iterator());
2184 const_child_range
children()
const {
2185 return const_child_range(const_child_iterator(), const_child_iterator());
2189 return child_range(child_iterator(), child_iterator());
2192 return const_child_range(const_child_iterator(), const_child_iterator());
2195 static bool classof(
const OMPClause *T) {
2196 return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
2208class OMPSelfMapsClause final :
public OMPClause {
2210 friend class OMPClauseReader;
2215 OMPSelfMapsClause(SourceLocation StartLoc, SourceLocation EndLoc)
2216 : OMPClause(llvm::omp::OMPC_self_maps, StartLoc, EndLoc) {}
2220 : OMPClause(llvm::omp::OMPC_self_maps, SourceLocation(),
2221 SourceLocation()) {}
2224 return child_range(child_iterator(), child_iterator());
2227 const_child_range
children()
const {
2228 return const_child_range(const_child_iterator(), const_child_iterator());
2232 return child_range(child_iterator(), child_iterator());
2235 return const_child_range(const_child_iterator(), const_child_iterator());
2238 static bool classof(
const OMPClause *T) {
2239 return T->getClauseKind() == llvm::omp::OMPC_self_maps;
2250class OMPAtClause final :
public OMPClause {
2251 friend class OMPClauseReader;
2254 SourceLocation LParenLoc;
2260 SourceLocation KindKwLoc;
2265 void setAtKind(OpenMPAtClauseKind K) {
Kind = K; }
2270 void setAtKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2273 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2283 OMPAtClause(OpenMPAtClauseKind A, SourceLocation ALoc,
2284 SourceLocation StartLoc, SourceLocation LParenLoc,
2285 SourceLocation EndLoc)
2286 : OMPClause(llvm::omp::OMPC_at, StartLoc, EndLoc), LParenLoc(LParenLoc),
2287 Kind(A), KindKwLoc(ALoc) {}
2291 : OMPClause(llvm::omp::OMPC_at, SourceLocation(), SourceLocation()) {}
2294 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2300 SourceLocation getAtKindKwLoc()
const {
return KindKwLoc; }
2303 return child_range(child_iterator(), child_iterator());
2306 const_child_range
children()
const {
2307 return const_child_range(const_child_iterator(), const_child_iterator());
2311 return child_range(child_iterator(), child_iterator());
2314 return const_child_range(const_child_iterator(), const_child_iterator());
2317 static bool classof(
const OMPClause *T) {
2318 return T->getClauseKind() == llvm::omp::OMPC_at;
2330class OMPSeverityClause final :
public OMPClause {
2331 friend class OMPClauseReader;
2334 SourceLocation LParenLoc;
2340 SourceLocation KindKwLoc;
2345 void setSeverityKind(OpenMPSeverityClauseKind K) {
Kind = K; }
2350 void setSeverityKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
2353 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2363 OMPSeverityClause(OpenMPSeverityClauseKind A, SourceLocation ALoc,
2364 SourceLocation StartLoc, SourceLocation LParenLoc,
2365 SourceLocation EndLoc)
2366 : OMPClause(llvm::omp::OMPC_severity, StartLoc, EndLoc),
2367 LParenLoc(LParenLoc),
Kind(A), KindKwLoc(ALoc) {}
2371 : OMPClause(llvm::omp::OMPC_severity, SourceLocation(),
2372 SourceLocation()) {}
2375 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2381 SourceLocation getSeverityKindKwLoc()
const {
return KindKwLoc; }
2384 return child_range(child_iterator(), child_iterator());
2387 const_child_range
children()
const {
2388 return const_child_range(const_child_iterator(), const_child_iterator());
2392 return child_range(child_iterator(), child_iterator());
2395 return const_child_range(const_child_iterator(), const_child_iterator());
2398 static bool classof(
const OMPClause *T) {
2399 return T->getClauseKind() == llvm::omp::OMPC_severity;
2411class OMPMessageClause final
2414 friend class OMPClauseReader;
2417 void setMessageString(Expr *MS) { setStmt(MS); }
2429 OMPMessageClause(Expr *MS, Stmt *HelperMS, OpenMPDirectiveKind CaptureRegion,
2430 SourceLocation StartLoc, SourceLocation LParenLoc,
2431 SourceLocation EndLoc)
2432 : OMPOneStmtClause(MS, StartLoc, LParenLoc, EndLoc),
2433 OMPClauseWithPreInit(this) {
2434 setPreInitStmt(HelperMS, CaptureRegion);
2438 OMPMessageClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
2441 Expr *getMessageString()
const {
return getStmtAs<Expr>(); }
2444 std::optional<std::string> tryEvaluateString(ASTContext &Ctx)
const {
2445 if (Expr *MessageExpr = getMessageString())
2446 return MessageExpr->tryEvaluateString(Ctx);
2447 return std::nullopt;
2459 friend class OMPClauseReader;
2462 SourceLocation LParenLoc;
2468 enum {FIRST, SECOND, NUM_MODIFIERS};
2472 SourceLocation ModifiersLoc[NUM_MODIFIERS];
2475 SourceLocation KindLoc;
2478 SourceLocation CommaLoc;
2481 Expr *ChunkSize =
nullptr;
2486 void setScheduleKind(OpenMPScheduleClauseKind K) {
Kind = K; }
2491 void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) {
2492 Modifiers[FIRST] = M;
2498 void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) {
2499 Modifiers[SECOND] = M;
2503 void setFirstScheduleModifierLoc(SourceLocation Loc) {
2504 ModifiersLoc[FIRST] = Loc;
2508 void setSecondScheduleModifierLoc(SourceLocation Loc) {
2509 ModifiersLoc[SECOND] = Loc;
2515 void setScheduleModifer(OpenMPScheduleClauseModifier M) {
2516 if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown)
2517 Modifiers[FIRST] = M;
2519 assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown);
2520 Modifiers[SECOND] = M;
2527 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2532 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
2537 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
2542 void setChunkSize(Expr *E) { ChunkSize = E; }
2560 OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2561 SourceLocation KLoc, SourceLocation CommaLoc,
2562 SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
2563 Expr *ChunkSize, Stmt *HelperChunkSize,
2564 OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
2565 OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
2566 : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc),
2567 OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
Kind(
Kind),
2568 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
2569 setPreInitStmt(HelperChunkSize);
2570 Modifiers[FIRST] = M1;
2571 Modifiers[SECOND] = M2;
2572 ModifiersLoc[FIRST] = M1Loc;
2573 ModifiersLoc[SECOND] = M2Loc;
2577 explicit OMPScheduleClause()
2578 : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()),
2579 OMPClauseWithPreInit(this) {
2589 return Modifiers[FIRST];
2594 return Modifiers[SECOND];
2598 SourceLocation getLParenLoc() {
return LParenLoc; }
2601 SourceLocation getScheduleKindLoc() {
return KindLoc; }
2604 SourceLocation getFirstScheduleModifierLoc()
const {
2605 return ModifiersLoc[FIRST];
2609 SourceLocation getSecondScheduleModifierLoc()
const {
2610 return ModifiersLoc[SECOND];
2614 SourceLocation getCommaLoc() {
return CommaLoc; }
2617 Expr *getChunkSize() {
return ChunkSize; }
2620 const Expr *getChunkSize()
const {
return ChunkSize; }
2623 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
2624 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
2627 const_child_range
children()
const {
2628 return const_cast<OMPScheduleClause *
>(
this)->
children();
2632 return child_range(child_iterator(), child_iterator());
2635 return const_child_range(const_child_iterator(), const_child_iterator());
2638 static bool classof(
const OMPClause *T) {
2639 return T->getClauseKind() == llvm::omp::OMPC_schedule;
2650class OMPOrderedClause final
2652 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
2653 friend class OMPClauseReader;
2654 friend TrailingObjects;
2657 SourceLocation LParenLoc;
2660 Stmt *NumForLoops =
nullptr;
2663 unsigned NumberOfLoops = 0;
2672 OMPOrderedClause(Expr *Num,
unsigned NumLoops, SourceLocation StartLoc,
2673 SourceLocation LParenLoc, SourceLocation EndLoc)
2674 : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc),
2675 LParenLoc(LParenLoc), NumForLoops(
Num), NumberOfLoops(NumLoops) {}
2678 explicit OMPOrderedClause(
unsigned NumLoops)
2679 : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()),
2680 NumberOfLoops(NumLoops) {}
2683 void setNumForLoops(Expr *Num) { NumForLoops =
Num; }
2693 static OMPOrderedClause *
Create(
const ASTContext &C, Expr *Num,
2694 unsigned NumLoops, SourceLocation StartLoc,
2695 SourceLocation LParenLoc,
2696 SourceLocation EndLoc);
2699 static OMPOrderedClause*
CreateEmpty(
const ASTContext &C,
unsigned NumLoops);
2702 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2705 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2708 Expr *getNumForLoops()
const {
return cast_or_null<Expr>(NumForLoops); }
2711 void setLoopNumIterations(
unsigned NumLoop, Expr *NumIterations);
2713 ArrayRef<Expr *> getLoopNumIterations()
const;
2716 void setLoopCounter(
unsigned NumLoop, Expr *Counter);
2718 Expr *getLoopCounter(
unsigned NumLoop);
2719 const Expr *getLoopCounter(
unsigned NumLoop)
const;
2721 child_range
children() {
return child_range(&NumForLoops, &NumForLoops + 1); }
2723 const_child_range
children()
const {
2724 return const_child_range(&NumForLoops, &NumForLoops + 1);
2728 return child_range(child_iterator(), child_iterator());
2731 return const_child_range(const_child_iterator(), const_child_iterator());
2734 static bool classof(
const OMPClause *T) {
2735 return T->getClauseKind() == llvm::omp::OMPC_ordered;
2746class OMPNowaitClause final :
public OMPClause {
2747 friend class OMPClauseReader;
2750 SourceLocation LParenLoc;
2756 void setCondition(Expr *Cond) {
Condition = Cond; }
2765 OMPNowaitClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
2766 SourceLocation EndLoc)
2767 : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
2768 LParenLoc(LParenLoc),
Condition(Cond) {}
2772 : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
2775 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2778 SourceLocation getLParenLoc()
const {
return LParenLoc; }
2781 Expr *getCondition()
const {
return cast_or_null<Expr>(Condition); }
2785 return child_range(&Condition, &Condition + 1);
2786 return child_range(child_iterator(), child_iterator());
2789 const_child_range
children()
const {
2791 return const_child_range(&Condition, &Condition + 1);
2792 return const_child_range(const_child_iterator(), const_child_iterator());
2797 return const_cast<OMPNowaitClause *
>(
this)->
used_children();
2800 static bool classof(
const OMPClause *T) {
2801 return T->getClauseKind() == llvm::omp::OMPC_nowait;
2811class OMPUntiedClause :
public OMPClause {
2817 OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2818 : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {}
2822 : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), SourceLocation()) {}
2825 return child_range(child_iterator(), child_iterator());
2828 const_child_range
children()
const {
2829 return const_child_range(const_child_iterator(), const_child_iterator());
2833 return child_range(child_iterator(), child_iterator());
2836 return const_child_range(const_child_iterator(), const_child_iterator());
2839 static bool classof(
const OMPClause *T) {
2840 return T->getClauseKind() == llvm::omp::OMPC_untied;
2851class OMPMergeableClause :
public OMPClause {
2857 OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
2858 : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {}
2861 OMPMergeableClause()
2862 : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(),
2863 SourceLocation()) {}
2866 return child_range(child_iterator(), child_iterator());
2869 const_child_range
children()
const {
2870 return const_child_range(const_child_iterator(), const_child_iterator());
2874 return child_range(child_iterator(), child_iterator());
2877 return const_child_range(const_child_iterator(), const_child_iterator());
2880 static bool classof(
const OMPClause *T) {
2881 return T->getClauseKind() == llvm::omp::OMPC_mergeable;
2892class OMPAbsentClause final
2894 private llvm::TrailingObjects<OMPAbsentClause, OpenMPDirectiveKind> {
2895 friend OMPDirectiveListClause;
2896 friend TrailingObjects;
2904 OMPAbsentClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2905 SourceLocation EndLoc,
unsigned NumKinds)
2906 : OMPDirectiveListClause<OMPAbsentClause>(
2907 llvm::omp::OMPC_absent, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2910 OMPAbsentClause(
unsigned NumKinds)
2911 : OMPDirectiveListClause<OMPAbsentClause>(
2912 llvm::omp::OMPC_absent, SourceLocation(), SourceLocation(),
2913 SourceLocation(), NumKinds) {}
2916 static OMPAbsentClause *
Create(
const ASTContext &C,
2917 ArrayRef<OpenMPDirectiveKind> DKVec,
2918 SourceLocation Loc, SourceLocation LLoc,
2919 SourceLocation RLoc);
2921 static OMPAbsentClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2923 static bool classof(
const OMPClause *C) {
2924 return C->getClauseKind() == llvm::omp::OMPC_absent;
2935class OMPContainsClause final
2937 private llvm::TrailingObjects<OMPContainsClause, OpenMPDirectiveKind> {
2938 friend OMPDirectiveListClause;
2939 friend TrailingObjects;
2947 OMPContainsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2948 SourceLocation EndLoc,
unsigned NumKinds)
2949 : OMPDirectiveListClause<OMPContainsClause>(
2950 llvm::omp::OMPC_contains, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2953 OMPContainsClause(
unsigned NumKinds)
2954 : OMPDirectiveListClause<OMPContainsClause>(
2955 llvm::omp::OMPC_contains, SourceLocation(), SourceLocation(),
2956 SourceLocation(), NumKinds) {}
2959 static OMPContainsClause *
Create(
const ASTContext &C,
2960 ArrayRef<OpenMPDirectiveKind> DKVec,
2961 SourceLocation Loc, SourceLocation LLoc,
2962 SourceLocation RLoc);
2964 static OMPContainsClause *
CreateEmpty(
const ASTContext &C,
unsigned NumKinds);
2966 static bool classof(
const OMPClause *C) {
2967 return C->getClauseKind() == llvm::omp::OMPC_contains;
2978class OMPHoldsClause final
2980 friend class OMPClauseReader;
2987 OMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc,
2988 SourceLocation EndLoc)
2989 : OMPOneStmtClause(E, StartLoc, LParenLoc, EndLoc) {}
2992 OMPHoldsClause() : OMPOneStmtClause() {}
2994 Expr *getExpr()
const {
return getStmtAs<Expr>(); }
2995 void setExpr(Expr *E) { setStmt(E); }
3005class OMPNoOpenMPClause final
3012 OMPNoOpenMPClause(SourceLocation StartLoc, SourceLocation EndLoc)
3013 : OMPNoChildClause(StartLoc, EndLoc) {}
3016 OMPNoOpenMPClause() : OMPNoChildClause() {}
3027class OMPNoOpenMPRoutinesClause final
3034 OMPNoOpenMPRoutinesClause(SourceLocation StartLoc, SourceLocation EndLoc)
3035 : OMPNoChildClause(StartLoc, EndLoc) {}
3038 OMPNoOpenMPRoutinesClause() : OMPNoChildClause() {}
3049class OMPNoOpenMPConstructsClause final
3056 OMPNoOpenMPConstructsClause(SourceLocation StartLoc, SourceLocation EndLoc)
3057 : OMPNoChildClause(StartLoc, EndLoc) {}
3060 OMPNoOpenMPConstructsClause() : OMPNoChildClause() {}
3071class OMPNoParallelismClause final
3078 OMPNoParallelismClause(SourceLocation StartLoc, SourceLocation EndLoc)
3079 : OMPNoChildClause(StartLoc, EndLoc) {}
3082 OMPNoParallelismClause() : OMPNoChildClause() {}
3097 OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
3098 : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {}
3102 : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {}
3105 return child_range(child_iterator(), child_iterator());
3108 const_child_range
children()
const {
3109 return const_child_range(const_child_iterator(), const_child_iterator());
3113 return child_range(child_iterator(), child_iterator());
3116 return const_child_range(const_child_iterator(), const_child_iterator());
3119 static bool classof(
const OMPClause *T) {
3120 return T->getClauseKind() == llvm::omp::OMPC_read;
3130class OMPWriteClause :
public OMPClause {
3136 OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
3137 : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {}
3141 : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {}
3144 return child_range(child_iterator(), child_iterator());
3147 const_child_range
children()
const {
3148 return const_child_range(const_child_iterator(), const_child_iterator());
3152 return child_range(child_iterator(), child_iterator());
3155 return const_child_range(const_child_iterator(), const_child_iterator());
3158 static bool classof(
const OMPClause *T) {
3159 return T->getClauseKind() == llvm::omp::OMPC_write;
3170class OMPUpdateClause :
public OMPClause {
3176 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
3177 : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc) {}
3181 : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()) {}
3184 return child_range(child_iterator(), child_iterator());
3187 const_child_range
children()
const {
3188 return const_child_range(const_child_iterator(), const_child_iterator());
3192 return child_range(child_iterator(), child_iterator());
3195 return const_child_range(const_child_iterator(), const_child_iterator());
3198 static bool classof(
const OMPClause *T) {
3199 return T->getClauseKind() == llvm::omp::OMPC_update;
3211class OMPUpdateDependObjectsClause final
3213 private llvm::TrailingObjects<OMPUpdateDependObjectsClause,
3214 SourceLocation, OpenMPDependClauseKind> {
3215 friend class OMPClauseReader;
3216 friend TrailingObjects;
3220 size_t numTrailingObjects(OverloadToken<SourceLocation>)
const {
3226 void setLParenLoc(SourceLocation Loc) {
3227 *getTrailingObjects<SourceLocation>() = Loc;
3231 void setArgumentLoc(SourceLocation Loc) {
3232 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
3236 void setDependencyKind(OpenMPDependClauseKind DK) {
3237 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
3244 OMPUpdateDependObjectsClause(SourceLocation StartLoc, SourceLocation EndLoc)
3245 : OMPClause(llvm::omp::OMPC_update_depend_objects, StartLoc, EndLoc) {}
3248 OMPUpdateDependObjectsClause()
3249 : OMPClause(llvm::omp::OMPC_update_depend_objects, SourceLocation(),
3250 SourceLocation()) {}
3261 static OMPUpdateDependObjectsClause *
3262 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3263 SourceLocation ArgumentLoc, OpenMPDependClauseKind DK,
3264 SourceLocation EndLoc);
3269 static OMPUpdateDependObjectsClause *
CreateEmpty(
const ASTContext &C);
3272 return child_range(child_iterator(), child_iterator());
3275 const_child_range
children()
const {
3276 return const_child_range(const_child_iterator(), const_child_iterator());
3280 return child_range(child_iterator(), child_iterator());
3283 return const_child_range(const_child_iterator(), const_child_iterator());
3287 SourceLocation getLParenLoc()
const {
3288 return *getTrailingObjects<SourceLocation>();
3292 SourceLocation getArgumentLoc()
const {
3293 return *std::next(getTrailingObjects<SourceLocation>(), 1);
3298 return *getTrailingObjects<OpenMPDependClauseKind>();
3301 static bool classof(
const OMPClause *T) {
3302 return T->getClauseKind() == llvm::omp::OMPC_update_depend_objects;
3313class OMPCaptureClause :
public OMPClause {
3319 OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
3320 : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {}
3324 : OMPClause(llvm::omp::OMPC_capture, SourceLocation(), SourceLocation()) {
3328 return child_range(child_iterator(), child_iterator());
3331 const_child_range
children()
const {
3332 return const_child_range(const_child_iterator(), const_child_iterator());
3336 return child_range(child_iterator(), child_iterator());
3339 return const_child_range(const_child_iterator(), const_child_iterator());
3342 static bool classof(
const OMPClause *T) {
3343 return T->getClauseKind() == llvm::omp::OMPC_capture;
3354class OMPCompareClause final :
public OMPClause {
3360 OMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
3361 : OMPClause(llvm::omp::OMPC_compare, StartLoc, EndLoc) {}
3365 : OMPClause(llvm::omp::OMPC_compare, SourceLocation(), SourceLocation()) {
3369 return child_range(child_iterator(), child_iterator());
3372 const_child_range
children()
const {
3373 return const_child_range(const_child_iterator(), const_child_iterator());
3377 return child_range(child_iterator(), child_iterator());
3380 return const_child_range(const_child_iterator(), const_child_iterator());
3383 static bool classof(
const OMPClause *T) {
3384 return T->getClauseKind() == llvm::omp::OMPC_compare;
3395class OMPSeqCstClause :
public OMPClause {
3401 OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
3402 : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {}
3406 : OMPClause(llvm::omp::OMPC_seq_cst, SourceLocation(), SourceLocation()) {
3410 return child_range(child_iterator(), child_iterator());
3413 const_child_range
children()
const {
3414 return const_child_range(const_child_iterator(), const_child_iterator());
3418 return child_range(child_iterator(), child_iterator());
3421 return const_child_range(const_child_iterator(), const_child_iterator());
3424 static bool classof(
const OMPClause *T) {
3425 return T->getClauseKind() == llvm::omp::OMPC_seq_cst;
3436class OMPAcqRelClause final :
public OMPClause {
3442 OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
3443 : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {}
3447 : OMPClause(llvm::omp::OMPC_acq_rel, SourceLocation(), SourceLocation()) {
3451 return child_range(child_iterator(), child_iterator());
3454 const_child_range
children()
const {
3455 return const_child_range(const_child_iterator(), const_child_iterator());
3459 return child_range(child_iterator(), child_iterator());
3462 return const_child_range(const_child_iterator(), const_child_iterator());
3465 static bool classof(
const OMPClause *T) {
3466 return T->getClauseKind() == llvm::omp::OMPC_acq_rel;
3477class OMPAcquireClause final :
public OMPClause {
3483 OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
3484 : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {}
3488 : OMPClause(llvm::omp::OMPC_acquire, SourceLocation(), SourceLocation()) {
3492 return child_range(child_iterator(), child_iterator());
3495 const_child_range
children()
const {
3496 return const_child_range(const_child_iterator(), const_child_iterator());
3500 return child_range(child_iterator(), child_iterator());
3503 return const_child_range(const_child_iterator(), const_child_iterator());
3506 static bool classof(
const OMPClause *T) {
3507 return T->getClauseKind() == llvm::omp::OMPC_acquire;
3518class OMPReleaseClause final :
public OMPClause {
3524 OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
3525 : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {}
3529 : OMPClause(llvm::omp::OMPC_release, SourceLocation(), SourceLocation()) {
3533 return child_range(child_iterator(), child_iterator());
3536 const_child_range
children()
const {
3537 return const_child_range(const_child_iterator(), const_child_iterator());
3541 return child_range(child_iterator(), child_iterator());
3544 return const_child_range(const_child_iterator(), const_child_iterator());
3547 static bool classof(
const OMPClause *T) {
3548 return T->getClauseKind() == llvm::omp::OMPC_release;
3559class OMPRelaxedClause final :
public OMPClause {
3565 OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
3566 : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {}
3570 : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) {
3574 return child_range(child_iterator(), child_iterator());
3577 const_child_range
children()
const {
3578 return const_child_range(const_child_iterator(), const_child_iterator());
3582 return child_range(child_iterator(), child_iterator());
3585 return const_child_range(const_child_iterator(), const_child_iterator());
3588 static bool classof(
const OMPClause *T) {
3589 return T->getClauseKind() == llvm::omp::OMPC_relaxed;
3600class OMPWeakClause final :
public OMPClause {
3606 OMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
3607 : OMPClause(llvm::omp::OMPC_weak, StartLoc, EndLoc) {}
3611 : OMPClause(llvm::omp::OMPC_weak, SourceLocation(), SourceLocation()) {}
3614 return child_range(child_iterator(), child_iterator());
3617 const_child_range
children()
const {
3618 return const_child_range(const_child_iterator(), const_child_iterator());
3622 return child_range(child_iterator(), child_iterator());
3625 return const_child_range(const_child_iterator(), const_child_iterator());
3628 static bool classof(
const OMPClause *T) {
3629 return T->getClauseKind() == llvm::omp::OMPC_weak;
3640class OMPFailClause final :
public OMPClause {
3645 SourceLocation FailParameterLoc;
3646 SourceLocation LParenLoc;
3648 friend class OMPClauseReader;
3651 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
3654 void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
3657 void setFailParameter(OpenMPClauseKind FailParameter) {
3658 this->FailParameter = FailParameter;
3660 "Invalid fail clause parameter");
3668 OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
3669 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
3671 OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
3672 SourceLocation StartLoc, SourceLocation LParenLoc,
3673 SourceLocation EndLoc)
3674 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
3675 FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
3677 setFailParameter(FailParameter);
3682 : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
3685 return child_range(child_iterator(), child_iterator());
3688 const_child_range
children()
const {
3689 return const_child_range(const_child_iterator(), const_child_iterator());
3693 return child_range(child_iterator(), child_iterator());
3696 return const_child_range(const_child_iterator(), const_child_iterator());
3699 static bool classof(
const OMPClause *T) {
3700 return T->getClauseKind() == llvm::omp::OMPC_fail;
3704 SourceLocation getLParenLoc()
const {
3710 SourceLocation getFailParameterLoc()
const {
return FailParameterLoc; }
3723class OMPPrivateClause final
3725 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
3726 friend class OMPClauseReader;
3727 friend OMPVarListClause;
3728 friend TrailingObjects;
3736 OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3737 SourceLocation EndLoc,
unsigned N)
3738 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private, StartLoc,
3739 LParenLoc, EndLoc, N) {}
3744 explicit OMPPrivateClause(
unsigned N)
3745 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private,
3746 SourceLocation(), SourceLocation(),
3747 SourceLocation(), N) {}
3752 void setPrivateCopies(ArrayRef<Expr *> VL);
3756 MutableArrayRef<Expr *> getPrivateCopies() {
3757 return {varlist_end(), varlist_size()};
3759 ArrayRef<const Expr *> getPrivateCopies()
const {
3760 return {varlist_end(), varlist_size()};
3772 static OMPPrivateClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
3773 SourceLocation LParenLoc,
3774 SourceLocation EndLoc, ArrayRef<Expr *> VL,
3775 ArrayRef<Expr *> PrivateVL);
3781 static OMPPrivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3783 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3784 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3785 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3786 using private_copies_const_range =
3787 llvm::iterator_range<private_copies_const_iterator>;
3789 private_copies_range private_copies() {
return getPrivateCopies(); }
3791 private_copies_const_range private_copies()
const {
3792 return getPrivateCopies();
3796 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3797 reinterpret_cast<Stmt **
>(varlist_end()));
3800 const_child_range
children()
const {
3801 return const_cast<OMPPrivateClause *
>(
this)->
children();
3805 return child_range(child_iterator(), child_iterator());
3808 return const_child_range(const_child_iterator(), const_child_iterator());
3811 static bool classof(
const OMPClause *T) {
3812 return T->getClauseKind() == llvm::omp::OMPC_private;
3824class OMPFirstprivateClause final
3827 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
3828 friend class OMPClauseReader;
3829 friend OMPVarListClause;
3830 friend TrailingObjects;
3838 OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3839 SourceLocation EndLoc,
unsigned N)
3840 : OMPVarListClause<OMPFirstprivateClause>(llvm::omp::OMPC_firstprivate,
3841 StartLoc, LParenLoc, EndLoc, N),
3842 OMPClauseWithPreInit(this) {}
3847 explicit OMPFirstprivateClause(
unsigned N)
3848 : OMPVarListClause<OMPFirstprivateClause>(
3849 llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(),
3850 SourceLocation(), N),
3851 OMPClauseWithPreInit(this) {}
3856 void setPrivateCopies(ArrayRef<Expr *> VL);
3860 MutableArrayRef<Expr *> getPrivateCopies() {
3861 return {varlist_end(), varlist_size()};
3863 ArrayRef<const Expr *> getPrivateCopies()
const {
3864 return {varlist_end(), varlist_size()};
3870 void setInits(ArrayRef<Expr *> VL);
3874 MutableArrayRef<Expr *>
getInits() {
3875 return {getPrivateCopies().end(), varlist_size()};
3877 ArrayRef<const Expr *>
getInits()
const {
3878 return {getPrivateCopies().end(), varlist_size()};
3895 static OMPFirstprivateClause *
3896 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3897 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
3898 ArrayRef<Expr *> InitVL, Stmt *PreInit);
3904 static OMPFirstprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
3906 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3907 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3908 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3909 using private_copies_const_range =
3910 llvm::iterator_range<private_copies_const_iterator>;
3912 private_copies_range private_copies() {
return getPrivateCopies(); }
3913 private_copies_const_range private_copies()
const {
3914 return getPrivateCopies();
3919 using inits_range = llvm::iterator_range<inits_iterator>;
3926 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3927 reinterpret_cast<Stmt **
>(varlist_end()));
3930 const_child_range
children()
const {
3931 return const_cast<OMPFirstprivateClause *
>(
this)->
children();
3935 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
3936 reinterpret_cast<Stmt **
>(varlist_end()));
3939 return const_cast<OMPFirstprivateClause *
>(
this)->
used_children();
3942 static bool classof(
const OMPClause *T) {
3943 return T->getClauseKind() == llvm::omp::OMPC_firstprivate;
3955class OMPLastprivateClause final
3958 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
3975 friend class OMPClauseReader;
3976 friend OMPVarListClause;
3977 friend TrailingObjects;
3982 SourceLocation LPKindLoc;
3984 SourceLocation ColonLoc;
3992 OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3993 SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
3994 SourceLocation LPKindLoc, SourceLocation ColonLoc,
3996 : OMPVarListClause<OMPLastprivateClause>(llvm::omp::OMPC_lastprivate,
3997 StartLoc, LParenLoc, EndLoc, N),
3998 OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
3999 ColonLoc(ColonLoc) {}
4004 explicit OMPLastprivateClause(
unsigned N)
4005 : OMPVarListClause<OMPLastprivateClause>(
4006 llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(),
4007 SourceLocation(), N),
4008 OMPClauseWithPostUpdate(this) {}
4012 MutableArrayRef<Expr *> getPrivateCopies() {
4013 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
4015 ArrayRef<const Expr *> getPrivateCopies()
const {
4016 return {varlist_end(), varlist_size()};
4023 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4026 MutableArrayRef<Expr *> getSourceExprs() {
4027 return {getPrivateCopies().end(), varlist_size()};
4029 ArrayRef<const Expr *> getSourceExprs()
const {
4030 return {getPrivateCopies().end(), varlist_size()};
4037 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4040 MutableArrayRef<Expr *> getDestinationExprs() {
4041 return {getSourceExprs().end(), varlist_size()};
4043 ArrayRef<const Expr *> getDestinationExprs()
const {
4044 return {getSourceExprs().end(), varlist_size()};
4050 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4053 MutableArrayRef<Expr *> getAssignmentOps() {
4054 return {getDestinationExprs().end(), varlist_size()};
4056 ArrayRef<const Expr *> getAssignmentOps()
const {
4057 return {getDestinationExprs().end(), varlist_size()};
4061 void setKind(OpenMPLastprivateModifier Kind) { LPKind =
Kind; }
4063 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
4065 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4095 static OMPLastprivateClause *
4096 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4097 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4098 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
4099 OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
4100 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
4106 static OMPLastprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4111 SourceLocation getKindLoc()
const {
return LPKindLoc; }
4113 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4115 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4116 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4117 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4118 using helper_expr_const_range =
4119 llvm::iterator_range<helper_expr_const_iterator>;
4123 void setPrivateCopies(ArrayRef<Expr *> PrivateCopies);
4125 helper_expr_const_range private_copies()
const {
return getPrivateCopies(); }
4127 helper_expr_range private_copies() {
return getPrivateCopies(); }
4129 helper_expr_const_range source_exprs()
const {
return getSourceExprs(); }
4131 helper_expr_range source_exprs() {
return getSourceExprs(); }
4133 helper_expr_const_range destination_exprs()
const {
4134 return getDestinationExprs();
4137 helper_expr_range destination_exprs() {
return getDestinationExprs(); }
4139 helper_expr_const_range assignment_ops()
const {
return getAssignmentOps(); }
4141 helper_expr_range assignment_ops() {
return getAssignmentOps(); }
4144 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4145 reinterpret_cast<Stmt **
>(varlist_end()));
4148 const_child_range
children()
const {
4149 return const_cast<OMPLastprivateClause *
>(
this)->
children();
4153 return child_range(child_iterator(), child_iterator());
4156 return const_child_range(const_child_iterator(), const_child_iterator());
4159 static bool classof(
const OMPClause *T) {
4160 return T->getClauseKind() == llvm::omp::OMPC_lastprivate;
4171class OMPSharedClause final
4173 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
4174 friend OMPVarListClause;
4175 friend TrailingObjects;
4183 OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4184 SourceLocation EndLoc,
unsigned N)
4185 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared, StartLoc,
4186 LParenLoc, EndLoc, N) {}
4191 explicit OMPSharedClause(
unsigned N)
4192 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared,
4193 SourceLocation(), SourceLocation(),
4194 SourceLocation(), N) {}
4204 static OMPSharedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
4205 SourceLocation LParenLoc,
4206 SourceLocation EndLoc, ArrayRef<Expr *> VL);
4212 static OMPSharedClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4215 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4216 reinterpret_cast<Stmt **
>(varlist_end()));
4219 const_child_range
children()
const {
4220 return const_cast<OMPSharedClause *
>(
this)->
children();
4224 return child_range(child_iterator(), child_iterator());
4227 return const_child_range(const_child_iterator(), const_child_iterator());
4230 static bool classof(
const OMPClause *T) {
4231 return T->getClauseKind() == llvm::omp::OMPC_shared;
4243class OMPReductionClause final
4246 private llvm::TrailingObjects<OMPReductionClause, Expr *, bool> {
4247 friend class OMPClauseReader;
4248 friend OMPVarListClause;
4249 friend TrailingObjects;
4256 OMPC_ORIGINAL_SHARING_default;
4259 SourceLocation ModifierLoc;
4262 SourceLocation ColonLoc;
4265 NestedNameSpecifierLoc QualifierLoc;
4268 DeclarationNameInfo NameInfo;
4280 OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4281 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4282 SourceLocation EndLoc,
4283 OpenMPReductionClauseModifier Modifier,
4284 OpenMPOriginalSharingModifier OriginalSharingModifier,
4285 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4286 const DeclarationNameInfo &NameInfo)
4287 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4288 StartLoc, LParenLoc, EndLoc, N),
4289 OMPClauseWithPostUpdate(this), Modifier(Modifier),
4290 OriginalSharingModifier(OriginalSharingModifier),
4291 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
4292 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4297 explicit OMPReductionClause(
unsigned N)
4298 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
4299 SourceLocation(), SourceLocation(),
4300 SourceLocation(), N),
4301 OMPClauseWithPostUpdate(this) {}
4304 void setModifier(OpenMPReductionClauseModifier M) { Modifier = M; }
4307 void setOriginalSharingModifier(OpenMPOriginalSharingModifier M) {
4308 OriginalSharingModifier = M;
4315 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4318 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4321 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4330 return {varlist_end(), varlist_size()};
4333 return {varlist_end(), varlist_size()};
4339 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4342 MutableArrayRef<Expr *> getLHSExprs() {
4345 ArrayRef<const Expr *> getLHSExprs()
const {
4354 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4357 void setPrivateVariableReductionFlags(ArrayRef<bool> Flags) {
4358 assert(Flags.size() == varlist_size() &&
4359 "Number of private flags does not match vars");
4360 llvm::copy(Flags, getTrailingObjects<bool>());
4364 MutableArrayRef<bool> getPrivateVariableReductionFlags() {
4365 return getTrailingObjects<bool>(varlist_size());
4367 ArrayRef<bool> getPrivateVariableReductionFlags()
const {
4368 return getTrailingObjects<bool>(varlist_size());
4372 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
4373 return varlist_size() * (Modifier == OMPC_REDUCTION_inscan ? 8 : 5);
4377 size_t numTrailingObjects(OverloadToken<bool>)
const {
4378 return varlist_size();
4382 MutableArrayRef<Expr *> getRHSExprs() {
4383 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
4385 ArrayRef<const Expr *> getRHSExprs()
const {
4386 return {getLHSExprs().end(), varlist_size()};
4393 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4396 MutableArrayRef<Expr *> getReductionOps() {
4397 return {getRHSExprs().end(), varlist_size()};
4399 ArrayRef<const Expr *> getReductionOps()
const {
4400 return {getRHSExprs().end(), varlist_size()};
4405 void setInscanCopyOps(ArrayRef<Expr *> Ops);
4408 MutableArrayRef<Expr *> getInscanCopyOps() {
4409 return {getReductionOps().end(), varlist_size()};
4411 ArrayRef<const Expr *> getInscanCopyOps()
const {
4412 return {getReductionOps().end(), varlist_size()};
4416 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
4419 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
4420 return {getInscanCopyOps().end(), varlist_size()};
4422 ArrayRef<const Expr *> getInscanCopyArrayTemps()
const {
4423 return {getInscanCopyOps().end(), varlist_size()};
4427 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
4430 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
4431 return {getInscanCopyArrayTemps().end(), varlist_size()};
4433 ArrayRef<const Expr *> getInscanCopyArrayElems()
const {
4434 return {getInscanCopyArrayTemps().end(), varlist_size()};
4478 static OMPReductionClause *
4479 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4480 SourceLocation ModifierLoc, SourceLocation ColonLoc,
4481 SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier,
4482 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
4483 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4484 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4485 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
4486 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
4487 Stmt *PreInit, Expr *PostUpdate, ArrayRef<bool> IsPrivateVarReduction,
4488 OpenMPOriginalSharingModifier OriginalSharingModifier);
4495 static OMPReductionClause *
4497 OpenMPReductionClauseModifier Modifier);
4504 return OriginalSharingModifier;
4511 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4514 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4517 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4519 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4520 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4521 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4522 using helper_expr_const_range =
4523 llvm::iterator_range<helper_expr_const_iterator>;
4524 using helper_flag_iterator = MutableArrayRef<bool>::iterator;
4525 using helper_flag_const_iterator = ArrayRef<bool>::iterator;
4526 using helper_flag_range = llvm::iterator_range<helper_flag_iterator>;
4527 using helper_flag_const_range =
4528 llvm::iterator_range<helper_flag_const_iterator>;
4534 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4536 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4538 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4540 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4542 helper_flag_const_range private_var_reduction_flags()
const {
4543 return getPrivateVariableReductionFlags();
4546 helper_flag_range private_var_reduction_flags() {
4547 return getPrivateVariableReductionFlags();
4550 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4552 helper_expr_range reduction_ops() {
return getReductionOps(); }
4554 helper_expr_const_range copy_ops()
const {
return getInscanCopyOps(); }
4556 helper_expr_range copy_ops() {
return getInscanCopyOps(); }
4558 helper_expr_const_range copy_array_temps()
const {
4559 return getInscanCopyArrayTemps();
4562 helper_expr_range copy_array_temps() {
return getInscanCopyArrayTemps(); }
4564 helper_expr_const_range copy_array_elems()
const {
4565 return getInscanCopyArrayElems();
4568 helper_expr_range copy_array_elems() {
return getInscanCopyArrayElems(); }
4571 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4572 reinterpret_cast<Stmt **
>(varlist_end()));
4575 const_child_range
children()
const {
4576 return const_cast<OMPReductionClause *
>(
this)->
children();
4580 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4581 reinterpret_cast<Stmt **
>(varlist_end()));
4584 return const_cast<OMPReductionClause *
>(
this)->
used_children();
4587 static bool classof(
const OMPClause *T) {
4588 return T->getClauseKind() == llvm::omp::OMPC_reduction;
4600class OMPTaskReductionClause final
4603 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
4604 friend class OMPClauseReader;
4605 friend OMPVarListClause;
4606 friend TrailingObjects;
4609 SourceLocation ColonLoc;
4612 NestedNameSpecifierLoc QualifierLoc;
4615 DeclarationNameInfo NameInfo;
4626 OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4627 SourceLocation ColonLoc, SourceLocation EndLoc,
4628 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4629 const DeclarationNameInfo &NameInfo)
4630 : OMPVarListClause<OMPTaskReductionClause>(
4631 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
4632 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4633 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4638 explicit OMPTaskReductionClause(
unsigned N)
4639 : OMPVarListClause<OMPTaskReductionClause>(
4640 llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(),
4641 SourceLocation(), N),
4642 OMPClauseWithPostUpdate(this) {}
4645 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4648 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4651 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4659 return {varlist_end(), varlist_size()};
4662 return {varlist_end(), varlist_size()};
4668 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4671 MutableArrayRef<Expr *> getLHSExprs() {
4674 ArrayRef<const Expr *> getLHSExprs()
const {
4682 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4685 MutableArrayRef<Expr *> getRHSExprs() {
4686 return {getLHSExprs().end(), varlist_size()};
4688 ArrayRef<const Expr *> getRHSExprs()
const {
4689 return {getLHSExprs().end(), varlist_size()};
4696 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4699 MutableArrayRef<Expr *> getReductionOps() {
4700 return {getRHSExprs().end(), varlist_size()};
4702 ArrayRef<const Expr *> getReductionOps()
const {
4703 return {getRHSExprs().end(), varlist_size()};
4739 static OMPTaskReductionClause *
4740 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4741 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4742 NestedNameSpecifierLoc QualifierLoc,
4743 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4744 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4745 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
4751 static OMPTaskReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4754 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4757 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4760 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4762 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4763 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4764 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4765 using helper_expr_const_range =
4766 llvm::iterator_range<helper_expr_const_iterator>;
4772 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
4774 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
4776 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
4778 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
4780 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
4782 helper_expr_range reduction_ops() {
return getReductionOps(); }
4785 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
4786 reinterpret_cast<Stmt **
>(varlist_end()));
4789 const_child_range
children()
const {
4790 return const_cast<OMPTaskReductionClause *
>(
this)->
children();
4794 return child_range(child_iterator(), child_iterator());
4797 return const_child_range(const_child_iterator(), const_child_iterator());
4800 static bool classof(
const OMPClause *T) {
4801 return T->getClauseKind() == llvm::omp::OMPC_task_reduction;
4812class OMPInReductionClause final
4815 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
4816 friend class OMPClauseReader;
4817 friend OMPVarListClause;
4818 friend TrailingObjects;
4821 SourceLocation ColonLoc;
4824 NestedNameSpecifierLoc QualifierLoc;
4827 DeclarationNameInfo NameInfo;
4838 OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4839 SourceLocation ColonLoc, SourceLocation EndLoc,
4840 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4841 const DeclarationNameInfo &NameInfo)
4842 : OMPVarListClause<OMPInReductionClause>(llvm::omp::OMPC_in_reduction,
4843 StartLoc, LParenLoc, EndLoc, N),
4844 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4845 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4850 explicit OMPInReductionClause(
unsigned N)
4851 : OMPVarListClause<OMPInReductionClause>(
4852 llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(),
4853 SourceLocation(), N),
4854 OMPClauseWithPostUpdate(this) {}
4857 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4860 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4863 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4871 return {varlist_end(), varlist_size()};
4874 return {varlist_end(), varlist_size()};
4880 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4883 MutableArrayRef<Expr *> getLHSExprs() {
4886 ArrayRef<const Expr *> getLHSExprs()
const {
4894 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4897 MutableArrayRef<Expr *> getRHSExprs() {
4898 return {getLHSExprs().end(), varlist_size()};
4900 ArrayRef<const Expr *> getRHSExprs()
const {
4901 return {getLHSExprs().end(), varlist_size()};
4908 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4911 MutableArrayRef<Expr *> getReductionOps() {
4912 return {getRHSExprs().end(), varlist_size()};
4914 ArrayRef<const Expr *> getReductionOps()
const {
4915 return {getRHSExprs().end(), varlist_size()};
4919 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
4922 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
4923 return {getReductionOps().end(), varlist_size()};
4925 ArrayRef<const Expr *> getTaskgroupDescriptors()
const {
4926 return {getReductionOps().end(), varlist_size()};
4964 static OMPInReductionClause *
4965 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4966 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4967 NestedNameSpecifierLoc QualifierLoc,
4968 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4969 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4970 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
4971 Stmt *PreInit, Expr *PostUpdate);
4977 static OMPInReductionClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
4980 SourceLocation
getColonLoc()
const {
return ColonLoc; }
4983 const DeclarationNameInfo &getNameInfo()
const {
return NameInfo; }
4986 NestedNameSpecifierLoc getQualifierLoc()
const {
return QualifierLoc; }
4988 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4989 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4990 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4991 using helper_expr_const_range =
4992 llvm::iterator_range<helper_expr_const_iterator>;
4998 helper_expr_const_range lhs_exprs()
const {
return getLHSExprs(); }
5000 helper_expr_range lhs_exprs() {
return getLHSExprs(); }
5002 helper_expr_const_range rhs_exprs()
const {
return getRHSExprs(); }
5004 helper_expr_range rhs_exprs() {
return getRHSExprs(); }
5006 helper_expr_const_range reduction_ops()
const {
return getReductionOps(); }
5008 helper_expr_range reduction_ops() {
return getReductionOps(); }
5010 helper_expr_const_range taskgroup_descriptors()
const {
5011 return getTaskgroupDescriptors();
5014 helper_expr_range taskgroup_descriptors() {
5015 return getTaskgroupDescriptors();
5019 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5020 reinterpret_cast<Stmt **
>(varlist_end()));
5023 const_child_range
children()
const {
5024 return const_cast<OMPInReductionClause *
>(
this)->
children();
5028 return child_range(child_iterator(), child_iterator());
5031 return const_child_range(const_child_iterator(), const_child_iterator());
5034 static bool classof(
const OMPClause *T) {
5035 return T->getClauseKind() == llvm::omp::OMPC_in_reduction;
5047class OMPLinearClause final
5050 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
5051 friend class OMPClauseReader;
5052 friend OMPVarListClause;
5053 friend TrailingObjects;
5059 SourceLocation ModifierLoc;
5062 SourceLocation ColonLoc;
5065 SourceLocation StepModifierLoc;
5068 void setStep(Expr *Step) { *(
getFinals().end()) = Step; }
5071 void setCalcStep(Expr *CalcStep) { *(
getFinals().end() + 1) = CalcStep; }
5081 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5082 OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
5083 SourceLocation ColonLoc, SourceLocation StepModifierLoc,
5084 SourceLocation EndLoc,
unsigned NumVars)
5085 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
5086 LParenLoc, EndLoc, NumVars),
5087 OMPClauseWithPostUpdate(this), Modifier(Modifier),
5088 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
5089 StepModifierLoc(StepModifierLoc) {}
5094 explicit OMPLinearClause(
unsigned NumVars)
5095 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear,
5096 SourceLocation(), SourceLocation(),
5097 SourceLocation(), NumVars),
5098 OMPClauseWithPostUpdate(this) {}
5113 return {varlist_end(), varlist_size()};
5116 return {varlist_end(), varlist_size()};
5123 return {getPrivates().end(), varlist_size()};
5128 return {
getInits().end(), varlist_size()};
5131 return {getInits().end(), varlist_size()};
5139 return {getUpdates().end(), varlist_size()};
5144 return {
getFinals().end() + 2, varlist_size() + 1};
5147 return {getFinals().end() + 2, varlist_size() + 1};
5179 static OMPLinearClause *
5221 const Expr *getStep()
const {
return *(getFinals().end()); }
5227 const Expr *getCalcStep()
const {
return *(getFinals().end() + 1); }
5247 privates_const_range privates()
const {
return getPrivates(); }
5256 inits_const_range inits()
const {
return getInits(); }
5265 updates_const_range updates()
const {
return getUpdates(); }
5274 finals_const_range finals()
const {
return getFinals(); }
5279 llvm::iterator_range<used_expressions_iterator>;
5281 llvm::iterator_range<used_expressions_const_iterator>;
5287 used_expressions_const_range used_expressions()
const {
5288 return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
5292 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5293 reinterpret_cast<Stmt **
>(varlist_end()));
5296 const_child_range children()
const {
5297 return const_cast<OMPLinearClause *
>(
this)->children();
5303 return const_cast<OMPLinearClause *
>(
this)->
used_children();
5307 return T->getClauseKind() == llvm::omp::OMPC_linear;
5319class OMPAlignedClause final
5320 :
public OMPVarListClause<OMPAlignedClause>,
5321 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
5323 friend OMPVarListClause;
5324 friend TrailingObjects;
5327 SourceLocation ColonLoc;
5330 void setAlignment(Expr *A) { *varlist_end() = A; }
5340 SourceLocation ColonLoc, SourceLocation EndLoc,
5343 LParenLoc, EndLoc, NumVars),
5344 ColonLoc(ColonLoc) {}
5349 explicit OMPAlignedClause(
unsigned NumVars)
5350 : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned,
5351 SourceLocation(), SourceLocation(),
5352 SourceLocation(), NumVars) {}
5364 static OMPAlignedClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5365 SourceLocation LParenLoc,
5366 SourceLocation ColonLoc,
5367 SourceLocation EndLoc, ArrayRef<Expr *> VL,
5374 static OMPAlignedClause *
CreateEmpty(
const ASTContext &C,
unsigned NumVars);
5389 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5390 reinterpret_cast<Stmt **
>(varlist_end()));
5394 return const_cast<OMPAlignedClause *
>(
this)->
children();
5398 return child_range(child_iterator(), child_iterator());
5401 return const_child_range(const_child_iterator(), const_child_iterator());
5405 return T->getClauseKind() == llvm::omp::OMPC_aligned;
5416class OMPCopyinClause final
5417 :
public OMPVarListClause<OMPCopyinClause>,
5418 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
5433 friend OMPVarListClause;
5434 friend TrailingObjects;
5442 OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5443 SourceLocation EndLoc,
unsigned N)
5444 : OMPVarListClause<OMPCopyinClause>(
llvm::omp::OMPC_copyin, StartLoc,
5445 LParenLoc, EndLoc, N) {}
5452 SourceLocation(), SourceLocation(),
5453 SourceLocation(), N) {}
5458 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5461 MutableArrayRef<Expr *> getSourceExprs() {
5462 return {varlist_end(), varlist_size()};
5464 ArrayRef<const Expr *> getSourceExprs()
const {
5465 return {varlist_end(), varlist_size()};
5471 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5474 MutableArrayRef<Expr *> getDestinationExprs() {
5475 return {getSourceExprs().end(), varlist_size()};
5477 ArrayRef<const Expr *> getDestinationExprs()
const {
5478 return {getSourceExprs().end(), varlist_size()};
5485 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5488 MutableArrayRef<Expr *> getAssignmentOps() {
5489 return {getDestinationExprs().end(), varlist_size()};
5491 ArrayRef<const Expr *> getAssignmentOps()
const {
5492 return {getDestinationExprs().end(), varlist_size()};
5517 static OMPCopyinClause *
5518 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5519 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5520 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5526 static OMPCopyinClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5532 llvm::iterator_range<helper_expr_const_iterator>;
5539 return getDestinationExprs();
5549 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5550 reinterpret_cast<Stmt **
>(varlist_end()));
5554 return const_cast<OMPCopyinClause *
>(
this)->
children();
5558 return child_range(child_iterator(), child_iterator());
5561 return const_child_range(const_child_iterator(), const_child_iterator());
5565 return T->getClauseKind() == llvm::omp::OMPC_copyin;
5577class OMPCopyprivateClause final
5578 :
public OMPVarListClause<OMPCopyprivateClause>,
5579 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
5581 friend OMPVarListClause;
5582 friend TrailingObjects;
5590 OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5591 SourceLocation EndLoc,
unsigned N)
5592 : OMPVarListClause<OMPCopyprivateClause>(
llvm::omp::OMPC_copyprivate,
5593 StartLoc, LParenLoc, EndLoc, N) {
5601 llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(),
5602 SourceLocation(), N) {}
5607 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5610 MutableArrayRef<Expr *> getSourceExprs() {
5611 return {varlist_end(), varlist_size()};
5613 ArrayRef<const Expr *> getSourceExprs()
const {
5614 return {varlist_end(), varlist_size()};
5620 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5623 MutableArrayRef<Expr *> getDestinationExprs() {
5624 return {getSourceExprs().end(), varlist_size()};
5626 ArrayRef<const Expr *> getDestinationExprs()
const {
5627 return {getSourceExprs().end(), varlist_size()};
5634 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5637 MutableArrayRef<Expr *> getAssignmentOps() {
5638 return {getDestinationExprs().end(), varlist_size()};
5640 ArrayRef<const Expr *> getAssignmentOps()
const {
5641 return {getDestinationExprs().end(), varlist_size()};
5665 static OMPCopyprivateClause *
5666 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5667 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5668 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5674 static OMPCopyprivateClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
5680 llvm::iterator_range<helper_expr_const_iterator>;
5687 return getDestinationExprs();
5697 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5698 reinterpret_cast<Stmt **
>(varlist_end()));
5702 return const_cast<OMPCopyprivateClause *
>(
this)->
children();
5706 return child_range(child_iterator(), child_iterator());
5709 return const_child_range(const_child_iterator(), const_child_iterator());
5713 return T->getClauseKind() == llvm::omp::OMPC_copyprivate;
5729class OMPFlushClause final
5730 :
public OMPVarListClause<OMPFlushClause>,
5731 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
5732 friend OMPVarListClause;
5733 friend TrailingObjects;
5741 OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5742 SourceLocation EndLoc,
unsigned N)
5743 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush, StartLoc,
5744 LParenLoc, EndLoc, N) {}
5749 explicit OMPFlushClause(
unsigned N)
5750 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush,
5751 SourceLocation(), SourceLocation(),
5752 SourceLocation(), N) {}
5762 static OMPFlushClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5763 SourceLocation LParenLoc, SourceLocation EndLoc,
5773 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5774 reinterpret_cast<Stmt **
>(varlist_end()));
5778 return const_cast<OMPFlushClause *
>(
this)->
children();
5782 return child_range(child_iterator(), child_iterator());
5785 return const_child_range(const_child_iterator(), const_child_iterator());
5789 return T->getClauseKind() == llvm::omp::OMPC_flush;
5809 SourceLocation LParenLoc;
5812 Expr *Depobj =
nullptr;
5814 void setDepobj(Expr *E) { Depobj = E; }
5817 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
5827 SourceLocation EndLoc, Expr *Depobj)
5829 LParenLoc(LParenLoc), Depobj(Depobj) {}
5833 :
OMPClause(
llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {}
5843 return child_range(
reinterpret_cast<Stmt **
>(&Depobj),
5844 reinterpret_cast<Stmt **
>(&Depobj) + 1);
5852 return child_range(child_iterator(), child_iterator());
5855 return const_child_range(const_child_iterator(), const_child_iterator());
5859 return T->getClauseKind() == llvm::omp::OMPC_depobj;
5871class OMPDependClause final
5872 :
public OMPVarListClause<OMPDependClause>,
5873 private llvm::TrailingObjects<OMPDependClause, Expr *> {
5875 friend OMPVarListClause;
5876 friend TrailingObjects;
5881 OpenMPDependClauseKind
DepKind = OMPC_DEPEND_unknown;
5898 unsigned NumLoops = 0;
5908 OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5909 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
5910 : OMPVarListClause<OMPDependClause>(
llvm::omp::OMPC_depend, StartLoc,
5911 LParenLoc, EndLoc, N),
5912 NumLoops(NumLoops) {}
5921 SourceLocation(), SourceLocation(),
5922 SourceLocation(), N),
5923 NumLoops(NumLoops) {}
5926 void setDependencyKind(OpenMPDependClauseKind K) {
Data.DepKind = K; }
5929 void setDependencyLoc(SourceLocation Loc) {
Data.DepLoc = Loc; }
5935 void setOmpAllMemoryLoc(SourceLocation Loc) {
Data.OmpAllMemoryLoc = Loc; }
5951 static OMPDependClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
5952 SourceLocation LParenLoc,
5953 SourceLocation EndLoc, DependDataTy Data,
5954 Expr *DepModifier, ArrayRef<Expr *> VL,
5963 static OMPDependClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
5979 Expr *getModifier();
5981 return const_cast<OMPDependClause *
>(
this)->
getModifier();
5989 void setLoopData(
unsigned NumLoop, Expr *Cnt);
5992 Expr *getLoopData(
unsigned NumLoop);
5993 const Expr *getLoopData(
unsigned NumLoop)
const;
5996 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
5997 reinterpret_cast<Stmt **
>(varlist_end()));
6001 return const_cast<OMPDependClause *
>(
this)->
children();
6005 return child_range(child_iterator(), child_iterator());
6008 return const_child_range(const_child_iterator(), const_child_iterator());
6012 return T->getClauseKind() == llvm::omp::OMPC_depend;
6028 SourceLocation LParenLoc;
6031 OpenMPDeviceClauseModifier Modifier = OMPC_DEVICE_unknown;
6034 SourceLocation ModifierLoc;
6037 Stmt *Device =
nullptr;
6042 void setDevice(Expr *E) { Device = E; }
6045 void setModifier(OpenMPDeviceClauseModifier M) { Modifier = M; }
6062 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
6063 SourceLocation LParenLoc, SourceLocation ModifierLoc,
6064 SourceLocation EndLoc)
6067 ModifierLoc(ModifierLoc), Device(E) {
6068 setPreInitStmt(HelperE, CaptureRegion);
6073 :
OMPClause(
llvm::omp::OMPC_device, SourceLocation(), SourceLocation()),
6094 child_range
children() {
return child_range(&Device, &Device + 1); }
6097 return const_child_range(&Device, &Device + 1);
6101 return child_range(child_iterator(), child_iterator());
6104 return const_child_range(const_child_iterator(), const_child_iterator());
6108 return T->getClauseKind() == llvm::omp::OMPC_device;
6149 :
OMPClause(
llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {}
6152 return child_range(child_iterator(), child_iterator());
6156 return const_child_range(const_child_iterator(), const_child_iterator());
6160 return child_range(child_iterator(), child_iterator());
6163 return const_child_range(const_child_iterator(), const_child_iterator());
6167 return T->getClauseKind() == llvm::omp::OMPC_simd;
6184 llvm::PointerIntPair<Expr *, 1, bool> AssociatedExpressionNonContiguousPr;
6189 ValueDecl *AssociatedDeclaration =
nullptr;
6194 ValueDecl *AssociatedDeclaration,
6195 bool IsNonContiguous)
6196 : AssociatedExpressionNonContiguousPr(AssociatedExpression,
6198 AssociatedDeclaration(
6199 AssociatedDeclaration
6204 return AssociatedExpressionNonContiguousPr.getPointer();
6208 return AssociatedExpressionNonContiguousPr.getInt();
6212 return AssociatedDeclaration;
6216 return AssociatedExpressionNonContiguousPr ==
6217 Other.AssociatedExpressionNonContiguousPr &&
6218 AssociatedDeclaration == Other.AssociatedDeclaration;
6258 static QualType getComponentExprElementType(
const Expr *Exp);
6318 static std::pair<const Expr *, std::optional<size_t>>
6319 findAttachPtrExpr(MappableExprComponentListRef Components,
6320 OpenMPDirectiveKind CurDirKind);
6325 getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists);
6361 unsigned NumUniqueDeclarations;
6364 unsigned NumComponentLists;
6367 unsigned NumComponents;
6372 const bool SupportsMapper;
6375 NestedNameSpecifierLoc MapperQualifierLoc;
6378 DeclarationNameInfo MapperIdInfo;
6400 OpenMPClauseKind K,
const OMPVarListLocTy &Locs,
6402 NestedNameSpecifierLoc *MapperQualifierLocPtr =
nullptr,
6403 DeclarationNameInfo *MapperIdInfoPtr =
nullptr)
6404 : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc,
6406 NumUniqueDeclarations(Sizes.NumUniqueDeclarations),
6407 NumComponentLists(Sizes.NumComponentLists),
6408 NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) {
6409 if (MapperQualifierLocPtr)
6410 MapperQualifierLoc = *MapperQualifierLocPtr;
6411 if (MapperIdInfoPtr)
6412 MapperIdInfo = *MapperIdInfoPtr;
6418 return static_cast<T *
>(
this)
6419 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6420 NumUniqueDeclarations);
6426 return static_cast<const T *
>(
this)
6427 ->
template getTrailingObjectsNonStrict<ValueDecl *>(
6428 NumUniqueDeclarations);
6434 assert(UDs.size() == NumUniqueDeclarations &&
6435 "Unexpected amount of unique declarations.");
6442 return static_cast<T *
>(
this)
6443 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6449 return static_cast<const T *
>(
this)
6450 ->
template getTrailingObjectsNonStrict<unsigned>(NumUniqueDeclarations);
6456 assert(DNLs.size() == NumUniqueDeclarations &&
6457 "Unexpected amount of list numbers.");
6464 return MutableArrayRef<unsigned>(
6465 static_cast<T *
>(
this)
6466 ->
template getTrailingObjectsNonStrict<unsigned>() +
6467 NumUniqueDeclarations,
6475 static_cast<const T *
>(
this)
6476 ->
template getTrailingObjectsNonStrict<unsigned>() +
6477 NumUniqueDeclarations,
6484 assert(CLSs.size() == NumComponentLists &&
6485 "Unexpected amount of component lists.");
6491 return static_cast<T *
>(
this)
6492 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6498 return static_cast<const T *
>(
this)
6499 ->
template getTrailingObjectsNonStrict<MappableComponent>(
6508 assert(Components.size() == NumComponents &&
6509 "Unexpected amount of component lists.");
6510 assert(CLSs.size() == NumComponentLists &&
6511 "Unexpected amount of list sizes.");
6522 NumUniqueDeclarations &&
6523 "Unexpected number of mappable expression info entries!");
6525 "Unexpected total number of components!");
6526 assert(Declarations.size() == ComponentLists.size() &&
6527 "Declaration and component lists size is not consistent!");
6528 assert(Declarations.size() == NumComponentLists &&
6529 "Unexpected declaration and component lists size!");
6534 llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>>
6537 auto CI = ComponentLists.begin();
6538 for (
auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE;
6540 assert(!CI->empty() &&
"Invalid component list!");
6541 ComponentListMap[*DI].push_back(*CI);
6547 auto UDI = UniqueDeclarations.begin();
6550 auto DNLI = DeclNumLists.begin();
6553 auto CLSI = ComponentListSizes.begin();
6556 auto CI = Components.begin();
6559 unsigned PrevSize = 0u;
6562 for (
auto &M : ComponentListMap) {
6579 PrevSize += C.size();
6586 CI = llvm::copy(C, CI);
6593 MapperQualifierLoc = NNSL;
6598 MapperIdInfo = MapperId;
6604 assert(SupportsMapper &&
6605 "Must be a clause that is possible to have user-defined mappers");
6606 return MutableArrayRef<Expr *>(
6607 static_cast<T *
>(
this)->
template getTrailingObjects<Expr *>() +
6608 OMPVarListClause<T>::varlist_size(),
6609 OMPVarListClause<T>::varlist_size());
6615 assert(SupportsMapper &&
6616 "Must be a clause that is possible to have user-defined mappers");
6618 static_cast<const T *
>(
this)->
template getTrailingObjects<Expr *>() +
6619 OMPVarListClause<T>::varlist_size(),
6620 OMPVarListClause<T>::varlist_size());
6626 assert(DMDs.size() == OMPVarListClause<T>::varlist_size() &&
6627 "Unexpected number of user-defined mappers.");
6628 assert(SupportsMapper &&
6629 "Must be a clause that is possible to have user-defined mappers");
6646 return MapperQualifierLoc;
6655 :
public llvm::iterator_adaptor_base<
6656 const_component_lists_iterator,
6657 MappableExprComponentListRef::const_iterator,
6658 std::forward_iterator_tag, MappableComponent, ptrdiff_t,
6659 MappableComponent, MappableComponent> {
6667 const bool SupportsMapper;
6673 unsigned RemainingLists = 0;
6677 unsigned PrevListSize = 0;
6685 MappableExprComponentListRef::const_iterator End;
6695 Components.begin()),
6696 DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()),
6697 SupportsMapper(SupportsMapper),
6698 ListSizeCur(CumulativeListSizes.begin()),
6699 ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) {
6700 assert(UniqueDecls.size() == DeclsListNum.size() &&
6701 "Inconsistent number of declarations and list sizes!");
6702 if (!DeclsListNum.empty())
6703 RemainingLists = *NumListsCur;
6705 MapperCur = Mappers.begin();
6716 CumulativeListSizes, Components,
6717 SupportsMapper, Mappers) {
6721 for (; DeclCur != UniqueDecls.end(); ++DeclCur, ++NumListsCur) {
6722 if (*DeclCur == Declaration)
6725 assert(*NumListsCur > 0 &&
"No lists associated with declaration??");
6729 std::advance(ListSizeCur, *NumListsCur - 1);
6730 PrevListSize = *ListSizeCur;
6739 if (ListSizeCur == CumulativeListSizes.end()) {
6741 RemainingLists = 0u;
6747 RemainingLists = *NumListsCur;
6750 ListSizeEnd = ListSizeCur;
6751 std::advance(ListSizeEnd, RemainingLists);
6755 std::advance(this->I, PrevListSize);
6763 assert(ListSizeCur != ListSizeEnd &&
"Invalid iterator!");
6764 const ValueDecl *Mapper =
nullptr;
6765 if (SupportsMapper && *MapperCur)
6766 Mapper = cast<ValueDecl>(cast<DeclRefExpr>(*MapperCur)->getDecl());
6767 return std::make_tuple(
6780 assert(ListSizeCur != ListSizeEnd && RemainingLists &&
6781 "Invalid iterator!");
6785 if (std::next(ListSizeCur) == ListSizeEnd) {
6789 std::advance(this->I, *ListSizeCur - PrevListSize);
6790 PrevListSize = *ListSizeCur;
6793 if (!(--RemainingLists)) {
6796 RemainingLists = *NumListsCur;
6797 assert(RemainingLists &&
"No lists in the following declaration??");
6809 llvm::iterator_range<const_component_lists_iterator>;
6823 SupportsMapper, {});
6831 const_component_lists_iterator
6854 llvm::iterator_range<const_all_num_lists_iterator>;
6862 llvm::iterator_range<const_all_lists_sizes_iterator>;
6870 llvm::iterator_range<const_all_components_iterator>;
6880 llvm::iterator_range<mapperlist_const_iterator>;
6906class OMPMapClause final :
public OMPMappableExprListClause<OMPMapClause>,
6907 private llvm::TrailingObjects<
6908 OMPMapClause, Expr *, ValueDecl *, unsigned,
6909 OMPClauseMappableExprCommon::MappableComponent> {
6911 friend OMPMappableExprListClause;
6912 friend OMPVarListClause;
6913 friend TrailingObjects;
6917 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
6920 return 2 * varlist_size() + 1;
6922 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
6923 return getUniqueDeclarationsNum();
6925 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
6926 return getUniqueDeclarationsNum() + getTotalComponentListNum();
6938 SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers];
6944 bool MapTypeIsImplicit =
false;
6947 SourceLocation MapLoc;
6950 SourceLocation ColonLoc;
6972 explicit OMPMapClause(ArrayRef<OpenMPMapModifierKind> MapModifiers,
6973 ArrayRef<SourceLocation> MapModifiersLoc,
6974 NestedNameSpecifierLoc MapperQualifierLoc,
6975 DeclarationNameInfo MapperIdInfo,
6976 OpenMPMapClauseKind MapType,
bool MapTypeIsImplicit,
6977 SourceLocation MapLoc,
const OMPVarListLocTy &Locs,
6978 const OMPMappableExprListSizeTy &Sizes)
6979 : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
6980 true, &MapperQualifierLoc,
6982 MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
6983 assert(std::size(MapTypeModifiers) == MapModifiers.size() &&
6984 "Unexpected number of map type modifiers.");
6985 llvm::copy(MapModifiers, std::begin(MapTypeModifiers));
6987 assert(std::size(MapTypeModifiersLoc) == MapModifiersLoc.size() &&
6988 "Unexpected number of map type modifier locations.");
6989 llvm::copy(MapModifiersLoc, std::begin(MapTypeModifiersLoc));
6999 explicit OMPMapClause(
const OMPMappableExprListSizeTy &Sizes)
7000 : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes,
7007 void setMapTypeModifier(
unsigned I, OpenMPMapModifierKind T) {
7008 assert(I < NumberOfOMPMapClauseModifiers &&
7009 "Unexpected index to store map type modifier, exceeds array size.");
7010 MapTypeModifiers[I] =
T;
7017 void setMapTypeModifierLoc(
unsigned I, SourceLocation TLoc) {
7018 assert(I < NumberOfOMPMapClauseModifiers &&
7019 "Index to store map type modifier location exceeds array size.");
7020 MapTypeModifiersLoc[I] = TLoc;
7026 void setMapType(OpenMPMapClauseKind T) { MapType =
T; }
7031 void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; }
7034 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
7037 void setIteratorModifier(Expr *IteratorModifier) {
7038 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
7062 static OMPMapClause *
7063 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
7064 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
7065 MappableExprComponentListsRef ComponentLists,
7066 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
7067 ArrayRef<OpenMPMapModifierKind> MapModifiers,
7068 ArrayRef<SourceLocation> MapModifiersLoc,
7069 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId,
7070 OpenMPMapClauseKind Type,
bool TypeIsImplicit, SourceLocation TypeLoc);
7082 static OMPMapClause *
CreateEmpty(
const ASTContext &C,
7083 const OMPMappableExprListSizeTy &Sizes);
7087 return getTrailingObjects<Expr *>()[2 * varlist_size()];
7091 OpenMPMapClauseKind
getMapType() const LLVM_READONLY {
return MapType; }
7104 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7105 "Requested modifier exceeds the total number of modifiers.");
7106 return MapTypeModifiers[Cnt];
7114 assert(Cnt < NumberOfOMPMapClauseModifiers &&
7115 "Requested modifier location exceeds total number of modifiers.");
7116 return MapTypeModifiersLoc[Cnt];
7121 return MapTypeModifiers;
7126 return MapTypeModifiersLoc;
7130 SourceLocation
getMapLoc() const LLVM_READONLY {
return MapLoc; }
7137 reinterpret_cast<Stmt **
>(varlist_begin()),
7138 reinterpret_cast<Stmt **
>(varlist_end()));
7142 return const_cast<OMPMapClause *
>(
this)->
children();
7146 if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_tofrom)
7147 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7148 reinterpret_cast<Stmt **
>(varlist_end()));
7149 return child_range(child_iterator(), child_iterator());
7157 return T->getClauseKind() == llvm::omp::OMPC_map;
7190class OMPNumTeamsClause final
7191 :
public OMPVarListClause<OMPNumTeamsClause>,
7193 private llvm::TrailingObjects<OMPNumTeamsClause, Expr *> {
7195 friend OMPVarListClause;
7196 friend TrailingObjects;
7199 OpenMPNumTeamsClauseModifier Modifier = OMPC_NUMTEAMS_unknown;
7202 SourceLocation ModifierLoc;
7204 OMPNumTeamsClause(
const ASTContext &C, SourceLocation StartLoc,
7205 SourceLocation LParenLoc, SourceLocation EndLoc,
unsigned N)
7206 : OMPVarListClause(
llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, EndLoc,
7212 : OMPVarListClause(
llvm::omp::OMPC_num_teams, SourceLocation(),
7213 SourceLocation(), SourceLocation(), N),
7217 void setModifier(OpenMPNumTeamsClauseModifier M) { Modifier = M; }
7220 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7237 static OMPNumTeamsClause *
7238 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7239 SourceLocation StartLoc, SourceLocation LParenLoc,
7240 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7241 OpenMPNumTeamsClauseModifier Modifier, Expr *ModifierExpr,
7242 SourceLocation ModifierLoc, Stmt *PreInit);
7248 static OMPNumTeamsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7255 return const_cast<OMPNumTeamsClause *
>(
this)->
getNumTeams();
7269 if (Modifier == OMPC_NUMTEAMS_dims)
7278 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7279 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7283 return const_cast<OMPNumTeamsClause *
>(
this)->
children();
7287 return child_range(child_iterator(), child_iterator());
7290 return const_child_range(const_child_iterator(), const_child_iterator());
7294 return T->getClauseKind() == llvm::omp::OMPC_num_teams;
7320class OMPThreadLimitClause final
7321 :
public OMPVarListClause<OMPThreadLimitClause>,
7323 private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
7325 friend OMPVarListClause;
7326 friend TrailingObjects;
7329 OpenMPThreadLimitClauseModifier Modifier = OMPC_THREADLIMIT_unknown;
7332 SourceLocation ModifierLoc;
7334 OMPThreadLimitClause(
const ASTContext &C, SourceLocation StartLoc,
7335 SourceLocation LParenLoc, SourceLocation EndLoc,
7337 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, StartLoc, LParenLoc,
7343 : OMPVarListClause(
llvm::omp::OMPC_thread_limit, SourceLocation(),
7344 SourceLocation(), SourceLocation(), N),
7348 void setModifier(OpenMPThreadLimitClauseModifier M) { Modifier = M; }
7354 void setModifierExpr(Expr *E) { *varlist_end() = E; }
7368 static OMPThreadLimitClause *
7369 Create(
const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
7370 SourceLocation StartLoc, SourceLocation LParenLoc,
7371 SourceLocation EndLoc, ArrayRef<Expr *> VL,
7372 OpenMPThreadLimitClauseModifier Modifier, Expr *ModifierExpr,
7373 SourceLocation ModifierLoc, Stmt *PreInit);
7379 static OMPThreadLimitClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
7386 return const_cast<OMPThreadLimitClause *
>(
this)->
getThreadLimit();
7390 OpenMPThreadLimitClauseModifier
getModifier()
const {
return Modifier; }
7400 if (Modifier == OMPC_THREADLIMIT_dims)
7409 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
7410 reinterpret_cast<Stmt **
>(varlist_end()) + 1);
7414 return const_cast<OMPThreadLimitClause *
>(
this)->
children();
7418 return child_range(child_iterator(), child_iterator());
7421 return const_child_range(const_child_iterator(), const_child_iterator());
7425 return T->getClauseKind() == llvm::omp::OMPC_thread_limit;
7441 SourceLocation LParenLoc;
7444 Stmt *Priority =
nullptr;
7449 void setPriority(Expr *E) { Priority = E; }
7462 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
7463 SourceLocation LParenLoc, SourceLocation EndLoc)
7466 setPreInitStmt(HelperPriority, CaptureRegion);
7471 :
OMPClause(
llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()),
7486 child_range
children() {
return child_range(&Priority, &Priority + 1); }
7489 return const_child_range(&Priority, &Priority + 1);
7492 child_range used_children();
7498 return T->getClauseKind() == llvm::omp::OMPC_priority;
7514 SourceLocation LParenLoc;
7517 OpenMPGrainsizeClauseModifier Modifier = OMPC_GRAINSIZE_unknown;
7520 SourceLocation ModifierLoc;
7523 Stmt *Grainsize =
nullptr;
7526 void setGrainsize(Expr *Size) { Grainsize = Size; }
7529 void setModifier(OpenMPGrainsizeClauseModifier M) { Modifier = M; }
7547 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7548 SourceLocation StartLoc, SourceLocation LParenLoc,
7549 SourceLocation ModifierLoc, SourceLocation EndLoc)
7552 ModifierLoc(ModifierLoc), Grainsize(Size) {
7553 setPreInitStmt(HelperSize, CaptureRegion);
7572 OpenMPGrainsizeClauseModifier
getModifier()
const {
return Modifier; }
7577 child_range
children() {
return child_range(&Grainsize, &Grainsize + 1); }
7580 return const_child_range(&Grainsize, &Grainsize + 1);
7583 child_range used_children();
7589 return T->getClauseKind() == llvm::omp::OMPC_grainsize;
7610 :
OMPClause(
llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) {
7614 return child_range(child_iterator(), child_iterator());
7618 return const_child_range(const_child_iterator(), const_child_iterator());
7622 return child_range(child_iterator(), child_iterator());
7625 return const_child_range(const_child_iterator(), const_child_iterator());
7629 return T->getClauseKind() == llvm::omp::OMPC_nogroup;
7645 SourceLocation LParenLoc;
7648 OpenMPNumTasksClauseModifier Modifier = OMPC_NUMTASKS_unknown;
7651 SourceLocation ModifierLoc;
7654 Stmt *NumTasks =
nullptr;
7657 void setNumTasks(Expr *Size) { NumTasks = Size; }
7660 void setModifier(OpenMPNumTasksClauseModifier M) { Modifier = M; }
7678 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
7679 SourceLocation StartLoc, SourceLocation LParenLoc,
7680 SourceLocation ModifierLoc, SourceLocation EndLoc)
7683 ModifierLoc(ModifierLoc), NumTasks(Size) {
7684 setPreInitStmt(HelperSize, CaptureRegion);
7708 child_range
children() {
return child_range(&NumTasks, &NumTasks + 1); }
7711 return const_child_range(&NumTasks, &NumTasks + 1);
7714 child_range used_children();
7720 return T->getClauseKind() == llvm::omp::OMPC_num_tasks;
7735 SourceLocation LParenLoc;
7738 Stmt *Hint =
nullptr;
7741 void setHint(Expr *H) { Hint = H; }
7751 SourceLocation EndLoc)
7752 :
OMPClause(
llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
7757 :
OMPClause(
llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {}
7766 Expr *
getHint()
const {
return cast_or_null<Expr>(Hint); }
7768 child_range
children() {
return child_range(&Hint, &Hint + 1); }
7771 return const_child_range(&Hint, &Hint + 1);
7775 return child_range(child_iterator(), child_iterator());
7778 return const_child_range(const_child_iterator(), const_child_iterator());
7782 return T->getClauseKind() == llvm::omp::OMPC_hint;
7798 SourceLocation LParenLoc;
7801 OpenMPDistScheduleClauseKind Kind = OMPC_DIST_SCHEDULE_unknown;
7804 SourceLocation KindLoc;
7807 SourceLocation CommaLoc;
7810 Expr *ChunkSize =
nullptr;
7815 void setDistScheduleKind(OpenMPDistScheduleClauseKind K) { Kind = K; }
7820 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7825 void setDistScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7830 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
7835 void setChunkSize(Expr *E) { ChunkSize = E; }
7850 SourceLocation KLoc, SourceLocation CommaLoc,
7851 SourceLocation EndLoc,
7852 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
7853 Stmt *HelperChunkSize)
7854 :
OMPClause(
llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc),
7856 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
7857 setPreInitStmt(HelperChunkSize);
7862 :
OMPClause(
llvm::omp::OMPC_dist_schedule, SourceLocation(),
7885 return child_range(
reinterpret_cast<Stmt **
>(&ChunkSize),
7886 reinterpret_cast<Stmt **
>(&ChunkSize) + 1);
7894 return child_range(child_iterator(), child_iterator());
7897 return const_child_range(const_child_iterator(), const_child_iterator());
7901 return T->getClauseKind() == llvm::omp::OMPC_dist_schedule;
7916 SourceLocation LParenLoc;
7919 OpenMPDefaultmapClauseModifier Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown;
7922 SourceLocation ModifierLoc;
7925 OpenMPDefaultmapClauseKind Kind = OMPC_DEFAULTMAP_unknown;
7928 SourceLocation KindLoc;
7933 void setDefaultmapKind(OpenMPDefaultmapClauseKind K) { Kind = K; }
7938 void setDefaultmapModifier(OpenMPDefaultmapClauseModifier M) {
7943 void setDefaultmapModifierLoc(SourceLocation Loc) {
7950 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7955 void setDefaultmapKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7968 SourceLocation MLoc, SourceLocation KLoc,
7969 SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind,
7970 OpenMPDefaultmapClauseModifier M)
7972 LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind),
7978 SourceLocation()) {}
8000 return child_range(child_iterator(), child_iterator());
8004 return const_child_range(const_child_iterator(), const_child_iterator());
8008 return child_range(child_iterator(), child_iterator());
8011 return const_child_range(const_child_iterator(), const_child_iterator());
8015 return T->getClauseKind() == llvm::omp::OMPC_defaultmap;
8027class OMPToClause final :
public OMPMappableExprListClause<OMPToClause>,
8028 private llvm::TrailingObjects<
8029 OMPToClause, Expr *, ValueDecl *, unsigned,
8030 OMPClauseMappableExprCommon::MappableComponent> {
8032 friend OMPMappableExprListClause;
8033 friend OMPVarListClause;
8034 friend TrailingObjects;
8037 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
8038 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
8039 OMPC_MOTION_MODIFIER_unknown};
8042 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
8045 SourceLocation ColonLoc;
8064 NestedNameSpecifierLoc MapperQualifierLoc,
8065 DeclarationNameInfo MapperIdInfo,
8066 const OMPVarListLocTy &Locs,
8069 true, &MapperQualifierLoc,
8071 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
8072 "Unexpected number of motion modifiers.");
8073 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8075 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8076 "Unexpected number of motion modifier locations.");
8077 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8087 explicit OMPToClause(
const OMPMappableExprListSizeTy &Sizes)
8088 : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
8095 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8096 assert(I < NumberOfOMPMotionModifiers &&
8097 "Unexpected index to store motion modifier, exceeds array size.");
8098 MotionModifiers[I] =
T;
8105 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8106 assert(I < NumberOfOMPMotionModifiers &&
8107 "Index to store motion modifier location exceeds array size.");
8108 MotionModifiersLoc[I] = TLoc;
8111 void setIteratorModifier(Expr *IteratorModifier) {
8112 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8115 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8119 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8122 return 2 * varlist_size() + 1;
8124 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8125 return getUniqueDeclarationsNum();
8127 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8128 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8148 static OMPToClause *
8149 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8150 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8151 MappableExprComponentListsRef ComponentLists,
8152 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
8153 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8154 ArrayRef<SourceLocation> MotionModifiersLoc,
8155 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8165 static OMPToClause *
CreateEmpty(
const ASTContext &C,
8166 const OMPMappableExprListSizeTy &Sizes);
8172 assert(Cnt < NumberOfOMPMotionModifiers &&
8173 "Requested modifier exceeds the total number of modifiers.");
8174 return MotionModifiers[Cnt];
8177 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8184 assert(Cnt < NumberOfOMPMotionModifiers &&
8185 "Requested modifier location exceeds total number of modifiers.");
8186 return MotionModifiersLoc[Cnt];
8191 return MotionModifiers;
8196 return MotionModifiersLoc;
8203 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8204 reinterpret_cast<Stmt **
>(varlist_end()));
8208 return const_cast<OMPToClause *
>(
this)->
children();
8212 return child_range(child_iterator(), child_iterator());
8215 return const_child_range(const_child_iterator(), const_child_iterator());
8219 return T->getClauseKind() == llvm::omp::OMPC_to;
8231class OMPFromClause final
8232 :
public OMPMappableExprListClause<OMPFromClause>,
8233 private llvm::TrailingObjects<
8234 OMPFromClause, Expr *, ValueDecl *, unsigned,
8235 OMPClauseMappableExprCommon::MappableComponent> {
8237 friend OMPMappableExprListClause;
8238 friend OMPVarListClause;
8239 friend TrailingObjects;
8242 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
8243 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown,
8244 OMPC_MOTION_MODIFIER_unknown};
8247 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
8250 SourceLocation ColonLoc;
8269 NestedNameSpecifierLoc MapperQualifierLoc,
8270 DeclarationNameInfo MapperIdInfo,
8271 const OMPVarListLocTy &Locs,
8274 true, &MapperQualifierLoc,
8276 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
8277 "Unexpected number of motion modifiers.");
8278 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
8280 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
8281 "Unexpected number of motion modifier locations.");
8282 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
8292 explicit OMPFromClause(
const OMPMappableExprListSizeTy &Sizes)
8293 : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
8300 void setMotionModifier(
unsigned I, OpenMPMotionModifierKind T) {
8301 assert(I < NumberOfOMPMotionModifiers &&
8302 "Unexpected index to store motion modifier, exceeds array size.");
8303 MotionModifiers[I] =
T;
8305 void setIteratorModifier(Expr *IteratorModifier) {
8306 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
8312 void setMotionModifierLoc(
unsigned I, SourceLocation TLoc) {
8313 assert(I < NumberOfOMPMotionModifiers &&
8314 "Index to store motion modifier location exceeds array size.");
8315 MotionModifiersLoc[I] = TLoc;
8319 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
8323 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8326 return 2 * varlist_size() + 1;
8328 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8329 return getUniqueDeclarationsNum();
8331 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8332 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8352 static OMPFromClause *
8353 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8354 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8355 MappableExprComponentListsRef ComponentLists,
8356 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorExpr,
8357 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
8358 ArrayRef<SourceLocation> MotionModifiersLoc,
8359 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
8369 static OMPFromClause *
CreateEmpty(
const ASTContext &C,
8370 const OMPMappableExprListSizeTy &Sizes);
8376 assert(Cnt < NumberOfOMPMotionModifiers &&
8377 "Requested modifier exceeds the total number of modifiers.");
8378 return MotionModifiers[Cnt];
8381 return getTrailingObjects<Expr *>()[2 * varlist_size()];
8388 assert(Cnt < NumberOfOMPMotionModifiers &&
8389 "Requested modifier location exceeds total number of modifiers.");
8390 return MotionModifiersLoc[Cnt];
8395 return MotionModifiers;
8400 return MotionModifiersLoc;
8407 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8408 reinterpret_cast<Stmt **
>(varlist_end()));
8412 return const_cast<OMPFromClause *
>(
this)->
children();
8416 return child_range(child_iterator(), child_iterator());
8419 return const_child_range(const_child_iterator(), const_child_iterator());
8423 return T->getClauseKind() == llvm::omp::OMPC_from;
8435class OMPUseDevicePtrClause final
8436 :
public OMPMappableExprListClause<OMPUseDevicePtrClause>,
8437 private llvm::TrailingObjects<
8438 OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned,
8439 OMPClauseMappableExprCommon::MappableComponent> {
8441 friend OMPMappableExprListClause;
8442 friend OMPVarListClause;
8443 friend TrailingObjects;
8446 OpenMPUseDevicePtrFallbackModifier FallbackModifier =
8447 OMPC_USE_DEVICE_PTR_FALLBACK_unknown;
8450 SourceLocation FallbackModifierLoc;
8464 explicit OMPUseDevicePtrClause(
8466 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8467 SourceLocation FallbackModifierLoc)
8468 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_ptr, Locs, Sizes),
8469 FallbackModifier(FallbackModifier),
8470 FallbackModifierLoc(FallbackModifierLoc) {}
8481 OMPVarListLocTy(), Sizes) {}
8485 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8486 return 3 * varlist_size();
8488 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8489 return getUniqueDeclarationsNum();
8491 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8492 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8498 void setPrivateCopies(ArrayRef<Expr *> VL);
8502 MutableArrayRef<Expr *> getPrivateCopies() {
8503 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
8505 ArrayRef<const Expr *> getPrivateCopies()
const {
8506 return {varlist_end(), varlist_size()};
8512 void setInits(ArrayRef<Expr *> VL);
8516 MutableArrayRef<Expr *>
getInits() {
8517 return {getPrivateCopies().end(), varlist_size()};
8519 ArrayRef<const Expr *>
getInits()
const {
8520 return {getPrivateCopies().end(), varlist_size()};
8524 void setFallbackModifier(OpenMPUseDevicePtrFallbackModifier M) {
8525 FallbackModifier = M;
8529 void setFallbackModifierLoc(SourceLocation Loc) { FallbackModifierLoc = Loc; }
8545 static OMPUseDevicePtrClause *
8546 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8547 ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
8548 ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations,
8549 MappableExprComponentListsRef ComponentLists,
8550 OpenMPUseDevicePtrFallbackModifier FallbackModifier,
8551 SourceLocation FallbackModifierLoc);
8561 static OMPUseDevicePtrClause *
8562 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8566 return FallbackModifier;
8576 llvm::iterator_range<private_copies_const_iterator>;
8581 return getPrivateCopies();
8594 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8595 reinterpret_cast<Stmt **
>(varlist_end()));
8599 return const_cast<OMPUseDevicePtrClause *
>(
this)->
children();
8603 return child_range(child_iterator(), child_iterator());
8606 return const_child_range(const_child_iterator(), const_child_iterator());
8610 return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr;
8622class OMPUseDeviceAddrClause final
8623 :
public OMPMappableExprListClause<OMPUseDeviceAddrClause>,
8624 private llvm::TrailingObjects<
8625 OMPUseDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8626 OMPClauseMappableExprCommon::MappableComponent> {
8628 friend OMPMappableExprListClause;
8629 friend OMPVarListClause;
8630 friend TrailingObjects;
8642 explicit OMPUseDeviceAddrClause(
const OMPVarListLocTy &Locs,
8644 : OMPMappableExprListClause(
llvm::omp::OMPC_use_device_addr, Locs,
8656 OMPVarListLocTy(), Sizes) {}
8660 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8661 return varlist_size();
8663 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8664 return getUniqueDeclarationsNum();
8666 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8667 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8680 static OMPUseDeviceAddrClause *
8681 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8682 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8683 MappableExprComponentListsRef ComponentLists);
8693 static OMPUseDeviceAddrClause *
8694 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8697 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8698 reinterpret_cast<Stmt **
>(varlist_end()));
8702 return const_cast<OMPUseDeviceAddrClause *
>(
this)->
children();
8706 return child_range(child_iterator(), child_iterator());
8709 return const_child_range(const_child_iterator(), const_child_iterator());
8713 return T->getClauseKind() == llvm::omp::OMPC_use_device_addr;
8725class OMPIsDevicePtrClause final
8726 :
public OMPMappableExprListClause<OMPIsDevicePtrClause>,
8727 private llvm::TrailingObjects<
8728 OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned,
8729 OMPClauseMappableExprCommon::MappableComponent> {
8731 friend OMPMappableExprListClause;
8732 friend OMPVarListClause;
8733 friend TrailingObjects;
8745 explicit OMPIsDevicePtrClause(
const OMPVarListLocTy &Locs,
8747 : OMPMappableExprListClause(
llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {}
8758 OMPVarListLocTy(), Sizes) {}
8762 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8763 return varlist_size();
8765 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8766 return getUniqueDeclarationsNum();
8768 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8769 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8782 static OMPIsDevicePtrClause *
8783 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8784 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8785 MappableExprComponentListsRef ComponentLists);
8795 static OMPIsDevicePtrClause *
8796 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8799 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8800 reinterpret_cast<Stmt **
>(varlist_end()));
8804 return const_cast<OMPIsDevicePtrClause *
>(
this)->
children();
8808 return child_range(child_iterator(), child_iterator());
8811 return const_child_range(const_child_iterator(), const_child_iterator());
8815 return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr;
8827class OMPHasDeviceAddrClause final
8828 :
public OMPMappableExprListClause<OMPHasDeviceAddrClause>,
8829 private llvm::TrailingObjects<
8830 OMPHasDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8831 OMPClauseMappableExprCommon::MappableComponent> {
8833 friend OMPMappableExprListClause;
8834 friend OMPVarListClause;
8835 friend TrailingObjects;
8847 explicit OMPHasDeviceAddrClause(
const OMPVarListLocTy &Locs,
8849 : OMPMappableExprListClause(
llvm::omp::OMPC_has_device_addr, Locs,
8861 OMPVarListLocTy(), Sizes) {}
8865 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
8866 return varlist_size();
8868 size_t numTrailingObjects(OverloadToken<ValueDecl *>)
const {
8869 return getUniqueDeclarationsNum();
8871 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
8872 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8885 static OMPHasDeviceAddrClause *
8886 Create(
const ASTContext &C,
const OMPVarListLocTy &Locs,
8887 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8888 MappableExprComponentListsRef ComponentLists);
8898 static OMPHasDeviceAddrClause *
8899 CreateEmpty(
const ASTContext &C,
const OMPMappableExprListSizeTy &Sizes);
8902 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8903 reinterpret_cast<Stmt **
>(varlist_end()));
8907 return const_cast<OMPHasDeviceAddrClause *
>(
this)->
children();
8911 return child_range(child_iterator(), child_iterator());
8914 return const_child_range(const_child_iterator(), const_child_iterator());
8918 return T->getClauseKind() == llvm::omp::OMPC_has_device_addr;
8929class OMPNontemporalClause final
8930 :
public OMPVarListClause<OMPNontemporalClause>,
8931 private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
8933 friend OMPVarListClause;
8934 friend TrailingObjects;
8942 OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8943 SourceLocation EndLoc,
unsigned N)
8944 : OMPVarListClause<OMPNontemporalClause>(
llvm::omp::OMPC_nontemporal,
8945 StartLoc, LParenLoc, EndLoc, N) {
8953 llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(),
8954 SourceLocation(), N) {}
8958 MutableArrayRef<Expr *> getPrivateRefs() {
8959 return {varlist_end(), varlist_size()};
8961 ArrayRef<const Expr *> getPrivateRefs()
const {
8962 return {varlist_end(), varlist_size()};
8973 static OMPNontemporalClause *
8974 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
8975 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8981 static OMPNontemporalClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
8985 void setPrivateRefs(ArrayRef<Expr *> VL);
8988 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
8989 reinterpret_cast<Stmt **
>(varlist_end()));
8993 return const_cast<OMPNontemporalClause *
>(
this)->
children();
8997 return child_range(
reinterpret_cast<Stmt **
>(getPrivateRefs().begin()),
8998 reinterpret_cast<Stmt **
>(getPrivateRefs().end()));
9002 return const_cast<OMPNontemporalClause *
>(
this)->
private_refs();
9006 return child_range(child_iterator(), child_iterator());
9009 return const_child_range(const_child_iterator(), const_child_iterator());
9013 return T->getClauseKind() == llvm::omp::OMPC_nontemporal;
9028 SourceLocation LParenLoc;
9031 OpenMPOrderClauseKind Kind = OMPC_ORDER_unknown;
9034 SourceLocation KindKwLoc;
9037 OpenMPOrderClauseModifier Modifier = OMPC_ORDER_MODIFIER_unknown;
9040 SourceLocation ModifierKwLoc;
9045 void setKind(OpenMPOrderClauseKind K) { Kind = K; }
9050 void setKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
9055 void setModifier(OpenMPOrderClauseModifier M) { Modifier = M; }
9060 void setModifierKwLoc(SourceLocation MLoc) { ModifierKwLoc = MLoc; }
9073 SourceLocation StartLoc, SourceLocation LParenLoc,
9074 SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
9075 SourceLocation MLoc)
9077 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
9078 ModifierKwLoc(MLoc) {}
9082 :
OMPClause(
llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {}
9091 OpenMPOrderClauseKind
getKind()
const {
return Kind; }
9103 return child_range(child_iterator(), child_iterator());
9107 return const_child_range(const_child_iterator(), const_child_iterator());
9111 return child_range(child_iterator(), child_iterator());
9114 return const_child_range(const_child_iterator(), const_child_iterator());
9118 return T->getClauseKind() == llvm::omp::OMPC_order;
9127class OMPInitClause final
9128 :
public OMPVarListClause<OMPInitClause>,
9129 private llvm::TrailingObjects<OMPInitClause, Expr *, unsigned> {
9131 friend OMPVarListClause;
9132 friend TrailingObjects;
9135 SourceLocation VarLoc;
9137 bool IsTarget =
false;
9138 bool IsTargetSync =
false;
9139 bool HasPreferAttrs =
false;
9143 unsigned NumAttrs = 0;
9160 size_t numTrailingObjects(OverloadToken<Expr *>)
const {
9161 return varlist_size() + NumAttrs;
9163 size_t numTrailingObjects(OverloadToken<unsigned>)
const {
9164 return getNumPrefs();
9167 void setInteropVar(Expr *E) { varlist_begin()[0] = E; }
9169 void setIsTarget(
bool V) { IsTarget =
V; }
9171 void setIsTargetSync(
bool V) { IsTargetSync =
V; }
9173 void setHasPreferAttrs(
bool V) { HasPreferAttrs =
V; }
9175 void setAttrs(ArrayRef<unsigned> Counts, ArrayRef<Expr *> Attrs);
9178 unsigned getNumPrefs()
const {
return varlist_size() - 1; }
9182 ArrayRef<unsigned> getAttrEnds()
const {
9183 return getTrailingObjects<unsigned>(getNumPrefs());
9187 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9198 OMPInitClause(
bool IsTarget,
bool IsTargetSync, SourceLocation StartLoc,
9199 SourceLocation LParenLoc, SourceLocation VarLoc,
9200 SourceLocation EndLoc,
unsigned N)
9201 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, StartLoc,
9202 LParenLoc, EndLoc, N),
9203 VarLoc(VarLoc), IsTarget(IsTarget), IsTargetSync(IsTargetSync) {}
9206 OMPInitClause(
unsigned N)
9207 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, SourceLocation(),
9208 SourceLocation(), SourceLocation(), N) {
9230 OMPInteropInfo &InteropInfo,
9231 SourceLocation StartLoc,
9232 SourceLocation LParenLoc, SourceLocation VarLoc,
9233 SourceLocation EndLoc);
9268 reinterpret_cast<Stmt **
>(varlist_begin()),
9269 reinterpret_cast<Stmt **
>(varlist_begin() + varlist_size() + NumAttrs));
9273 return const_cast<OMPInitClause *
>(
this)->
children();
9277 return child_range(child_iterator(), child_iterator());
9280 return const_child_range(const_child_iterator(), const_child_iterator());
9286 unsigned N = getNumPrefs();
9287 Expr *
const *E = getTrailingObjects<Expr *>();
9289 return llvm::map_range(llvm::seq<unsigned>(0, N), [
this, E,
9291 unsigned Start = (I == 0) ? 0 : Ends[I - 1];
9293 const_cast<Expr *
>(E[1 + I]),
9300 return T->getClauseKind() == llvm::omp::OMPC_init;
9313 SourceLocation LParenLoc;
9316 SourceLocation VarLoc;
9319 Stmt *InteropVar =
nullptr;
9322 void setInteropVar(Expr *E) { InteropVar = E; }
9325 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9328 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9339 SourceLocation LParenLoc, SourceLocation VarLoc,
9340 SourceLocation EndLoc)
9341 :
OMPClause(
llvm::omp::OMPC_use, StartLoc, EndLoc), LParenLoc(LParenLoc),
9342 VarLoc(VarLoc), InteropVar(InteropVar) {}
9346 :
OMPClause(
llvm::omp::OMPC_use, SourceLocation(), SourceLocation()) {}
9357 child_range
children() {
return child_range(&InteropVar, &InteropVar + 1); }
9360 return const_child_range(&InteropVar, &InteropVar + 1);
9364 return child_range(child_iterator(), child_iterator());
9367 return const_child_range(const_child_iterator(), const_child_iterator());
9371 return T->getClauseKind() == llvm::omp::OMPC_use;
9388 SourceLocation LParenLoc;
9391 SourceLocation VarLoc;
9394 Stmt *InteropVar =
nullptr;
9397 void setInteropVar(Expr *E) { InteropVar = E; }
9400 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9403 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
9414 SourceLocation LParenLoc, SourceLocation VarLoc,
9415 SourceLocation EndLoc)
9417 LParenLoc(LParenLoc), VarLoc(VarLoc), InteropVar(InteropVar) {}
9428 :
OMPClause(
llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) {
9442 return child_range(&InteropVar, &InteropVar + 1);
9443 return child_range(child_iterator(), child_iterator());
9448 return const_child_range(&InteropVar, &InteropVar + 1);
9449 return const_child_range(const_child_iterator(), const_child_iterator());
9453 return child_range(child_iterator(), child_iterator());
9456 return const_child_range(const_child_iterator(), const_child_iterator());
9460 return T->getClauseKind() == llvm::omp::OMPC_destroy;
9477 void setCondition(Expr *Cond) { setStmt(Cond); }
9490 OpenMPDirectiveKind CaptureRegion,
9491 SourceLocation StartLoc, SourceLocation LParenLoc,
9492 SourceLocation EndLoc)
9495 setPreInitStmt(HelperCond, CaptureRegion);
9504 child_range used_children();
9523 void setCondition(Expr *Cond) { setStmt(Cond); }
9536 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9537 SourceLocation LParenLoc, SourceLocation EndLoc)
9540 setPreInitStmt(HelperCond, CaptureRegion);
9549 child_range used_children();
9567 void setEventHandler(Expr *E) { setStmt(E); }
9577 SourceLocation EndLoc)
9594class OMPInclusiveClause final
9595 :
public OMPVarListClause<OMPInclusiveClause>,
9596 private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
9598 friend OMPVarListClause;
9599 friend TrailingObjects;
9607 OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9608 SourceLocation EndLoc,
unsigned N)
9609 : OMPVarListClause<OMPInclusiveClause>(
llvm::omp::OMPC_inclusive,
9610 StartLoc, LParenLoc, EndLoc, N) {}
9617 SourceLocation(), SourceLocation(),
9618 SourceLocation(), N) {}
9628 static OMPInclusiveClause *
Create(
const ASTContext &C,
9629 SourceLocation StartLoc,
9630 SourceLocation LParenLoc,
9631 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9637 static OMPInclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9640 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9641 reinterpret_cast<Stmt **
>(varlist_end()));
9645 return const_cast<OMPInclusiveClause *
>(
this)->
children();
9649 return child_range(child_iterator(), child_iterator());
9652 return const_child_range(const_child_iterator(), const_child_iterator());
9656 return T->getClauseKind() == llvm::omp::OMPC_inclusive;
9667class OMPExclusiveClause final
9668 :
public OMPVarListClause<OMPExclusiveClause>,
9669 private llvm::TrailingObjects<OMPExclusiveClause, Expr *> {
9671 friend OMPVarListClause;
9672 friend TrailingObjects;
9680 OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9681 SourceLocation EndLoc,
unsigned N)
9682 : OMPVarListClause<OMPExclusiveClause>(
llvm::omp::OMPC_exclusive,
9683 StartLoc, LParenLoc, EndLoc, N) {}
9690 SourceLocation(), SourceLocation(),
9691 SourceLocation(), N) {}
9701 static OMPExclusiveClause *
Create(
const ASTContext &C,
9702 SourceLocation StartLoc,
9703 SourceLocation LParenLoc,
9704 SourceLocation EndLoc, ArrayRef<Expr *> VL);
9710 static OMPExclusiveClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9713 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9714 reinterpret_cast<Stmt **
>(varlist_end()));
9718 return const_cast<OMPExclusiveClause *
>(
this)->
children();
9722 return child_range(child_iterator(), child_iterator());
9725 return const_child_range(const_child_iterator(), const_child_iterator());
9729 return T->getClauseKind() == llvm::omp::OMPC_exclusive;
9741class OMPUsesAllocatorsClause final
9743 private llvm::TrailingObjects<OMPUsesAllocatorsClause, Expr *,
9758 friend TrailingObjects;
9760 enum class ExprOffsets {
9766 enum class ParenLocsOffsets {
9773 SourceLocation LParenLoc;
9775 unsigned NumOfAllocators = 0;
9783 OMPUsesAllocatorsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9784 SourceLocation EndLoc,
unsigned N)
9785 : OMPClause(llvm::omp::OMPC_uses_allocators, StartLoc, EndLoc),
9786 LParenLoc(LParenLoc), NumOfAllocators(N) {}
9791 explicit OMPUsesAllocatorsClause(
unsigned N)
9792 : OMPClause(llvm::omp::OMPC_uses_allocators, SourceLocation(),
9794 NumOfAllocators(N) {}
9796 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
9797 return NumOfAllocators *
static_cast<int>(ExprOffsets::Total);
9801 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9804 void setAllocatorsData(ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9814 static OMPUsesAllocatorsClause *
9815 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
9816 SourceLocation EndLoc, ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9822 static OMPUsesAllocatorsClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9835 Stmt **Begin =
reinterpret_cast<Stmt **
>(getTrailingObjects<Expr *>());
9836 return child_range(Begin, Begin + NumOfAllocators *
9837 static_cast<int>(ExprOffsets::Total));
9840 Stmt *
const *Begin =
9841 reinterpret_cast<Stmt *
const *
>(getTrailingObjects<Expr *>());
9842 return const_child_range(
9843 Begin, Begin + NumOfAllocators *
static_cast<int>(ExprOffsets::Total));
9847 return child_range(child_iterator(), child_iterator());
9850 return const_child_range(const_child_iterator(), const_child_iterator());
9854 return T->getClauseKind() == llvm::omp::OMPC_uses_allocators;
9867class OMPAffinityClause final
9868 :
public OMPVarListClause<OMPAffinityClause>,
9869 private llvm::TrailingObjects<OMPAffinityClause, Expr *> {
9871 friend OMPVarListClause;
9872 friend TrailingObjects;
9875 SourceLocation ColonLoc;
9884 OMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9885 SourceLocation ColonLoc, SourceLocation EndLoc,
unsigned N)
9886 : OMPVarListClause<OMPAffinityClause>(
llvm::omp::OMPC_affinity, StartLoc,
9887 LParenLoc, EndLoc, N) {}
9894 SourceLocation(), SourceLocation(),
9895 SourceLocation(), N) {}
9898 void setModifier(Expr *E) { getTrailingObjects()[varlist_size()] = E; }
9901 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
9912 static OMPAffinityClause *
Create(
const ASTContext &C, SourceLocation StartLoc,
9913 SourceLocation LParenLoc,
9914 SourceLocation ColonLoc,
9915 SourceLocation EndLoc, Expr *Modifier,
9916 ArrayRef<Expr *> Locators);
9922 static OMPAffinityClause *
CreateEmpty(
const ASTContext &C,
unsigned N);
9926 Expr *
getModifier()
const {
return getTrailingObjects()[varlist_size()]; }
9934 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
9935 reinterpret_cast<Stmt **
>(varlist_end() + Offset));
9939 return const_cast<OMPAffinityClause *
>(
this)->
children();
9943 return child_range(child_iterator(), child_iterator());
9946 return const_child_range(const_child_iterator(), const_child_iterator());
9950 return T->getClauseKind() == llvm::omp::OMPC_affinity;
9967 void setThreadID(Expr *TID) { setStmt(TID); }
9980 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9981 SourceLocation LParenLoc, SourceLocation EndLoc)
9984 setPreInitStmt(HelperE, CaptureRegion);
10006 SourceLocation LParenLoc;
10009 OpenMPBindClauseKind Kind = OMPC_BIND_unknown;
10012 SourceLocation KindLoc;
10015 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
10018 void setBindKind(OpenMPBindClauseKind K) { Kind = K; }
10021 void setBindKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
10032 SourceLocation StartLoc, SourceLocation LParenLoc,
10033 SourceLocation EndLoc)
10052template<
class ImplClass,
template <
typename>
class Ptr,
typename RetTy>
10055#define PTR(CLASS) Ptr<CLASS>
10056#define DISPATCH(CLASS) \
10057 return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
10059#define GEN_CLANG_CLAUSE_CLASS
10060#define CLAUSE_CLASS(Enum, Str, Class) \
10061 RetTy Visit##Class(PTR(Class) S) { \
10062 return static_cast<ImplClass *>(this)->VisitOMPClause(S); \
10064#include "llvm/Frontend/OpenMP/OMP.inc"
10068 switch (S->getClauseKind()) {
10069#define GEN_CLANG_CLAUSE_CLASS
10070#define CLAUSE_CLASS(Enum, Str, Class) \
10071 case llvm::omp::Clause::Enum: \
10073#define CLAUSE_NO_CLASS(Enum, Str) \
10074 case llvm::omp::Clause::Enum: \
10076#include "llvm/Frontend/OpenMP/OMP.inc"
10085template <
typename T>
using const_ptr = std::add_pointer_t<std::add_const_t<T>>;
10087template <
class ImplClass,
typename RetTy =
void>
10090template<
class ImplClass,
typename RetTy =
void>
10096 const PrintingPolicy &Policy;
10097 llvm::omp::Version Version;
10100 template <
typename T>
void VisitOMPClauseList(T *Node,
char StartSym);
10102 template <
typename T>
void VisitOMPMotionClause(T *Node);
10106 llvm::omp::Version OpenMPVersion)
10107 : OS(OS), Policy(Policy), Version(OpenMPVersion) {}
10109#define GEN_CLANG_CLAUSE_CLASS
10110#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
10111#include "llvm/Frontend/OpenMP/OMP.inc"
10115 llvm::omp::TraitProperty
Kind = llvm::omp::TraitProperty::invalid;
10124 llvm::omp::TraitSelector
Kind = llvm::omp::TraitSelector::invalid;
10129 llvm::omp::TraitSet
Kind = llvm::omp::TraitSet::invalid;
10138class OMPTraitInfo {
10145 OMPTraitInfo(StringRef MangledName);
10151 llvm::function_ref<
bool(Expr *&,
bool )> Cond) {
10153 return llvm::any_of(
10155 return Cond(Selector.ScoreOrCondition,
10157 llvm::omp::TraitSelector::user_condition);
10167 void getAsVariantMatchInfo(
ASTContext &ASTCtx,
10168 llvm::omp::VariantMatchInfo &VMI)
const;
10171 std::string getMangledName()
const;
10176 if (Set.Kind != llvm::omp::TraitSet::implementation)
10179 if (Selector.
Kind != llvm::omp::TraitSelector::implementation_extension)
10182 if (Property.Kind == TP)
10191 void print(llvm::raw_ostream &OS,
const PrintingPolicy &Policy)
const;
10200 const FunctionDecl *CurrentFunctionDecl,
10212 llvm::StringMap<bool> FeatureMap;
10218class OMPChildren final
10219 :
private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
10220 friend TrailingObjects;
10227 unsigned NumClauses = 0;
10229 unsigned NumChildren = 0;
10231 bool HasAssociatedStmt =
false;
10235 size_t numTrailingObjects(OverloadToken<OMPClause *>)
const {
10241 OMPChildren(
unsigned NumClauses,
unsigned NumChildren,
bool HasAssociatedStmt)
10242 : NumClauses(NumClauses), NumChildren(NumChildren),
10243 HasAssociatedStmt(HasAssociatedStmt) {}
10245 static size_t size(
unsigned NumClauses,
bool HasAssociatedStmt,
10246 unsigned NumChildren);
10248 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses);
10249 static OMPChildren *
Create(
void *Mem, ArrayRef<OMPClause *> Clauses, Stmt *S,
10250 unsigned NumChildren = 0);
10251 static OMPChildren *
CreateEmpty(
void *Mem,
unsigned NumClauses,
10252 bool HasAssociatedStmt =
false,
10253 unsigned NumChildren = 0);
10262 getTrailingObjects<Stmt *>()[NumChildren] = S;
10278 assert(HasAssociatedStmt &&
10279 "Expected directive with the associated statement.");
10280 return getTrailingObjects<Stmt *>()[NumChildren];
10285 return getTrailingObjects<OMPClause *>(NumClauses);
10288 return const_cast<OMPChildren *
>(
this)->
getClauses();
10295 const CapturedStmt *
10298 assert(llvm::is_contained(CaptureRegions, RegionKind) &&
10299 "RegionKind not found in OpenMP CaptureRegions.");
10301 for (
auto ThisCaptureRegion : CaptureRegions) {
10302 if (ThisCaptureRegion == RegionKind)
10304 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10306 llvm_unreachable(
"Incorrect RegionKind specified for directive.");
10313 assert(!CaptureRegions.empty() &&
10314 "At least one captured statement must be provided.");
10316 for (
unsigned Level = CaptureRegions.size(); Level > 1; --Level)
10317 CS = cast<CapturedStmt>(CS->getCapturedStmt());
10321 const CapturedStmt *
10327 MutableArrayRef<Stmt *> getChildren();
10329 return const_cast<OMPChildren *
>(
this)->
getChildren();
10333 assert(HasAssociatedStmt &&
10334 "Expected directive with the associated statement.");
10338 S = CS->getCapturedStmt();
10339 CS = dyn_cast<CapturedStmt>(S);
10346 return const_cast<OMPChildren *
>(
this)->
getRawStmt();
10350 if (!HasAssociatedStmt)
10351 return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator());
10352 return Stmt::child_range(&getTrailingObjects<Stmt *>()[NumChildren],
10353 &getTrailingObjects<Stmt *>()[NumChildren + 1]);
10364 :
public OMPOneStmtClause<llvm::omp::OMPC_ompx_dyn_cgroup_mem, OMPClause>,
10369 void setSize(Expr *E) { setStmt(E); }
10381 OpenMPDirectiveKind CaptureRegion,
10382 SourceLocation StartLoc, SourceLocation LParenLoc,
10383 SourceLocation EndLoc)
10386 setPreInitStmt(HelperSize, CaptureRegion);
10409 SourceLocation LParenLoc;
10412 enum { SIMPLE, FALLBACK, NUM_MODIFIERS };
10413 unsigned Modifiers[NUM_MODIFIERS];
10416 SourceLocation ModifiersLoc[NUM_MODIFIERS];
10419 Expr *Size =
nullptr;
10424 void setDynGroupprivateModifier(OpenMPDynGroupprivateClauseModifier M) {
10425 Modifiers[SIMPLE] = M;
10431 void setDynGroupprivateFallbackModifier(
10432 OpenMPDynGroupprivateClauseFallbackModifier M) {
10433 Modifiers[FALLBACK] = M;
10437 void setDynGroupprivateModifierLoc(SourceLocation Loc) {
10438 ModifiersLoc[SIMPLE] = Loc;
10442 void setDynGroupprivateFallbackModifierLoc(SourceLocation Loc) {
10443 ModifiersLoc[FALLBACK] = Loc;
10449 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
10454 void setSize(Expr *E) {
Size = E; }
10468 SourceLocation EndLoc, Expr *Size, Stmt *HelperSize,
10469 OpenMPDirectiveKind CaptureRegion,
10470 OpenMPDynGroupprivateClauseModifier M1,
10471 SourceLocation M1Loc,
10472 OpenMPDynGroupprivateClauseFallbackModifier M2,
10473 SourceLocation M2Loc)
10474 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
10476 setPreInitStmt(HelperSize, CaptureRegion);
10477 Modifiers[SIMPLE] = M1;
10478 Modifiers[FALLBACK] = M2;
10479 ModifiersLoc[SIMPLE] = M1Loc;
10480 ModifiersLoc[FALLBACK] = M2Loc;
10485 :
OMPClause(
llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
10488 Modifiers[SIMPLE] = OMPC_DYN_GROUPPRIVATE_unknown;
10489 Modifiers[FALLBACK] = OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown;
10494 return static_cast<OpenMPDynGroupprivateClauseModifier
>(Modifiers[SIMPLE]);
10498 OpenMPDynGroupprivateClauseFallbackModifier
10500 return static_cast<OpenMPDynGroupprivateClauseFallbackModifier
>(
10501 Modifiers[FALLBACK]);
10509 return ModifiersLoc[SIMPLE];
10514 return ModifiersLoc[FALLBACK];
10524 return child_range(
reinterpret_cast<Stmt **
>(&Size),
10525 reinterpret_cast<Stmt **
>(&Size) + 1);
10533 return child_range(child_iterator(), child_iterator());
10536 return const_child_range(const_child_iterator(), const_child_iterator());
10540 return T->getClauseKind() == llvm::omp::OMPC_dyn_groupprivate;
10552class OMPDoacrossClause final
10553 :
public OMPVarListClause<OMPDoacrossClause>,
10554 private llvm::TrailingObjects<OMPDoacrossClause, Expr *> {
10556 friend OMPVarListClause;
10557 friend TrailingObjects;
10560 OpenMPDoacrossClauseModifier DepType = OMPC_DOACROSS_unknown;
10563 SourceLocation DepLoc;
10566 SourceLocation ColonLoc;
10569 unsigned NumLoops = 0;
10578 OMPDoacrossClause(SourceLocation StartLoc, SourceLocation LParenLoc,
10579 SourceLocation EndLoc,
unsigned N,
unsigned NumLoops)
10580 : OMPVarListClause<OMPDoacrossClause>(
llvm::omp::OMPC_doacross, StartLoc,
10581 LParenLoc, EndLoc, N),
10582 NumLoops(NumLoops) {}
10590 SourceLocation(), SourceLocation(),
10591 SourceLocation(), N),
10592 NumLoops(NumLoops) {}
10595 void setDependenceType(OpenMPDoacrossClauseModifier M) { DepType = M; }
10598 void setDependenceLoc(SourceLocation Loc) { DepLoc = Loc; }
10601 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
10615 static OMPDoacrossClause *
10616 Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
10617 SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType,
10618 SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL,
10619 unsigned NumLoops);
10626 static OMPDoacrossClause *
CreateEmpty(
const ASTContext &C,
unsigned N,
10627 unsigned NumLoops);
10642 void setLoopData(
unsigned NumLoop, Expr *Cnt);
10645 Expr *getLoopData(
unsigned NumLoop);
10646 const Expr *getLoopData(
unsigned NumLoop)
const;
10649 return child_range(
reinterpret_cast<Stmt **
>(varlist_begin()),
10650 reinterpret_cast<Stmt **
>(varlist_end()));
10654 return const_cast<OMPDoacrossClause *
>(
this)->
children();
10658 return child_range(child_iterator(), child_iterator());
10661 return const_child_range(const_child_iterator(), const_child_iterator());
10665 return T->getClauseKind() == llvm::omp::OMPC_doacross;
10680 SourceLocation LParenLoc;
10693 SourceLocation LParenLoc, SourceLocation EndLoc)
10694 :
OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Attrs(Attrs) {
10713 Attrs.append(NewAttrs.begin(), NewAttrs.end());
10756 const FunctionDecl *FD,
unsigned NumArgs,
10758 SmallVectorImpl<unsigned> &Positions);
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.
bool resolveOMPAdjustArgsItem(const OMPAdjustArgsItem &Item, const FunctionDecl *FD, unsigned NumArgs, const ASTContext &Ctx, SmallVectorImpl< unsigned > &Positions)
Resolve one 'adjust_args' parameter-list item to the 1-based argument positions it identifies (OpenMP...
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 OMPMetaDirective
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.
ArrayRef< OMPAdjustArgsItem > items() const
OpenMPNeedDevicePtrModifier NeedDevicePtrModifier
OpenMPAdjustArgsOpKind AdjustOp
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; }.
OpenMPNeedDevicePtrModifier
OpenMP 6.1 need_device modifier.
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
OpenMPAdjustArgsOpKind
OpenMP adjust-op kinds for 'adjust_args' clause.
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
__builtin_bitreverse32 uint32_t __builtin_riscv_aaddu_u32 __builtin_riscv_asubu_u32 __builtin_elementwise_add_sat __builtin_elementwise_sub_sat int32_t uint32_t uint32_t __builtin_riscv_mhacc_i32 __builtin_riscv_mhaccu_u32 __builtin_riscv_mhaccsu_i32 __builtin_riscv_mulq_i32 __builtin_riscv_mqwacc_i64 uint8_t
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
One bound of a parameter range.
Expr * E
The bound expression, or the logical offset for a NumArgs bound.
One item in an OpenMP 'adjust_args' parameter list.
Expr * E
A named parameter or positional expression for a Single item.
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)