File indexing completed on 2026-05-10 08:36:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H
0017 #define LLVM_CLANG_AST_OPENMPCLAUSE_H
0018
0019 #include "clang/AST/ASTFwd.h"
0020 #include "clang/AST/Decl.h"
0021 #include "clang/AST/DeclarationName.h"
0022 #include "clang/AST/Expr.h"
0023 #include "clang/AST/NestedNameSpecifier.h"
0024 #include "clang/AST/Stmt.h"
0025 #include "clang/AST/StmtIterator.h"
0026 #include "clang/Basic/LLVM.h"
0027 #include "clang/Basic/OpenMPKinds.h"
0028 #include "clang/Basic/SourceLocation.h"
0029 #include "llvm/ADT/ArrayRef.h"
0030 #include "llvm/ADT/MapVector.h"
0031 #include "llvm/ADT/PointerIntPair.h"
0032 #include "llvm/ADT/SmallVector.h"
0033 #include "llvm/ADT/iterator.h"
0034 #include "llvm/ADT/iterator_range.h"
0035 #include "llvm/Frontend/OpenMP/OMPAssume.h"
0036 #include "llvm/Frontend/OpenMP/OMPConstants.h"
0037 #include "llvm/Frontend/OpenMP/OMPContext.h"
0038 #include "llvm/Support/Casting.h"
0039 #include "llvm/Support/Compiler.h"
0040 #include "llvm/Support/TrailingObjects.h"
0041 #include <cassert>
0042 #include <cstddef>
0043 #include <iterator>
0044 #include <utility>
0045
0046 namespace clang {
0047
0048 class ASTContext;
0049
0050
0051
0052
0053
0054
0055 class OMPClause {
0056
0057 SourceLocation StartLoc;
0058
0059
0060 SourceLocation EndLoc;
0061
0062
0063 OpenMPClauseKind Kind;
0064
0065 protected:
0066 OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc)
0067 : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
0068
0069 public:
0070
0071 SourceLocation getBeginLoc() const { return StartLoc; }
0072
0073
0074 SourceLocation getEndLoc() const { return EndLoc; }
0075
0076
0077 void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
0078
0079
0080 void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
0081
0082
0083 OpenMPClauseKind getClauseKind() const { return Kind; }
0084
0085 bool isImplicit() const { return StartLoc.isInvalid(); }
0086
0087 using child_iterator = StmtIterator;
0088 using const_child_iterator = ConstStmtIterator;
0089 using child_range = llvm::iterator_range<child_iterator>;
0090 using const_child_range = llvm::iterator_range<const_child_iterator>;
0091
0092 child_range children();
0093 const_child_range children() const {
0094 auto Children = const_cast<OMPClause *>(this)->children();
0095 return const_child_range(Children.begin(), Children.end());
0096 }
0097
0098
0099
0100
0101 child_range used_children();
0102 const_child_range used_children() const {
0103 auto Children = const_cast<OMPClause *>(this)->children();
0104 return const_child_range(Children.begin(), Children.end());
0105 }
0106
0107 static bool classof(const OMPClause *) { return true; }
0108 };
0109
0110 template <OpenMPClauseKind ClauseKind>
0111 struct OMPNoChildClause : public OMPClause {
0112
0113
0114
0115
0116 OMPNoChildClause(SourceLocation StartLoc, SourceLocation EndLoc)
0117 : OMPClause(ClauseKind, StartLoc, EndLoc) {}
0118
0119
0120 OMPNoChildClause()
0121 : OMPClause(ClauseKind, SourceLocation(), SourceLocation()) {}
0122
0123 child_range children() {
0124 return child_range(child_iterator(), child_iterator());
0125 }
0126
0127 const_child_range children() const {
0128 return const_child_range(const_child_iterator(), const_child_iterator());
0129 }
0130
0131 child_range used_children() {
0132 return child_range(child_iterator(), child_iterator());
0133 }
0134 const_child_range used_children() const {
0135 return const_child_range(const_child_iterator(), const_child_iterator());
0136 }
0137
0138 static bool classof(const OMPClause *T) {
0139 return T->getClauseKind() == ClauseKind;
0140 }
0141 };
0142
0143 template <OpenMPClauseKind ClauseKind, class Base>
0144 class OMPOneStmtClause : public Base {
0145
0146
0147 SourceLocation LParenLoc;
0148
0149
0150 Stmt *S = nullptr;
0151
0152 protected:
0153 void setStmt(Stmt *S) { this->S = S; }
0154
0155 public:
0156 OMPOneStmtClause(Stmt *S, SourceLocation StartLoc, SourceLocation LParenLoc,
0157 SourceLocation EndLoc)
0158 : Base(ClauseKind, StartLoc, EndLoc), LParenLoc(LParenLoc), S(S) {}
0159
0160 OMPOneStmtClause() : Base(ClauseKind, SourceLocation(), SourceLocation()) {}
0161
0162
0163 template <typename T> T *getStmtAs() const { return cast_or_null<T>(S); }
0164
0165
0166 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
0167
0168
0169 SourceLocation getLParenLoc() const { return LParenLoc; }
0170
0171 using child_iterator = StmtIterator;
0172 using const_child_iterator = ConstStmtIterator;
0173 using child_range = llvm::iterator_range<child_iterator>;
0174 using const_child_range = llvm::iterator_range<const_child_iterator>;
0175
0176 child_range children() { return child_range(&S, &S + 1); }
0177
0178 const_child_range children() const { return const_child_range(&S, &S + 1); }
0179
0180
0181 child_range used_children() {
0182 return child_range(child_iterator(), child_iterator());
0183 }
0184 const_child_range used_children() const {
0185 return const_child_range(const_child_iterator(), const_child_iterator());
0186 }
0187
0188 static bool classof(const OMPClause *T) {
0189 return T->getClauseKind() == ClauseKind;
0190 }
0191 };
0192
0193
0194
0195 class OMPClauseWithPreInit {
0196 friend class OMPClauseReader;
0197
0198
0199 Stmt *PreInit = nullptr;
0200
0201
0202 OpenMPDirectiveKind CaptureRegion = llvm::omp::OMPD_unknown;
0203
0204 protected:
0205 OMPClauseWithPreInit(const OMPClause *This) {
0206 assert(get(This) && "get is not tuned for pre-init.");
0207 }
0208
0209
0210 void
0211 setPreInitStmt(Stmt *S,
0212 OpenMPDirectiveKind ThisRegion = llvm::omp::OMPD_unknown) {
0213 PreInit = S;
0214 CaptureRegion = ThisRegion;
0215 }
0216
0217 public:
0218
0219 const Stmt *getPreInitStmt() const { return PreInit; }
0220
0221
0222 Stmt *getPreInitStmt() { return PreInit; }
0223
0224
0225 OpenMPDirectiveKind getCaptureRegion() const { return CaptureRegion; }
0226
0227 static OMPClauseWithPreInit *get(OMPClause *C);
0228 static const OMPClauseWithPreInit *get(const OMPClause *C);
0229 };
0230
0231
0232
0233 class OMPClauseWithPostUpdate : public OMPClauseWithPreInit {
0234 friend class OMPClauseReader;
0235
0236
0237 Expr *PostUpdate = nullptr;
0238
0239 protected:
0240 OMPClauseWithPostUpdate(const OMPClause *This) : OMPClauseWithPreInit(This) {
0241 assert(get(This) && "get is not tuned for post-update.");
0242 }
0243
0244
0245 void setPostUpdateExpr(Expr *S) { PostUpdate = S; }
0246
0247 public:
0248
0249 const Expr *getPostUpdateExpr() const { return PostUpdate; }
0250
0251
0252 Expr *getPostUpdateExpr() { return PostUpdate; }
0253
0254 static OMPClauseWithPostUpdate *get(OMPClause *C);
0255 static const OMPClauseWithPostUpdate *get(const OMPClause *C);
0256 };
0257
0258
0259 struct OMPVarListLocTy {
0260
0261 SourceLocation StartLoc;
0262
0263 SourceLocation LParenLoc;
0264
0265 SourceLocation EndLoc;
0266 OMPVarListLocTy() = default;
0267 OMPVarListLocTy(SourceLocation StartLoc, SourceLocation LParenLoc,
0268 SourceLocation EndLoc)
0269 : StartLoc(StartLoc), LParenLoc(LParenLoc), EndLoc(EndLoc) {}
0270 };
0271
0272
0273
0274
0275 template <class T> class OMPVarListClause : public OMPClause {
0276 friend class OMPClauseReader;
0277
0278
0279 SourceLocation LParenLoc;
0280
0281
0282 unsigned NumVars;
0283
0284 protected:
0285
0286
0287
0288
0289
0290
0291
0292 OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc,
0293 SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N)
0294 : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
0295
0296
0297 MutableArrayRef<Expr *> getVarRefs() {
0298 return MutableArrayRef<Expr *>(
0299 static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
0300 }
0301
0302
0303 void setVarRefs(ArrayRef<Expr *> VL) {
0304 assert(VL.size() == NumVars &&
0305 "Number of variables is not the same as the preallocated buffer");
0306 std::copy(VL.begin(), VL.end(),
0307 static_cast<T *>(this)->template getTrailingObjects<Expr *>());
0308 }
0309
0310 public:
0311 using varlist_iterator = MutableArrayRef<Expr *>::iterator;
0312 using varlist_const_iterator = ArrayRef<const Expr *>::iterator;
0313 using varlist_range = llvm::iterator_range<varlist_iterator>;
0314 using varlist_const_range = llvm::iterator_range<varlist_const_iterator>;
0315
0316 unsigned varlist_size() const { return NumVars; }
0317 bool varlist_empty() const { return NumVars == 0; }
0318
0319 varlist_range varlist() {
0320 return varlist_range(varlist_begin(), varlist_end());
0321 }
0322 varlist_const_range varlist() const {
0323 return varlist_const_range(varlist_begin(), varlist_end());
0324 }
0325
0326 varlist_iterator varlist_begin() { return getVarRefs().begin(); }
0327 varlist_iterator varlist_end() { return getVarRefs().end(); }
0328 varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
0329 varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
0330
0331
0332 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
0333
0334
0335 SourceLocation getLParenLoc() const { return LParenLoc; }
0336
0337
0338 ArrayRef<const Expr *> getVarRefs() const {
0339 return llvm::ArrayRef(
0340 static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
0341 NumVars);
0342 }
0343 };
0344
0345
0346
0347 template <class T> class OMPDirectiveListClause : public OMPClause {
0348
0349 SourceLocation LParenLoc;
0350
0351 protected:
0352
0353 unsigned NumKinds;
0354
0355 public:
0356
0357
0358
0359
0360
0361
0362
0363 OMPDirectiveListClause(OpenMPClauseKind K, SourceLocation StartLoc,
0364 SourceLocation LParenLoc, SourceLocation EndLoc,
0365 unsigned NumKinds)
0366 : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc),
0367 NumKinds(NumKinds) {}
0368
0369 child_range children() {
0370 return child_range(child_iterator(), child_iterator());
0371 }
0372
0373 const_child_range children() const {
0374 return const_child_range(const_child_iterator(), const_child_iterator());
0375 }
0376
0377 child_range used_children() {
0378 return child_range(child_iterator(), child_iterator());
0379 }
0380 const_child_range used_children() const {
0381 return const_child_range(const_child_iterator(), const_child_iterator());
0382 }
0383
0384 MutableArrayRef<OpenMPDirectiveKind> getDirectiveKinds() {
0385 return MutableArrayRef<OpenMPDirectiveKind>(
0386 static_cast<T *>(this)
0387 ->template getTrailingObjects<OpenMPDirectiveKind>(),
0388 NumKinds);
0389 }
0390
0391 void setDirectiveKinds(ArrayRef<OpenMPDirectiveKind> DK) {
0392 assert(
0393 DK.size() == NumKinds &&
0394 "Number of directive kinds is not the same as the preallocated buffer");
0395 std::copy(DK.begin(), DK.end(),
0396 static_cast<T *>(this)
0397 ->template getTrailingObjects<OpenMPDirectiveKind>());
0398 }
0399
0400 SourceLocation getLParenLoc() { return LParenLoc; }
0401
0402 void setLParenLoc(SourceLocation S) { LParenLoc = S; }
0403 };
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413 class OMPAllocatorClause final
0414 : public OMPOneStmtClause<llvm::omp::OMPC_allocator, OMPClause> {
0415 friend class OMPClauseReader;
0416
0417
0418 void setAllocator(Expr *A) { setStmt(A); }
0419
0420 public:
0421
0422
0423
0424
0425
0426
0427 OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc,
0428 SourceLocation EndLoc)
0429 : OMPOneStmtClause(A, StartLoc, LParenLoc, EndLoc) {}
0430
0431
0432 OMPAllocatorClause() : OMPOneStmtClause() {}
0433
0434
0435 Expr *getAllocator() const { return getStmtAs<Expr>(); }
0436 };
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447 class OMPAlignClause final
0448 : public OMPOneStmtClause<llvm::omp::OMPC_align, OMPClause> {
0449 friend class OMPClauseReader;
0450
0451
0452 void setAlignment(Expr *A) { setStmt(A); }
0453
0454
0455
0456
0457
0458
0459
0460 OMPAlignClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc,
0461 SourceLocation EndLoc)
0462 : OMPOneStmtClause(A, StartLoc, LParenLoc, EndLoc) {}
0463
0464
0465 OMPAlignClause() : OMPOneStmtClause() {}
0466
0467 public:
0468
0469
0470
0471
0472
0473
0474 static OMPAlignClause *Create(const ASTContext &C, Expr *A,
0475 SourceLocation StartLoc,
0476 SourceLocation LParenLoc,
0477 SourceLocation EndLoc);
0478
0479
0480 Expr *getAlignment() const { return getStmtAs<Expr>(); }
0481 };
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491 class OMPAllocateClause final
0492 : public OMPVarListClause<OMPAllocateClause>,
0493 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
0494 friend class OMPClauseReader;
0495 friend OMPVarListClause;
0496 friend TrailingObjects;
0497
0498
0499
0500 Expr *Allocator = nullptr;
0501
0502
0503 Expr *Alignment = nullptr;
0504
0505 SourceLocation ColonLoc;
0506
0507 OpenMPAllocateClauseModifier AllocatorModifier = OMPC_ALLOCATE_unknown;
0508
0509 SourceLocation AllocatorModifierLoc;
0510
0511
0512
0513
0514 enum { FIRST, SECOND, NUM_MODIFIERS };
0515 OpenMPAllocateClauseModifier Modifiers[NUM_MODIFIERS];
0516
0517
0518 SourceLocation ModifiersLoc[NUM_MODIFIERS];
0519
0520
0521
0522
0523 void setFirstAllocateModifier(OpenMPAllocateClauseModifier M) {
0524 Modifiers[FIRST] = M;
0525 }
0526
0527
0528
0529
0530 void setSecondAllocateModifier(OpenMPAllocateClauseModifier M) {
0531 Modifiers[SECOND] = M;
0532 }
0533
0534
0535 void setFirstAllocateModifierLoc(SourceLocation Loc) {
0536 ModifiersLoc[FIRST] = Loc;
0537 }
0538
0539
0540 void setSecondAllocateModifierLoc(SourceLocation Loc) {
0541 ModifiersLoc[SECOND] = Loc;
0542 }
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554 OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
0555 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
0556 OpenMPAllocateClauseModifier Modifier1,
0557 SourceLocation Modifier1Loc,
0558 OpenMPAllocateClauseModifier Modifier2,
0559 SourceLocation Modifier2Loc, SourceLocation EndLoc,
0560 unsigned N)
0561 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
0562 LParenLoc, EndLoc, N),
0563 Allocator(Allocator), Alignment(Alignment), ColonLoc(ColonLoc) {
0564 Modifiers[FIRST] = Modifier1;
0565 Modifiers[SECOND] = Modifier2;
0566 ModifiersLoc[FIRST] = Modifier1Loc;
0567 ModifiersLoc[SECOND] = Modifier2Loc;
0568 }
0569
0570
0571
0572
0573 explicit OMPAllocateClause(unsigned N)
0574 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
0575 SourceLocation(), SourceLocation(),
0576 SourceLocation(), N) {
0577 Modifiers[FIRST] = OMPC_ALLOCATE_unknown;
0578 Modifiers[SECOND] = OMPC_ALLOCATE_unknown;
0579 }
0580
0581
0582 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
0583
0584 void setAllocator(Expr *A) { Allocator = A; }
0585 void setAllocatorModifier(OpenMPAllocateClauseModifier AM) {
0586 AllocatorModifier = AM;
0587 }
0588 void setAlignment(Expr *A) { Alignment = A; }
0589
0590 public:
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602 static OMPAllocateClause *
0603 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
0604 Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
0605 OpenMPAllocateClauseModifier Modifier1, SourceLocation Modifier1Loc,
0606 OpenMPAllocateClauseModifier Modifier2, SourceLocation Modifier2Loc,
0607 SourceLocation EndLoc, ArrayRef<Expr *> VL);
0608
0609
0610 Expr *getAllocator() const { return Allocator; }
0611
0612
0613 Expr *getAlignment() const { return Alignment; }
0614
0615
0616 OpenMPAllocateClauseModifier getAllocatorModifier() const {
0617 return AllocatorModifier;
0618 }
0619
0620
0621 OpenMPAllocateClauseModifier getFirstAllocateModifier() const {
0622 return Modifiers[FIRST];
0623 }
0624
0625
0626 SourceLocation getFirstAllocateModifierLoc() const {
0627 return ModifiersLoc[FIRST];
0628 }
0629
0630
0631 OpenMPAllocateClauseModifier getSecondAllocateModifier() const {
0632 return Modifiers[SECOND];
0633 }
0634
0635
0636 SourceLocation getSecondAllocateModifierLoc() const {
0637 return ModifiersLoc[SECOND];
0638 }
0639
0640
0641 SourceLocation getColonLoc() const { return ColonLoc; }
0642
0643 SourceLocation getAllocatorModifierLoc() const {
0644 return AllocatorModifierLoc;
0645 }
0646
0647
0648
0649
0650
0651 static OMPAllocateClause *CreateEmpty(const ASTContext &C, unsigned N);
0652
0653 child_range children() {
0654 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
0655 reinterpret_cast<Stmt **>(varlist_end()));
0656 }
0657
0658 const_child_range children() const {
0659 auto Children = const_cast<OMPAllocateClause *>(this)->children();
0660 return const_child_range(Children.begin(), Children.end());
0661 }
0662
0663 child_range used_children() {
0664 return child_range(child_iterator(), child_iterator());
0665 }
0666 const_child_range used_children() const {
0667 return const_child_range(const_child_iterator(), const_child_iterator());
0668 }
0669
0670 static bool classof(const OMPClause *T) {
0671 return T->getClauseKind() == llvm::omp::OMPC_allocate;
0672 }
0673 };
0674
0675
0676
0677
0678
0679
0680
0681
0682 class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
0683 friend class OMPClauseReader;
0684
0685
0686 SourceLocation LParenLoc;
0687
0688
0689 Stmt *Condition = nullptr;
0690
0691
0692 SourceLocation ColonLoc;
0693
0694
0695 OpenMPDirectiveKind NameModifier = llvm::omp::OMPD_unknown;
0696
0697
0698 SourceLocation NameModifierLoc;
0699
0700
0701 void setCondition(Expr *Cond) { Condition = Cond; }
0702
0703
0704 void setNameModifier(OpenMPDirectiveKind NM) { NameModifier = NM; }
0705
0706
0707 void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
0708
0709
0710 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
0711
0712 public:
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725 OMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Cond, Stmt *HelperCond,
0726 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
0727 SourceLocation LParenLoc, SourceLocation NameModifierLoc,
0728 SourceLocation ColonLoc, SourceLocation EndLoc)
0729 : OMPClause(llvm::omp::OMPC_if, StartLoc, EndLoc),
0730 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Condition(Cond),
0731 ColonLoc(ColonLoc), NameModifier(NameModifier),
0732 NameModifierLoc(NameModifierLoc) {
0733 setPreInitStmt(HelperCond, CaptureRegion);
0734 }
0735
0736
0737 OMPIfClause()
0738 : OMPClause(llvm::omp::OMPC_if, SourceLocation(), SourceLocation()),
0739 OMPClauseWithPreInit(this) {}
0740
0741
0742 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
0743
0744
0745 SourceLocation getLParenLoc() const { return LParenLoc; }
0746
0747
0748 SourceLocation getColonLoc() const { return ColonLoc; }
0749
0750
0751 Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
0752
0753
0754 OpenMPDirectiveKind getNameModifier() const { return NameModifier; }
0755
0756
0757 SourceLocation getNameModifierLoc() const { return NameModifierLoc; }
0758
0759 child_range children() { return child_range(&Condition, &Condition + 1); }
0760
0761 const_child_range children() const {
0762 return const_child_range(&Condition, &Condition + 1);
0763 }
0764
0765 child_range used_children();
0766 const_child_range used_children() const {
0767 auto Children = const_cast<OMPIfClause *>(this)->used_children();
0768 return const_child_range(Children.begin(), Children.end());
0769 }
0770
0771 static bool classof(const OMPClause *T) {
0772 return T->getClauseKind() == llvm::omp::OMPC_if;
0773 }
0774 };
0775
0776
0777
0778
0779
0780
0781
0782
0783 class OMPFinalClause final
0784 : public OMPOneStmtClause<llvm::omp::OMPC_final, OMPClause>,
0785 public OMPClauseWithPreInit {
0786 friend class OMPClauseReader;
0787
0788
0789 void setCondition(Expr *Cond) { setStmt(Cond); }
0790
0791 public:
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801 OMPFinalClause(Expr *Cond, Stmt *HelperCond,
0802 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
0803 SourceLocation LParenLoc, SourceLocation EndLoc)
0804 : OMPOneStmtClause(Cond, StartLoc, LParenLoc, EndLoc),
0805 OMPClauseWithPreInit(this) {
0806 setPreInitStmt(HelperCond, CaptureRegion);
0807 }
0808
0809
0810 OMPFinalClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
0811
0812
0813 Expr *getCondition() const { return getStmtAs<Expr>(); }
0814
0815 child_range used_children();
0816 const_child_range used_children() const {
0817 auto Children = const_cast<OMPFinalClause *>(this)->used_children();
0818 return const_child_range(Children.begin(), Children.end());
0819 }
0820 };
0821
0822
0823
0824
0825
0826
0827
0828
0829 class OMPNumThreadsClause final
0830 : public OMPOneStmtClause<llvm::omp::OMPC_num_threads, OMPClause>,
0831 public OMPClauseWithPreInit {
0832 friend class OMPClauseReader;
0833
0834
0835 void setNumThreads(Expr *NThreads) { setStmt(NThreads); }
0836
0837 public:
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847 OMPNumThreadsClause(Expr *NumThreads, Stmt *HelperNumThreads,
0848 OpenMPDirectiveKind CaptureRegion,
0849 SourceLocation StartLoc, SourceLocation LParenLoc,
0850 SourceLocation EndLoc)
0851 : OMPOneStmtClause(NumThreads, StartLoc, LParenLoc, EndLoc),
0852 OMPClauseWithPreInit(this) {
0853 setPreInitStmt(HelperNumThreads, CaptureRegion);
0854 }
0855
0856
0857 OMPNumThreadsClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
0858
0859
0860 Expr *getNumThreads() const { return getStmtAs<Expr>(); }
0861 };
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875 class OMPSafelenClause final
0876 : public OMPOneStmtClause<llvm::omp::OMPC_safelen, OMPClause> {
0877 friend class OMPClauseReader;
0878
0879
0880 void setSafelen(Expr *Len) { setStmt(Len); }
0881
0882 public:
0883
0884
0885
0886
0887
0888 OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
0889 SourceLocation EndLoc)
0890 : OMPOneStmtClause(Len, StartLoc, LParenLoc, EndLoc) {}
0891
0892
0893 explicit OMPSafelenClause() : OMPOneStmtClause() {}
0894
0895
0896 Expr *getSafelen() const { return getStmtAs<Expr>(); }
0897 };
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910 class OMPSimdlenClause final
0911 : public OMPOneStmtClause<llvm::omp::OMPC_simdlen, OMPClause> {
0912 friend class OMPClauseReader;
0913
0914
0915 void setSimdlen(Expr *Len) { setStmt(Len); }
0916
0917 public:
0918
0919
0920
0921
0922
0923 OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
0924 SourceLocation EndLoc)
0925 : OMPOneStmtClause(Len, StartLoc, LParenLoc, EndLoc) {}
0926
0927
0928 explicit OMPSimdlenClause() : OMPOneStmtClause() {}
0929
0930
0931 Expr *getSimdlen() const { return getStmtAs<Expr>(); }
0932 };
0933
0934
0935
0936
0937
0938
0939
0940
0941 class OMPSizesClause final
0942 : public OMPClause,
0943 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
0944 friend class OMPClauseReader;
0945 friend class llvm::TrailingObjects<OMPSizesClause, Expr *>;
0946
0947
0948 SourceLocation LParenLoc;
0949
0950
0951 unsigned NumSizes;
0952
0953
0954 explicit OMPSizesClause(int NumSizes)
0955 : OMPClause(llvm::omp::OMPC_sizes, SourceLocation(), SourceLocation()),
0956 NumSizes(NumSizes) {}
0957
0958 public:
0959
0960
0961
0962
0963
0964
0965
0966 static OMPSizesClause *Create(const ASTContext &C, SourceLocation StartLoc,
0967 SourceLocation LParenLoc, SourceLocation EndLoc,
0968 ArrayRef<Expr *> Sizes);
0969
0970
0971
0972
0973
0974 static OMPSizesClause *CreateEmpty(const ASTContext &C, unsigned NumSizes);
0975
0976
0977 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
0978
0979
0980 SourceLocation getLParenLoc() const { return LParenLoc; }
0981
0982
0983 unsigned getNumSizes() const { return NumSizes; }
0984
0985
0986 MutableArrayRef<Expr *> getSizesRefs() {
0987 return MutableArrayRef<Expr *>(static_cast<OMPSizesClause *>(this)
0988 ->template getTrailingObjects<Expr *>(),
0989 NumSizes);
0990 }
0991 ArrayRef<Expr *> getSizesRefs() const {
0992 return ArrayRef<Expr *>(static_cast<const OMPSizesClause *>(this)
0993 ->template getTrailingObjects<Expr *>(),
0994 NumSizes);
0995 }
0996
0997
0998 void setSizesRefs(ArrayRef<Expr *> VL) {
0999 assert(VL.size() == NumSizes);
1000 std::copy(VL.begin(), VL.end(),
1001 static_cast<OMPSizesClause *>(this)
1002 ->template getTrailingObjects<Expr *>());
1003 }
1004
1005 child_range children() {
1006 MutableArrayRef<Expr *> Sizes = getSizesRefs();
1007 return child_range(reinterpret_cast<Stmt **>(Sizes.begin()),
1008 reinterpret_cast<Stmt **>(Sizes.end()));
1009 }
1010 const_child_range children() const {
1011 ArrayRef<Expr *> Sizes = getSizesRefs();
1012 return const_child_range(reinterpret_cast<Stmt *const *>(Sizes.begin()),
1013 reinterpret_cast<Stmt *const *>(Sizes.end()));
1014 }
1015
1016 child_range used_children() {
1017 return child_range(child_iterator(), child_iterator());
1018 }
1019 const_child_range used_children() const {
1020 return const_child_range(const_child_iterator(), const_child_iterator());
1021 }
1022
1023 static bool classof(const OMPClause *T) {
1024 return T->getClauseKind() == llvm::omp::OMPC_sizes;
1025 }
1026 };
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036 class OMPPermutationClause final
1037 : public OMPClause,
1038 private llvm::TrailingObjects<OMPSizesClause, Expr *> {
1039 friend class OMPClauseReader;
1040 friend class llvm::TrailingObjects<OMPSizesClause, Expr *>;
1041
1042
1043 SourceLocation LParenLoc;
1044
1045
1046
1047 unsigned NumLoops;
1048
1049
1050 void setArgRefs(ArrayRef<Expr *> VL) {
1051 assert(VL.size() == NumLoops && "Expecting one expression per loop");
1052 llvm::copy(VL, static_cast<OMPPermutationClause *>(this)
1053 ->template getTrailingObjects<Expr *>());
1054 }
1055
1056
1057 explicit OMPPermutationClause(int NumLoops)
1058 : OMPClause(llvm::omp::OMPC_permutation, SourceLocation(),
1059 SourceLocation()),
1060 NumLoops(NumLoops) {}
1061
1062 public:
1063
1064
1065
1066
1067
1068
1069
1070 static OMPPermutationClause *
1071 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
1072 SourceLocation EndLoc, ArrayRef<Expr *> Args);
1073
1074
1075
1076
1077
1078 static OMPPermutationClause *CreateEmpty(const ASTContext &C,
1079 unsigned NumLoops);
1080
1081
1082 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1083
1084
1085 SourceLocation getLParenLoc() const { return LParenLoc; }
1086
1087
1088 unsigned getNumLoops() const { return NumLoops; }
1089
1090
1091
1092 MutableArrayRef<Expr *> getArgsRefs() {
1093 return MutableArrayRef<Expr *>(static_cast<OMPPermutationClause *>(this)
1094 ->template getTrailingObjects<Expr *>(),
1095 NumLoops);
1096 }
1097 ArrayRef<Expr *> getArgsRefs() const {
1098 return ArrayRef<Expr *>(static_cast<const OMPPermutationClause *>(this)
1099 ->template getTrailingObjects<Expr *>(),
1100 NumLoops);
1101 }
1102
1103
1104 child_range children() {
1105 MutableArrayRef<Expr *> Args = getArgsRefs();
1106 return child_range(reinterpret_cast<Stmt **>(Args.begin()),
1107 reinterpret_cast<Stmt **>(Args.end()));
1108 }
1109 const_child_range children() const {
1110 ArrayRef<Expr *> Args = getArgsRefs();
1111 return const_child_range(reinterpret_cast<Stmt *const *>(Args.begin()),
1112 reinterpret_cast<Stmt *const *>(Args.end()));
1113 }
1114
1115 child_range used_children() {
1116 return child_range(child_iterator(), child_iterator());
1117 }
1118 const_child_range used_children() const {
1119 return const_child_range(const_child_iterator(), const_child_iterator());
1120 }
1121
1122 static bool classof(const OMPClause *T) {
1123 return T->getClauseKind() == llvm::omp::OMPC_permutation;
1124 }
1125 };
1126
1127
1128
1129
1130
1131
1132
1133 class OMPFullClause final : public OMPNoChildClause<llvm::omp::OMPC_full> {
1134 friend class OMPClauseReader;
1135
1136
1137 explicit OMPFullClause() : OMPNoChildClause() {}
1138
1139 public:
1140
1141
1142
1143
1144
1145 static OMPFullClause *Create(const ASTContext &C, SourceLocation StartLoc,
1146 SourceLocation EndLoc);
1147
1148
1149
1150
1151 static OMPFullClause *CreateEmpty(const ASTContext &C);
1152 };
1153
1154
1155
1156
1157
1158
1159
1160
1161 class OMPPartialClause final : public OMPClause {
1162 friend class OMPClauseReader;
1163
1164
1165 SourceLocation LParenLoc;
1166
1167
1168 Stmt *Factor;
1169
1170
1171 explicit OMPPartialClause() : OMPClause(llvm::omp::OMPC_partial, {}, {}) {}
1172
1173
1174 void setFactor(Expr *E) { Factor = E; }
1175
1176
1177 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1178
1179 public:
1180
1181
1182
1183
1184
1185
1186
1187 static OMPPartialClause *Create(const ASTContext &C, SourceLocation StartLoc,
1188 SourceLocation LParenLoc,
1189 SourceLocation EndLoc, Expr *Factor);
1190
1191
1192
1193
1194 static OMPPartialClause *CreateEmpty(const ASTContext &C);
1195
1196
1197 SourceLocation getLParenLoc() const { return LParenLoc; }
1198
1199
1200 Expr *getFactor() const { return cast_or_null<Expr>(Factor); }
1201
1202 child_range children() { return child_range(&Factor, &Factor + 1); }
1203 const_child_range children() const {
1204 return const_child_range(&Factor, &Factor + 1);
1205 }
1206
1207 child_range used_children() {
1208 return child_range(child_iterator(), child_iterator());
1209 }
1210 const_child_range used_children() const {
1211 return const_child_range(const_child_iterator(), const_child_iterator());
1212 }
1213
1214 static bool classof(const OMPClause *T) {
1215 return T->getClauseKind() == llvm::omp::OMPC_partial;
1216 }
1217 };
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230 class OMPCollapseClause final
1231 : public OMPOneStmtClause<llvm::omp::OMPC_collapse, OMPClause> {
1232 friend class OMPClauseReader;
1233
1234
1235 void setNumForLoops(Expr *Num) { setStmt(Num); }
1236
1237 public:
1238
1239
1240
1241
1242
1243
1244 OMPCollapseClause(Expr *Num, SourceLocation StartLoc,
1245 SourceLocation LParenLoc, SourceLocation EndLoc)
1246 : OMPOneStmtClause(Num, StartLoc, LParenLoc, EndLoc) {}
1247
1248
1249 explicit OMPCollapseClause() : OMPOneStmtClause() {}
1250
1251
1252 Expr *getNumForLoops() const { return getStmtAs<Expr>(); }
1253 };
1254
1255
1256
1257
1258
1259
1260
1261
1262 class OMPDefaultClause : public OMPClause {
1263 friend class OMPClauseReader;
1264
1265
1266 SourceLocation LParenLoc;
1267
1268
1269 llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
1270
1271
1272 SourceLocation KindKwLoc;
1273
1274
1275
1276
1277 void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
1278
1279
1280
1281
1282 void setDefaultKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1283
1284 public:
1285
1286
1287
1288
1289
1290
1291
1292 OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc,
1293 SourceLocation StartLoc, SourceLocation LParenLoc,
1294 SourceLocation EndLoc)
1295 : OMPClause(llvm::omp::OMPC_default, StartLoc, EndLoc),
1296 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1297
1298
1299 OMPDefaultClause()
1300 : OMPClause(llvm::omp::OMPC_default, SourceLocation(), SourceLocation()) {
1301 }
1302
1303
1304 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1305
1306
1307 SourceLocation getLParenLoc() const { return LParenLoc; }
1308
1309
1310 llvm::omp::DefaultKind getDefaultKind() const { return Kind; }
1311
1312
1313 SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; }
1314
1315 child_range children() {
1316 return child_range(child_iterator(), child_iterator());
1317 }
1318
1319 const_child_range children() const {
1320 return const_child_range(const_child_iterator(), const_child_iterator());
1321 }
1322
1323 child_range used_children() {
1324 return child_range(child_iterator(), child_iterator());
1325 }
1326 const_child_range used_children() const {
1327 return const_child_range(const_child_iterator(), const_child_iterator());
1328 }
1329
1330 static bool classof(const OMPClause *T) {
1331 return T->getClauseKind() == llvm::omp::OMPC_default;
1332 }
1333 };
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343 class OMPProcBindClause : public OMPClause {
1344 friend class OMPClauseReader;
1345
1346
1347 SourceLocation LParenLoc;
1348
1349
1350 llvm::omp::ProcBindKind Kind = llvm::omp::OMP_PROC_BIND_unknown;
1351
1352
1353 SourceLocation KindKwLoc;
1354
1355
1356
1357
1358 void setProcBindKind(llvm::omp::ProcBindKind K) { Kind = K; }
1359
1360
1361
1362
1363 void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1364
1365 public:
1366
1367
1368
1369
1370
1371
1372
1373
1374 OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
1375 SourceLocation StartLoc, SourceLocation LParenLoc,
1376 SourceLocation EndLoc)
1377 : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc),
1378 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1379
1380
1381 OMPProcBindClause()
1382 : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(),
1383 SourceLocation()) {}
1384
1385
1386 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1387
1388
1389 SourceLocation getLParenLoc() const { return LParenLoc; }
1390
1391
1392 llvm::omp::ProcBindKind getProcBindKind() const { return Kind; }
1393
1394
1395 SourceLocation getProcBindKindKwLoc() const { return KindKwLoc; }
1396
1397 child_range children() {
1398 return child_range(child_iterator(), child_iterator());
1399 }
1400
1401 const_child_range children() const {
1402 return const_child_range(const_child_iterator(), const_child_iterator());
1403 }
1404
1405 child_range used_children() {
1406 return child_range(child_iterator(), child_iterator());
1407 }
1408 const_child_range used_children() const {
1409 return const_child_range(const_child_iterator(), const_child_iterator());
1410 }
1411
1412 static bool classof(const OMPClause *T) {
1413 return T->getClauseKind() == llvm::omp::OMPC_proc_bind;
1414 }
1415 };
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425 class OMPUnifiedAddressClause final
1426 : public OMPNoChildClause<llvm::omp::OMPC_unified_address> {
1427 public:
1428 friend class OMPClauseReader;
1429
1430
1431
1432
1433 OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
1434 : OMPNoChildClause(StartLoc, EndLoc) {}
1435
1436
1437 OMPUnifiedAddressClause() : OMPNoChildClause() {}
1438 };
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448 class OMPUnifiedSharedMemoryClause final : public OMPClause {
1449 public:
1450 friend class OMPClauseReader;
1451
1452
1453
1454
1455 OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
1456 : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1457
1458
1459 OMPUnifiedSharedMemoryClause()
1460 : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(),
1461 SourceLocation()) {}
1462
1463 child_range children() {
1464 return child_range(child_iterator(), child_iterator());
1465 }
1466
1467 const_child_range children() const {
1468 return const_child_range(const_child_iterator(), const_child_iterator());
1469 }
1470
1471 child_range used_children() {
1472 return child_range(child_iterator(), child_iterator());
1473 }
1474 const_child_range used_children() const {
1475 return const_child_range(const_child_iterator(), const_child_iterator());
1476 }
1477
1478 static bool classof(const OMPClause *T) {
1479 return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory;
1480 }
1481 };
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491 class OMPReverseOffloadClause final : public OMPClause {
1492 public:
1493 friend class OMPClauseReader;
1494
1495
1496
1497
1498 OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
1499 : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {}
1500
1501
1502 OMPReverseOffloadClause()
1503 : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(),
1504 SourceLocation()) {}
1505
1506 child_range children() {
1507 return child_range(child_iterator(), child_iterator());
1508 }
1509
1510 const_child_range children() const {
1511 return const_child_range(const_child_iterator(), const_child_iterator());
1512 }
1513
1514 child_range used_children() {
1515 return child_range(child_iterator(), child_iterator());
1516 }
1517 const_child_range used_children() const {
1518 return const_child_range(const_child_iterator(), const_child_iterator());
1519 }
1520
1521 static bool classof(const OMPClause *T) {
1522 return T->getClauseKind() == llvm::omp::OMPC_reverse_offload;
1523 }
1524 };
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534 class OMPDynamicAllocatorsClause final : public OMPClause {
1535 public:
1536 friend class OMPClauseReader;
1537
1538
1539
1540
1541 OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
1542 : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {}
1543
1544
1545 OMPDynamicAllocatorsClause()
1546 : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(),
1547 SourceLocation()) {}
1548
1549 child_range children() {
1550 return child_range(child_iterator(), child_iterator());
1551 }
1552
1553 const_child_range children() const {
1554 return const_child_range(const_child_iterator(), const_child_iterator());
1555 }
1556
1557 child_range used_children() {
1558 return child_range(child_iterator(), child_iterator());
1559 }
1560 const_child_range used_children() const {
1561 return const_child_range(const_child_iterator(), const_child_iterator());
1562 }
1563
1564 static bool classof(const OMPClause *T) {
1565 return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators;
1566 }
1567 };
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577 class OMPAtomicDefaultMemOrderClause final : public OMPClause {
1578 friend class OMPClauseReader;
1579
1580
1581 SourceLocation LParenLoc;
1582
1583
1584 OpenMPAtomicDefaultMemOrderClauseKind Kind =
1585 OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown;
1586
1587
1588 SourceLocation KindKwLoc;
1589
1590
1591
1592
1593 void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
1594 Kind = K;
1595 }
1596
1597
1598
1599
1600 void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
1601 KindKwLoc = KLoc;
1602 }
1603
1604 public:
1605
1606
1607
1608
1609
1610
1611
1612
1613 OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
1614 SourceLocation ALoc, SourceLocation StartLoc,
1615 SourceLocation LParenLoc,
1616 SourceLocation EndLoc)
1617 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc),
1618 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1619
1620
1621 OMPAtomicDefaultMemOrderClause()
1622 : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(),
1623 SourceLocation()) {}
1624
1625
1626 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1627
1628
1629 SourceLocation getLParenLoc() const { return LParenLoc; }
1630
1631
1632 OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const {
1633 return Kind;
1634 }
1635
1636
1637 SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; }
1638
1639 child_range children() {
1640 return child_range(child_iterator(), child_iterator());
1641 }
1642
1643 const_child_range children() const {
1644 return const_child_range(const_child_iterator(), const_child_iterator());
1645 }
1646
1647 child_range used_children() {
1648 return child_range(child_iterator(), child_iterator());
1649 }
1650 const_child_range used_children() const {
1651 return const_child_range(const_child_iterator(), const_child_iterator());
1652 }
1653
1654 static bool classof(const OMPClause *T) {
1655 return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order;
1656 }
1657 };
1658
1659
1660
1661
1662
1663
1664
1665
1666 class OMPAtClause final : public OMPClause {
1667 friend class OMPClauseReader;
1668
1669
1670 SourceLocation LParenLoc;
1671
1672
1673 OpenMPAtClauseKind Kind = OMPC_AT_unknown;
1674
1675
1676 SourceLocation KindKwLoc;
1677
1678
1679
1680
1681 void setAtKind(OpenMPAtClauseKind K) { Kind = K; }
1682
1683
1684
1685
1686 void setAtKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1687
1688
1689 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1690
1691 public:
1692
1693
1694
1695
1696
1697
1698
1699 OMPAtClause(OpenMPAtClauseKind A, SourceLocation ALoc,
1700 SourceLocation StartLoc, SourceLocation LParenLoc,
1701 SourceLocation EndLoc)
1702 : OMPClause(llvm::omp::OMPC_at, StartLoc, EndLoc), LParenLoc(LParenLoc),
1703 Kind(A), KindKwLoc(ALoc) {}
1704
1705
1706 OMPAtClause()
1707 : OMPClause(llvm::omp::OMPC_at, SourceLocation(), SourceLocation()) {}
1708
1709
1710 SourceLocation getLParenLoc() const { return LParenLoc; }
1711
1712
1713 OpenMPAtClauseKind getAtKind() const { return Kind; }
1714
1715
1716 SourceLocation getAtKindKwLoc() const { return KindKwLoc; }
1717
1718 child_range children() {
1719 return child_range(child_iterator(), child_iterator());
1720 }
1721
1722 const_child_range children() const {
1723 return const_child_range(const_child_iterator(), const_child_iterator());
1724 }
1725
1726 child_range used_children() {
1727 return child_range(child_iterator(), child_iterator());
1728 }
1729 const_child_range used_children() const {
1730 return const_child_range(const_child_iterator(), const_child_iterator());
1731 }
1732
1733 static bool classof(const OMPClause *T) {
1734 return T->getClauseKind() == llvm::omp::OMPC_at;
1735 }
1736 };
1737
1738
1739
1740
1741
1742
1743
1744
1745 class OMPSeverityClause final : public OMPClause {
1746 friend class OMPClauseReader;
1747
1748
1749 SourceLocation LParenLoc;
1750
1751
1752 OpenMPSeverityClauseKind Kind = OMPC_SEVERITY_unknown;
1753
1754
1755 SourceLocation KindKwLoc;
1756
1757
1758
1759
1760 void setSeverityKind(OpenMPSeverityClauseKind K) { Kind = K; }
1761
1762
1763
1764
1765 void setSeverityKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
1766
1767
1768 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1769
1770 public:
1771
1772
1773
1774
1775
1776
1777
1778 OMPSeverityClause(OpenMPSeverityClauseKind A, SourceLocation ALoc,
1779 SourceLocation StartLoc, SourceLocation LParenLoc,
1780 SourceLocation EndLoc)
1781 : OMPClause(llvm::omp::OMPC_severity, StartLoc, EndLoc),
1782 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1783
1784
1785 OMPSeverityClause()
1786 : OMPClause(llvm::omp::OMPC_severity, SourceLocation(),
1787 SourceLocation()) {}
1788
1789
1790 SourceLocation getLParenLoc() const { return LParenLoc; }
1791
1792
1793 OpenMPSeverityClauseKind getSeverityKind() const { return Kind; }
1794
1795
1796 SourceLocation getSeverityKindKwLoc() const { return KindKwLoc; }
1797
1798 child_range children() {
1799 return child_range(child_iterator(), child_iterator());
1800 }
1801
1802 const_child_range children() const {
1803 return const_child_range(const_child_iterator(), const_child_iterator());
1804 }
1805
1806 child_range used_children() {
1807 return child_range(child_iterator(), child_iterator());
1808 }
1809 const_child_range used_children() const {
1810 return const_child_range(const_child_iterator(), const_child_iterator());
1811 }
1812
1813 static bool classof(const OMPClause *T) {
1814 return T->getClauseKind() == llvm::omp::OMPC_severity;
1815 }
1816 };
1817
1818
1819
1820
1821
1822
1823
1824
1825 class OMPMessageClause final : public OMPClause {
1826 friend class OMPClauseReader;
1827
1828
1829 SourceLocation LParenLoc;
1830
1831
1832 Stmt *MessageString = nullptr;
1833
1834
1835 void setMessageString(Expr *MS) { MessageString = MS; }
1836
1837
1838 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1839
1840 public:
1841
1842
1843
1844
1845
1846
1847 OMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc,
1848 SourceLocation EndLoc)
1849 : OMPClause(llvm::omp::OMPC_message, StartLoc, EndLoc),
1850 LParenLoc(LParenLoc), MessageString(MS) {}
1851
1852
1853 OMPMessageClause()
1854 : OMPClause(llvm::omp::OMPC_message, SourceLocation(), SourceLocation()) {
1855 }
1856
1857
1858 SourceLocation getLParenLoc() const { return LParenLoc; }
1859
1860
1861 Expr *getMessageString() const { return cast_or_null<Expr>(MessageString); }
1862
1863 child_range children() {
1864 return child_range(&MessageString, &MessageString + 1);
1865 }
1866
1867 const_child_range children() const {
1868 return const_child_range(&MessageString, &MessageString + 1);
1869 }
1870
1871 child_range used_children() {
1872 return child_range(child_iterator(), child_iterator());
1873 }
1874
1875 const_child_range used_children() const {
1876 return const_child_range(const_child_iterator(), const_child_iterator());
1877 }
1878
1879 static bool classof(const OMPClause *T) {
1880 return T->getClauseKind() == llvm::omp::OMPC_message;
1881 }
1882 };
1883
1884
1885
1886
1887
1888
1889
1890
1891 class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
1892 friend class OMPClauseReader;
1893
1894
1895 SourceLocation LParenLoc;
1896
1897
1898 OpenMPScheduleClauseKind Kind = OMPC_SCHEDULE_unknown;
1899
1900
1901 enum {FIRST, SECOND, NUM_MODIFIERS};
1902 OpenMPScheduleClauseModifier Modifiers[NUM_MODIFIERS];
1903
1904
1905 SourceLocation ModifiersLoc[NUM_MODIFIERS];
1906
1907
1908 SourceLocation KindLoc;
1909
1910
1911 SourceLocation CommaLoc;
1912
1913
1914 Expr *ChunkSize = nullptr;
1915
1916
1917
1918
1919 void setScheduleKind(OpenMPScheduleClauseKind K) { Kind = K; }
1920
1921
1922
1923
1924 void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) {
1925 Modifiers[FIRST] = M;
1926 }
1927
1928
1929
1930
1931 void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) {
1932 Modifiers[SECOND] = M;
1933 }
1934
1935
1936 void setFirstScheduleModifierLoc(SourceLocation Loc) {
1937 ModifiersLoc[FIRST] = Loc;
1938 }
1939
1940
1941 void setSecondScheduleModifierLoc(SourceLocation Loc) {
1942 ModifiersLoc[SECOND] = Loc;
1943 }
1944
1945
1946
1947
1948 void setScheduleModifer(OpenMPScheduleClauseModifier M) {
1949 if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown)
1950 Modifiers[FIRST] = M;
1951 else {
1952 assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown);
1953 Modifiers[SECOND] = M;
1954 }
1955 }
1956
1957
1958
1959
1960 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1961
1962
1963
1964
1965 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
1966
1967
1968
1969
1970 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
1971
1972
1973
1974
1975 void setChunkSize(Expr *E) { ChunkSize = E; }
1976
1977 public:
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993 OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1994 SourceLocation KLoc, SourceLocation CommaLoc,
1995 SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
1996 Expr *ChunkSize, Stmt *HelperChunkSize,
1997 OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
1998 OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
1999 : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc),
2000 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind),
2001 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
2002 setPreInitStmt(HelperChunkSize);
2003 Modifiers[FIRST] = M1;
2004 Modifiers[SECOND] = M2;
2005 ModifiersLoc[FIRST] = M1Loc;
2006 ModifiersLoc[SECOND] = M2Loc;
2007 }
2008
2009
2010 explicit OMPScheduleClause()
2011 : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()),
2012 OMPClauseWithPreInit(this) {
2013 Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown;
2014 Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown;
2015 }
2016
2017
2018 OpenMPScheduleClauseKind getScheduleKind() const { return Kind; }
2019
2020
2021 OpenMPScheduleClauseModifier getFirstScheduleModifier() const {
2022 return Modifiers[FIRST];
2023 }
2024
2025
2026 OpenMPScheduleClauseModifier getSecondScheduleModifier() const {
2027 return Modifiers[SECOND];
2028 }
2029
2030
2031 SourceLocation getLParenLoc() { return LParenLoc; }
2032
2033
2034 SourceLocation getScheduleKindLoc() { return KindLoc; }
2035
2036
2037 SourceLocation getFirstScheduleModifierLoc() const {
2038 return ModifiersLoc[FIRST];
2039 }
2040
2041
2042 SourceLocation getSecondScheduleModifierLoc() const {
2043 return ModifiersLoc[SECOND];
2044 }
2045
2046
2047 SourceLocation getCommaLoc() { return CommaLoc; }
2048
2049
2050 Expr *getChunkSize() { return ChunkSize; }
2051
2052
2053 const Expr *getChunkSize() const { return ChunkSize; }
2054
2055 child_range children() {
2056 return child_range(reinterpret_cast<Stmt **>(&ChunkSize),
2057 reinterpret_cast<Stmt **>(&ChunkSize) + 1);
2058 }
2059
2060 const_child_range children() const {
2061 auto Children = const_cast<OMPScheduleClause *>(this)->children();
2062 return const_child_range(Children.begin(), Children.end());
2063 }
2064
2065 child_range used_children() {
2066 return child_range(child_iterator(), child_iterator());
2067 }
2068 const_child_range used_children() const {
2069 return const_child_range(const_child_iterator(), const_child_iterator());
2070 }
2071
2072 static bool classof(const OMPClause *T) {
2073 return T->getClauseKind() == llvm::omp::OMPC_schedule;
2074 }
2075 };
2076
2077
2078
2079
2080
2081
2082
2083
2084 class OMPOrderedClause final
2085 : public OMPClause,
2086 private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
2087 friend class OMPClauseReader;
2088 friend TrailingObjects;
2089
2090
2091 SourceLocation LParenLoc;
2092
2093
2094 Stmt *NumForLoops = nullptr;
2095
2096
2097 unsigned NumberOfLoops = 0;
2098
2099
2100
2101
2102
2103
2104
2105
2106 OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc,
2107 SourceLocation LParenLoc, SourceLocation EndLoc)
2108 : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc),
2109 LParenLoc(LParenLoc), NumForLoops(Num), NumberOfLoops(NumLoops) {}
2110
2111
2112 explicit OMPOrderedClause(unsigned NumLoops)
2113 : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()),
2114 NumberOfLoops(NumLoops) {}
2115
2116
2117 void setNumForLoops(Expr *Num) { NumForLoops = Num; }
2118
2119 public:
2120
2121
2122
2123
2124
2125
2126
2127 static OMPOrderedClause *Create(const ASTContext &C, Expr *Num,
2128 unsigned NumLoops, SourceLocation StartLoc,
2129 SourceLocation LParenLoc,
2130 SourceLocation EndLoc);
2131
2132
2133 static OMPOrderedClause* CreateEmpty(const ASTContext &C, unsigned NumLoops);
2134
2135
2136 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2137
2138
2139 SourceLocation getLParenLoc() const { return LParenLoc; }
2140
2141
2142 Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); }
2143
2144
2145 void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations);
2146
2147 ArrayRef<Expr *> getLoopNumIterations() const;
2148
2149
2150 void setLoopCounter(unsigned NumLoop, Expr *Counter);
2151
2152 Expr *getLoopCounter(unsigned NumLoop);
2153 const Expr *getLoopCounter(unsigned NumLoop) const;
2154
2155 child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); }
2156
2157 const_child_range children() const {
2158 return const_child_range(&NumForLoops, &NumForLoops + 1);
2159 }
2160
2161 child_range used_children() {
2162 return child_range(child_iterator(), child_iterator());
2163 }
2164 const_child_range used_children() const {
2165 return const_child_range(const_child_iterator(), const_child_iterator());
2166 }
2167
2168 static bool classof(const OMPClause *T) {
2169 return T->getClauseKind() == llvm::omp::OMPC_ordered;
2170 }
2171 };
2172
2173
2174
2175
2176
2177
2178
2179 class OMPNowaitClause final : public OMPNoChildClause<llvm::omp::OMPC_nowait> {
2180 public:
2181
2182
2183
2184
2185 OMPNowaitClause(SourceLocation StartLoc = SourceLocation(),
2186 SourceLocation EndLoc = SourceLocation())
2187 : OMPNoChildClause(StartLoc, EndLoc) {}
2188 };
2189
2190
2191
2192
2193
2194
2195
2196 class OMPUntiedClause : public OMPClause {
2197 public:
2198
2199
2200
2201
2202 OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2203 : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {}
2204
2205
2206 OMPUntiedClause()
2207 : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), SourceLocation()) {}
2208
2209 child_range children() {
2210 return child_range(child_iterator(), child_iterator());
2211 }
2212
2213 const_child_range children() const {
2214 return const_child_range(const_child_iterator(), const_child_iterator());
2215 }
2216
2217 child_range used_children() {
2218 return child_range(child_iterator(), child_iterator());
2219 }
2220 const_child_range used_children() const {
2221 return const_child_range(const_child_iterator(), const_child_iterator());
2222 }
2223
2224 static bool classof(const OMPClause *T) {
2225 return T->getClauseKind() == llvm::omp::OMPC_untied;
2226 }
2227 };
2228
2229
2230
2231
2232
2233
2234
2235
2236 class OMPMergeableClause : public OMPClause {
2237 public:
2238
2239
2240
2241
2242 OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
2243 : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {}
2244
2245
2246 OMPMergeableClause()
2247 : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(),
2248 SourceLocation()) {}
2249
2250 child_range children() {
2251 return child_range(child_iterator(), child_iterator());
2252 }
2253
2254 const_child_range children() const {
2255 return const_child_range(const_child_iterator(), const_child_iterator());
2256 }
2257
2258 child_range used_children() {
2259 return child_range(child_iterator(), child_iterator());
2260 }
2261 const_child_range used_children() const {
2262 return const_child_range(const_child_iterator(), const_child_iterator());
2263 }
2264
2265 static bool classof(const OMPClause *T) {
2266 return T->getClauseKind() == llvm::omp::OMPC_mergeable;
2267 }
2268 };
2269
2270
2271
2272
2273
2274
2275
2276
2277 class OMPAbsentClause final
2278 : public OMPDirectiveListClause<OMPAbsentClause>,
2279 private llvm::TrailingObjects<OMPAbsentClause, OpenMPDirectiveKind> {
2280 friend OMPDirectiveListClause;
2281 friend TrailingObjects;
2282
2283
2284
2285
2286
2287
2288
2289 OMPAbsentClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2290 SourceLocation EndLoc, unsigned NumKinds)
2291 : OMPDirectiveListClause<OMPAbsentClause>(
2292 llvm::omp::OMPC_absent, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2293
2294
2295 OMPAbsentClause(unsigned NumKinds)
2296 : OMPDirectiveListClause<OMPAbsentClause>(
2297 llvm::omp::OMPC_absent, SourceLocation(), SourceLocation(),
2298 SourceLocation(), NumKinds) {}
2299
2300 public:
2301 static OMPAbsentClause *Create(const ASTContext &C,
2302 ArrayRef<OpenMPDirectiveKind> DKVec,
2303 SourceLocation Loc, SourceLocation LLoc,
2304 SourceLocation RLoc);
2305
2306 static OMPAbsentClause *CreateEmpty(const ASTContext &C, unsigned NumKinds);
2307
2308 static bool classof(const OMPClause *C) {
2309 return C->getClauseKind() == llvm::omp::OMPC_absent;
2310 }
2311 };
2312
2313
2314
2315
2316
2317
2318
2319
2320 class OMPContainsClause final
2321 : public OMPDirectiveListClause<OMPContainsClause>,
2322 private llvm::TrailingObjects<OMPContainsClause, OpenMPDirectiveKind> {
2323 friend OMPDirectiveListClause;
2324 friend TrailingObjects;
2325
2326
2327
2328
2329
2330
2331
2332 OMPContainsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2333 SourceLocation EndLoc, unsigned NumKinds)
2334 : OMPDirectiveListClause<OMPContainsClause>(
2335 llvm::omp::OMPC_contains, StartLoc, LParenLoc, EndLoc, NumKinds) {}
2336
2337
2338 OMPContainsClause(unsigned NumKinds)
2339 : OMPDirectiveListClause<OMPContainsClause>(
2340 llvm::omp::OMPC_contains, SourceLocation(), SourceLocation(),
2341 SourceLocation(), NumKinds) {}
2342
2343 public:
2344 static OMPContainsClause *Create(const ASTContext &C,
2345 ArrayRef<OpenMPDirectiveKind> DKVec,
2346 SourceLocation Loc, SourceLocation LLoc,
2347 SourceLocation RLoc);
2348
2349 static OMPContainsClause *CreateEmpty(const ASTContext &C, unsigned NumKinds);
2350
2351 static bool classof(const OMPClause *C) {
2352 return C->getClauseKind() == llvm::omp::OMPC_contains;
2353 }
2354 };
2355
2356
2357
2358
2359
2360
2361
2362
2363 class OMPHoldsClause final
2364 : public OMPOneStmtClause<llvm::omp::OMPC_holds, OMPClause> {
2365 friend class OMPClauseReader;
2366
2367 public:
2368
2369
2370
2371
2372 OMPHoldsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc,
2373 SourceLocation EndLoc)
2374 : OMPOneStmtClause(E, StartLoc, LParenLoc, EndLoc) {}
2375
2376
2377 OMPHoldsClause() : OMPOneStmtClause() {}
2378
2379 Expr *getExpr() const { return getStmtAs<Expr>(); }
2380 void setExpr(Expr *E) { setStmt(E); }
2381 };
2382
2383
2384
2385
2386
2387
2388
2389
2390 class OMPNoOpenMPClause final
2391 : public OMPNoChildClause<llvm::omp::OMPC_no_openmp> {
2392 public:
2393
2394
2395
2396
2397 OMPNoOpenMPClause(SourceLocation StartLoc, SourceLocation EndLoc)
2398 : OMPNoChildClause(StartLoc, EndLoc) {}
2399
2400
2401 OMPNoOpenMPClause() : OMPNoChildClause() {}
2402 };
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412 class OMPNoOpenMPRoutinesClause final
2413 : public OMPNoChildClause<llvm::omp::OMPC_no_openmp_routines> {
2414 public:
2415
2416
2417
2418
2419 OMPNoOpenMPRoutinesClause(SourceLocation StartLoc, SourceLocation EndLoc)
2420 : OMPNoChildClause(StartLoc, EndLoc) {}
2421
2422
2423 OMPNoOpenMPRoutinesClause() : OMPNoChildClause() {}
2424 };
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434 class OMPNoParallelismClause final
2435 : public OMPNoChildClause<llvm::omp::OMPC_no_parallelism> {
2436 public:
2437
2438
2439
2440
2441 OMPNoParallelismClause(SourceLocation StartLoc, SourceLocation EndLoc)
2442 : OMPNoChildClause(StartLoc, EndLoc) {}
2443
2444
2445 OMPNoParallelismClause() : OMPNoChildClause() {}
2446 };
2447
2448
2449
2450
2451
2452
2453
2454 class OMPReadClause : public OMPClause {
2455 public:
2456
2457
2458
2459
2460 OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
2461 : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {}
2462
2463
2464 OMPReadClause()
2465 : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {}
2466
2467 child_range children() {
2468 return child_range(child_iterator(), child_iterator());
2469 }
2470
2471 const_child_range children() const {
2472 return const_child_range(const_child_iterator(), const_child_iterator());
2473 }
2474
2475 child_range used_children() {
2476 return child_range(child_iterator(), child_iterator());
2477 }
2478 const_child_range used_children() const {
2479 return const_child_range(const_child_iterator(), const_child_iterator());
2480 }
2481
2482 static bool classof(const OMPClause *T) {
2483 return T->getClauseKind() == llvm::omp::OMPC_read;
2484 }
2485 };
2486
2487
2488
2489
2490
2491
2492
2493 class OMPWriteClause : public OMPClause {
2494 public:
2495
2496
2497
2498
2499 OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
2500 : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {}
2501
2502
2503 OMPWriteClause()
2504 : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {}
2505
2506 child_range children() {
2507 return child_range(child_iterator(), child_iterator());
2508 }
2509
2510 const_child_range children() const {
2511 return const_child_range(const_child_iterator(), const_child_iterator());
2512 }
2513
2514 child_range used_children() {
2515 return child_range(child_iterator(), child_iterator());
2516 }
2517 const_child_range used_children() const {
2518 return const_child_range(const_child_iterator(), const_child_iterator());
2519 }
2520
2521 static bool classof(const OMPClause *T) {
2522 return T->getClauseKind() == llvm::omp::OMPC_write;
2523 }
2524 };
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541 class OMPUpdateClause final
2542 : public OMPClause,
2543 private llvm::TrailingObjects<OMPUpdateClause, SourceLocation,
2544 OpenMPDependClauseKind> {
2545 friend class OMPClauseReader;
2546 friend TrailingObjects;
2547
2548
2549 bool IsExtended = false;
2550
2551
2552
2553 size_t numTrailingObjects(OverloadToken<SourceLocation>) const {
2554
2555 return IsExtended ? 2 : 0;
2556 }
2557
2558
2559 void setLParenLoc(SourceLocation Loc) {
2560 assert(IsExtended && "Expected extended clause.");
2561 *getTrailingObjects<SourceLocation>() = Loc;
2562 }
2563
2564
2565 void setArgumentLoc(SourceLocation Loc) {
2566 assert(IsExtended && "Expected extended clause.");
2567 *std::next(getTrailingObjects<SourceLocation>(), 1) = Loc;
2568 }
2569
2570
2571 void setDependencyKind(OpenMPDependClauseKind DK) {
2572 assert(IsExtended && "Expected extended clause.");
2573 *getTrailingObjects<OpenMPDependClauseKind>() = DK;
2574 }
2575
2576
2577
2578
2579
2580 OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc,
2581 bool IsExtended)
2582 : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc),
2583 IsExtended(IsExtended) {}
2584
2585
2586 OMPUpdateClause(bool IsExtended)
2587 : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()),
2588 IsExtended(IsExtended) {}
2589
2590 public:
2591
2592
2593
2594
2595
2596 static OMPUpdateClause *Create(const ASTContext &C, SourceLocation StartLoc,
2597 SourceLocation EndLoc);
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607 static OMPUpdateClause *Create(const ASTContext &C, SourceLocation StartLoc,
2608 SourceLocation LParenLoc,
2609 SourceLocation ArgumentLoc,
2610 OpenMPDependClauseKind DK,
2611 SourceLocation EndLoc);
2612
2613
2614
2615
2616
2617
2618 static OMPUpdateClause *CreateEmpty(const ASTContext &C, bool IsExtended);
2619
2620
2621 bool isExtended() const { return IsExtended; }
2622
2623 child_range children() {
2624 return child_range(child_iterator(), child_iterator());
2625 }
2626
2627 const_child_range children() const {
2628 return const_child_range(const_child_iterator(), const_child_iterator());
2629 }
2630
2631 child_range used_children() {
2632 return child_range(child_iterator(), child_iterator());
2633 }
2634 const_child_range used_children() const {
2635 return const_child_range(const_child_iterator(), const_child_iterator());
2636 }
2637
2638
2639 SourceLocation getLParenLoc() const {
2640 assert(IsExtended && "Expected extended clause.");
2641 return *getTrailingObjects<SourceLocation>();
2642 }
2643
2644
2645 SourceLocation getArgumentLoc() const {
2646 assert(IsExtended && "Expected extended clause.");
2647 return *std::next(getTrailingObjects<SourceLocation>(), 1);
2648 }
2649
2650
2651 OpenMPDependClauseKind getDependencyKind() const {
2652 assert(IsExtended && "Expected extended clause.");
2653 return *getTrailingObjects<OpenMPDependClauseKind>();
2654 }
2655
2656 static bool classof(const OMPClause *T) {
2657 return T->getClauseKind() == llvm::omp::OMPC_update;
2658 }
2659 };
2660
2661
2662
2663
2664
2665
2666
2667
2668 class OMPCaptureClause : public OMPClause {
2669 public:
2670
2671
2672
2673
2674 OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
2675 : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {}
2676
2677
2678 OMPCaptureClause()
2679 : OMPClause(llvm::omp::OMPC_capture, SourceLocation(), SourceLocation()) {
2680 }
2681
2682 child_range children() {
2683 return child_range(child_iterator(), child_iterator());
2684 }
2685
2686 const_child_range children() const {
2687 return const_child_range(const_child_iterator(), const_child_iterator());
2688 }
2689
2690 child_range used_children() {
2691 return child_range(child_iterator(), child_iterator());
2692 }
2693 const_child_range used_children() const {
2694 return const_child_range(const_child_iterator(), const_child_iterator());
2695 }
2696
2697 static bool classof(const OMPClause *T) {
2698 return T->getClauseKind() == llvm::omp::OMPC_capture;
2699 }
2700 };
2701
2702
2703
2704
2705
2706
2707
2708
2709 class OMPCompareClause final : public OMPClause {
2710 public:
2711
2712
2713
2714
2715 OMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
2716 : OMPClause(llvm::omp::OMPC_compare, StartLoc, EndLoc) {}
2717
2718
2719 OMPCompareClause()
2720 : OMPClause(llvm::omp::OMPC_compare, SourceLocation(), SourceLocation()) {
2721 }
2722
2723 child_range children() {
2724 return child_range(child_iterator(), child_iterator());
2725 }
2726
2727 const_child_range children() const {
2728 return const_child_range(const_child_iterator(), const_child_iterator());
2729 }
2730
2731 child_range used_children() {
2732 return child_range(child_iterator(), child_iterator());
2733 }
2734 const_child_range used_children() const {
2735 return const_child_range(const_child_iterator(), const_child_iterator());
2736 }
2737
2738 static bool classof(const OMPClause *T) {
2739 return T->getClauseKind() == llvm::omp::OMPC_compare;
2740 }
2741 };
2742
2743
2744
2745
2746
2747
2748
2749
2750 class OMPSeqCstClause : public OMPClause {
2751 public:
2752
2753
2754
2755
2756 OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
2757 : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {}
2758
2759
2760 OMPSeqCstClause()
2761 : OMPClause(llvm::omp::OMPC_seq_cst, SourceLocation(), SourceLocation()) {
2762 }
2763
2764 child_range children() {
2765 return child_range(child_iterator(), child_iterator());
2766 }
2767
2768 const_child_range children() const {
2769 return const_child_range(const_child_iterator(), const_child_iterator());
2770 }
2771
2772 child_range used_children() {
2773 return child_range(child_iterator(), child_iterator());
2774 }
2775 const_child_range used_children() const {
2776 return const_child_range(const_child_iterator(), const_child_iterator());
2777 }
2778
2779 static bool classof(const OMPClause *T) {
2780 return T->getClauseKind() == llvm::omp::OMPC_seq_cst;
2781 }
2782 };
2783
2784
2785
2786
2787
2788
2789
2790
2791 class OMPAcqRelClause final : public OMPClause {
2792 public:
2793
2794
2795
2796
2797 OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
2798 : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {}
2799
2800
2801 OMPAcqRelClause()
2802 : OMPClause(llvm::omp::OMPC_acq_rel, SourceLocation(), SourceLocation()) {
2803 }
2804
2805 child_range children() {
2806 return child_range(child_iterator(), child_iterator());
2807 }
2808
2809 const_child_range children() const {
2810 return const_child_range(const_child_iterator(), const_child_iterator());
2811 }
2812
2813 child_range used_children() {
2814 return child_range(child_iterator(), child_iterator());
2815 }
2816 const_child_range used_children() const {
2817 return const_child_range(const_child_iterator(), const_child_iterator());
2818 }
2819
2820 static bool classof(const OMPClause *T) {
2821 return T->getClauseKind() == llvm::omp::OMPC_acq_rel;
2822 }
2823 };
2824
2825
2826
2827
2828
2829
2830
2831
2832 class OMPAcquireClause final : public OMPClause {
2833 public:
2834
2835
2836
2837
2838 OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
2839 : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {}
2840
2841
2842 OMPAcquireClause()
2843 : OMPClause(llvm::omp::OMPC_acquire, SourceLocation(), SourceLocation()) {
2844 }
2845
2846 child_range children() {
2847 return child_range(child_iterator(), child_iterator());
2848 }
2849
2850 const_child_range children() const {
2851 return const_child_range(const_child_iterator(), const_child_iterator());
2852 }
2853
2854 child_range used_children() {
2855 return child_range(child_iterator(), child_iterator());
2856 }
2857 const_child_range used_children() const {
2858 return const_child_range(const_child_iterator(), const_child_iterator());
2859 }
2860
2861 static bool classof(const OMPClause *T) {
2862 return T->getClauseKind() == llvm::omp::OMPC_acquire;
2863 }
2864 };
2865
2866
2867
2868
2869
2870
2871
2872
2873 class OMPReleaseClause final : public OMPClause {
2874 public:
2875
2876
2877
2878
2879 OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
2880 : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {}
2881
2882
2883 OMPReleaseClause()
2884 : OMPClause(llvm::omp::OMPC_release, SourceLocation(), SourceLocation()) {
2885 }
2886
2887 child_range children() {
2888 return child_range(child_iterator(), child_iterator());
2889 }
2890
2891 const_child_range children() const {
2892 return const_child_range(const_child_iterator(), const_child_iterator());
2893 }
2894
2895 child_range used_children() {
2896 return child_range(child_iterator(), child_iterator());
2897 }
2898 const_child_range used_children() const {
2899 return const_child_range(const_child_iterator(), const_child_iterator());
2900 }
2901
2902 static bool classof(const OMPClause *T) {
2903 return T->getClauseKind() == llvm::omp::OMPC_release;
2904 }
2905 };
2906
2907
2908
2909
2910
2911
2912
2913
2914 class OMPRelaxedClause final : public OMPClause {
2915 public:
2916
2917
2918
2919
2920 OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2921 : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {}
2922
2923
2924 OMPRelaxedClause()
2925 : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) {
2926 }
2927
2928 child_range children() {
2929 return child_range(child_iterator(), child_iterator());
2930 }
2931
2932 const_child_range children() const {
2933 return const_child_range(const_child_iterator(), const_child_iterator());
2934 }
2935
2936 child_range used_children() {
2937 return child_range(child_iterator(), child_iterator());
2938 }
2939 const_child_range used_children() const {
2940 return const_child_range(const_child_iterator(), const_child_iterator());
2941 }
2942
2943 static bool classof(const OMPClause *T) {
2944 return T->getClauseKind() == llvm::omp::OMPC_relaxed;
2945 }
2946 };
2947
2948
2949
2950
2951
2952
2953
2954
2955 class OMPWeakClause final : public OMPClause {
2956 public:
2957
2958
2959
2960
2961 OMPWeakClause(SourceLocation StartLoc, SourceLocation EndLoc)
2962 : OMPClause(llvm::omp::OMPC_weak, StartLoc, EndLoc) {}
2963
2964
2965 OMPWeakClause()
2966 : OMPClause(llvm::omp::OMPC_weak, SourceLocation(), SourceLocation()) {}
2967
2968 child_range children() {
2969 return child_range(child_iterator(), child_iterator());
2970 }
2971
2972 const_child_range children() const {
2973 return const_child_range(const_child_iterator(), const_child_iterator());
2974 }
2975
2976 child_range used_children() {
2977 return child_range(child_iterator(), child_iterator());
2978 }
2979 const_child_range used_children() const {
2980 return const_child_range(const_child_iterator(), const_child_iterator());
2981 }
2982
2983 static bool classof(const OMPClause *T) {
2984 return T->getClauseKind() == llvm::omp::OMPC_weak;
2985 }
2986 };
2987
2988
2989
2990
2991
2992
2993
2994
2995 class OMPFailClause final : public OMPClause {
2996
2997
2998
2999 OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
3000 SourceLocation FailParameterLoc;
3001 SourceLocation LParenLoc;
3002
3003 friend class OMPClauseReader;
3004
3005
3006 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
3007
3008
3009 void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
3010
3011
3012 void setFailParameter(OpenMPClauseKind FailParameter) {
3013 this->FailParameter = FailParameter;
3014 assert(checkFailClauseParameter(FailParameter) &&
3015 "Invalid fail clause parameter");
3016 }
3017
3018 public:
3019
3020
3021
3022
3023 OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
3024 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
3025
3026 OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
3027 SourceLocation StartLoc, SourceLocation LParenLoc,
3028 SourceLocation EndLoc)
3029 : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
3030 FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
3031
3032 setFailParameter(FailParameter);
3033 }
3034
3035
3036 OMPFailClause()
3037 : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
3038
3039 child_range children() {
3040 return child_range(child_iterator(), child_iterator());
3041 }
3042
3043 const_child_range children() const {
3044 return const_child_range(const_child_iterator(), const_child_iterator());
3045 }
3046
3047 child_range used_children() {
3048 return child_range(child_iterator(), child_iterator());
3049 }
3050 const_child_range used_children() const {
3051 return const_child_range(const_child_iterator(), const_child_iterator());
3052 }
3053
3054 static bool classof(const OMPClause *T) {
3055 return T->getClauseKind() == llvm::omp::OMPC_fail;
3056 }
3057
3058
3059 SourceLocation getLParenLoc() const {
3060 return LParenLoc;
3061 }
3062
3063
3064
3065 SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
3066
3067
3068 OpenMPClauseKind getFailParameter() const { return FailParameter; }
3069 };
3070
3071
3072
3073
3074
3075
3076
3077
3078 class OMPPrivateClause final
3079 : public OMPVarListClause<OMPPrivateClause>,
3080 private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
3081 friend class OMPClauseReader;
3082 friend OMPVarListClause;
3083 friend TrailingObjects;
3084
3085
3086
3087
3088
3089
3090
3091 OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3092 SourceLocation EndLoc, unsigned N)
3093 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private, StartLoc,
3094 LParenLoc, EndLoc, N) {}
3095
3096
3097
3098
3099 explicit OMPPrivateClause(unsigned N)
3100 : OMPVarListClause<OMPPrivateClause>(llvm::omp::OMPC_private,
3101 SourceLocation(), SourceLocation(),
3102 SourceLocation(), N) {}
3103
3104
3105
3106
3107 void setPrivateCopies(ArrayRef<Expr *> VL);
3108
3109
3110
3111 MutableArrayRef<Expr *> getPrivateCopies() {
3112 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3113 }
3114 ArrayRef<const Expr *> getPrivateCopies() const {
3115 return llvm::ArrayRef(varlist_end(), varlist_size());
3116 }
3117
3118 public:
3119
3120
3121
3122
3123
3124
3125
3126
3127 static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc,
3128 SourceLocation LParenLoc,
3129 SourceLocation EndLoc, ArrayRef<Expr *> VL,
3130 ArrayRef<Expr *> PrivateVL);
3131
3132
3133
3134
3135
3136 static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N);
3137
3138 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3139 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3140 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3141 using private_copies_const_range =
3142 llvm::iterator_range<private_copies_const_iterator>;
3143
3144 private_copies_range private_copies() {
3145 return private_copies_range(getPrivateCopies().begin(),
3146 getPrivateCopies().end());
3147 }
3148
3149 private_copies_const_range private_copies() const {
3150 return private_copies_const_range(getPrivateCopies().begin(),
3151 getPrivateCopies().end());
3152 }
3153
3154 child_range children() {
3155 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3156 reinterpret_cast<Stmt **>(varlist_end()));
3157 }
3158
3159 const_child_range children() const {
3160 auto Children = const_cast<OMPPrivateClause *>(this)->children();
3161 return const_child_range(Children.begin(), Children.end());
3162 }
3163
3164 child_range used_children() {
3165 return child_range(child_iterator(), child_iterator());
3166 }
3167 const_child_range used_children() const {
3168 return const_child_range(const_child_iterator(), const_child_iterator());
3169 }
3170
3171 static bool classof(const OMPClause *T) {
3172 return T->getClauseKind() == llvm::omp::OMPC_private;
3173 }
3174 };
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184 class OMPFirstprivateClause final
3185 : public OMPVarListClause<OMPFirstprivateClause>,
3186 public OMPClauseWithPreInit,
3187 private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
3188 friend class OMPClauseReader;
3189 friend OMPVarListClause;
3190 friend TrailingObjects;
3191
3192
3193
3194
3195
3196
3197
3198 OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3199 SourceLocation EndLoc, unsigned N)
3200 : OMPVarListClause<OMPFirstprivateClause>(llvm::omp::OMPC_firstprivate,
3201 StartLoc, LParenLoc, EndLoc, N),
3202 OMPClauseWithPreInit(this) {}
3203
3204
3205
3206
3207 explicit OMPFirstprivateClause(unsigned N)
3208 : OMPVarListClause<OMPFirstprivateClause>(
3209 llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(),
3210 SourceLocation(), N),
3211 OMPClauseWithPreInit(this) {}
3212
3213
3214
3215
3216 void setPrivateCopies(ArrayRef<Expr *> VL);
3217
3218
3219
3220 MutableArrayRef<Expr *> getPrivateCopies() {
3221 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3222 }
3223 ArrayRef<const Expr *> getPrivateCopies() const {
3224 return llvm::ArrayRef(varlist_end(), varlist_size());
3225 }
3226
3227
3228
3229
3230 void setInits(ArrayRef<Expr *> VL);
3231
3232
3233
3234 MutableArrayRef<Expr *> getInits() {
3235 return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size());
3236 }
3237 ArrayRef<const Expr *> getInits() const {
3238 return llvm::ArrayRef(getPrivateCopies().end(), varlist_size());
3239 }
3240
3241 public:
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255 static OMPFirstprivateClause *
3256 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3257 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
3258 ArrayRef<Expr *> InitVL, Stmt *PreInit);
3259
3260
3261
3262
3263
3264 static OMPFirstprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
3265
3266 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
3267 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
3268 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
3269 using private_copies_const_range =
3270 llvm::iterator_range<private_copies_const_iterator>;
3271
3272 private_copies_range private_copies() {
3273 return private_copies_range(getPrivateCopies().begin(),
3274 getPrivateCopies().end());
3275 }
3276 private_copies_const_range private_copies() const {
3277 return private_copies_const_range(getPrivateCopies().begin(),
3278 getPrivateCopies().end());
3279 }
3280
3281 using inits_iterator = MutableArrayRef<Expr *>::iterator;
3282 using inits_const_iterator = ArrayRef<const Expr *>::iterator;
3283 using inits_range = llvm::iterator_range<inits_iterator>;
3284 using inits_const_range = llvm::iterator_range<inits_const_iterator>;
3285
3286 inits_range inits() {
3287 return inits_range(getInits().begin(), getInits().end());
3288 }
3289 inits_const_range inits() const {
3290 return inits_const_range(getInits().begin(), getInits().end());
3291 }
3292
3293 child_range children() {
3294 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3295 reinterpret_cast<Stmt **>(varlist_end()));
3296 }
3297
3298 const_child_range children() const {
3299 auto Children = const_cast<OMPFirstprivateClause *>(this)->children();
3300 return const_child_range(Children.begin(), Children.end());
3301 }
3302
3303 child_range used_children() {
3304 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3305 reinterpret_cast<Stmt **>(varlist_end()));
3306 }
3307 const_child_range used_children() const {
3308 auto Children = const_cast<OMPFirstprivateClause *>(this)->used_children();
3309 return const_child_range(Children.begin(), Children.end());
3310 }
3311
3312 static bool classof(const OMPClause *T) {
3313 return T->getClauseKind() == llvm::omp::OMPC_firstprivate;
3314 }
3315 };
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325 class OMPLastprivateClause final
3326 : public OMPVarListClause<OMPLastprivateClause>,
3327 public OMPClauseWithPostUpdate,
3328 private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345 friend class OMPClauseReader;
3346 friend OMPVarListClause;
3347 friend TrailingObjects;
3348
3349
3350 OpenMPLastprivateModifier LPKind;
3351
3352 SourceLocation LPKindLoc;
3353
3354 SourceLocation ColonLoc;
3355
3356
3357
3358
3359
3360
3361
3362 OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3363 SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
3364 SourceLocation LPKindLoc, SourceLocation ColonLoc,
3365 unsigned N)
3366 : OMPVarListClause<OMPLastprivateClause>(llvm::omp::OMPC_lastprivate,
3367 StartLoc, LParenLoc, EndLoc, N),
3368 OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
3369 ColonLoc(ColonLoc) {}
3370
3371
3372
3373
3374 explicit OMPLastprivateClause(unsigned N)
3375 : OMPVarListClause<OMPLastprivateClause>(
3376 llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(),
3377 SourceLocation(), N),
3378 OMPClauseWithPostUpdate(this) {}
3379
3380
3381
3382 MutableArrayRef<Expr *> getPrivateCopies() {
3383 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3384 }
3385 ArrayRef<const Expr *> getPrivateCopies() const {
3386 return llvm::ArrayRef(varlist_end(), varlist_size());
3387 }
3388
3389
3390
3391
3392
3393 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
3394
3395
3396 MutableArrayRef<Expr *> getSourceExprs() {
3397 return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size());
3398 }
3399 ArrayRef<const Expr *> getSourceExprs() const {
3400 return llvm::ArrayRef(getPrivateCopies().end(), varlist_size());
3401 }
3402
3403
3404
3405
3406
3407 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
3408
3409
3410 MutableArrayRef<Expr *> getDestinationExprs() {
3411 return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
3412 }
3413 ArrayRef<const Expr *> getDestinationExprs() const {
3414 return llvm::ArrayRef(getSourceExprs().end(), varlist_size());
3415 }
3416
3417
3418
3419
3420 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
3421
3422
3423 MutableArrayRef<Expr *> getAssignmentOps() {
3424 return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
3425 }
3426 ArrayRef<const Expr *> getAssignmentOps() const {
3427 return llvm::ArrayRef(getDestinationExprs().end(), varlist_size());
3428 }
3429
3430
3431 void setKind(OpenMPLastprivateModifier Kind) { LPKind = Kind; }
3432
3433 void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
3434
3435 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
3436
3437 public:
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465 static OMPLastprivateClause *
3466 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3467 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
3468 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
3469 OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
3470 SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
3471
3472
3473
3474
3475
3476 static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
3477
3478
3479 OpenMPLastprivateModifier getKind() const { return LPKind; }
3480
3481 SourceLocation getKindLoc() const { return LPKindLoc; }
3482
3483 SourceLocation getColonLoc() const { return ColonLoc; }
3484
3485 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3486 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3487 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3488 using helper_expr_const_range =
3489 llvm::iterator_range<helper_expr_const_iterator>;
3490
3491
3492
3493 void setPrivateCopies(ArrayRef<Expr *> PrivateCopies);
3494
3495 helper_expr_const_range private_copies() const {
3496 return helper_expr_const_range(getPrivateCopies().begin(),
3497 getPrivateCopies().end());
3498 }
3499
3500 helper_expr_range private_copies() {
3501 return helper_expr_range(getPrivateCopies().begin(),
3502 getPrivateCopies().end());
3503 }
3504
3505 helper_expr_const_range source_exprs() const {
3506 return helper_expr_const_range(getSourceExprs().begin(),
3507 getSourceExprs().end());
3508 }
3509
3510 helper_expr_range source_exprs() {
3511 return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
3512 }
3513
3514 helper_expr_const_range destination_exprs() const {
3515 return helper_expr_const_range(getDestinationExprs().begin(),
3516 getDestinationExprs().end());
3517 }
3518
3519 helper_expr_range destination_exprs() {
3520 return helper_expr_range(getDestinationExprs().begin(),
3521 getDestinationExprs().end());
3522 }
3523
3524 helper_expr_const_range assignment_ops() const {
3525 return helper_expr_const_range(getAssignmentOps().begin(),
3526 getAssignmentOps().end());
3527 }
3528
3529 helper_expr_range assignment_ops() {
3530 return helper_expr_range(getAssignmentOps().begin(),
3531 getAssignmentOps().end());
3532 }
3533
3534 child_range children() {
3535 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3536 reinterpret_cast<Stmt **>(varlist_end()));
3537 }
3538
3539 const_child_range children() const {
3540 auto Children = const_cast<OMPLastprivateClause *>(this)->children();
3541 return const_child_range(Children.begin(), Children.end());
3542 }
3543
3544 child_range used_children() {
3545 return child_range(child_iterator(), child_iterator());
3546 }
3547 const_child_range used_children() const {
3548 return const_child_range(const_child_iterator(), const_child_iterator());
3549 }
3550
3551 static bool classof(const OMPClause *T) {
3552 return T->getClauseKind() == llvm::omp::OMPC_lastprivate;
3553 }
3554 };
3555
3556
3557
3558
3559
3560
3561
3562
3563 class OMPSharedClause final
3564 : public OMPVarListClause<OMPSharedClause>,
3565 private llvm::TrailingObjects<OMPSharedClause, Expr *> {
3566 friend OMPVarListClause;
3567 friend TrailingObjects;
3568
3569
3570
3571
3572
3573
3574
3575 OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3576 SourceLocation EndLoc, unsigned N)
3577 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared, StartLoc,
3578 LParenLoc, EndLoc, N) {}
3579
3580
3581
3582
3583 explicit OMPSharedClause(unsigned N)
3584 : OMPVarListClause<OMPSharedClause>(llvm::omp::OMPC_shared,
3585 SourceLocation(), SourceLocation(),
3586 SourceLocation(), N) {}
3587
3588 public:
3589
3590
3591
3592
3593
3594
3595
3596 static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc,
3597 SourceLocation LParenLoc,
3598 SourceLocation EndLoc, ArrayRef<Expr *> VL);
3599
3600
3601
3602
3603
3604 static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N);
3605
3606 child_range children() {
3607 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3608 reinterpret_cast<Stmt **>(varlist_end()));
3609 }
3610
3611 const_child_range children() const {
3612 auto Children = const_cast<OMPSharedClause *>(this)->children();
3613 return const_child_range(Children.begin(), Children.end());
3614 }
3615
3616 child_range used_children() {
3617 return child_range(child_iterator(), child_iterator());
3618 }
3619 const_child_range used_children() const {
3620 return const_child_range(const_child_iterator(), const_child_iterator());
3621 }
3622
3623 static bool classof(const OMPClause *T) {
3624 return T->getClauseKind() == llvm::omp::OMPC_shared;
3625 }
3626 };
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636 class OMPReductionClause final
3637 : public OMPVarListClause<OMPReductionClause>,
3638 public OMPClauseWithPostUpdate,
3639 private llvm::TrailingObjects<OMPReductionClause, Expr *> {
3640 friend class OMPClauseReader;
3641 friend OMPVarListClause;
3642 friend TrailingObjects;
3643
3644
3645 OpenMPReductionClauseModifier Modifier = OMPC_REDUCTION_unknown;
3646
3647
3648 SourceLocation ModifierLoc;
3649
3650
3651 SourceLocation ColonLoc;
3652
3653
3654 NestedNameSpecifierLoc QualifierLoc;
3655
3656
3657 DeclarationNameInfo NameInfo;
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669 OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3670 SourceLocation ModifierLoc, SourceLocation ColonLoc,
3671 SourceLocation EndLoc,
3672 OpenMPReductionClauseModifier Modifier, unsigned N,
3673 NestedNameSpecifierLoc QualifierLoc,
3674 const DeclarationNameInfo &NameInfo)
3675 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
3676 StartLoc, LParenLoc, EndLoc, N),
3677 OMPClauseWithPostUpdate(this), Modifier(Modifier),
3678 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
3679 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3680
3681
3682
3683
3684 explicit OMPReductionClause(unsigned N)
3685 : OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
3686 SourceLocation(), SourceLocation(),
3687 SourceLocation(), N),
3688 OMPClauseWithPostUpdate(this) {}
3689
3690
3691 void setModifier(OpenMPReductionClauseModifier M) { Modifier = M; }
3692
3693
3694 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
3695
3696
3697 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3698
3699
3700 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3701
3702
3703 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3704
3705
3706
3707
3708 void setPrivates(ArrayRef<Expr *> Privates);
3709
3710
3711 MutableArrayRef<Expr *> getPrivates() {
3712 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3713 }
3714 ArrayRef<const Expr *> getPrivates() const {
3715 return llvm::ArrayRef(varlist_end(), varlist_size());
3716 }
3717
3718
3719
3720
3721 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3722
3723
3724 MutableArrayRef<Expr *> getLHSExprs() {
3725 return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
3726 }
3727 ArrayRef<const Expr *> getLHSExprs() const {
3728 return llvm::ArrayRef(getPrivates().end(), varlist_size());
3729 }
3730
3731
3732
3733
3734
3735
3736 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3737
3738
3739 MutableArrayRef<Expr *> getRHSExprs() {
3740 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
3741 }
3742 ArrayRef<const Expr *> getRHSExprs() const {
3743 return llvm::ArrayRef(getLHSExprs().end(), varlist_size());
3744 }
3745
3746
3747
3748
3749
3750 void setReductionOps(ArrayRef<Expr *> ReductionOps);
3751
3752
3753 MutableArrayRef<Expr *> getReductionOps() {
3754 return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
3755 }
3756 ArrayRef<const Expr *> getReductionOps() const {
3757 return llvm::ArrayRef(getRHSExprs().end(), varlist_size());
3758 }
3759
3760
3761
3762 void setInscanCopyOps(ArrayRef<Expr *> Ops);
3763
3764
3765 MutableArrayRef<Expr *> getInscanCopyOps() {
3766 return MutableArrayRef<Expr *>(getReductionOps().end(), varlist_size());
3767 }
3768 ArrayRef<const Expr *> getInscanCopyOps() const {
3769 return llvm::ArrayRef(getReductionOps().end(), varlist_size());
3770 }
3771
3772
3773 void setInscanCopyArrayTemps(ArrayRef<Expr *> CopyArrayTemps);
3774
3775
3776 MutableArrayRef<Expr *> getInscanCopyArrayTemps() {
3777 return MutableArrayRef<Expr *>(getInscanCopyOps().end(), varlist_size());
3778 }
3779 ArrayRef<const Expr *> getInscanCopyArrayTemps() const {
3780 return llvm::ArrayRef(getInscanCopyOps().end(), varlist_size());
3781 }
3782
3783
3784 void setInscanCopyArrayElems(ArrayRef<Expr *> CopyArrayElems);
3785
3786
3787 MutableArrayRef<Expr *> getInscanCopyArrayElems() {
3788 return MutableArrayRef<Expr *>(getInscanCopyArrayTemps().end(),
3789 varlist_size());
3790 }
3791 ArrayRef<const Expr *> getInscanCopyArrayElems() const {
3792 return llvm::ArrayRef(getInscanCopyArrayTemps().end(), varlist_size());
3793 }
3794
3795 public:
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835 static OMPReductionClause *
3836 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3837 SourceLocation ModifierLoc, SourceLocation ColonLoc,
3838 SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier,
3839 ArrayRef<Expr *> VL, NestedNameSpecifierLoc QualifierLoc,
3840 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3841 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3842 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
3843 ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
3844 Stmt *PreInit, Expr *PostUpdate);
3845
3846
3847
3848
3849
3850
3851 static OMPReductionClause *
3852 CreateEmpty(const ASTContext &C, unsigned N,
3853 OpenMPReductionClauseModifier Modifier);
3854
3855
3856 OpenMPReductionClauseModifier getModifier() const { return Modifier; }
3857
3858
3859 SourceLocation getModifierLoc() const { return ModifierLoc; }
3860
3861
3862 SourceLocation getColonLoc() const { return ColonLoc; }
3863
3864
3865 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3866
3867
3868 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3869
3870 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3871 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3872 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3873 using helper_expr_const_range =
3874 llvm::iterator_range<helper_expr_const_iterator>;
3875
3876 helper_expr_const_range privates() const {
3877 return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
3878 }
3879
3880 helper_expr_range privates() {
3881 return helper_expr_range(getPrivates().begin(), getPrivates().end());
3882 }
3883
3884 helper_expr_const_range lhs_exprs() const {
3885 return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
3886 }
3887
3888 helper_expr_range lhs_exprs() {
3889 return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
3890 }
3891
3892 helper_expr_const_range rhs_exprs() const {
3893 return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
3894 }
3895
3896 helper_expr_range rhs_exprs() {
3897 return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
3898 }
3899
3900 helper_expr_const_range reduction_ops() const {
3901 return helper_expr_const_range(getReductionOps().begin(),
3902 getReductionOps().end());
3903 }
3904
3905 helper_expr_range reduction_ops() {
3906 return helper_expr_range(getReductionOps().begin(),
3907 getReductionOps().end());
3908 }
3909
3910 helper_expr_const_range copy_ops() const {
3911 return helper_expr_const_range(getInscanCopyOps().begin(),
3912 getInscanCopyOps().end());
3913 }
3914
3915 helper_expr_range copy_ops() {
3916 return helper_expr_range(getInscanCopyOps().begin(),
3917 getInscanCopyOps().end());
3918 }
3919
3920 helper_expr_const_range copy_array_temps() const {
3921 return helper_expr_const_range(getInscanCopyArrayTemps().begin(),
3922 getInscanCopyArrayTemps().end());
3923 }
3924
3925 helper_expr_range copy_array_temps() {
3926 return helper_expr_range(getInscanCopyArrayTemps().begin(),
3927 getInscanCopyArrayTemps().end());
3928 }
3929
3930 helper_expr_const_range copy_array_elems() const {
3931 return helper_expr_const_range(getInscanCopyArrayElems().begin(),
3932 getInscanCopyArrayElems().end());
3933 }
3934
3935 helper_expr_range copy_array_elems() {
3936 return helper_expr_range(getInscanCopyArrayElems().begin(),
3937 getInscanCopyArrayElems().end());
3938 }
3939
3940 child_range children() {
3941 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3942 reinterpret_cast<Stmt **>(varlist_end()));
3943 }
3944
3945 const_child_range children() const {
3946 auto Children = const_cast<OMPReductionClause *>(this)->children();
3947 return const_child_range(Children.begin(), Children.end());
3948 }
3949
3950 child_range used_children() {
3951 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3952 reinterpret_cast<Stmt **>(varlist_end()));
3953 }
3954 const_child_range used_children() const {
3955 auto Children = const_cast<OMPReductionClause *>(this)->used_children();
3956 return const_child_range(Children.begin(), Children.end());
3957 }
3958
3959 static bool classof(const OMPClause *T) {
3960 return T->getClauseKind() == llvm::omp::OMPC_reduction;
3961 }
3962 };
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972 class OMPTaskReductionClause final
3973 : public OMPVarListClause<OMPTaskReductionClause>,
3974 public OMPClauseWithPostUpdate,
3975 private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
3976 friend class OMPClauseReader;
3977 friend OMPVarListClause;
3978 friend TrailingObjects;
3979
3980
3981 SourceLocation ColonLoc;
3982
3983
3984 NestedNameSpecifierLoc QualifierLoc;
3985
3986
3987 DeclarationNameInfo NameInfo;
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998 OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3999 SourceLocation ColonLoc, SourceLocation EndLoc,
4000 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4001 const DeclarationNameInfo &NameInfo)
4002 : OMPVarListClause<OMPTaskReductionClause>(
4003 llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N),
4004 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4005 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4006
4007
4008
4009
4010 explicit OMPTaskReductionClause(unsigned N)
4011 : OMPVarListClause<OMPTaskReductionClause>(
4012 llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(),
4013 SourceLocation(), N),
4014 OMPClauseWithPostUpdate(this) {}
4015
4016
4017 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4018
4019
4020 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4021
4022
4023 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4024
4025
4026
4027 void setPrivates(ArrayRef<Expr *> Privates);
4028
4029
4030 MutableArrayRef<Expr *> getPrivates() {
4031 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
4032 }
4033 ArrayRef<const Expr *> getPrivates() const {
4034 return llvm::ArrayRef(varlist_end(), varlist_size());
4035 }
4036
4037
4038
4039
4040 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4041
4042
4043 MutableArrayRef<Expr *> getLHSExprs() {
4044 return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
4045 }
4046 ArrayRef<const Expr *> getLHSExprs() const {
4047 return llvm::ArrayRef(getPrivates().end(), varlist_size());
4048 }
4049
4050
4051
4052
4053
4054 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4055
4056
4057 MutableArrayRef<Expr *> getRHSExprs() {
4058 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
4059 }
4060 ArrayRef<const Expr *> getRHSExprs() const {
4061 return llvm::ArrayRef(getLHSExprs().end(), varlist_size());
4062 }
4063
4064
4065
4066
4067
4068 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4069
4070
4071 MutableArrayRef<Expr *> getReductionOps() {
4072 return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
4073 }
4074 ArrayRef<const Expr *> getReductionOps() const {
4075 return llvm::ArrayRef(getRHSExprs().end(), varlist_size());
4076 }
4077
4078 public:
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111 static OMPTaskReductionClause *
4112 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4113 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4114 NestedNameSpecifierLoc QualifierLoc,
4115 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4116 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4117 ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
4118
4119
4120
4121
4122
4123 static OMPTaskReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
4124
4125
4126 SourceLocation getColonLoc() const { return ColonLoc; }
4127
4128
4129 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
4130
4131
4132 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
4133
4134 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4135 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4136 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4137 using helper_expr_const_range =
4138 llvm::iterator_range<helper_expr_const_iterator>;
4139
4140 helper_expr_const_range privates() const {
4141 return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
4142 }
4143
4144 helper_expr_range privates() {
4145 return helper_expr_range(getPrivates().begin(), getPrivates().end());
4146 }
4147
4148 helper_expr_const_range lhs_exprs() const {
4149 return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
4150 }
4151
4152 helper_expr_range lhs_exprs() {
4153 return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
4154 }
4155
4156 helper_expr_const_range rhs_exprs() const {
4157 return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
4158 }
4159
4160 helper_expr_range rhs_exprs() {
4161 return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
4162 }
4163
4164 helper_expr_const_range reduction_ops() const {
4165 return helper_expr_const_range(getReductionOps().begin(),
4166 getReductionOps().end());
4167 }
4168
4169 helper_expr_range reduction_ops() {
4170 return helper_expr_range(getReductionOps().begin(),
4171 getReductionOps().end());
4172 }
4173
4174 child_range children() {
4175 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4176 reinterpret_cast<Stmt **>(varlist_end()));
4177 }
4178
4179 const_child_range children() const {
4180 auto Children = const_cast<OMPTaskReductionClause *>(this)->children();
4181 return const_child_range(Children.begin(), Children.end());
4182 }
4183
4184 child_range used_children() {
4185 return child_range(child_iterator(), child_iterator());
4186 }
4187 const_child_range used_children() const {
4188 return const_child_range(const_child_iterator(), const_child_iterator());
4189 }
4190
4191 static bool classof(const OMPClause *T) {
4192 return T->getClauseKind() == llvm::omp::OMPC_task_reduction;
4193 }
4194 };
4195
4196
4197
4198
4199
4200
4201
4202
4203 class OMPInReductionClause final
4204 : public OMPVarListClause<OMPInReductionClause>,
4205 public OMPClauseWithPostUpdate,
4206 private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
4207 friend class OMPClauseReader;
4208 friend OMPVarListClause;
4209 friend TrailingObjects;
4210
4211
4212 SourceLocation ColonLoc;
4213
4214
4215 NestedNameSpecifierLoc QualifierLoc;
4216
4217
4218 DeclarationNameInfo NameInfo;
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229 OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4230 SourceLocation ColonLoc, SourceLocation EndLoc,
4231 unsigned N, NestedNameSpecifierLoc QualifierLoc,
4232 const DeclarationNameInfo &NameInfo)
4233 : OMPVarListClause<OMPInReductionClause>(llvm::omp::OMPC_in_reduction,
4234 StartLoc, LParenLoc, EndLoc, N),
4235 OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
4236 QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
4237
4238
4239
4240
4241 explicit OMPInReductionClause(unsigned N)
4242 : OMPVarListClause<OMPInReductionClause>(
4243 llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(),
4244 SourceLocation(), N),
4245 OMPClauseWithPostUpdate(this) {}
4246
4247
4248 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
4249
4250
4251 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
4252
4253
4254 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
4255
4256
4257
4258 void setPrivates(ArrayRef<Expr *> Privates);
4259
4260
4261 MutableArrayRef<Expr *> getPrivates() {
4262 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
4263 }
4264 ArrayRef<const Expr *> getPrivates() const {
4265 return llvm::ArrayRef(varlist_end(), varlist_size());
4266 }
4267
4268
4269
4270
4271 void setLHSExprs(ArrayRef<Expr *> LHSExprs);
4272
4273
4274 MutableArrayRef<Expr *> getLHSExprs() {
4275 return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
4276 }
4277 ArrayRef<const Expr *> getLHSExprs() const {
4278 return llvm::ArrayRef(getPrivates().end(), varlist_size());
4279 }
4280
4281
4282
4283
4284
4285 void setRHSExprs(ArrayRef<Expr *> RHSExprs);
4286
4287
4288 MutableArrayRef<Expr *> getRHSExprs() {
4289 return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
4290 }
4291 ArrayRef<const Expr *> getRHSExprs() const {
4292 return llvm::ArrayRef(getLHSExprs().end(), varlist_size());
4293 }
4294
4295
4296
4297
4298
4299 void setReductionOps(ArrayRef<Expr *> ReductionOps);
4300
4301
4302 MutableArrayRef<Expr *> getReductionOps() {
4303 return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
4304 }
4305 ArrayRef<const Expr *> getReductionOps() const {
4306 return llvm::ArrayRef(getRHSExprs().end(), varlist_size());
4307 }
4308
4309
4310 void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
4311
4312
4313 MutableArrayRef<Expr *> getTaskgroupDescriptors() {
4314 return MutableArrayRef<Expr *>(getReductionOps().end(), varlist_size());
4315 }
4316 ArrayRef<const Expr *> getTaskgroupDescriptors() const {
4317 return llvm::ArrayRef(getReductionOps().end(), varlist_size());
4318 }
4319
4320 public:
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355 static OMPInReductionClause *
4356 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4357 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
4358 NestedNameSpecifierLoc QualifierLoc,
4359 const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
4360 ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
4361 ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
4362 Stmt *PreInit, Expr *PostUpdate);
4363
4364
4365
4366
4367
4368 static OMPInReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
4369
4370
4371 SourceLocation getColonLoc() const { return ColonLoc; }
4372
4373
4374 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
4375
4376
4377 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
4378
4379 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4380 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4381 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4382 using helper_expr_const_range =
4383 llvm::iterator_range<helper_expr_const_iterator>;
4384
4385 helper_expr_const_range privates() const {
4386 return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
4387 }
4388
4389 helper_expr_range privates() {
4390 return helper_expr_range(getPrivates().begin(), getPrivates().end());
4391 }
4392
4393 helper_expr_const_range lhs_exprs() const {
4394 return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
4395 }
4396
4397 helper_expr_range lhs_exprs() {
4398 return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
4399 }
4400
4401 helper_expr_const_range rhs_exprs() const {
4402 return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
4403 }
4404
4405 helper_expr_range rhs_exprs() {
4406 return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
4407 }
4408
4409 helper_expr_const_range reduction_ops() const {
4410 return helper_expr_const_range(getReductionOps().begin(),
4411 getReductionOps().end());
4412 }
4413
4414 helper_expr_range reduction_ops() {
4415 return helper_expr_range(getReductionOps().begin(),
4416 getReductionOps().end());
4417 }
4418
4419 helper_expr_const_range taskgroup_descriptors() const {
4420 return helper_expr_const_range(getTaskgroupDescriptors().begin(),
4421 getTaskgroupDescriptors().end());
4422 }
4423
4424 helper_expr_range taskgroup_descriptors() {
4425 return helper_expr_range(getTaskgroupDescriptors().begin(),
4426 getTaskgroupDescriptors().end());
4427 }
4428
4429 child_range children() {
4430 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4431 reinterpret_cast<Stmt **>(varlist_end()));
4432 }
4433
4434 const_child_range children() const {
4435 auto Children = const_cast<OMPInReductionClause *>(this)->children();
4436 return const_child_range(Children.begin(), Children.end());
4437 }
4438
4439 child_range used_children() {
4440 return child_range(child_iterator(), child_iterator());
4441 }
4442 const_child_range used_children() const {
4443 return const_child_range(const_child_iterator(), const_child_iterator());
4444 }
4445
4446 static bool classof(const OMPClause *T) {
4447 return T->getClauseKind() == llvm::omp::OMPC_in_reduction;
4448 }
4449 };
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459 class OMPLinearClause final
4460 : public OMPVarListClause<OMPLinearClause>,
4461 public OMPClauseWithPostUpdate,
4462 private llvm::TrailingObjects<OMPLinearClause, Expr *> {
4463 friend class OMPClauseReader;
4464 friend OMPVarListClause;
4465 friend TrailingObjects;
4466
4467
4468 OpenMPLinearClauseKind Modifier = OMPC_LINEAR_val;
4469
4470
4471 SourceLocation ModifierLoc;
4472
4473
4474 SourceLocation ColonLoc;
4475
4476
4477 SourceLocation StepModifierLoc;
4478
4479
4480 void setStep(Expr *Step) { *(getFinals().end()) = Step; }
4481
4482
4483 void setCalcStep(Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; }
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4494 OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
4495 SourceLocation ColonLoc, SourceLocation StepModifierLoc,
4496 SourceLocation EndLoc, unsigned NumVars)
4497 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear, StartLoc,
4498 LParenLoc, EndLoc, NumVars),
4499 OMPClauseWithPostUpdate(this), Modifier(Modifier),
4500 ModifierLoc(ModifierLoc), ColonLoc(ColonLoc),
4501 StepModifierLoc(StepModifierLoc) {}
4502
4503
4504
4505
4506 explicit OMPLinearClause(unsigned NumVars)
4507 : OMPVarListClause<OMPLinearClause>(llvm::omp::OMPC_linear,
4508 SourceLocation(), SourceLocation(),
4509 SourceLocation(), NumVars),
4510 OMPClauseWithPostUpdate(this) {}
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524 MutableArrayRef<Expr *> getPrivates() {
4525 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
4526 }
4527 ArrayRef<const Expr *> getPrivates() const {
4528 return llvm::ArrayRef(varlist_end(), varlist_size());
4529 }
4530
4531 MutableArrayRef<Expr *> getInits() {
4532 return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
4533 }
4534 ArrayRef<const Expr *> getInits() const {
4535 return llvm::ArrayRef(getPrivates().end(), varlist_size());
4536 }
4537
4538
4539 MutableArrayRef<Expr *> getUpdates() {
4540 return MutableArrayRef<Expr *>(getInits().end(), varlist_size());
4541 }
4542 ArrayRef<const Expr *> getUpdates() const {
4543 return llvm::ArrayRef(getInits().end(), varlist_size());
4544 }
4545
4546
4547 MutableArrayRef<Expr *> getFinals() {
4548 return MutableArrayRef<Expr *>(getUpdates().end(), varlist_size());
4549 }
4550 ArrayRef<const Expr *> getFinals() const {
4551 return llvm::ArrayRef(getUpdates().end(), varlist_size());
4552 }
4553
4554
4555 MutableArrayRef<Expr *> getUsedExprs() {
4556 return MutableArrayRef<Expr *>(getFinals().end() + 2, varlist_size() + 1);
4557 }
4558 ArrayRef<const Expr *> getUsedExprs() const {
4559 return llvm::ArrayRef(getFinals().end() + 2, varlist_size() + 1);
4560 }
4561
4562
4563
4564 void setPrivates(ArrayRef<Expr *> PL);
4565
4566
4567
4568 void setInits(ArrayRef<Expr *> IL);
4569
4570 public:
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591 static OMPLinearClause *
4592 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4593 OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
4594 SourceLocation ColonLoc, SourceLocation StepModifierLoc,
4595 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PL,
4596 ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit,
4597 Expr *PostUpdate);
4598
4599
4600
4601
4602
4603 static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
4604
4605
4606 void setModifier(OpenMPLinearClauseKind Kind) { Modifier = Kind; }
4607
4608
4609 OpenMPLinearClauseKind getModifier() const { return Modifier; }
4610
4611
4612 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
4613
4614
4615 SourceLocation getModifierLoc() const { return ModifierLoc; }
4616
4617
4618 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4619
4620
4621 void setStepModifierLoc(SourceLocation Loc) { StepModifierLoc = Loc; }
4622
4623
4624 SourceLocation getColonLoc() const { return ColonLoc; }
4625
4626
4627 SourceLocation getStepModifierLoc() const { return StepModifierLoc; }
4628
4629
4630 Expr *getStep() { return *(getFinals().end()); }
4631
4632
4633 const Expr *getStep() const { return *(getFinals().end()); }
4634
4635
4636 Expr *getCalcStep() { return *(getFinals().end() + 1); }
4637
4638
4639 const Expr *getCalcStep() const { return *(getFinals().end() + 1); }
4640
4641
4642
4643 void setUpdates(ArrayRef<Expr *> UL);
4644
4645
4646
4647 void setFinals(ArrayRef<Expr *> FL);
4648
4649
4650 void setUsedExprs(ArrayRef<Expr *> UE);
4651
4652 using privates_iterator = MutableArrayRef<Expr *>::iterator;
4653 using privates_const_iterator = ArrayRef<const Expr *>::iterator;
4654 using privates_range = llvm::iterator_range<privates_iterator>;
4655 using privates_const_range = llvm::iterator_range<privates_const_iterator>;
4656
4657 privates_range privates() {
4658 return privates_range(getPrivates().begin(), getPrivates().end());
4659 }
4660
4661 privates_const_range privates() const {
4662 return privates_const_range(getPrivates().begin(), getPrivates().end());
4663 }
4664
4665 using inits_iterator = MutableArrayRef<Expr *>::iterator;
4666 using inits_const_iterator = ArrayRef<const Expr *>::iterator;
4667 using inits_range = llvm::iterator_range<inits_iterator>;
4668 using inits_const_range = llvm::iterator_range<inits_const_iterator>;
4669
4670 inits_range inits() {
4671 return inits_range(getInits().begin(), getInits().end());
4672 }
4673
4674 inits_const_range inits() const {
4675 return inits_const_range(getInits().begin(), getInits().end());
4676 }
4677
4678 using updates_iterator = MutableArrayRef<Expr *>::iterator;
4679 using updates_const_iterator = ArrayRef<const Expr *>::iterator;
4680 using updates_range = llvm::iterator_range<updates_iterator>;
4681 using updates_const_range = llvm::iterator_range<updates_const_iterator>;
4682
4683 updates_range updates() {
4684 return updates_range(getUpdates().begin(), getUpdates().end());
4685 }
4686
4687 updates_const_range updates() const {
4688 return updates_const_range(getUpdates().begin(), getUpdates().end());
4689 }
4690
4691 using finals_iterator = MutableArrayRef<Expr *>::iterator;
4692 using finals_const_iterator = ArrayRef<const Expr *>::iterator;
4693 using finals_range = llvm::iterator_range<finals_iterator>;
4694 using finals_const_range = llvm::iterator_range<finals_const_iterator>;
4695
4696 finals_range finals() {
4697 return finals_range(getFinals().begin(), getFinals().end());
4698 }
4699
4700 finals_const_range finals() const {
4701 return finals_const_range(getFinals().begin(), getFinals().end());
4702 }
4703
4704 using used_expressions_iterator = MutableArrayRef<Expr *>::iterator;
4705 using used_expressions_const_iterator = ArrayRef<const Expr *>::iterator;
4706 using used_expressions_range =
4707 llvm::iterator_range<used_expressions_iterator>;
4708 using used_expressions_const_range =
4709 llvm::iterator_range<used_expressions_const_iterator>;
4710
4711 used_expressions_range used_expressions() {
4712 return finals_range(getUsedExprs().begin(), getUsedExprs().end());
4713 }
4714
4715 used_expressions_const_range used_expressions() const {
4716 return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
4717 }
4718
4719 child_range children() {
4720 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4721 reinterpret_cast<Stmt **>(varlist_end()));
4722 }
4723
4724 const_child_range children() const {
4725 auto Children = const_cast<OMPLinearClause *>(this)->children();
4726 return const_child_range(Children.begin(), Children.end());
4727 }
4728
4729 child_range used_children();
4730
4731 const_child_range used_children() const {
4732 auto Children = const_cast<OMPLinearClause *>(this)->used_children();
4733 return const_child_range(Children.begin(), Children.end());
4734 }
4735
4736 static bool classof(const OMPClause *T) {
4737 return T->getClauseKind() == llvm::omp::OMPC_linear;
4738 }
4739 };
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749 class OMPAlignedClause final
4750 : public OMPVarListClause<OMPAlignedClause>,
4751 private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
4752 friend class OMPClauseReader;
4753 friend OMPVarListClause;
4754 friend TrailingObjects;
4755
4756
4757 SourceLocation ColonLoc;
4758
4759
4760 void setAlignment(Expr *A) { *varlist_end() = A; }
4761
4762
4763
4764
4765
4766
4767
4768
4769 OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4770 SourceLocation ColonLoc, SourceLocation EndLoc,
4771 unsigned NumVars)
4772 : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned, StartLoc,
4773 LParenLoc, EndLoc, NumVars),
4774 ColonLoc(ColonLoc) {}
4775
4776
4777
4778
4779 explicit OMPAlignedClause(unsigned NumVars)
4780 : OMPVarListClause<OMPAlignedClause>(llvm::omp::OMPC_aligned,
4781 SourceLocation(), SourceLocation(),
4782 SourceLocation(), NumVars) {}
4783
4784 public:
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794 static OMPAlignedClause *Create(const ASTContext &C, SourceLocation StartLoc,
4795 SourceLocation LParenLoc,
4796 SourceLocation ColonLoc,
4797 SourceLocation EndLoc, ArrayRef<Expr *> VL,
4798 Expr *A);
4799
4800
4801
4802
4803
4804 static OMPAlignedClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
4805
4806
4807 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4808
4809
4810 SourceLocation getColonLoc() const { return ColonLoc; }
4811
4812
4813 Expr *getAlignment() { return *varlist_end(); }
4814
4815
4816 const Expr *getAlignment() const { return *varlist_end(); }
4817
4818 child_range children() {
4819 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4820 reinterpret_cast<Stmt **>(varlist_end()));
4821 }
4822
4823 const_child_range children() const {
4824 auto Children = const_cast<OMPAlignedClause *>(this)->children();
4825 return const_child_range(Children.begin(), Children.end());
4826 }
4827
4828 child_range used_children() {
4829 return child_range(child_iterator(), child_iterator());
4830 }
4831 const_child_range used_children() const {
4832 return const_child_range(const_child_iterator(), const_child_iterator());
4833 }
4834
4835 static bool classof(const OMPClause *T) {
4836 return T->getClauseKind() == llvm::omp::OMPC_aligned;
4837 }
4838 };
4839
4840
4841
4842
4843
4844
4845
4846
4847 class OMPCopyinClause final
4848 : public OMPVarListClause<OMPCopyinClause>,
4849 private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863 friend class OMPClauseReader;
4864 friend OMPVarListClause;
4865 friend TrailingObjects;
4866
4867
4868
4869
4870
4871
4872
4873 OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4874 SourceLocation EndLoc, unsigned N)
4875 : OMPVarListClause<OMPCopyinClause>(llvm::omp::OMPC_copyin, StartLoc,
4876 LParenLoc, EndLoc, N) {}
4877
4878
4879
4880
4881 explicit OMPCopyinClause(unsigned N)
4882 : OMPVarListClause<OMPCopyinClause>(llvm::omp::OMPC_copyin,
4883 SourceLocation(), SourceLocation(),
4884 SourceLocation(), N) {}
4885
4886
4887
4888
4889 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
4890
4891
4892 MutableArrayRef<Expr *> getSourceExprs() {
4893 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
4894 }
4895 ArrayRef<const Expr *> getSourceExprs() const {
4896 return llvm::ArrayRef(varlist_end(), varlist_size());
4897 }
4898
4899
4900
4901
4902 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
4903
4904
4905 MutableArrayRef<Expr *> getDestinationExprs() {
4906 return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
4907 }
4908 ArrayRef<const Expr *> getDestinationExprs() const {
4909 return llvm::ArrayRef(getSourceExprs().end(), varlist_size());
4910 }
4911
4912
4913
4914
4915
4916 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
4917
4918
4919 MutableArrayRef<Expr *> getAssignmentOps() {
4920 return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
4921 }
4922 ArrayRef<const Expr *> getAssignmentOps() const {
4923 return llvm::ArrayRef(getDestinationExprs().end(), varlist_size());
4924 }
4925
4926 public:
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948 static OMPCopyinClause *
4949 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
4950 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
4951 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
4952
4953
4954
4955
4956
4957 static OMPCopyinClause *CreateEmpty(const ASTContext &C, unsigned N);
4958
4959 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
4960 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
4961 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
4962 using helper_expr_const_range =
4963 llvm::iterator_range<helper_expr_const_iterator>;
4964
4965 helper_expr_const_range source_exprs() const {
4966 return helper_expr_const_range(getSourceExprs().begin(),
4967 getSourceExprs().end());
4968 }
4969
4970 helper_expr_range source_exprs() {
4971 return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
4972 }
4973
4974 helper_expr_const_range destination_exprs() const {
4975 return helper_expr_const_range(getDestinationExprs().begin(),
4976 getDestinationExprs().end());
4977 }
4978
4979 helper_expr_range destination_exprs() {
4980 return helper_expr_range(getDestinationExprs().begin(),
4981 getDestinationExprs().end());
4982 }
4983
4984 helper_expr_const_range assignment_ops() const {
4985 return helper_expr_const_range(getAssignmentOps().begin(),
4986 getAssignmentOps().end());
4987 }
4988
4989 helper_expr_range assignment_ops() {
4990 return helper_expr_range(getAssignmentOps().begin(),
4991 getAssignmentOps().end());
4992 }
4993
4994 child_range children() {
4995 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4996 reinterpret_cast<Stmt **>(varlist_end()));
4997 }
4998
4999 const_child_range children() const {
5000 auto Children = const_cast<OMPCopyinClause *>(this)->children();
5001 return const_child_range(Children.begin(), Children.end());
5002 }
5003
5004 child_range used_children() {
5005 return child_range(child_iterator(), child_iterator());
5006 }
5007 const_child_range used_children() const {
5008 return const_child_range(const_child_iterator(), const_child_iterator());
5009 }
5010
5011 static bool classof(const OMPClause *T) {
5012 return T->getClauseKind() == llvm::omp::OMPC_copyin;
5013 }
5014 };
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024 class OMPCopyprivateClause final
5025 : public OMPVarListClause<OMPCopyprivateClause>,
5026 private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
5027 friend class OMPClauseReader;
5028 friend OMPVarListClause;
5029 friend TrailingObjects;
5030
5031
5032
5033
5034
5035
5036
5037 OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5038 SourceLocation EndLoc, unsigned N)
5039 : OMPVarListClause<OMPCopyprivateClause>(llvm::omp::OMPC_copyprivate,
5040 StartLoc, LParenLoc, EndLoc, N) {
5041 }
5042
5043
5044
5045
5046 explicit OMPCopyprivateClause(unsigned N)
5047 : OMPVarListClause<OMPCopyprivateClause>(
5048 llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(),
5049 SourceLocation(), N) {}
5050
5051
5052
5053
5054 void setSourceExprs(ArrayRef<Expr *> SrcExprs);
5055
5056
5057 MutableArrayRef<Expr *> getSourceExprs() {
5058 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
5059 }
5060 ArrayRef<const Expr *> getSourceExprs() const {
5061 return llvm::ArrayRef(varlist_end(), varlist_size());
5062 }
5063
5064
5065
5066
5067 void setDestinationExprs(ArrayRef<Expr *> DstExprs);
5068
5069
5070 MutableArrayRef<Expr *> getDestinationExprs() {
5071 return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
5072 }
5073 ArrayRef<const Expr *> getDestinationExprs() const {
5074 return llvm::ArrayRef(getSourceExprs().end(), varlist_size());
5075 }
5076
5077
5078
5079
5080
5081 void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
5082
5083
5084 MutableArrayRef<Expr *> getAssignmentOps() {
5085 return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
5086 }
5087 ArrayRef<const Expr *> getAssignmentOps() const {
5088 return llvm::ArrayRef(getDestinationExprs().end(), varlist_size());
5089 }
5090
5091 public:
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112 static OMPCopyprivateClause *
5113 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
5114 SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
5115 ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
5116
5117
5118
5119
5120
5121 static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
5122
5123 using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
5124 using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
5125 using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
5126 using helper_expr_const_range =
5127 llvm::iterator_range<helper_expr_const_iterator>;
5128
5129 helper_expr_const_range source_exprs() const {
5130 return helper_expr_const_range(getSourceExprs().begin(),
5131 getSourceExprs().end());
5132 }
5133
5134 helper_expr_range source_exprs() {
5135 return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
5136 }
5137
5138 helper_expr_const_range destination_exprs() const {
5139 return helper_expr_const_range(getDestinationExprs().begin(),
5140 getDestinationExprs().end());
5141 }
5142
5143 helper_expr_range destination_exprs() {
5144 return helper_expr_range(getDestinationExprs().begin(),
5145 getDestinationExprs().end());
5146 }
5147
5148 helper_expr_const_range assignment_ops() const {
5149 return helper_expr_const_range(getAssignmentOps().begin(),
5150 getAssignmentOps().end());
5151 }
5152
5153 helper_expr_range assignment_ops() {
5154 return helper_expr_range(getAssignmentOps().begin(),
5155 getAssignmentOps().end());
5156 }
5157
5158 child_range children() {
5159 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
5160 reinterpret_cast<Stmt **>(varlist_end()));
5161 }
5162
5163 const_child_range children() const {
5164 auto Children = const_cast<OMPCopyprivateClause *>(this)->children();
5165 return const_child_range(Children.begin(), Children.end());
5166 }
5167
5168 child_range used_children() {
5169 return child_range(child_iterator(), child_iterator());
5170 }
5171 const_child_range used_children() const {
5172 return const_child_range(const_child_iterator(), const_child_iterator());
5173 }
5174
5175 static bool classof(const OMPClause *T) {
5176 return T->getClauseKind() == llvm::omp::OMPC_copyprivate;
5177 }
5178 };
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192 class OMPFlushClause final
5193 : public OMPVarListClause<OMPFlushClause>,
5194 private llvm::TrailingObjects<OMPFlushClause, Expr *> {
5195 friend OMPVarListClause;
5196 friend TrailingObjects;
5197
5198
5199
5200
5201
5202
5203
5204 OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5205 SourceLocation EndLoc, unsigned N)
5206 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush, StartLoc,
5207 LParenLoc, EndLoc, N) {}
5208
5209
5210
5211
5212 explicit OMPFlushClause(unsigned N)
5213 : OMPVarListClause<OMPFlushClause>(llvm::omp::OMPC_flush,
5214 SourceLocation(), SourceLocation(),
5215 SourceLocation(), N) {}
5216
5217 public:
5218
5219
5220
5221
5222
5223
5224
5225 static OMPFlushClause *Create(const ASTContext &C, SourceLocation StartLoc,
5226 SourceLocation LParenLoc, SourceLocation EndLoc,
5227 ArrayRef<Expr *> VL);
5228
5229
5230
5231
5232
5233 static OMPFlushClause *CreateEmpty(const ASTContext &C, unsigned N);
5234
5235 child_range children() {
5236 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
5237 reinterpret_cast<Stmt **>(varlist_end()));
5238 }
5239
5240 const_child_range children() const {
5241 auto Children = const_cast<OMPFlushClause *>(this)->children();
5242 return const_child_range(Children.begin(), Children.end());
5243 }
5244
5245 child_range used_children() {
5246 return child_range(child_iterator(), child_iterator());
5247 }
5248 const_child_range used_children() const {
5249 return const_child_range(const_child_iterator(), const_child_iterator());
5250 }
5251
5252 static bool classof(const OMPClause *T) {
5253 return T->getClauseKind() == llvm::omp::OMPC_flush;
5254 }
5255 };
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269 class OMPDepobjClause final : public OMPClause {
5270 friend class OMPClauseReader;
5271
5272
5273 SourceLocation LParenLoc;
5274
5275
5276 Expr *Depobj = nullptr;
5277
5278
5279
5280
5281
5282
5283 OMPDepobjClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5284 SourceLocation EndLoc)
5285 : OMPClause(llvm::omp::OMPC_depobj, StartLoc, EndLoc),
5286 LParenLoc(LParenLoc) {}
5287
5288
5289
5290 explicit OMPDepobjClause()
5291 : OMPClause(llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {}
5292
5293 void setDepobj(Expr *E) { Depobj = E; }
5294
5295
5296 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
5297
5298 public:
5299
5300
5301
5302
5303
5304
5305
5306 static OMPDepobjClause *Create(const ASTContext &C, SourceLocation StartLoc,
5307 SourceLocation LParenLoc,
5308 SourceLocation EndLoc, Expr *Depobj);
5309
5310
5311
5312
5313 static OMPDepobjClause *CreateEmpty(const ASTContext &C);
5314
5315
5316 Expr *getDepobj() { return Depobj; }
5317 const Expr *getDepobj() const { return Depobj; }
5318
5319
5320 SourceLocation getLParenLoc() const { return LParenLoc; }
5321
5322 child_range children() {
5323 return child_range(reinterpret_cast<Stmt **>(&Depobj),
5324 reinterpret_cast<Stmt **>(&Depobj) + 1);
5325 }
5326
5327 const_child_range children() const {
5328 auto Children = const_cast<OMPDepobjClause *>(this)->children();
5329 return const_child_range(Children.begin(), Children.end());
5330 }
5331
5332 child_range used_children() {
5333 return child_range(child_iterator(), child_iterator());
5334 }
5335 const_child_range used_children() const {
5336 return const_child_range(const_child_iterator(), const_child_iterator());
5337 }
5338
5339 static bool classof(const OMPClause *T) {
5340 return T->getClauseKind() == llvm::omp::OMPC_depobj;
5341 }
5342 };
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352 class OMPDependClause final
5353 : public OMPVarListClause<OMPDependClause>,
5354 private llvm::TrailingObjects<OMPDependClause, Expr *> {
5355 friend class OMPClauseReader;
5356 friend OMPVarListClause;
5357 friend TrailingObjects;
5358
5359 public:
5360 struct DependDataTy final {
5361
5362 OpenMPDependClauseKind DepKind = OMPC_DEPEND_unknown;
5363
5364
5365 SourceLocation DepLoc;
5366
5367
5368 SourceLocation ColonLoc;
5369
5370
5371 SourceLocation OmpAllMemoryLoc;
5372 };
5373
5374 private:
5375
5376 DependDataTy Data;
5377
5378
5379 unsigned NumLoops = 0;
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389 OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
5390 SourceLocation EndLoc, unsigned N, unsigned NumLoops)
5391 : OMPVarListClause<OMPDependClause>(llvm::omp::OMPC_depend, StartLoc,
5392 LParenLoc, EndLoc, N),
5393 NumLoops(NumLoops) {}
5394
5395
5396
5397
5398
5399
5400 explicit OMPDependClause(unsigned N, unsigned NumLoops)
5401 : OMPVarListClause<OMPDependClause>(llvm::omp::OMPC_depend,
5402 SourceLocation(), SourceLocation(),
5403 SourceLocation(), N),
5404 NumLoops(NumLoops) {}
5405
5406
5407 void setDependencyKind(OpenMPDependClauseKind K) { Data.DepKind = K; }
5408
5409
5410 void setDependencyLoc(SourceLocation Loc) { Data.DepLoc = Loc; }
5411
5412
5413 void setColonLoc(SourceLocation Loc) { Data.ColonLoc = Loc; }
5414
5415
5416 void setOmpAllMemoryLoc(SourceLocation Loc) { Data.OmpAllMemoryLoc = Loc; }
5417
5418
5419 void setModifier(Expr *DepModifier);
5420
5421 public:
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432 static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc,
5433 SourceLocation LParenLoc,
5434 SourceLocation EndLoc, DependDataTy Data,
5435 Expr *DepModifier, ArrayRef<Expr *> VL,
5436 unsigned NumLoops);
5437
5438
5439
5440
5441
5442
5443
5444 static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N,
5445 unsigned NumLoops);
5446
5447
5448 OpenMPDependClauseKind getDependencyKind() const { return Data.DepKind; }
5449
5450
5451 SourceLocation getDependencyLoc() const { return Data.DepLoc; }
5452
5453
5454 SourceLocation getColonLoc() const { return Data.ColonLoc; }
5455
5456
5457 SourceLocation getOmpAllMemoryLoc() const { return Data.OmpAllMemoryLoc; }
5458
5459
5460 Expr *getModifier();
5461 const Expr *getModifier() const {
5462 return const_cast<OMPDependClause *>(this)->getModifier();
5463 }
5464
5465
5466 unsigned getNumLoops() const { return NumLoops; }
5467
5468
5469
5470 void setLoopData(unsigned NumLoop, Expr *Cnt);
5471
5472
5473 Expr *getLoopData(unsigned NumLoop);
5474 const Expr *getLoopData(unsigned NumLoop) const;
5475
5476 child_range children() {
5477 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
5478 reinterpret_cast<Stmt **>(varlist_end()));
5479 }
5480
5481 const_child_range children() const {
5482 auto Children = const_cast<OMPDependClause *>(this)->children();
5483 return const_child_range(Children.begin(), Children.end());
5484 }
5485
5486 child_range used_children() {
5487 return child_range(child_iterator(), child_iterator());
5488 }
5489 const_child_range used_children() const {
5490 return const_child_range(const_child_iterator(), const_child_iterator());
5491 }
5492
5493 static bool classof(const OMPClause *T) {
5494 return T->getClauseKind() == llvm::omp::OMPC_depend;
5495 }
5496 };
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506 class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
5507 friend class OMPClauseReader;
5508
5509
5510 SourceLocation LParenLoc;
5511
5512
5513 OpenMPDeviceClauseModifier Modifier = OMPC_DEVICE_unknown;
5514
5515
5516 SourceLocation ModifierLoc;
5517
5518
5519 Stmt *Device = nullptr;
5520
5521
5522
5523
5524 void setDevice(Expr *E) { Device = E; }
5525
5526
5527 void setModifier(OpenMPDeviceClauseModifier M) { Modifier = M; }
5528
5529
5530 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
5531
5532 public:
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543 OMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *E, Stmt *HelperE,
5544 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
5545 SourceLocation LParenLoc, SourceLocation ModifierLoc,
5546 SourceLocation EndLoc)
5547 : OMPClause(llvm::omp::OMPC_device, StartLoc, EndLoc),
5548 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Modifier(Modifier),
5549 ModifierLoc(ModifierLoc), Device(E) {
5550 setPreInitStmt(HelperE, CaptureRegion);
5551 }
5552
5553
5554 OMPDeviceClause()
5555 : OMPClause(llvm::omp::OMPC_device, SourceLocation(), SourceLocation()),
5556 OMPClauseWithPreInit(this) {}
5557
5558
5559 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
5560
5561
5562 SourceLocation getLParenLoc() const { return LParenLoc; }
5563
5564
5565 Expr *getDevice() { return cast<Expr>(Device); }
5566
5567
5568 Expr *getDevice() const { return cast<Expr>(Device); }
5569
5570
5571 OpenMPDeviceClauseModifier getModifier() const { return Modifier; }
5572
5573
5574 SourceLocation getModifierLoc() const { return ModifierLoc; }
5575
5576 child_range children() { return child_range(&Device, &Device + 1); }
5577
5578 const_child_range children() const {
5579 return const_child_range(&Device, &Device + 1);
5580 }
5581
5582 child_range used_children() {
5583 return child_range(child_iterator(), child_iterator());
5584 }
5585 const_child_range used_children() const {
5586 return const_child_range(const_child_iterator(), const_child_iterator());
5587 }
5588
5589 static bool classof(const OMPClause *T) {
5590 return T->getClauseKind() == llvm::omp::OMPC_device;
5591 }
5592 };
5593
5594
5595
5596
5597
5598
5599
5600 class OMPThreadsClause final
5601 : public OMPNoChildClause<llvm::omp::OMPC_threads> {
5602 public:
5603
5604
5605
5606
5607 OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
5608 : OMPNoChildClause(StartLoc, EndLoc) {}
5609
5610
5611 OMPThreadsClause() : OMPNoChildClause() {}
5612 };
5613
5614
5615
5616
5617
5618
5619
5620 class OMPSIMDClause : public OMPClause {
5621 public:
5622
5623
5624
5625
5626 OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
5627 : OMPClause(llvm::omp::OMPC_simd, StartLoc, EndLoc) {}
5628
5629
5630 OMPSIMDClause()
5631 : OMPClause(llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {}
5632
5633 child_range children() {
5634 return child_range(child_iterator(), child_iterator());
5635 }
5636
5637 const_child_range children() const {
5638 return const_child_range(const_child_iterator(), const_child_iterator());
5639 }
5640
5641 child_range used_children() {
5642 return child_range(child_iterator(), child_iterator());
5643 }
5644 const_child_range used_children() const {
5645 return const_child_range(const_child_iterator(), const_child_iterator());
5646 }
5647
5648 static bool classof(const OMPClause *T) {
5649 return T->getClauseKind() == llvm::omp::OMPC_simd;
5650 }
5651 };
5652
5653
5654
5655 class OMPClauseMappableExprCommon {
5656 public:
5657
5658
5659
5660
5661
5662
5663 class MappableComponent {
5664
5665
5666 llvm::PointerIntPair<Expr *, 1, bool> AssociatedExpressionNonContiguousPr;
5667
5668
5669
5670
5671 ValueDecl *AssociatedDeclaration = nullptr;
5672
5673 public:
5674 explicit MappableComponent() = default;
5675 explicit MappableComponent(Expr *AssociatedExpression,
5676 ValueDecl *AssociatedDeclaration,
5677 bool IsNonContiguous)
5678 : AssociatedExpressionNonContiguousPr(AssociatedExpression,
5679 IsNonContiguous),
5680 AssociatedDeclaration(
5681 AssociatedDeclaration
5682 ? cast<ValueDecl>(AssociatedDeclaration->getCanonicalDecl())
5683 : nullptr) {}
5684
5685 Expr *getAssociatedExpression() const {
5686 return AssociatedExpressionNonContiguousPr.getPointer();
5687 }
5688
5689 bool isNonContiguous() const {
5690 return AssociatedExpressionNonContiguousPr.getInt();
5691 }
5692
5693 ValueDecl *getAssociatedDeclaration() const {
5694 return AssociatedDeclaration;
5695 }
5696 };
5697
5698
5699
5700 using MappableExprComponentList = SmallVector<MappableComponent, 8>;
5701 using MappableExprComponentListRef = ArrayRef<MappableComponent>;
5702
5703
5704
5705
5706 using MappableExprComponentLists = SmallVector<MappableExprComponentList, 8>;
5707 using MappableExprComponentListsRef = ArrayRef<MappableExprComponentList>;
5708
5709 protected:
5710
5711 static unsigned
5712 getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists);
5713
5714
5715
5716 static unsigned
5717 getUniqueDeclarationsTotalNumber(ArrayRef<const ValueDecl *> Declarations);
5718 };
5719
5720
5721
5722 struct OMPMappableExprListSizeTy {
5723
5724 unsigned NumVars;
5725
5726 unsigned NumUniqueDeclarations;
5727
5728 unsigned NumComponentLists;
5729
5730 unsigned NumComponents;
5731 OMPMappableExprListSizeTy() = default;
5732 OMPMappableExprListSizeTy(unsigned NumVars, unsigned NumUniqueDeclarations,
5733 unsigned NumComponentLists, unsigned NumComponents)
5734 : NumVars(NumVars), NumUniqueDeclarations(NumUniqueDeclarations),
5735 NumComponentLists(NumComponentLists), NumComponents(NumComponents) {}
5736 };
5737
5738
5739
5740
5741
5742 template <class T>
5743 class OMPMappableExprListClause : public OMPVarListClause<T>,
5744 public OMPClauseMappableExprCommon {
5745 friend class OMPClauseReader;
5746
5747
5748 unsigned NumUniqueDeclarations;
5749
5750
5751 unsigned NumComponentLists;
5752
5753
5754 unsigned NumComponents;
5755
5756
5757
5758
5759 const bool SupportsMapper;
5760
5761
5762 NestedNameSpecifierLoc MapperQualifierLoc;
5763
5764
5765 DeclarationNameInfo MapperIdInfo;
5766
5767 protected:
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786 OMPMappableExprListClause(
5787 OpenMPClauseKind K, const OMPVarListLocTy &Locs,
5788 const OMPMappableExprListSizeTy &Sizes, bool SupportsMapper = false,
5789 NestedNameSpecifierLoc *MapperQualifierLocPtr = nullptr,
5790 DeclarationNameInfo *MapperIdInfoPtr = nullptr)
5791 : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc,
5792 Sizes.NumVars),
5793 NumUniqueDeclarations(Sizes.NumUniqueDeclarations),
5794 NumComponentLists(Sizes.NumComponentLists),
5795 NumComponents(Sizes.NumComponents), SupportsMapper(SupportsMapper) {
5796 if (MapperQualifierLocPtr)
5797 MapperQualifierLoc = *MapperQualifierLocPtr;
5798 if (MapperIdInfoPtr)
5799 MapperIdInfo = *MapperIdInfoPtr;
5800 }
5801
5802
5803
5804 MutableArrayRef<ValueDecl *> getUniqueDeclsRef() {
5805 return MutableArrayRef<ValueDecl *>(
5806 static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(),
5807 NumUniqueDeclarations);
5808 }
5809
5810
5811
5812 ArrayRef<ValueDecl *> getUniqueDeclsRef() const {
5813 return ArrayRef<ValueDecl *>(
5814 static_cast<const T *>(this)
5815 ->template getTrailingObjects<ValueDecl *>(),
5816 NumUniqueDeclarations);
5817 }
5818
5819
5820
5821 void setUniqueDecls(ArrayRef<ValueDecl *> UDs) {
5822 assert(UDs.size() == NumUniqueDeclarations &&
5823 "Unexpected amount of unique declarations.");
5824 std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin());
5825 }
5826
5827
5828
5829 MutableArrayRef<unsigned> getDeclNumListsRef() {
5830 return MutableArrayRef<unsigned>(
5831 static_cast<T *>(this)->template getTrailingObjects<unsigned>(),
5832 NumUniqueDeclarations);
5833 }
5834
5835
5836
5837 ArrayRef<unsigned> getDeclNumListsRef() const {
5838 return ArrayRef<unsigned>(
5839 static_cast<const T *>(this)->template getTrailingObjects<unsigned>(),
5840 NumUniqueDeclarations);
5841 }
5842
5843
5844
5845 void setDeclNumLists(ArrayRef<unsigned> DNLs) {
5846 assert(DNLs.size() == NumUniqueDeclarations &&
5847 "Unexpected amount of list numbers.");
5848 std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin());
5849 }
5850
5851
5852
5853 MutableArrayRef<unsigned> getComponentListSizesRef() {
5854 return MutableArrayRef<unsigned>(
5855 static_cast<T *>(this)->template getTrailingObjects<unsigned>() +
5856 NumUniqueDeclarations,
5857 NumComponentLists);
5858 }
5859
5860
5861
5862 ArrayRef<unsigned> getComponentListSizesRef() const {
5863 return ArrayRef<unsigned>(
5864 static_cast<const T *>(this)->template getTrailingObjects<unsigned>() +
5865 NumUniqueDeclarations,
5866 NumComponentLists);
5867 }
5868
5869
5870
5871 void setComponentListSizes(ArrayRef<unsigned> CLSs) {
5872 assert(CLSs.size() == NumComponentLists &&
5873 "Unexpected amount of component lists.");
5874 std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin());
5875 }
5876
5877
5878 MutableArrayRef<MappableComponent> getComponentsRef() {
5879 return MutableArrayRef<MappableComponent>(
5880 static_cast<T *>(this)
5881 ->template getTrailingObjects<MappableComponent>(),
5882 NumComponents);
5883 }
5884
5885
5886 ArrayRef<MappableComponent> getComponentsRef() const {
5887 return ArrayRef<MappableComponent>(
5888 static_cast<const T *>(this)
5889 ->template getTrailingObjects<MappableComponent>(),
5890 NumComponents);
5891 }
5892
5893
5894
5895
5896 void setComponents(ArrayRef<MappableComponent> Components,
5897 ArrayRef<unsigned> CLSs) {
5898 assert(Components.size() == NumComponents &&
5899 "Unexpected amount of component lists.");
5900 assert(CLSs.size() == NumComponentLists &&
5901 "Unexpected amount of list sizes.");
5902 std::copy(Components.begin(), Components.end(), getComponentsRef().begin());
5903 }
5904
5905
5906
5907 void setClauseInfo(ArrayRef<ValueDecl *> Declarations,
5908 MappableExprComponentListsRef ComponentLists) {
5909
5910
5911 assert(getUniqueDeclarationsTotalNumber(Declarations) ==
5912 NumUniqueDeclarations &&
5913 "Unexpected number of mappable expression info entries!");
5914 assert(getComponentsTotalNumber(ComponentLists) == NumComponents &&
5915 "Unexpected total number of components!");
5916 assert(Declarations.size() == ComponentLists.size() &&
5917 "Declaration and component lists size is not consistent!");
5918 assert(Declarations.size() == NumComponentLists &&
5919 "Unexpected declaration and component lists size!");
5920
5921
5922
5923
5924 llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>>
5925 ComponentListMap;
5926 {
5927 auto CI = ComponentLists.begin();
5928 for (auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE;
5929 ++DI, ++CI) {
5930 assert(!CI->empty() && "Invalid component list!");
5931 ComponentListMap[*DI].push_back(*CI);
5932 }
5933 }
5934
5935
5936 auto UniqueDeclarations = getUniqueDeclsRef();
5937 auto UDI = UniqueDeclarations.begin();
5938
5939 auto DeclNumLists = getDeclNumListsRef();
5940 auto DNLI = DeclNumLists.begin();
5941
5942 auto ComponentListSizes = getComponentListSizesRef();
5943 auto CLSI = ComponentListSizes.begin();
5944
5945 auto Components = getComponentsRef();
5946 auto CI = Components.begin();
5947
5948
5949 unsigned PrevSize = 0u;
5950
5951
5952 for (auto &M : ComponentListMap) {
5953
5954 auto *D = M.first;
5955
5956 auto CL = M.second;
5957
5958
5959 *UDI = D;
5960 ++UDI;
5961
5962 *DNLI = CL.size();
5963 ++DNLI;
5964
5965
5966
5967 for (auto C : CL) {
5968
5969 PrevSize += C.size();
5970
5971
5972 *CLSI = PrevSize;
5973 ++CLSI;
5974
5975
5976 CI = std::copy(C.begin(), C.end(), CI);
5977 }
5978 }
5979 }
5980
5981
5982 void setMapperQualifierLoc(NestedNameSpecifierLoc NNSL) {
5983 MapperQualifierLoc = NNSL;
5984 }
5985
5986
5987 void setMapperIdInfo(DeclarationNameInfo MapperId) {
5988 MapperIdInfo = MapperId;
5989 }
5990
5991
5992
5993 MutableArrayRef<Expr *> getUDMapperRefs() {
5994 assert(SupportsMapper &&
5995 "Must be a clause that is possible to have user-defined mappers");
5996 return llvm::MutableArrayRef<Expr *>(
5997 static_cast<T *>(this)->template getTrailingObjects<Expr *>() +
5998 OMPVarListClause<T>::varlist_size(),
5999 OMPVarListClause<T>::varlist_size());
6000 }
6001
6002
6003
6004 ArrayRef<Expr *> getUDMapperRefs() const {
6005 assert(SupportsMapper &&
6006 "Must be a clause that is possible to have user-defined mappers");
6007 return llvm::ArrayRef<Expr *>(
6008 static_cast<const T *>(this)->template getTrailingObjects<Expr *>() +
6009 OMPVarListClause<T>::varlist_size(),
6010 OMPVarListClause<T>::varlist_size());
6011 }
6012
6013
6014
6015 void setUDMapperRefs(ArrayRef<Expr *> DMDs) {
6016 assert(DMDs.size() == OMPVarListClause<T>::varlist_size() &&
6017 "Unexpected number of user-defined mappers.");
6018 assert(SupportsMapper &&
6019 "Must be a clause that is possible to have user-defined mappers");
6020 std::copy(DMDs.begin(), DMDs.end(), getUDMapperRefs().begin());
6021 }
6022
6023 public:
6024
6025 unsigned getUniqueDeclarationsNum() const { return NumUniqueDeclarations; }
6026
6027
6028 unsigned getTotalComponentListNum() const { return NumComponentLists; }
6029
6030
6031
6032 unsigned getTotalComponentsNum() const { return NumComponents; }
6033
6034
6035 NestedNameSpecifierLoc getMapperQualifierLoc() const {
6036 return MapperQualifierLoc;
6037 }
6038
6039
6040 const DeclarationNameInfo &getMapperIdInfo() const { return MapperIdInfo; }
6041
6042
6043
6044 class const_component_lists_iterator
6045 : public llvm::iterator_adaptor_base<
6046 const_component_lists_iterator,
6047 MappableExprComponentListRef::const_iterator,
6048 std::forward_iterator_tag, MappableComponent, ptrdiff_t,
6049 MappableComponent, MappableComponent> {
6050
6051 ArrayRef<ValueDecl *>::iterator DeclCur;
6052
6053
6054 ArrayRef<unsigned>::iterator NumListsCur;
6055
6056
6057 const bool SupportsMapper;
6058
6059
6060 ArrayRef<Expr *>::iterator MapperCur;
6061
6062
6063 unsigned RemainingLists = 0;
6064
6065
6066
6067 unsigned PrevListSize = 0;
6068
6069
6070
6071 ArrayRef<unsigned>::const_iterator ListSizeCur;
6072 ArrayRef<unsigned>::const_iterator ListSizeEnd;
6073
6074
6075 MappableExprComponentListRef::const_iterator End;
6076
6077 public:
6078
6079 explicit const_component_lists_iterator(
6080 ArrayRef<ValueDecl *> UniqueDecls, ArrayRef<unsigned> DeclsListNum,
6081 ArrayRef<unsigned> CumulativeListSizes,
6082 MappableExprComponentListRef Components, bool SupportsMapper,
6083 ArrayRef<Expr *> Mappers)
6084 : const_component_lists_iterator::iterator_adaptor_base(
6085 Components.begin()),
6086 DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()),
6087 SupportsMapper(SupportsMapper),
6088 ListSizeCur(CumulativeListSizes.begin()),
6089 ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) {
6090 assert(UniqueDecls.size() == DeclsListNum.size() &&
6091 "Inconsistent number of declarations and list sizes!");
6092 if (!DeclsListNum.empty())
6093 RemainingLists = *NumListsCur;
6094 if (SupportsMapper)
6095 MapperCur = Mappers.begin();
6096 }
6097
6098
6099
6100 explicit const_component_lists_iterator(
6101 const ValueDecl *Declaration, ArrayRef<ValueDecl *> UniqueDecls,
6102 ArrayRef<unsigned> DeclsListNum, ArrayRef<unsigned> CumulativeListSizes,
6103 MappableExprComponentListRef Components, bool SupportsMapper,
6104 ArrayRef<Expr *> Mappers)
6105 : const_component_lists_iterator(UniqueDecls, DeclsListNum,
6106 CumulativeListSizes, Components,
6107 SupportsMapper, Mappers) {
6108
6109
6110
6111 for (; DeclCur != UniqueDecls.end(); ++DeclCur, ++NumListsCur) {
6112 if (*DeclCur == Declaration)
6113 break;
6114
6115 assert(*NumListsCur > 0 && "No lists associated with declaration??");
6116
6117
6118
6119 std::advance(ListSizeCur, *NumListsCur - 1);
6120 PrevListSize = *ListSizeCur;
6121 ++ListSizeCur;
6122
6123 if (SupportsMapper)
6124 ++MapperCur;
6125 }
6126
6127
6128
6129 if (ListSizeCur == CumulativeListSizes.end()) {
6130 this->I = End;
6131 RemainingLists = 0u;
6132 return;
6133 }
6134
6135
6136
6137 RemainingLists = *NumListsCur;
6138
6139
6140 ListSizeEnd = ListSizeCur;
6141 std::advance(ListSizeEnd, RemainingLists);
6142
6143
6144
6145 std::advance(this->I, PrevListSize);
6146 }
6147
6148
6149
6150 std::tuple<const ValueDecl *, MappableExprComponentListRef,
6151 const ValueDecl *>
6152 operator*() const {
6153 assert(ListSizeCur != ListSizeEnd && "Invalid iterator!");
6154 const ValueDecl *Mapper = nullptr;
6155 if (SupportsMapper && *MapperCur)
6156 Mapper = cast<ValueDecl>(cast<DeclRefExpr>(*MapperCur)->getDecl());
6157 return std::make_tuple(
6158 *DeclCur,
6159 MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize),
6160 Mapper);
6161 }
6162 std::tuple<const ValueDecl *, MappableExprComponentListRef,
6163 const ValueDecl *>
6164 operator->() const {
6165 return **this;
6166 }
6167
6168
6169 const_component_lists_iterator &operator++() {
6170 assert(ListSizeCur != ListSizeEnd && RemainingLists &&
6171 "Invalid iterator!");
6172
6173
6174
6175 if (std::next(ListSizeCur) == ListSizeEnd) {
6176 this->I = End;
6177 RemainingLists = 0;
6178 } else {
6179 std::advance(this->I, *ListSizeCur - PrevListSize);
6180 PrevListSize = *ListSizeCur;
6181
6182
6183 if (!(--RemainingLists)) {
6184 ++DeclCur;
6185 ++NumListsCur;
6186 RemainingLists = *NumListsCur;
6187 assert(RemainingLists && "No lists in the following declaration??");
6188 }
6189 }
6190
6191 ++ListSizeCur;
6192 if (SupportsMapper)
6193 ++MapperCur;
6194 return *this;
6195 }
6196 };
6197
6198 using const_component_lists_range =
6199 llvm::iterator_range<const_component_lists_iterator>;
6200
6201
6202 const_component_lists_iterator component_lists_begin() const {
6203 return const_component_lists_iterator(
6204 getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(),
6205 getComponentsRef(), SupportsMapper,
6206 SupportsMapper ? getUDMapperRefs() : ArrayRef<Expr *>());
6207 }
6208 const_component_lists_iterator component_lists_end() const {
6209 return const_component_lists_iterator(
6210 ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(),
6211 MappableExprComponentListRef(getComponentsRef().end(),
6212 getComponentsRef().end()),
6213 SupportsMapper, {});
6214 }
6215 const_component_lists_range component_lists() const {
6216 return {component_lists_begin(), component_lists_end()};
6217 }
6218
6219
6220
6221 const_component_lists_iterator
6222 decl_component_lists_begin(const ValueDecl *VD) const {
6223 return const_component_lists_iterator(
6224 VD, getUniqueDeclsRef(), getDeclNumListsRef(),
6225 getComponentListSizesRef(), getComponentsRef(), SupportsMapper,
6226 SupportsMapper ? getUDMapperRefs() : ArrayRef<Expr *>());
6227 }
6228 const_component_lists_iterator decl_component_lists_end() const {
6229 return component_lists_end();
6230 }
6231 const_component_lists_range decl_component_lists(const ValueDecl *VD) const {
6232 return {decl_component_lists_begin(VD), decl_component_lists_end()};
6233 }
6234
6235
6236
6237 using const_all_decls_iterator = ArrayRef<ValueDecl *>::iterator;
6238 using const_all_decls_range = llvm::iterator_range<const_all_decls_iterator>;
6239
6240 const_all_decls_range all_decls() const {
6241 auto A = getUniqueDeclsRef();
6242 return const_all_decls_range(A.begin(), A.end());
6243 }
6244
6245 using const_all_num_lists_iterator = ArrayRef<unsigned>::iterator;
6246 using const_all_num_lists_range =
6247 llvm::iterator_range<const_all_num_lists_iterator>;
6248
6249 const_all_num_lists_range all_num_lists() const {
6250 auto A = getDeclNumListsRef();
6251 return const_all_num_lists_range(A.begin(), A.end());
6252 }
6253
6254 using const_all_lists_sizes_iterator = ArrayRef<unsigned>::iterator;
6255 using const_all_lists_sizes_range =
6256 llvm::iterator_range<const_all_lists_sizes_iterator>;
6257
6258 const_all_lists_sizes_range all_lists_sizes() const {
6259 auto A = getComponentListSizesRef();
6260 return const_all_lists_sizes_range(A.begin(), A.end());
6261 }
6262
6263 using const_all_components_iterator = ArrayRef<MappableComponent>::iterator;
6264 using const_all_components_range =
6265 llvm::iterator_range<const_all_components_iterator>;
6266
6267 const_all_components_range all_components() const {
6268 auto A = getComponentsRef();
6269 return const_all_components_range(A.begin(), A.end());
6270 }
6271
6272 using mapperlist_iterator = MutableArrayRef<Expr *>::iterator;
6273 using mapperlist_const_iterator = ArrayRef<const Expr *>::iterator;
6274 using mapperlist_range = llvm::iterator_range<mapperlist_iterator>;
6275 using mapperlist_const_range =
6276 llvm::iterator_range<mapperlist_const_iterator>;
6277
6278 mapperlist_iterator mapperlist_begin() { return getUDMapperRefs().begin(); }
6279 mapperlist_iterator mapperlist_end() { return getUDMapperRefs().end(); }
6280 mapperlist_const_iterator mapperlist_begin() const {
6281 return getUDMapperRefs().begin();
6282 }
6283 mapperlist_const_iterator mapperlist_end() const {
6284 return getUDMapperRefs().end();
6285 }
6286 mapperlist_range mapperlists() {
6287 return mapperlist_range(mapperlist_begin(), mapperlist_end());
6288 }
6289 mapperlist_const_range mapperlists() const {
6290 return mapperlist_const_range(mapperlist_begin(), mapperlist_end());
6291 }
6292 };
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302 class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
6303 private llvm::TrailingObjects<
6304 OMPMapClause, Expr *, ValueDecl *, unsigned,
6305 OMPClauseMappableExprCommon::MappableComponent> {
6306 friend class OMPClauseReader;
6307 friend OMPMappableExprListClause;
6308 friend OMPVarListClause;
6309 friend TrailingObjects;
6310
6311
6312
6313 size_t numTrailingObjects(OverloadToken<Expr *>) const {
6314
6315
6316 return 2 * varlist_size() + 1;
6317 }
6318 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
6319 return getUniqueDeclarationsNum();
6320 }
6321 size_t numTrailingObjects(OverloadToken<unsigned>) const {
6322 return getUniqueDeclarationsNum() + getTotalComponentListNum();
6323 }
6324
6325 private:
6326
6327 OpenMPMapModifierKind MapTypeModifiers[NumberOfOMPMapClauseModifiers] = {
6328 OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown,
6329 OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown,
6330 OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown};
6331
6332
6333 SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers];
6334
6335
6336 OpenMPMapClauseKind MapType = OMPC_MAP_unknown;
6337
6338
6339 bool MapTypeIsImplicit = false;
6340
6341
6342 SourceLocation MapLoc;
6343
6344
6345 SourceLocation ColonLoc;
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367 explicit OMPMapClause(ArrayRef<OpenMPMapModifierKind> MapModifiers,
6368 ArrayRef<SourceLocation> MapModifiersLoc,
6369 NestedNameSpecifierLoc MapperQualifierLoc,
6370 DeclarationNameInfo MapperIdInfo,
6371 OpenMPMapClauseKind MapType, bool MapTypeIsImplicit,
6372 SourceLocation MapLoc, const OMPVarListLocTy &Locs,
6373 const OMPMappableExprListSizeTy &Sizes)
6374 : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes,
6375 true, &MapperQualifierLoc,
6376 &MapperIdInfo),
6377 MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {
6378 assert(std::size(MapTypeModifiers) == MapModifiers.size() &&
6379 "Unexpected number of map type modifiers.");
6380 llvm::copy(MapModifiers, std::begin(MapTypeModifiers));
6381
6382 assert(std::size(MapTypeModifiersLoc) == MapModifiersLoc.size() &&
6383 "Unexpected number of map type modifier locations.");
6384 llvm::copy(MapModifiersLoc, std::begin(MapTypeModifiersLoc));
6385 }
6386
6387
6388
6389
6390
6391
6392
6393
6394 explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes)
6395 : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), Sizes,
6396 true) {}
6397
6398
6399
6400
6401
6402 void setMapTypeModifier(unsigned I, OpenMPMapModifierKind T) {
6403 assert(I < NumberOfOMPMapClauseModifiers &&
6404 "Unexpected index to store map type modifier, exceeds array size.");
6405 MapTypeModifiers[I] = T;
6406 }
6407
6408
6409
6410
6411
6412 void setMapTypeModifierLoc(unsigned I, SourceLocation TLoc) {
6413 assert(I < NumberOfOMPMapClauseModifiers &&
6414 "Index to store map type modifier location exceeds array size.");
6415 MapTypeModifiersLoc[I] = TLoc;
6416 }
6417
6418
6419
6420
6421 void setMapType(OpenMPMapClauseKind T) { MapType = T; }
6422
6423
6424
6425
6426 void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; }
6427
6428
6429 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
6430
6431
6432 void setIteratorModifier(Expr *IteratorModifier) {
6433 getTrailingObjects<Expr *>()[2 * varlist_size()] = IteratorModifier;
6434 }
6435
6436 public:
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457 static OMPMapClause *
6458 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
6459 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
6460 MappableExprComponentListsRef ComponentLists,
6461 ArrayRef<Expr *> UDMapperRefs, Expr *IteratorModifier,
6462 ArrayRef<OpenMPMapModifierKind> MapModifiers,
6463 ArrayRef<SourceLocation> MapModifiersLoc,
6464 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId,
6465 OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc);
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477 static OMPMapClause *CreateEmpty(const ASTContext &C,
6478 const OMPMappableExprListSizeTy &Sizes);
6479
6480
6481 Expr *getIteratorModifier() {
6482 return getTrailingObjects<Expr *>()[2 * varlist_size()];
6483 }
6484
6485
6486 OpenMPMapClauseKind getMapType() const LLVM_READONLY { return MapType; }
6487
6488
6489
6490
6491
6492
6493 bool isImplicitMapType() const LLVM_READONLY { return MapTypeIsImplicit; }
6494
6495
6496
6497
6498 OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY {
6499 assert(Cnt < NumberOfOMPMapClauseModifiers &&
6500 "Requested modifier exceeds the total number of modifiers.");
6501 return MapTypeModifiers[Cnt];
6502 }
6503
6504
6505
6506
6507
6508 SourceLocation getMapTypeModifierLoc(unsigned Cnt) const LLVM_READONLY {
6509 assert(Cnt < NumberOfOMPMapClauseModifiers &&
6510 "Requested modifier location exceeds total number of modifiers.");
6511 return MapTypeModifiersLoc[Cnt];
6512 }
6513
6514
6515 ArrayRef<OpenMPMapModifierKind> getMapTypeModifiers() const LLVM_READONLY {
6516 return llvm::ArrayRef(MapTypeModifiers);
6517 }
6518
6519
6520 ArrayRef<SourceLocation> getMapTypeModifiersLoc() const LLVM_READONLY {
6521 return llvm::ArrayRef(MapTypeModifiersLoc);
6522 }
6523
6524
6525 SourceLocation getMapLoc() const LLVM_READONLY { return MapLoc; }
6526
6527
6528 SourceLocation getColonLoc() const { return ColonLoc; }
6529
6530 child_range children() {
6531 return child_range(
6532 reinterpret_cast<Stmt **>(varlist_begin()),
6533 reinterpret_cast<Stmt **>(varlist_end()));
6534 }
6535
6536 const_child_range children() const {
6537 auto Children = const_cast<OMPMapClause *>(this)->children();
6538 return const_child_range(Children.begin(), Children.end());
6539 }
6540
6541 child_range used_children() {
6542 if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_tofrom)
6543 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
6544 reinterpret_cast<Stmt **>(varlist_end()));
6545 return child_range(child_iterator(), child_iterator());
6546 }
6547 const_child_range used_children() const {
6548 auto Children = const_cast<OMPMapClause *>(this)->used_children();
6549 return const_child_range(Children.begin(), Children.end());
6550 }
6551
6552
6553 static bool classof(const OMPClause *T) {
6554 return T->getClauseKind() == llvm::omp::OMPC_map;
6555 }
6556 };
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573 class OMPNumTeamsClause final
6574 : public OMPVarListClause<OMPNumTeamsClause>,
6575 public OMPClauseWithPreInit,
6576 private llvm::TrailingObjects<OMPNumTeamsClause, Expr *> {
6577 friend OMPVarListClause;
6578 friend TrailingObjects;
6579
6580
6581 SourceLocation LParenLoc;
6582
6583 OMPNumTeamsClause(const ASTContext &C, SourceLocation StartLoc,
6584 SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N)
6585 : OMPVarListClause(llvm::omp::OMPC_num_teams, StartLoc, LParenLoc, EndLoc,
6586 N),
6587 OMPClauseWithPreInit(this) {}
6588
6589
6590 OMPNumTeamsClause(unsigned N)
6591 : OMPVarListClause(llvm::omp::OMPC_num_teams, SourceLocation(),
6592 SourceLocation(), SourceLocation(), N),
6593 OMPClauseWithPreInit(this) {}
6594
6595 public:
6596
6597
6598
6599
6600
6601
6602
6603
6604 static OMPNumTeamsClause *
6605 Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
6606 SourceLocation StartLoc, SourceLocation LParenLoc,
6607 SourceLocation EndLoc, ArrayRef<Expr *> VL, Stmt *PreInit);
6608
6609
6610
6611
6612
6613 static OMPNumTeamsClause *CreateEmpty(const ASTContext &C, unsigned N);
6614
6615
6616 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
6617
6618
6619 SourceLocation getLParenLoc() const { return LParenLoc; }
6620
6621
6622 ArrayRef<Expr *> getNumTeams() { return getVarRefs(); }
6623
6624
6625 ArrayRef<Expr *> getNumTeams() const {
6626 return const_cast<OMPNumTeamsClause *>(this)->getNumTeams();
6627 }
6628
6629 child_range children() {
6630 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
6631 reinterpret_cast<Stmt **>(varlist_end()));
6632 }
6633
6634 const_child_range children() const {
6635 auto Children = const_cast<OMPNumTeamsClause *>(this)->children();
6636 return const_child_range(Children.begin(), Children.end());
6637 }
6638
6639 child_range used_children() {
6640 return child_range(child_iterator(), child_iterator());
6641 }
6642 const_child_range used_children() const {
6643 return const_child_range(const_child_iterator(), const_child_iterator());
6644 }
6645
6646 static bool classof(const OMPClause *T) {
6647 return T->getClauseKind() == llvm::omp::OMPC_num_teams;
6648 }
6649 };
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666 class OMPThreadLimitClause final
6667 : public OMPVarListClause<OMPThreadLimitClause>,
6668 public OMPClauseWithPreInit,
6669 private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
6670 friend OMPVarListClause;
6671 friend TrailingObjects;
6672
6673
6674 SourceLocation LParenLoc;
6675
6676 OMPThreadLimitClause(const ASTContext &C, SourceLocation StartLoc,
6677 SourceLocation LParenLoc, SourceLocation EndLoc,
6678 unsigned N)
6679 : OMPVarListClause(llvm::omp::OMPC_thread_limit, StartLoc, LParenLoc,
6680 EndLoc, N),
6681 OMPClauseWithPreInit(this) {}
6682
6683
6684 OMPThreadLimitClause(unsigned N)
6685 : OMPVarListClause(llvm::omp::OMPC_thread_limit, SourceLocation(),
6686 SourceLocation(), SourceLocation(), N),
6687 OMPClauseWithPreInit(this) {}
6688
6689 public:
6690
6691
6692
6693
6694
6695
6696
6697
6698 static OMPThreadLimitClause *
6699 Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
6700 SourceLocation StartLoc, SourceLocation LParenLoc,
6701 SourceLocation EndLoc, ArrayRef<Expr *> VL, Stmt *PreInit);
6702
6703
6704
6705
6706
6707 static OMPThreadLimitClause *CreateEmpty(const ASTContext &C, unsigned N);
6708
6709
6710 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
6711
6712
6713 SourceLocation getLParenLoc() const { return LParenLoc; }
6714
6715
6716 ArrayRef<Expr *> getThreadLimit() { return getVarRefs(); }
6717
6718
6719 ArrayRef<Expr *> getThreadLimit() const {
6720 return const_cast<OMPThreadLimitClause *>(this)->getThreadLimit();
6721 }
6722
6723 child_range children() {
6724 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
6725 reinterpret_cast<Stmt **>(varlist_end()));
6726 }
6727
6728 const_child_range children() const {
6729 auto Children = const_cast<OMPThreadLimitClause *>(this)->children();
6730 return const_child_range(Children.begin(), Children.end());
6731 }
6732
6733 child_range used_children() {
6734 return child_range(child_iterator(), child_iterator());
6735 }
6736 const_child_range used_children() const {
6737 return const_child_range(const_child_iterator(), const_child_iterator());
6738 }
6739
6740 static bool classof(const OMPClause *T) {
6741 return T->getClauseKind() == llvm::omp::OMPC_thread_limit;
6742 }
6743 };
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753 class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
6754 friend class OMPClauseReader;
6755
6756
6757 SourceLocation LParenLoc;
6758
6759
6760 Stmt *Priority = nullptr;
6761
6762
6763
6764
6765 void setPriority(Expr *E) { Priority = E; }
6766
6767 public:
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777 OMPPriorityClause(Expr *Priority, Stmt *HelperPriority,
6778 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
6779 SourceLocation LParenLoc, SourceLocation EndLoc)
6780 : OMPClause(llvm::omp::OMPC_priority, StartLoc, EndLoc),
6781 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Priority(Priority) {
6782 setPreInitStmt(HelperPriority, CaptureRegion);
6783 }
6784
6785
6786 OMPPriorityClause()
6787 : OMPClause(llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()),
6788 OMPClauseWithPreInit(this) {}
6789
6790
6791 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
6792
6793
6794 SourceLocation getLParenLoc() const { return LParenLoc; }
6795
6796
6797 Expr *getPriority() { return cast<Expr>(Priority); }
6798
6799
6800 Expr *getPriority() const { return cast<Expr>(Priority); }
6801
6802 child_range children() { return child_range(&Priority, &Priority + 1); }
6803
6804 const_child_range children() const {
6805 return const_child_range(&Priority, &Priority + 1);
6806 }
6807
6808 child_range used_children();
6809 const_child_range used_children() const {
6810 auto Children = const_cast<OMPPriorityClause *>(this)->used_children();
6811 return const_child_range(Children.begin(), Children.end());
6812 }
6813
6814 static bool classof(const OMPClause *T) {
6815 return T->getClauseKind() == llvm::omp::OMPC_priority;
6816 }
6817 };
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827 class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
6828 friend class OMPClauseReader;
6829
6830
6831 SourceLocation LParenLoc;
6832
6833
6834 OpenMPGrainsizeClauseModifier Modifier = OMPC_GRAINSIZE_unknown;
6835
6836
6837 SourceLocation ModifierLoc;
6838
6839
6840 Stmt *Grainsize = nullptr;
6841
6842
6843 void setGrainsize(Expr *Size) { Grainsize = Size; }
6844
6845
6846 void setModifier(OpenMPGrainsizeClauseModifier M) { Modifier = M; }
6847
6848
6849 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
6850
6851 public:
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863 OMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size,
6864 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
6865 SourceLocation StartLoc, SourceLocation LParenLoc,
6866 SourceLocation ModifierLoc, SourceLocation EndLoc)
6867 : OMPClause(llvm::omp::OMPC_grainsize, StartLoc, EndLoc),
6868 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Modifier(Modifier),
6869 ModifierLoc(ModifierLoc), Grainsize(Size) {
6870 setPreInitStmt(HelperSize, CaptureRegion);
6871 }
6872
6873
6874 explicit OMPGrainsizeClause()
6875 : OMPClause(llvm::omp::OMPC_grainsize, SourceLocation(),
6876 SourceLocation()),
6877 OMPClauseWithPreInit(this) {}
6878
6879
6880 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
6881
6882
6883 SourceLocation getLParenLoc() const { return LParenLoc; }
6884
6885
6886 Expr *getGrainsize() const { return cast_or_null<Expr>(Grainsize); }
6887
6888
6889 OpenMPGrainsizeClauseModifier getModifier() const { return Modifier; }
6890
6891
6892 SourceLocation getModifierLoc() const { return ModifierLoc; }
6893
6894 child_range children() { return child_range(&Grainsize, &Grainsize + 1); }
6895
6896 const_child_range children() const {
6897 return const_child_range(&Grainsize, &Grainsize + 1);
6898 }
6899
6900 child_range used_children();
6901 const_child_range used_children() const {
6902 auto Children = const_cast<OMPGrainsizeClause *>(this)->used_children();
6903 return const_child_range(Children.begin(), Children.end());
6904 }
6905
6906 static bool classof(const OMPClause *T) {
6907 return T->getClauseKind() == llvm::omp::OMPC_grainsize;
6908 }
6909 };
6910
6911
6912
6913
6914
6915
6916
6917 class OMPNogroupClause : public OMPClause {
6918 public:
6919
6920
6921
6922
6923 OMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
6924 : OMPClause(llvm::omp::OMPC_nogroup, StartLoc, EndLoc) {}
6925
6926
6927 OMPNogroupClause()
6928 : OMPClause(llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) {
6929 }
6930
6931 child_range children() {
6932 return child_range(child_iterator(), child_iterator());
6933 }
6934
6935 const_child_range children() const {
6936 return const_child_range(const_child_iterator(), const_child_iterator());
6937 }
6938
6939 child_range used_children() {
6940 return child_range(child_iterator(), child_iterator());
6941 }
6942 const_child_range used_children() const {
6943 return const_child_range(const_child_iterator(), const_child_iterator());
6944 }
6945
6946 static bool classof(const OMPClause *T) {
6947 return T->getClauseKind() == llvm::omp::OMPC_nogroup;
6948 }
6949 };
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959 class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
6960 friend class OMPClauseReader;
6961
6962
6963 SourceLocation LParenLoc;
6964
6965
6966 OpenMPNumTasksClauseModifier Modifier = OMPC_NUMTASKS_unknown;
6967
6968
6969 SourceLocation ModifierLoc;
6970
6971
6972 Stmt *NumTasks = nullptr;
6973
6974
6975 void setNumTasks(Expr *Size) { NumTasks = Size; }
6976
6977
6978 void setModifier(OpenMPNumTasksClauseModifier M) { Modifier = M; }
6979
6980
6981 void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
6982
6983 public:
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995 OMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *Size,
6996 Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion,
6997 SourceLocation StartLoc, SourceLocation LParenLoc,
6998 SourceLocation ModifierLoc, SourceLocation EndLoc)
6999 : OMPClause(llvm::omp::OMPC_num_tasks, StartLoc, EndLoc),
7000 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Modifier(Modifier),
7001 ModifierLoc(ModifierLoc), NumTasks(Size) {
7002 setPreInitStmt(HelperSize, CaptureRegion);
7003 }
7004
7005
7006 explicit OMPNumTasksClause()
7007 : OMPClause(llvm::omp::OMPC_num_tasks, SourceLocation(),
7008 SourceLocation()),
7009 OMPClauseWithPreInit(this) {}
7010
7011
7012 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7013
7014
7015 SourceLocation getLParenLoc() const { return LParenLoc; }
7016
7017
7018 Expr *getNumTasks() const { return cast_or_null<Expr>(NumTasks); }
7019
7020
7021 OpenMPNumTasksClauseModifier getModifier() const { return Modifier; }
7022
7023
7024 SourceLocation getModifierLoc() const { return ModifierLoc; }
7025
7026 child_range children() { return child_range(&NumTasks, &NumTasks + 1); }
7027
7028 const_child_range children() const {
7029 return const_child_range(&NumTasks, &NumTasks + 1);
7030 }
7031
7032 child_range used_children();
7033 const_child_range used_children() const {
7034 auto Children = const_cast<OMPNumTasksClause *>(this)->used_children();
7035 return const_child_range(Children.begin(), Children.end());
7036 }
7037
7038 static bool classof(const OMPClause *T) {
7039 return T->getClauseKind() == llvm::omp::OMPC_num_tasks;
7040 }
7041 };
7042
7043
7044
7045
7046
7047
7048
7049
7050 class OMPHintClause : public OMPClause {
7051 friend class OMPClauseReader;
7052
7053
7054 SourceLocation LParenLoc;
7055
7056
7057 Stmt *Hint = nullptr;
7058
7059
7060 void setHint(Expr *H) { Hint = H; }
7061
7062 public:
7063
7064
7065
7066
7067
7068
7069 OMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc,
7070 SourceLocation EndLoc)
7071 : OMPClause(llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc),
7072 Hint(Hint) {}
7073
7074
7075 OMPHintClause()
7076 : OMPClause(llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {}
7077
7078
7079 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7080
7081
7082 SourceLocation getLParenLoc() const { return LParenLoc; }
7083
7084
7085 Expr *getHint() const { return cast_or_null<Expr>(Hint); }
7086
7087 child_range children() { return child_range(&Hint, &Hint + 1); }
7088
7089 const_child_range children() const {
7090 return const_child_range(&Hint, &Hint + 1);
7091 }
7092
7093 child_range used_children() {
7094 return child_range(child_iterator(), child_iterator());
7095 }
7096 const_child_range used_children() const {
7097 return const_child_range(const_child_iterator(), const_child_iterator());
7098 }
7099
7100 static bool classof(const OMPClause *T) {
7101 return T->getClauseKind() == llvm::omp::OMPC_hint;
7102 }
7103 };
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113 class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit {
7114 friend class OMPClauseReader;
7115
7116
7117 SourceLocation LParenLoc;
7118
7119
7120 OpenMPDistScheduleClauseKind Kind = OMPC_DIST_SCHEDULE_unknown;
7121
7122
7123 SourceLocation KindLoc;
7124
7125
7126 SourceLocation CommaLoc;
7127
7128
7129 Expr *ChunkSize = nullptr;
7130
7131
7132
7133
7134 void setDistScheduleKind(OpenMPDistScheduleClauseKind K) { Kind = K; }
7135
7136
7137
7138
7139 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7140
7141
7142
7143
7144 void setDistScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7145
7146
7147
7148
7149 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
7150
7151
7152
7153
7154 void setChunkSize(Expr *E) { ChunkSize = E; }
7155
7156 public:
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168 OMPDistScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
7169 SourceLocation KLoc, SourceLocation CommaLoc,
7170 SourceLocation EndLoc,
7171 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
7172 Stmt *HelperChunkSize)
7173 : OMPClause(llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc),
7174 OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind),
7175 KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {
7176 setPreInitStmt(HelperChunkSize);
7177 }
7178
7179
7180 explicit OMPDistScheduleClause()
7181 : OMPClause(llvm::omp::OMPC_dist_schedule, SourceLocation(),
7182 SourceLocation()),
7183 OMPClauseWithPreInit(this) {}
7184
7185
7186 OpenMPDistScheduleClauseKind getDistScheduleKind() const { return Kind; }
7187
7188
7189 SourceLocation getLParenLoc() { return LParenLoc; }
7190
7191
7192 SourceLocation getDistScheduleKindLoc() { return KindLoc; }
7193
7194
7195 SourceLocation getCommaLoc() { return CommaLoc; }
7196
7197
7198 Expr *getChunkSize() { return ChunkSize; }
7199
7200
7201 const Expr *getChunkSize() const { return ChunkSize; }
7202
7203 child_range children() {
7204 return child_range(reinterpret_cast<Stmt **>(&ChunkSize),
7205 reinterpret_cast<Stmt **>(&ChunkSize) + 1);
7206 }
7207
7208 const_child_range children() const {
7209 auto Children = const_cast<OMPDistScheduleClause *>(this)->children();
7210 return const_child_range(Children.begin(), Children.end());
7211 }
7212
7213 child_range used_children() {
7214 return child_range(child_iterator(), child_iterator());
7215 }
7216 const_child_range used_children() const {
7217 return const_child_range(const_child_iterator(), const_child_iterator());
7218 }
7219
7220 static bool classof(const OMPClause *T) {
7221 return T->getClauseKind() == llvm::omp::OMPC_dist_schedule;
7222 }
7223 };
7224
7225
7226
7227
7228
7229
7230
7231
7232 class OMPDefaultmapClause : public OMPClause {
7233 friend class OMPClauseReader;
7234
7235
7236 SourceLocation LParenLoc;
7237
7238
7239 OpenMPDefaultmapClauseModifier Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown;
7240
7241
7242 SourceLocation ModifierLoc;
7243
7244
7245 OpenMPDefaultmapClauseKind Kind = OMPC_DEFAULTMAP_unknown;
7246
7247
7248 SourceLocation KindLoc;
7249
7250
7251
7252
7253 void setDefaultmapKind(OpenMPDefaultmapClauseKind K) { Kind = K; }
7254
7255
7256
7257
7258 void setDefaultmapModifier(OpenMPDefaultmapClauseModifier M) {
7259 Modifier = M;
7260 }
7261
7262
7263 void setDefaultmapModifierLoc(SourceLocation Loc) {
7264 ModifierLoc = Loc;
7265 }
7266
7267
7268
7269
7270 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
7271
7272
7273
7274
7275 void setDefaultmapKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
7276
7277 public:
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287 OMPDefaultmapClause(SourceLocation StartLoc, SourceLocation LParenLoc,
7288 SourceLocation MLoc, SourceLocation KLoc,
7289 SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind,
7290 OpenMPDefaultmapClauseModifier M)
7291 : OMPClause(llvm::omp::OMPC_defaultmap, StartLoc, EndLoc),
7292 LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind),
7293 KindLoc(KLoc) {}
7294
7295
7296 explicit OMPDefaultmapClause()
7297 : OMPClause(llvm::omp::OMPC_defaultmap, SourceLocation(),
7298 SourceLocation()) {}
7299
7300
7301 OpenMPDefaultmapClauseKind getDefaultmapKind() const { return Kind; }
7302
7303
7304 OpenMPDefaultmapClauseModifier getDefaultmapModifier() const {
7305 return Modifier;
7306 }
7307
7308
7309 SourceLocation getLParenLoc() { return LParenLoc; }
7310
7311
7312 SourceLocation getDefaultmapKindLoc() { return KindLoc; }
7313
7314
7315 SourceLocation getDefaultmapModifierLoc() const {
7316 return ModifierLoc;
7317 }
7318
7319 child_range children() {
7320 return child_range(child_iterator(), child_iterator());
7321 }
7322
7323 const_child_range children() const {
7324 return const_child_range(const_child_iterator(), const_child_iterator());
7325 }
7326
7327 child_range used_children() {
7328 return child_range(child_iterator(), child_iterator());
7329 }
7330 const_child_range used_children() const {
7331 return const_child_range(const_child_iterator(), const_child_iterator());
7332 }
7333
7334 static bool classof(const OMPClause *T) {
7335 return T->getClauseKind() == llvm::omp::OMPC_defaultmap;
7336 }
7337 };
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347 class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
7348 private llvm::TrailingObjects<
7349 OMPToClause, Expr *, ValueDecl *, unsigned,
7350 OMPClauseMappableExprCommon::MappableComponent> {
7351 friend class OMPClauseReader;
7352 friend OMPMappableExprListClause;
7353 friend OMPVarListClause;
7354 friend TrailingObjects;
7355
7356
7357 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
7358 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
7359
7360
7361 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
7362
7363
7364 SourceLocation ColonLoc;
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381 explicit OMPToClause(ArrayRef<OpenMPMotionModifierKind> TheMotionModifiers,
7382 ArrayRef<SourceLocation> TheMotionModifiersLoc,
7383 NestedNameSpecifierLoc MapperQualifierLoc,
7384 DeclarationNameInfo MapperIdInfo,
7385 const OMPVarListLocTy &Locs,
7386 const OMPMappableExprListSizeTy &Sizes)
7387 : OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes,
7388 true, &MapperQualifierLoc,
7389 &MapperIdInfo) {
7390 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
7391 "Unexpected number of motion modifiers.");
7392 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
7393
7394 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
7395 "Unexpected number of motion modifier locations.");
7396 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
7397 }
7398
7399
7400
7401
7402
7403
7404
7405
7406 explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes)
7407 : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
7408 true) {}
7409
7410
7411
7412
7413
7414 void setMotionModifier(unsigned I, OpenMPMotionModifierKind T) {
7415 assert(I < NumberOfOMPMotionModifiers &&
7416 "Unexpected index to store motion modifier, exceeds array size.");
7417 MotionModifiers[I] = T;
7418 }
7419
7420
7421
7422
7423
7424 void setMotionModifierLoc(unsigned I, SourceLocation TLoc) {
7425 assert(I < NumberOfOMPMotionModifiers &&
7426 "Index to store motion modifier location exceeds array size.");
7427 MotionModifiersLoc[I] = TLoc;
7428 }
7429
7430
7431 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
7432
7433
7434
7435 size_t numTrailingObjects(OverloadToken<Expr *>) const {
7436
7437
7438 return 2 * varlist_size();
7439 }
7440 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
7441 return getUniqueDeclarationsNum();
7442 }
7443 size_t numTrailingObjects(OverloadToken<unsigned>) const {
7444 return getUniqueDeclarationsNum() + getTotalComponentListNum();
7445 }
7446
7447 public:
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464 static OMPToClause *Create(const ASTContext &C, const OMPVarListLocTy &Locs,
7465 ArrayRef<Expr *> Vars,
7466 ArrayRef<ValueDecl *> Declarations,
7467 MappableExprComponentListsRef ComponentLists,
7468 ArrayRef<Expr *> UDMapperRefs,
7469 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
7470 ArrayRef<SourceLocation> MotionModifiersLoc,
7471 NestedNameSpecifierLoc UDMQualifierLoc,
7472 DeclarationNameInfo MapperId);
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482 static OMPToClause *CreateEmpty(const ASTContext &C,
7483 const OMPMappableExprListSizeTy &Sizes);
7484
7485
7486
7487
7488 OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY {
7489 assert(Cnt < NumberOfOMPMotionModifiers &&
7490 "Requested modifier exceeds the total number of modifiers.");
7491 return MotionModifiers[Cnt];
7492 }
7493
7494
7495
7496
7497
7498 SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY {
7499 assert(Cnt < NumberOfOMPMotionModifiers &&
7500 "Requested modifier location exceeds total number of modifiers.");
7501 return MotionModifiersLoc[Cnt];
7502 }
7503
7504
7505 ArrayRef<OpenMPMotionModifierKind> getMotionModifiers() const LLVM_READONLY {
7506 return llvm::ArrayRef(MotionModifiers);
7507 }
7508
7509
7510 ArrayRef<SourceLocation> getMotionModifiersLoc() const LLVM_READONLY {
7511 return llvm::ArrayRef(MotionModifiersLoc);
7512 }
7513
7514
7515 SourceLocation getColonLoc() const { return ColonLoc; }
7516
7517 child_range children() {
7518 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
7519 reinterpret_cast<Stmt **>(varlist_end()));
7520 }
7521
7522 const_child_range children() const {
7523 auto Children = const_cast<OMPToClause *>(this)->children();
7524 return const_child_range(Children.begin(), Children.end());
7525 }
7526
7527 child_range used_children() {
7528 return child_range(child_iterator(), child_iterator());
7529 }
7530 const_child_range used_children() const {
7531 return const_child_range(const_child_iterator(), const_child_iterator());
7532 }
7533
7534 static bool classof(const OMPClause *T) {
7535 return T->getClauseKind() == llvm::omp::OMPC_to;
7536 }
7537 };
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547 class OMPFromClause final
7548 : public OMPMappableExprListClause<OMPFromClause>,
7549 private llvm::TrailingObjects<
7550 OMPFromClause, Expr *, ValueDecl *, unsigned,
7551 OMPClauseMappableExprCommon::MappableComponent> {
7552 friend class OMPClauseReader;
7553 friend OMPMappableExprListClause;
7554 friend OMPVarListClause;
7555 friend TrailingObjects;
7556
7557
7558 OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
7559 OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
7560
7561
7562 SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
7563
7564
7565 SourceLocation ColonLoc;
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582 explicit OMPFromClause(ArrayRef<OpenMPMotionModifierKind> TheMotionModifiers,
7583 ArrayRef<SourceLocation> TheMotionModifiersLoc,
7584 NestedNameSpecifierLoc MapperQualifierLoc,
7585 DeclarationNameInfo MapperIdInfo,
7586 const OMPVarListLocTy &Locs,
7587 const OMPMappableExprListSizeTy &Sizes)
7588 : OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes,
7589 true, &MapperQualifierLoc,
7590 &MapperIdInfo) {
7591 assert(std::size(MotionModifiers) == TheMotionModifiers.size() &&
7592 "Unexpected number of motion modifiers.");
7593 llvm::copy(TheMotionModifiers, std::begin(MotionModifiers));
7594
7595 assert(std::size(MotionModifiersLoc) == TheMotionModifiersLoc.size() &&
7596 "Unexpected number of motion modifier locations.");
7597 llvm::copy(TheMotionModifiersLoc, std::begin(MotionModifiersLoc));
7598 }
7599
7600
7601
7602
7603
7604
7605
7606
7607 explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes)
7608 : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
7609 Sizes, true) {}
7610
7611
7612
7613
7614
7615 void setMotionModifier(unsigned I, OpenMPMotionModifierKind T) {
7616 assert(I < NumberOfOMPMotionModifiers &&
7617 "Unexpected index to store motion modifier, exceeds array size.");
7618 MotionModifiers[I] = T;
7619 }
7620
7621
7622
7623
7624
7625 void setMotionModifierLoc(unsigned I, SourceLocation TLoc) {
7626 assert(I < NumberOfOMPMotionModifiers &&
7627 "Index to store motion modifier location exceeds array size.");
7628 MotionModifiersLoc[I] = TLoc;
7629 }
7630
7631
7632 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
7633
7634
7635
7636 size_t numTrailingObjects(OverloadToken<Expr *>) const {
7637
7638
7639 return 2 * varlist_size();
7640 }
7641 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
7642 return getUniqueDeclarationsNum();
7643 }
7644 size_t numTrailingObjects(OverloadToken<unsigned>) const {
7645 return getUniqueDeclarationsNum() + getTotalComponentListNum();
7646 }
7647
7648 public:
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665 static OMPFromClause *
7666 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
7667 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
7668 MappableExprComponentListsRef ComponentLists,
7669 ArrayRef<Expr *> UDMapperRefs,
7670 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
7671 ArrayRef<SourceLocation> MotionModifiersLoc,
7672 NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682 static OMPFromClause *CreateEmpty(const ASTContext &C,
7683 const OMPMappableExprListSizeTy &Sizes);
7684
7685
7686
7687
7688 OpenMPMotionModifierKind getMotionModifier(unsigned Cnt) const LLVM_READONLY {
7689 assert(Cnt < NumberOfOMPMotionModifiers &&
7690 "Requested modifier exceeds the total number of modifiers.");
7691 return MotionModifiers[Cnt];
7692 }
7693
7694
7695
7696
7697
7698 SourceLocation getMotionModifierLoc(unsigned Cnt) const LLVM_READONLY {
7699 assert(Cnt < NumberOfOMPMotionModifiers &&
7700 "Requested modifier location exceeds total number of modifiers.");
7701 return MotionModifiersLoc[Cnt];
7702 }
7703
7704
7705 ArrayRef<OpenMPMotionModifierKind> getMotionModifiers() const LLVM_READONLY {
7706 return llvm::ArrayRef(MotionModifiers);
7707 }
7708
7709
7710 ArrayRef<SourceLocation> getMotionModifiersLoc() const LLVM_READONLY {
7711 return llvm::ArrayRef(MotionModifiersLoc);
7712 }
7713
7714
7715 SourceLocation getColonLoc() const { return ColonLoc; }
7716
7717 child_range children() {
7718 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
7719 reinterpret_cast<Stmt **>(varlist_end()));
7720 }
7721
7722 const_child_range children() const {
7723 auto Children = const_cast<OMPFromClause *>(this)->children();
7724 return const_child_range(Children.begin(), Children.end());
7725 }
7726
7727 child_range used_children() {
7728 return child_range(child_iterator(), child_iterator());
7729 }
7730 const_child_range used_children() const {
7731 return const_child_range(const_child_iterator(), const_child_iterator());
7732 }
7733
7734 static bool classof(const OMPClause *T) {
7735 return T->getClauseKind() == llvm::omp::OMPC_from;
7736 }
7737 };
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747 class OMPUseDevicePtrClause final
7748 : public OMPMappableExprListClause<OMPUseDevicePtrClause>,
7749 private llvm::TrailingObjects<
7750 OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned,
7751 OMPClauseMappableExprCommon::MappableComponent> {
7752 friend class OMPClauseReader;
7753 friend OMPMappableExprListClause;
7754 friend OMPVarListClause;
7755 friend TrailingObjects;
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767 explicit OMPUseDevicePtrClause(const OMPVarListLocTy &Locs,
7768 const OMPMappableExprListSizeTy &Sizes)
7769 : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr, Locs, Sizes) {
7770 }
7771
7772
7773
7774
7775
7776
7777
7778
7779 explicit OMPUseDevicePtrClause(const OMPMappableExprListSizeTy &Sizes)
7780 : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr,
7781 OMPVarListLocTy(), Sizes) {}
7782
7783
7784
7785 size_t numTrailingObjects(OverloadToken<Expr *>) const {
7786 return 3 * varlist_size();
7787 }
7788 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
7789 return getUniqueDeclarationsNum();
7790 }
7791 size_t numTrailingObjects(OverloadToken<unsigned>) const {
7792 return getUniqueDeclarationsNum() + getTotalComponentListNum();
7793 }
7794
7795
7796
7797
7798 void setPrivateCopies(ArrayRef<Expr *> VL);
7799
7800
7801
7802 MutableArrayRef<Expr *> getPrivateCopies() {
7803 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
7804 }
7805 ArrayRef<const Expr *> getPrivateCopies() const {
7806 return llvm::ArrayRef(varlist_end(), varlist_size());
7807 }
7808
7809
7810
7811
7812 void setInits(ArrayRef<Expr *> VL);
7813
7814
7815
7816 MutableArrayRef<Expr *> getInits() {
7817 return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size());
7818 }
7819 ArrayRef<const Expr *> getInits() const {
7820 return llvm::ArrayRef(getPrivateCopies().end(), varlist_size());
7821 }
7822
7823 public:
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835 static OMPUseDevicePtrClause *
7836 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
7837 ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars,
7838 ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations,
7839 MappableExprComponentListsRef ComponentLists);
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849 static OMPUseDevicePtrClause *
7850 CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes);
7851
7852 using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
7853 using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
7854 using private_copies_range = llvm::iterator_range<private_copies_iterator>;
7855 using private_copies_const_range =
7856 llvm::iterator_range<private_copies_const_iterator>;
7857
7858 private_copies_range private_copies() {
7859 return private_copies_range(getPrivateCopies().begin(),
7860 getPrivateCopies().end());
7861 }
7862
7863 private_copies_const_range private_copies() const {
7864 return private_copies_const_range(getPrivateCopies().begin(),
7865 getPrivateCopies().end());
7866 }
7867
7868 using inits_iterator = MutableArrayRef<Expr *>::iterator;
7869 using inits_const_iterator = ArrayRef<const Expr *>::iterator;
7870 using inits_range = llvm::iterator_range<inits_iterator>;
7871 using inits_const_range = llvm::iterator_range<inits_const_iterator>;
7872
7873 inits_range inits() {
7874 return inits_range(getInits().begin(), getInits().end());
7875 }
7876
7877 inits_const_range inits() const {
7878 return inits_const_range(getInits().begin(), getInits().end());
7879 }
7880
7881 child_range children() {
7882 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
7883 reinterpret_cast<Stmt **>(varlist_end()));
7884 }
7885
7886 const_child_range children() const {
7887 auto Children = const_cast<OMPUseDevicePtrClause *>(this)->children();
7888 return const_child_range(Children.begin(), Children.end());
7889 }
7890
7891 child_range used_children() {
7892 return child_range(child_iterator(), child_iterator());
7893 }
7894 const_child_range used_children() const {
7895 return const_child_range(const_child_iterator(), const_child_iterator());
7896 }
7897
7898 static bool classof(const OMPClause *T) {
7899 return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr;
7900 }
7901 };
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911 class OMPUseDeviceAddrClause final
7912 : public OMPMappableExprListClause<OMPUseDeviceAddrClause>,
7913 private llvm::TrailingObjects<
7914 OMPUseDeviceAddrClause, Expr *, ValueDecl *, unsigned,
7915 OMPClauseMappableExprCommon::MappableComponent> {
7916 friend class OMPClauseReader;
7917 friend OMPMappableExprListClause;
7918 friend OMPVarListClause;
7919 friend TrailingObjects;
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931 explicit OMPUseDeviceAddrClause(const OMPVarListLocTy &Locs,
7932 const OMPMappableExprListSizeTy &Sizes)
7933 : OMPMappableExprListClause(llvm::omp::OMPC_use_device_addr, Locs,
7934 Sizes) {}
7935
7936
7937
7938
7939
7940
7941
7942
7943 explicit OMPUseDeviceAddrClause(const OMPMappableExprListSizeTy &Sizes)
7944 : OMPMappableExprListClause(llvm::omp::OMPC_use_device_addr,
7945 OMPVarListLocTy(), Sizes) {}
7946
7947
7948
7949 size_t numTrailingObjects(OverloadToken<Expr *>) const {
7950 return varlist_size();
7951 }
7952 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
7953 return getUniqueDeclarationsNum();
7954 }
7955 size_t numTrailingObjects(OverloadToken<unsigned>) const {
7956 return getUniqueDeclarationsNum() + getTotalComponentListNum();
7957 }
7958
7959 public:
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969 static OMPUseDeviceAddrClause *
7970 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
7971 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
7972 MappableExprComponentListsRef ComponentLists);
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982 static OMPUseDeviceAddrClause *
7983 CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes);
7984
7985 child_range children() {
7986 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
7987 reinterpret_cast<Stmt **>(varlist_end()));
7988 }
7989
7990 const_child_range children() const {
7991 auto Children = const_cast<OMPUseDeviceAddrClause *>(this)->children();
7992 return const_child_range(Children.begin(), Children.end());
7993 }
7994
7995 child_range used_children() {
7996 return child_range(child_iterator(), child_iterator());
7997 }
7998 const_child_range used_children() const {
7999 return const_child_range(const_child_iterator(), const_child_iterator());
8000 }
8001
8002 static bool classof(const OMPClause *T) {
8003 return T->getClauseKind() == llvm::omp::OMPC_use_device_addr;
8004 }
8005 };
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015 class OMPIsDevicePtrClause final
8016 : public OMPMappableExprListClause<OMPIsDevicePtrClause>,
8017 private llvm::TrailingObjects<
8018 OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned,
8019 OMPClauseMappableExprCommon::MappableComponent> {
8020 friend class OMPClauseReader;
8021 friend OMPMappableExprListClause;
8022 friend OMPVarListClause;
8023 friend TrailingObjects;
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035 explicit OMPIsDevicePtrClause(const OMPVarListLocTy &Locs,
8036 const OMPMappableExprListSizeTy &Sizes)
8037 : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {}
8038
8039
8040
8041
8042
8043
8044
8045
8046 explicit OMPIsDevicePtrClause(const OMPMappableExprListSizeTy &Sizes)
8047 : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr,
8048 OMPVarListLocTy(), Sizes) {}
8049
8050
8051
8052 size_t numTrailingObjects(OverloadToken<Expr *>) const {
8053 return varlist_size();
8054 }
8055 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
8056 return getUniqueDeclarationsNum();
8057 }
8058 size_t numTrailingObjects(OverloadToken<unsigned>) const {
8059 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8060 }
8061
8062 public:
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072 static OMPIsDevicePtrClause *
8073 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
8074 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8075 MappableExprComponentListsRef ComponentLists);
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085 static OMPIsDevicePtrClause *
8086 CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes);
8087
8088 child_range children() {
8089 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8090 reinterpret_cast<Stmt **>(varlist_end()));
8091 }
8092
8093 const_child_range children() const {
8094 auto Children = const_cast<OMPIsDevicePtrClause *>(this)->children();
8095 return const_child_range(Children.begin(), Children.end());
8096 }
8097
8098 child_range used_children() {
8099 return child_range(child_iterator(), child_iterator());
8100 }
8101 const_child_range used_children() const {
8102 return const_child_range(const_child_iterator(), const_child_iterator());
8103 }
8104
8105 static bool classof(const OMPClause *T) {
8106 return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr;
8107 }
8108 };
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118 class OMPHasDeviceAddrClause final
8119 : public OMPMappableExprListClause<OMPHasDeviceAddrClause>,
8120 private llvm::TrailingObjects<
8121 OMPHasDeviceAddrClause, Expr *, ValueDecl *, unsigned,
8122 OMPClauseMappableExprCommon::MappableComponent> {
8123 friend class OMPClauseReader;
8124 friend OMPMappableExprListClause;
8125 friend OMPVarListClause;
8126 friend TrailingObjects;
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138 explicit OMPHasDeviceAddrClause(const OMPVarListLocTy &Locs,
8139 const OMPMappableExprListSizeTy &Sizes)
8140 : OMPMappableExprListClause(llvm::omp::OMPC_has_device_addr, Locs,
8141 Sizes) {}
8142
8143
8144
8145
8146
8147
8148
8149
8150 explicit OMPHasDeviceAddrClause(const OMPMappableExprListSizeTy &Sizes)
8151 : OMPMappableExprListClause(llvm::omp::OMPC_has_device_addr,
8152 OMPVarListLocTy(), Sizes) {}
8153
8154
8155
8156 size_t numTrailingObjects(OverloadToken<Expr *>) const {
8157 return varlist_size();
8158 }
8159 size_t numTrailingObjects(OverloadToken<ValueDecl *>) const {
8160 return getUniqueDeclarationsNum();
8161 }
8162 size_t numTrailingObjects(OverloadToken<unsigned>) const {
8163 return getUniqueDeclarationsNum() + getTotalComponentListNum();
8164 }
8165
8166 public:
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176 static OMPHasDeviceAddrClause *
8177 Create(const ASTContext &C, const OMPVarListLocTy &Locs,
8178 ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
8179 MappableExprComponentListsRef ComponentLists);
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189 static OMPHasDeviceAddrClause *
8190 CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes);
8191
8192 child_range children() {
8193 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8194 reinterpret_cast<Stmt **>(varlist_end()));
8195 }
8196
8197 const_child_range children() const {
8198 auto Children = const_cast<OMPHasDeviceAddrClause *>(this)->children();
8199 return const_child_range(Children.begin(), Children.end());
8200 }
8201
8202 child_range used_children() {
8203 return child_range(child_iterator(), child_iterator());
8204 }
8205 const_child_range used_children() const {
8206 return const_child_range(const_child_iterator(), const_child_iterator());
8207 }
8208
8209 static bool classof(const OMPClause *T) {
8210 return T->getClauseKind() == llvm::omp::OMPC_has_device_addr;
8211 }
8212 };
8213
8214
8215
8216
8217
8218
8219
8220
8221 class OMPNontemporalClause final
8222 : public OMPVarListClause<OMPNontemporalClause>,
8223 private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
8224 friend class OMPClauseReader;
8225 friend OMPVarListClause;
8226 friend TrailingObjects;
8227
8228
8229
8230
8231
8232
8233
8234 OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8235 SourceLocation EndLoc, unsigned N)
8236 : OMPVarListClause<OMPNontemporalClause>(llvm::omp::OMPC_nontemporal,
8237 StartLoc, LParenLoc, EndLoc, N) {
8238 }
8239
8240
8241
8242
8243 explicit OMPNontemporalClause(unsigned N)
8244 : OMPVarListClause<OMPNontemporalClause>(
8245 llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(),
8246 SourceLocation(), N) {}
8247
8248
8249
8250 MutableArrayRef<Expr *> getPrivateRefs() {
8251 return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
8252 }
8253 ArrayRef<const Expr *> getPrivateRefs() const {
8254 return llvm::ArrayRef(varlist_end(), varlist_size());
8255 }
8256
8257 public:
8258
8259
8260
8261
8262
8263
8264
8265 static OMPNontemporalClause *
8266 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
8267 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8268
8269
8270
8271
8272
8273 static OMPNontemporalClause *CreateEmpty(const ASTContext &C, unsigned N);
8274
8275
8276
8277 void setPrivateRefs(ArrayRef<Expr *> VL);
8278
8279 child_range children() {
8280 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8281 reinterpret_cast<Stmt **>(varlist_end()));
8282 }
8283
8284 const_child_range children() const {
8285 auto Children = const_cast<OMPNontemporalClause *>(this)->children();
8286 return const_child_range(Children.begin(), Children.end());
8287 }
8288
8289 child_range private_refs() {
8290 return child_range(reinterpret_cast<Stmt **>(getPrivateRefs().begin()),
8291 reinterpret_cast<Stmt **>(getPrivateRefs().end()));
8292 }
8293
8294 const_child_range private_refs() const {
8295 auto Children = const_cast<OMPNontemporalClause *>(this)->private_refs();
8296 return const_child_range(Children.begin(), Children.end());
8297 }
8298
8299 child_range used_children() {
8300 return child_range(child_iterator(), child_iterator());
8301 }
8302 const_child_range used_children() const {
8303 return const_child_range(const_child_iterator(), const_child_iterator());
8304 }
8305
8306 static bool classof(const OMPClause *T) {
8307 return T->getClauseKind() == llvm::omp::OMPC_nontemporal;
8308 }
8309 };
8310
8311
8312
8313
8314
8315
8316
8317
8318 class OMPOrderClause final : public OMPClause {
8319 friend class OMPClauseReader;
8320
8321
8322 SourceLocation LParenLoc;
8323
8324
8325 OpenMPOrderClauseKind Kind = OMPC_ORDER_unknown;
8326
8327
8328 SourceLocation KindKwLoc;
8329
8330
8331 OpenMPOrderClauseModifier Modifier = OMPC_ORDER_MODIFIER_unknown;
8332
8333
8334 SourceLocation ModifierKwLoc;
8335
8336
8337
8338
8339 void setKind(OpenMPOrderClauseKind K) { Kind = K; }
8340
8341
8342
8343
8344 void setKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
8345
8346
8347
8348
8349 void setModifier(OpenMPOrderClauseModifier M) { Modifier = M; }
8350
8351
8352
8353
8354 void setModifierKwLoc(SourceLocation MLoc) { ModifierKwLoc = MLoc; }
8355
8356 public:
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366 OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc,
8367 SourceLocation StartLoc, SourceLocation LParenLoc,
8368 SourceLocation EndLoc, OpenMPOrderClauseModifier Modifier,
8369 SourceLocation MLoc)
8370 : OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc),
8371 LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc), Modifier(Modifier),
8372 ModifierKwLoc(MLoc) {}
8373
8374
8375 OMPOrderClause()
8376 : OMPClause(llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {}
8377
8378
8379 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
8380
8381
8382 SourceLocation getLParenLoc() const { return LParenLoc; }
8383
8384
8385 OpenMPOrderClauseKind getKind() const { return Kind; }
8386
8387
8388 SourceLocation getKindKwLoc() const { return KindKwLoc; }
8389
8390
8391 OpenMPOrderClauseModifier getModifier() const { return Modifier; }
8392
8393
8394 SourceLocation getModifierKwLoc() const { return ModifierKwLoc; }
8395
8396 child_range children() {
8397 return child_range(child_iterator(), child_iterator());
8398 }
8399
8400 const_child_range children() const {
8401 return const_child_range(const_child_iterator(), const_child_iterator());
8402 }
8403
8404 child_range used_children() {
8405 return child_range(child_iterator(), child_iterator());
8406 }
8407 const_child_range used_children() const {
8408 return const_child_range(const_child_iterator(), const_child_iterator());
8409 }
8410
8411 static bool classof(const OMPClause *T) {
8412 return T->getClauseKind() == llvm::omp::OMPC_order;
8413 }
8414 };
8415
8416
8417
8418
8419
8420
8421 class OMPInitClause final
8422 : public OMPVarListClause<OMPInitClause>,
8423 private llvm::TrailingObjects<OMPInitClause, Expr *> {
8424 friend class OMPClauseReader;
8425 friend OMPVarListClause;
8426 friend TrailingObjects;
8427
8428
8429 SourceLocation VarLoc;
8430
8431 bool IsTarget = false;
8432 bool IsTargetSync = false;
8433
8434 void setInteropVar(Expr *E) { varlist_begin()[0] = E; }
8435
8436 void setIsTarget(bool V) { IsTarget = V; }
8437
8438 void setIsTargetSync(bool V) { IsTargetSync = V; }
8439
8440
8441 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452 OMPInitClause(bool IsTarget, bool IsTargetSync, SourceLocation StartLoc,
8453 SourceLocation LParenLoc, SourceLocation VarLoc,
8454 SourceLocation EndLoc, unsigned N)
8455 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, StartLoc,
8456 LParenLoc, EndLoc, N),
8457 VarLoc(VarLoc), IsTarget(IsTarget), IsTargetSync(IsTargetSync) {}
8458
8459
8460 OMPInitClause(unsigned N)
8461 : OMPVarListClause<OMPInitClause>(llvm::omp::OMPC_init, SourceLocation(),
8462 SourceLocation(), SourceLocation(), N) {
8463 }
8464
8465 public:
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475 static OMPInitClause *Create(const ASTContext &C, Expr *InteropVar,
8476 OMPInteropInfo &InteropInfo,
8477 SourceLocation StartLoc,
8478 SourceLocation LParenLoc, SourceLocation VarLoc,
8479 SourceLocation EndLoc);
8480
8481
8482
8483
8484
8485 static OMPInitClause *CreateEmpty(const ASTContext &C, unsigned N);
8486
8487
8488 SourceLocation getVarLoc() const { return VarLoc; }
8489
8490
8491 Expr *getInteropVar() { return varlist_begin()[0]; }
8492 const Expr *getInteropVar() const { return varlist_begin()[0]; }
8493
8494
8495 bool getIsTarget() const { return IsTarget; }
8496
8497
8498 bool getIsTargetSync() const { return IsTargetSync; }
8499
8500 child_range children() {
8501 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8502 reinterpret_cast<Stmt **>(varlist_end()));
8503 }
8504
8505 const_child_range children() const {
8506 auto Children = const_cast<OMPInitClause *>(this)->children();
8507 return const_child_range(Children.begin(), Children.end());
8508 }
8509
8510 child_range used_children() {
8511 return child_range(child_iterator(), child_iterator());
8512 }
8513 const_child_range used_children() const {
8514 return const_child_range(const_child_iterator(), const_child_iterator());
8515 }
8516
8517 using prefs_iterator = MutableArrayRef<Expr *>::iterator;
8518 using const_prefs_iterator = ArrayRef<const Expr *>::iterator;
8519 using prefs_range = llvm::iterator_range<prefs_iterator>;
8520 using const_prefs_range = llvm::iterator_range<const_prefs_iterator>;
8521
8522 prefs_range prefs() {
8523 return prefs_range(reinterpret_cast<Expr **>(std::next(varlist_begin())),
8524 reinterpret_cast<Expr **>(varlist_end()));
8525 }
8526
8527 const_prefs_range prefs() const {
8528 auto Prefs = const_cast<OMPInitClause *>(this)->prefs();
8529 return const_prefs_range(Prefs.begin(), Prefs.end());
8530 }
8531
8532 static bool classof(const OMPClause *T) {
8533 return T->getClauseKind() == llvm::omp::OMPC_init;
8534 }
8535 };
8536
8537
8538
8539
8540
8541
8542 class OMPUseClause final : public OMPClause {
8543 friend class OMPClauseReader;
8544
8545
8546 SourceLocation LParenLoc;
8547
8548
8549 SourceLocation VarLoc;
8550
8551
8552 Stmt *InteropVar = nullptr;
8553
8554
8555 void setInteropVar(Expr *E) { InteropVar = E; }
8556
8557
8558 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
8559
8560
8561 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
8562
8563 public:
8564
8565
8566
8567
8568
8569
8570
8571 OMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
8572 SourceLocation LParenLoc, SourceLocation VarLoc,
8573 SourceLocation EndLoc)
8574 : OMPClause(llvm::omp::OMPC_use, StartLoc, EndLoc), LParenLoc(LParenLoc),
8575 VarLoc(VarLoc), InteropVar(InteropVar) {}
8576
8577
8578 OMPUseClause()
8579 : OMPClause(llvm::omp::OMPC_use, SourceLocation(), SourceLocation()) {}
8580
8581
8582 SourceLocation getLParenLoc() const { return LParenLoc; }
8583
8584
8585 SourceLocation getVarLoc() const { return VarLoc; }
8586
8587
8588 Expr *getInteropVar() const { return cast<Expr>(InteropVar); }
8589
8590 child_range children() { return child_range(&InteropVar, &InteropVar + 1); }
8591
8592 const_child_range children() const {
8593 return const_child_range(&InteropVar, &InteropVar + 1);
8594 }
8595
8596 child_range used_children() {
8597 return child_range(child_iterator(), child_iterator());
8598 }
8599 const_child_range used_children() const {
8600 return const_child_range(const_child_iterator(), const_child_iterator());
8601 }
8602
8603 static bool classof(const OMPClause *T) {
8604 return T->getClauseKind() == llvm::omp::OMPC_use;
8605 }
8606 };
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617 class OMPDestroyClause final : public OMPClause {
8618 friend class OMPClauseReader;
8619
8620
8621 SourceLocation LParenLoc;
8622
8623
8624 SourceLocation VarLoc;
8625
8626
8627 Stmt *InteropVar = nullptr;
8628
8629
8630 void setInteropVar(Expr *E) { InteropVar = E; }
8631
8632
8633 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
8634
8635
8636 void setVarLoc(SourceLocation Loc) { VarLoc = Loc; }
8637
8638 public:
8639
8640
8641
8642
8643
8644
8645
8646 OMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc,
8647 SourceLocation LParenLoc, SourceLocation VarLoc,
8648 SourceLocation EndLoc)
8649 : OMPClause(llvm::omp::OMPC_destroy, StartLoc, EndLoc),
8650 LParenLoc(LParenLoc), VarLoc(VarLoc), InteropVar(InteropVar) {}
8651
8652
8653
8654
8655
8656 OMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc)
8657 : OMPClause(llvm::omp::OMPC_destroy, StartLoc, EndLoc) {}
8658
8659
8660 OMPDestroyClause()
8661 : OMPClause(llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) {
8662 }
8663
8664
8665 SourceLocation getLParenLoc() const { return LParenLoc; }
8666
8667
8668 SourceLocation getVarLoc() const { return VarLoc; }
8669
8670
8671 Expr *getInteropVar() const { return cast_or_null<Expr>(InteropVar); }
8672
8673 child_range children() {
8674 if (InteropVar)
8675 return child_range(&InteropVar, &InteropVar + 1);
8676 return child_range(child_iterator(), child_iterator());
8677 }
8678
8679 const_child_range children() const {
8680 if (InteropVar)
8681 return const_child_range(&InteropVar, &InteropVar + 1);
8682 return const_child_range(const_child_iterator(), const_child_iterator());
8683 }
8684
8685 child_range used_children() {
8686 return child_range(child_iterator(), child_iterator());
8687 }
8688 const_child_range used_children() const {
8689 return const_child_range(const_child_iterator(), const_child_iterator());
8690 }
8691
8692 static bool classof(const OMPClause *T) {
8693 return T->getClauseKind() == llvm::omp::OMPC_destroy;
8694 }
8695 };
8696
8697
8698
8699
8700
8701
8702
8703
8704 class OMPNovariantsClause final
8705 : public OMPOneStmtClause<llvm::omp::OMPC_novariants, OMPClause>,
8706 public OMPClauseWithPreInit {
8707 friend class OMPClauseReader;
8708
8709
8710 void setCondition(Expr *Cond) { setStmt(Cond); }
8711
8712 public:
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722 OMPNovariantsClause(Expr *Cond, Stmt *HelperCond,
8723 OpenMPDirectiveKind CaptureRegion,
8724 SourceLocation StartLoc, SourceLocation LParenLoc,
8725 SourceLocation EndLoc)
8726 : OMPOneStmtClause(Cond, StartLoc, LParenLoc, EndLoc),
8727 OMPClauseWithPreInit(this) {
8728 setPreInitStmt(HelperCond, CaptureRegion);
8729 }
8730
8731
8732 OMPNovariantsClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
8733
8734
8735 Expr *getCondition() const { return getStmtAs<Expr>(); }
8736
8737 child_range used_children();
8738 const_child_range used_children() const {
8739 auto Children = const_cast<OMPNovariantsClause *>(this)->used_children();
8740 return const_child_range(Children.begin(), Children.end());
8741 }
8742 };
8743
8744
8745
8746
8747
8748
8749
8750
8751 class OMPNocontextClause final
8752 : public OMPOneStmtClause<llvm::omp::OMPC_nocontext, OMPClause>,
8753 public OMPClauseWithPreInit {
8754 friend class OMPClauseReader;
8755
8756
8757 void setCondition(Expr *Cond) { setStmt(Cond); }
8758
8759 public:
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769 OMPNocontextClause(Expr *Cond, Stmt *HelperCond,
8770 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
8771 SourceLocation LParenLoc, SourceLocation EndLoc)
8772 : OMPOneStmtClause(Cond, StartLoc, LParenLoc, EndLoc),
8773 OMPClauseWithPreInit(this) {
8774 setPreInitStmt(HelperCond, CaptureRegion);
8775 }
8776
8777
8778 OMPNocontextClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
8779
8780
8781 Expr *getCondition() const { return getStmtAs<Expr>(); }
8782
8783 child_range used_children();
8784 const_child_range used_children() const {
8785 auto Children = const_cast<OMPNocontextClause *>(this)->used_children();
8786 return const_child_range(Children.begin(), Children.end());
8787 }
8788 };
8789
8790
8791
8792
8793
8794
8795
8796
8797 class OMPDetachClause final
8798 : public OMPOneStmtClause<llvm::omp::OMPC_detach, OMPClause> {
8799 friend class OMPClauseReader;
8800
8801
8802 void setEventHandler(Expr *E) { setStmt(E); }
8803
8804 public:
8805
8806
8807
8808
8809
8810
8811 OMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc,
8812 SourceLocation EndLoc)
8813 : OMPOneStmtClause(Evt, StartLoc, LParenLoc, EndLoc) {}
8814
8815
8816 OMPDetachClause() : OMPOneStmtClause() {}
8817
8818
8819 Expr *getEventHandler() const { return getStmtAs<Expr>(); }
8820 };
8821
8822
8823
8824
8825
8826
8827
8828
8829 class OMPInclusiveClause final
8830 : public OMPVarListClause<OMPInclusiveClause>,
8831 private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
8832 friend class OMPClauseReader;
8833 friend OMPVarListClause;
8834 friend TrailingObjects;
8835
8836
8837
8838
8839
8840
8841
8842 OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8843 SourceLocation EndLoc, unsigned N)
8844 : OMPVarListClause<OMPInclusiveClause>(llvm::omp::OMPC_inclusive,
8845 StartLoc, LParenLoc, EndLoc, N) {}
8846
8847
8848
8849
8850 explicit OMPInclusiveClause(unsigned N)
8851 : OMPVarListClause<OMPInclusiveClause>(llvm::omp::OMPC_inclusive,
8852 SourceLocation(), SourceLocation(),
8853 SourceLocation(), N) {}
8854
8855 public:
8856
8857
8858
8859
8860
8861
8862
8863 static OMPInclusiveClause *Create(const ASTContext &C,
8864 SourceLocation StartLoc,
8865 SourceLocation LParenLoc,
8866 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8867
8868
8869
8870
8871
8872 static OMPInclusiveClause *CreateEmpty(const ASTContext &C, unsigned N);
8873
8874 child_range children() {
8875 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8876 reinterpret_cast<Stmt **>(varlist_end()));
8877 }
8878
8879 const_child_range children() const {
8880 auto Children = const_cast<OMPInclusiveClause *>(this)->children();
8881 return const_child_range(Children.begin(), Children.end());
8882 }
8883
8884 child_range used_children() {
8885 return child_range(child_iterator(), child_iterator());
8886 }
8887 const_child_range used_children() const {
8888 return const_child_range(const_child_iterator(), const_child_iterator());
8889 }
8890
8891 static bool classof(const OMPClause *T) {
8892 return T->getClauseKind() == llvm::omp::OMPC_inclusive;
8893 }
8894 };
8895
8896
8897
8898
8899
8900
8901
8902
8903 class OMPExclusiveClause final
8904 : public OMPVarListClause<OMPExclusiveClause>,
8905 private llvm::TrailingObjects<OMPExclusiveClause, Expr *> {
8906 friend class OMPClauseReader;
8907 friend OMPVarListClause;
8908 friend TrailingObjects;
8909
8910
8911
8912
8913
8914
8915
8916 OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
8917 SourceLocation EndLoc, unsigned N)
8918 : OMPVarListClause<OMPExclusiveClause>(llvm::omp::OMPC_exclusive,
8919 StartLoc, LParenLoc, EndLoc, N) {}
8920
8921
8922
8923
8924 explicit OMPExclusiveClause(unsigned N)
8925 : OMPVarListClause<OMPExclusiveClause>(llvm::omp::OMPC_exclusive,
8926 SourceLocation(), SourceLocation(),
8927 SourceLocation(), N) {}
8928
8929 public:
8930
8931
8932
8933
8934
8935
8936
8937 static OMPExclusiveClause *Create(const ASTContext &C,
8938 SourceLocation StartLoc,
8939 SourceLocation LParenLoc,
8940 SourceLocation EndLoc, ArrayRef<Expr *> VL);
8941
8942
8943
8944
8945
8946 static OMPExclusiveClause *CreateEmpty(const ASTContext &C, unsigned N);
8947
8948 child_range children() {
8949 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
8950 reinterpret_cast<Stmt **>(varlist_end()));
8951 }
8952
8953 const_child_range children() const {
8954 auto Children = const_cast<OMPExclusiveClause *>(this)->children();
8955 return const_child_range(Children.begin(), Children.end());
8956 }
8957
8958 child_range used_children() {
8959 return child_range(child_iterator(), child_iterator());
8960 }
8961 const_child_range used_children() const {
8962 return const_child_range(const_child_iterator(), const_child_iterator());
8963 }
8964
8965 static bool classof(const OMPClause *T) {
8966 return T->getClauseKind() == llvm::omp::OMPC_exclusive;
8967 }
8968 };
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978 class OMPUsesAllocatorsClause final
8979 : public OMPClause,
8980 private llvm::TrailingObjects<OMPUsesAllocatorsClause, Expr *,
8981 SourceLocation> {
8982 public:
8983
8984 struct Data {
8985
8986 Expr *Allocator = nullptr;
8987
8988 Expr *AllocatorTraits = nullptr;
8989
8990 SourceLocation LParenLoc, RParenLoc;
8991 };
8992
8993 private:
8994 friend class OMPClauseReader;
8995 friend TrailingObjects;
8996
8997 enum class ExprOffsets {
8998 Allocator,
8999 AllocatorTraits,
9000 Total,
9001 };
9002
9003 enum class ParenLocsOffsets {
9004 LParen,
9005 RParen,
9006 Total,
9007 };
9008
9009
9010 SourceLocation LParenLoc;
9011
9012 unsigned NumOfAllocators = 0;
9013
9014
9015
9016
9017
9018
9019
9020 OMPUsesAllocatorsClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9021 SourceLocation EndLoc, unsigned N)
9022 : OMPClause(llvm::omp::OMPC_uses_allocators, StartLoc, EndLoc),
9023 LParenLoc(LParenLoc), NumOfAllocators(N) {}
9024
9025
9026
9027
9028 explicit OMPUsesAllocatorsClause(unsigned N)
9029 : OMPClause(llvm::omp::OMPC_uses_allocators, SourceLocation(),
9030 SourceLocation()),
9031 NumOfAllocators(N) {}
9032
9033 unsigned numTrailingObjects(OverloadToken<Expr *>) const {
9034 return NumOfAllocators * static_cast<int>(ExprOffsets::Total);
9035 }
9036
9037
9038 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9039
9040
9041 void setAllocatorsData(ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9042
9043 public:
9044
9045
9046
9047
9048
9049
9050
9051 static OMPUsesAllocatorsClause *
9052 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
9053 SourceLocation EndLoc, ArrayRef<OMPUsesAllocatorsClause::Data> Data);
9054
9055
9056
9057
9058
9059 static OMPUsesAllocatorsClause *CreateEmpty(const ASTContext &C, unsigned N);
9060
9061
9062 SourceLocation getLParenLoc() const { return LParenLoc; }
9063
9064
9065 unsigned getNumberOfAllocators() const { return NumOfAllocators; }
9066
9067
9068 OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const;
9069
9070
9071 child_range children() {
9072 Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>());
9073 return child_range(Begin, Begin + NumOfAllocators *
9074 static_cast<int>(ExprOffsets::Total));
9075 }
9076 const_child_range children() const {
9077 Stmt *const *Begin =
9078 reinterpret_cast<Stmt *const *>(getTrailingObjects<Expr *>());
9079 return const_child_range(
9080 Begin, Begin + NumOfAllocators * static_cast<int>(ExprOffsets::Total));
9081 }
9082
9083 child_range used_children() {
9084 return child_range(child_iterator(), child_iterator());
9085 }
9086 const_child_range used_children() const {
9087 return const_child_range(const_child_iterator(), const_child_iterator());
9088 }
9089
9090 static bool classof(const OMPClause *T) {
9091 return T->getClauseKind() == llvm::omp::OMPC_uses_allocators;
9092 }
9093 };
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104 class OMPAffinityClause final
9105 : public OMPVarListClause<OMPAffinityClause>,
9106 private llvm::TrailingObjects<OMPAffinityClause, Expr *> {
9107 friend class OMPClauseReader;
9108 friend OMPVarListClause;
9109 friend TrailingObjects;
9110
9111
9112 SourceLocation ColonLoc;
9113
9114
9115
9116
9117
9118
9119
9120
9121 OMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9122 SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N)
9123 : OMPVarListClause<OMPAffinityClause>(llvm::omp::OMPC_affinity, StartLoc,
9124 LParenLoc, EndLoc, N) {}
9125
9126
9127
9128
9129 explicit OMPAffinityClause(unsigned N)
9130 : OMPVarListClause<OMPAffinityClause>(llvm::omp::OMPC_affinity,
9131 SourceLocation(), SourceLocation(),
9132 SourceLocation(), N) {}
9133
9134
9135 void setModifier(Expr *E) {
9136 getTrailingObjects<Expr *>()[varlist_size()] = E;
9137 }
9138
9139
9140 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
9141
9142 public:
9143
9144
9145
9146
9147
9148
9149
9150
9151 static OMPAffinityClause *Create(const ASTContext &C, SourceLocation StartLoc,
9152 SourceLocation LParenLoc,
9153 SourceLocation ColonLoc,
9154 SourceLocation EndLoc, Expr *Modifier,
9155 ArrayRef<Expr *> Locators);
9156
9157
9158
9159
9160
9161 static OMPAffinityClause *CreateEmpty(const ASTContext &C, unsigned N);
9162
9163
9164 Expr *getModifier() { return getTrailingObjects<Expr *>()[varlist_size()]; }
9165 Expr *getModifier() const {
9166 return getTrailingObjects<Expr *>()[varlist_size()];
9167 }
9168
9169
9170 SourceLocation getColonLoc() const { return ColonLoc; }
9171
9172
9173 child_range children() {
9174 int Offset = getModifier() ? 1 : 0;
9175 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
9176 reinterpret_cast<Stmt **>(varlist_end() + Offset));
9177 }
9178
9179 const_child_range children() const {
9180 auto Children = const_cast<OMPAffinityClause *>(this)->children();
9181 return const_child_range(Children.begin(), Children.end());
9182 }
9183
9184 child_range used_children() {
9185 return child_range(child_iterator(), child_iterator());
9186 }
9187 const_child_range used_children() const {
9188 return const_child_range(const_child_iterator(), const_child_iterator());
9189 }
9190
9191 static bool classof(const OMPClause *T) {
9192 return T->getClauseKind() == llvm::omp::OMPC_affinity;
9193 }
9194 };
9195
9196
9197
9198
9199
9200
9201
9202
9203 class OMPFilterClause final
9204 : public OMPOneStmtClause<llvm::omp::OMPC_filter, OMPClause>,
9205 public OMPClauseWithPreInit {
9206 friend class OMPClauseReader;
9207
9208
9209 void setThreadID(Expr *TID) { setStmt(TID); }
9210
9211 public:
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221 OMPFilterClause(Expr *ThreadID, Stmt *HelperE,
9222 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
9223 SourceLocation LParenLoc, SourceLocation EndLoc)
9224 : OMPOneStmtClause(ThreadID, StartLoc, LParenLoc, EndLoc),
9225 OMPClauseWithPreInit(this) {
9226 setPreInitStmt(HelperE, CaptureRegion);
9227 }
9228
9229
9230 OMPFilterClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
9231
9232
9233 Expr *getThreadID() const { return getStmtAs<Expr>(); }
9234
9235
9236 Expr *getThreadID() { return getStmtAs<Expr>(); }
9237 };
9238
9239
9240
9241
9242
9243
9244 class OMPBindClause final : public OMPNoChildClause<llvm::omp::OMPC_bind> {
9245 friend class OMPClauseReader;
9246
9247
9248 SourceLocation LParenLoc;
9249
9250
9251 OpenMPBindClauseKind Kind = OMPC_BIND_unknown;
9252
9253
9254 SourceLocation KindLoc;
9255
9256
9257 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9258
9259
9260 void setBindKind(OpenMPBindClauseKind K) { Kind = K; }
9261
9262
9263 void setBindKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
9264
9265
9266
9267
9268
9269
9270
9271
9272 OMPBindClause(OpenMPBindClauseKind K, SourceLocation KLoc,
9273 SourceLocation StartLoc, SourceLocation LParenLoc,
9274 SourceLocation EndLoc)
9275 : OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Kind(K),
9276 KindLoc(KLoc) {}
9277
9278
9279 OMPBindClause() : OMPNoChildClause() {}
9280
9281 public:
9282
9283
9284
9285
9286
9287
9288
9289
9290 static OMPBindClause *Create(const ASTContext &C, OpenMPBindClauseKind K,
9291 SourceLocation KLoc, SourceLocation StartLoc,
9292 SourceLocation LParenLoc, SourceLocation EndLoc);
9293
9294
9295
9296
9297 static OMPBindClause *CreateEmpty(const ASTContext &C);
9298
9299
9300 SourceLocation getLParenLoc() const { return LParenLoc; }
9301
9302
9303 OpenMPBindClauseKind getBindKind() const { return Kind; }
9304
9305
9306 SourceLocation getBindKindLoc() const { return KindLoc; }
9307 };
9308
9309
9310
9311 template<class ImplClass, template <typename> class Ptr, typename RetTy>
9312 class OMPClauseVisitorBase {
9313 public:
9314 #define PTR(CLASS) Ptr<CLASS>
9315 #define DISPATCH(CLASS) \
9316 return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S))
9317
9318 #define GEN_CLANG_CLAUSE_CLASS
9319 #define CLAUSE_CLASS(Enum, Str, Class) \
9320 RetTy Visit##Class(PTR(Class) S) { DISPATCH(Class); }
9321 #include "llvm/Frontend/OpenMP/OMP.inc"
9322
9323 RetTy Visit(PTR(OMPClause) S) {
9324
9325 switch (S->getClauseKind()) {
9326 #define GEN_CLANG_CLAUSE_CLASS
9327 #define CLAUSE_CLASS(Enum, Str, Class) \
9328 case llvm::omp::Clause::Enum: \
9329 return Visit##Class(static_cast<PTR(Class)>(S));
9330 #define CLAUSE_NO_CLASS(Enum, Str) \
9331 case llvm::omp::Clause::Enum: \
9332 break;
9333 #include "llvm/Frontend/OpenMP/OMP.inc"
9334 }
9335 }
9336
9337 RetTy VisitOMPClause(PTR(OMPClause) Node) { return RetTy(); }
9338 #undef PTR
9339 #undef DISPATCH
9340 };
9341
9342 template <typename T> using const_ptr = std::add_pointer_t<std::add_const_t<T>>;
9343
9344 template <class ImplClass, typename RetTy = void>
9345 class OMPClauseVisitor
9346 : public OMPClauseVisitorBase<ImplClass, std::add_pointer_t, RetTy> {};
9347 template<class ImplClass, typename RetTy = void>
9348 class ConstOMPClauseVisitor :
9349 public OMPClauseVisitorBase <ImplClass, const_ptr, RetTy> {};
9350
9351 class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
9352 raw_ostream &OS;
9353 const PrintingPolicy &Policy;
9354
9355
9356 template <typename T> void VisitOMPClauseList(T *Node, char StartSym);
9357
9358 template <typename T> void VisitOMPMotionClause(T *Node);
9359
9360 public:
9361 OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy)
9362 : OS(OS), Policy(Policy) {}
9363
9364 #define GEN_CLANG_CLAUSE_CLASS
9365 #define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S);
9366 #include "llvm/Frontend/OpenMP/OMP.inc"
9367 };
9368
9369 struct OMPTraitProperty {
9370 llvm::omp::TraitProperty Kind = llvm::omp::TraitProperty::invalid;
9371
9372
9373
9374 StringRef RawString;
9375 };
9376 struct OMPTraitSelector {
9377 Expr *ScoreOrCondition = nullptr;
9378 llvm::omp::TraitSelector Kind = llvm::omp::TraitSelector::invalid;
9379 llvm::SmallVector<OMPTraitProperty, 1> Properties;
9380 };
9381 struct OMPTraitSet {
9382 llvm::omp::TraitSet Kind = llvm::omp::TraitSet::invalid;
9383 llvm::SmallVector<OMPTraitSelector, 2> Selectors;
9384 };
9385
9386
9387
9388
9389
9390
9391 class OMPTraitInfo {
9392
9393 OMPTraitInfo() {}
9394 friend class ASTContext;
9395
9396 public:
9397
9398 OMPTraitInfo(StringRef MangledName);
9399
9400
9401 llvm::SmallVector<OMPTraitSet, 2> Sets;
9402
9403 bool anyScoreOrCondition(
9404 llvm::function_ref<bool(Expr *&, bool )> Cond) {
9405 return llvm::any_of(Sets, [&](OMPTraitSet &Set) {
9406 return llvm::any_of(
9407 Set.Selectors, [&](OMPTraitSelector &Selector) {
9408 return Cond(Selector.ScoreOrCondition,
9409 Selector.Kind !=
9410 llvm::omp::TraitSelector::user_condition);
9411 });
9412 });
9413 }
9414
9415
9416
9417
9418
9419
9420 void getAsVariantMatchInfo(ASTContext &ASTCtx,
9421 llvm::omp::VariantMatchInfo &VMI) const;
9422
9423
9424 std::string getMangledName() const;
9425
9426
9427 bool isExtensionActive(llvm::omp::TraitProperty TP) {
9428 for (const OMPTraitSet &Set : Sets) {
9429 if (Set.Kind != llvm::omp::TraitSet::implementation)
9430 continue;
9431 for (const OMPTraitSelector &Selector : Set.Selectors) {
9432 if (Selector.Kind != llvm::omp::TraitSelector::implementation_extension)
9433 continue;
9434 for (const OMPTraitProperty &Property : Selector.Properties) {
9435 if (Property.Kind == TP)
9436 return true;
9437 }
9438 }
9439 }
9440 return false;
9441 }
9442
9443
9444 void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
9445 };
9446 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo &TI);
9447 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo *TI);
9448
9449
9450 struct TargetOMPContext final : public llvm::omp::OMPContext {
9451 TargetOMPContext(ASTContext &ASTCtx,
9452 std::function<void(StringRef)> &&DiagUnknownTrait,
9453 const FunctionDecl *CurrentFunctionDecl,
9454 ArrayRef<llvm::omp::TraitProperty> ConstructTraits);
9455
9456 virtual ~TargetOMPContext() = default;
9457
9458
9459 bool matchesISATrait(StringRef RawString) const override;
9460
9461 private:
9462 std::function<bool(StringRef)> FeatureValidityCheck;
9463 std::function<void(StringRef)> DiagUnknownTrait;
9464 llvm::StringMap<bool> FeatureMap;
9465 };
9466
9467
9468
9469
9470 class OMPChildren final
9471 : private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
9472 friend TrailingObjects;
9473 friend class OMPClauseReader;
9474 friend class OMPExecutableDirective;
9475 template <typename T> friend class OMPDeclarativeDirective;
9476
9477
9478 unsigned NumClauses = 0;
9479
9480 unsigned NumChildren = 0;
9481
9482 bool HasAssociatedStmt = false;
9483
9484
9485
9486 size_t numTrailingObjects(OverloadToken<OMPClause *>) const {
9487 return NumClauses;
9488 }
9489
9490 OMPChildren() = delete;
9491
9492 OMPChildren(unsigned NumClauses, unsigned NumChildren, bool HasAssociatedStmt)
9493 : NumClauses(NumClauses), NumChildren(NumChildren),
9494 HasAssociatedStmt(HasAssociatedStmt) {}
9495
9496 static size_t size(unsigned NumClauses, bool HasAssociatedStmt,
9497 unsigned NumChildren);
9498
9499 static OMPChildren *Create(void *Mem, ArrayRef<OMPClause *> Clauses);
9500 static OMPChildren *Create(void *Mem, ArrayRef<OMPClause *> Clauses, Stmt *S,
9501 unsigned NumChildren = 0);
9502 static OMPChildren *CreateEmpty(void *Mem, unsigned NumClauses,
9503 bool HasAssociatedStmt = false,
9504 unsigned NumChildren = 0);
9505
9506 public:
9507 unsigned getNumClauses() const { return NumClauses; }
9508 unsigned getNumChildren() const { return NumChildren; }
9509 bool hasAssociatedStmt() const { return HasAssociatedStmt; }
9510
9511
9512 void setAssociatedStmt(Stmt *S) {
9513 getTrailingObjects<Stmt *>()[NumChildren] = S;
9514 }
9515
9516 void setChildren(ArrayRef<Stmt *> Children);
9517
9518
9519
9520
9521
9522 void setClauses(ArrayRef<OMPClause *> Clauses);
9523
9524
9525 const Stmt *getAssociatedStmt() const {
9526 return const_cast<OMPChildren *>(this)->getAssociatedStmt();
9527 }
9528 Stmt *getAssociatedStmt() {
9529 assert(HasAssociatedStmt &&
9530 "Expected directive with the associated statement.");
9531 return getTrailingObjects<Stmt *>()[NumChildren];
9532 }
9533
9534
9535 MutableArrayRef<OMPClause *> getClauses() {
9536 return llvm::MutableArrayRef(getTrailingObjects<OMPClause *>(),
9537 NumClauses);
9538 }
9539 ArrayRef<OMPClause *> getClauses() const {
9540 return const_cast<OMPChildren *>(this)->getClauses();
9541 }
9542
9543
9544
9545
9546
9547 const CapturedStmt *
9548 getCapturedStmt(OpenMPDirectiveKind RegionKind,
9549 ArrayRef<OpenMPDirectiveKind> CaptureRegions) const {
9550 assert(llvm::is_contained(CaptureRegions, RegionKind) &&
9551 "RegionKind not found in OpenMP CaptureRegions.");
9552 auto *CS = cast<CapturedStmt>(getAssociatedStmt());
9553 for (auto ThisCaptureRegion : CaptureRegions) {
9554 if (ThisCaptureRegion == RegionKind)
9555 return CS;
9556 CS = cast<CapturedStmt>(CS->getCapturedStmt());
9557 }
9558 llvm_unreachable("Incorrect RegionKind specified for directive.");
9559 }
9560
9561
9562 CapturedStmt *
9563 getInnermostCapturedStmt(ArrayRef<OpenMPDirectiveKind> CaptureRegions) {
9564 assert(hasAssociatedStmt() && "Must have associated captured statement.");
9565 assert(!CaptureRegions.empty() &&
9566 "At least one captured statement must be provided.");
9567 auto *CS = cast<CapturedStmt>(getAssociatedStmt());
9568 for (unsigned Level = CaptureRegions.size(); Level > 1; --Level)
9569 CS = cast<CapturedStmt>(CS->getCapturedStmt());
9570 return CS;
9571 }
9572
9573 const CapturedStmt *
9574 getInnermostCapturedStmt(ArrayRef<OpenMPDirectiveKind> CaptureRegions) const {
9575 return const_cast<OMPChildren *>(this)->getInnermostCapturedStmt(
9576 CaptureRegions);
9577 }
9578
9579 MutableArrayRef<Stmt *> getChildren();
9580 ArrayRef<Stmt *> getChildren() const {
9581 return const_cast<OMPChildren *>(this)->getChildren();
9582 }
9583
9584 Stmt *getRawStmt() {
9585 assert(HasAssociatedStmt &&
9586 "Expected directive with the associated statement.");
9587 if (auto *CS = dyn_cast<CapturedStmt>(getAssociatedStmt())) {
9588 Stmt *S = nullptr;
9589 do {
9590 S = CS->getCapturedStmt();
9591 CS = dyn_cast<CapturedStmt>(S);
9592 } while (CS);
9593 return S;
9594 }
9595 return getAssociatedStmt();
9596 }
9597 const Stmt *getRawStmt() const {
9598 return const_cast<OMPChildren *>(this)->getRawStmt();
9599 }
9600
9601 Stmt::child_range getAssociatedStmtAsRange() {
9602 if (!HasAssociatedStmt)
9603 return Stmt::child_range(Stmt::child_iterator(), Stmt::child_iterator());
9604 return Stmt::child_range(&getTrailingObjects<Stmt *>()[NumChildren],
9605 &getTrailingObjects<Stmt *>()[NumChildren + 1]);
9606 }
9607 };
9608
9609
9610
9611
9612
9613
9614
9615 class OMPXDynCGroupMemClause
9616 : public OMPOneStmtClause<llvm::omp::OMPC_ompx_dyn_cgroup_mem, OMPClause>,
9617 public OMPClauseWithPreInit {
9618 friend class OMPClauseReader;
9619
9620
9621 void setSize(Expr *E) { setStmt(E); }
9622
9623 public:
9624
9625
9626
9627
9628
9629
9630
9631
9632 OMPXDynCGroupMemClause(Expr *Size, Stmt *HelperSize,
9633 OpenMPDirectiveKind CaptureRegion,
9634 SourceLocation StartLoc, SourceLocation LParenLoc,
9635 SourceLocation EndLoc)
9636 : OMPOneStmtClause(Size, StartLoc, LParenLoc, EndLoc),
9637 OMPClauseWithPreInit(this) {
9638 setPreInitStmt(HelperSize, CaptureRegion);
9639 }
9640
9641
9642 OMPXDynCGroupMemClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
9643
9644
9645 Expr *getSize() { return getStmtAs<Expr>(); }
9646
9647
9648 Expr *getSize() const { return getStmtAs<Expr>(); }
9649 };
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659 class OMPDoacrossClause final
9660 : public OMPVarListClause<OMPDoacrossClause>,
9661 private llvm::TrailingObjects<OMPDoacrossClause, Expr *> {
9662 friend class OMPClauseReader;
9663 friend OMPVarListClause;
9664 friend TrailingObjects;
9665
9666
9667 OpenMPDoacrossClauseModifier DepType = OMPC_DOACROSS_unknown;
9668
9669
9670 SourceLocation DepLoc;
9671
9672
9673 SourceLocation ColonLoc;
9674
9675
9676 unsigned NumLoops = 0;
9677
9678
9679
9680
9681
9682
9683
9684
9685 OMPDoacrossClause(SourceLocation StartLoc, SourceLocation LParenLoc,
9686 SourceLocation EndLoc, unsigned N, unsigned NumLoops)
9687 : OMPVarListClause<OMPDoacrossClause>(llvm::omp::OMPC_doacross, StartLoc,
9688 LParenLoc, EndLoc, N),
9689 NumLoops(NumLoops) {}
9690
9691
9692
9693
9694
9695 explicit OMPDoacrossClause(unsigned N, unsigned NumLoops)
9696 : OMPVarListClause<OMPDoacrossClause>(llvm::omp::OMPC_doacross,
9697 SourceLocation(), SourceLocation(),
9698 SourceLocation(), N),
9699 NumLoops(NumLoops) {}
9700
9701
9702 void setDependenceType(OpenMPDoacrossClauseModifier M) { DepType = M; }
9703
9704
9705 void setDependenceLoc(SourceLocation Loc) { DepLoc = Loc; }
9706
9707
9708 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
9709
9710 public:
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722 static OMPDoacrossClause *
9723 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
9724 SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType,
9725 SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL,
9726 unsigned NumLoops);
9727
9728
9729
9730
9731
9732
9733 static OMPDoacrossClause *CreateEmpty(const ASTContext &C, unsigned N,
9734 unsigned NumLoops);
9735
9736
9737 OpenMPDoacrossClauseModifier getDependenceType() const { return DepType; }
9738
9739
9740 SourceLocation getDependenceLoc() const { return DepLoc; }
9741
9742
9743 SourceLocation getColonLoc() const { return ColonLoc; }
9744
9745
9746 unsigned getNumLoops() const { return NumLoops; }
9747
9748
9749 void setLoopData(unsigned NumLoop, Expr *Cnt);
9750
9751
9752 Expr *getLoopData(unsigned NumLoop);
9753 const Expr *getLoopData(unsigned NumLoop) const;
9754
9755 child_range children() {
9756 return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
9757 reinterpret_cast<Stmt **>(varlist_end()));
9758 }
9759
9760 const_child_range children() const {
9761 auto Children = const_cast<OMPDoacrossClause *>(this)->children();
9762 return const_child_range(Children.begin(), Children.end());
9763 }
9764
9765 child_range used_children() {
9766 return child_range(child_iterator(), child_iterator());
9767 }
9768 const_child_range used_children() const {
9769 return const_child_range(const_child_iterator(), const_child_iterator());
9770 }
9771
9772 static bool classof(const OMPClause *T) {
9773 return T->getClauseKind() == llvm::omp::OMPC_doacross;
9774 }
9775 };
9776
9777
9778
9779
9780
9781
9782
9783 class OMPXAttributeClause
9784 : public OMPNoChildClause<llvm::omp::OMPC_ompx_attribute> {
9785 friend class OMPClauseReader;
9786
9787
9788 SourceLocation LParenLoc;
9789
9790
9791 SmallVector<const Attr *> Attrs;
9792
9793 public:
9794
9795
9796
9797
9798
9799
9800 OMPXAttributeClause(ArrayRef<const Attr *> Attrs, SourceLocation StartLoc,
9801 SourceLocation LParenLoc, SourceLocation EndLoc)
9802 : OMPNoChildClause(StartLoc, EndLoc), LParenLoc(LParenLoc), Attrs(Attrs) {
9803 }
9804
9805
9806 OMPXAttributeClause() : OMPNoChildClause() {}
9807
9808
9809 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
9810
9811
9812 SourceLocation getLParenLoc() const { return LParenLoc; }
9813
9814
9815 ArrayRef<const Attr *> getAttrs() const { return Attrs; }
9816
9817 private:
9818
9819 void setAttrs(ArrayRef<Attr *> NewAttrs) {
9820 Attrs.clear();
9821 Attrs.append(NewAttrs.begin(), NewAttrs.end());
9822 }
9823 };
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833 class OMPXBareClause : public OMPNoChildClause<llvm::omp::OMPC_ompx_bare> {
9834 public:
9835
9836
9837
9838
9839 OMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
9840 : OMPNoChildClause(StartLoc, EndLoc) {}
9841
9842
9843 OMPXBareClause() = default;
9844 };
9845
9846 }
9847
9848 #endif