@@ -6329,8 +6329,20 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6329
6329
friend OMPVarListClause;
6330
6330
friend TrailingObjects;
6331
6331
6332
+ // / Motion-modifiers for the 'to' clause.
6333
+ OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
6334
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
6335
+
6336
+ // / Location of motion-modifiers for the 'to' clause.
6337
+ SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
6338
+
6339
+ // / Colon location.
6340
+ SourceLocation ColonLoc;
6341
+
6332
6342
// / Build clause with number of variables \a NumVars.
6333
6343
// /
6344
+ // / \param TheMotionModifiers Motion-modifiers.
6345
+ // / \param TheMotionModifiersLoc Locations of motion-modifiers.
6334
6346
// / \param MapperQualifierLoc C++ nested name specifier for the associated
6335
6347
// / user-defined mapper.
6336
6348
// / \param MapperIdInfo The identifier of associated user-defined mapper.
@@ -6342,13 +6354,24 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6342
6354
// / NumUniqueDeclarations: number of unique base declarations in this clause;
6343
6355
// / 3) NumComponentLists: number of component lists in this clause; and 4)
6344
6356
// / NumComponents: total number of expression components in the clause.
6345
- explicit OMPToClause (NestedNameSpecifierLoc MapperQualifierLoc,
6357
+ explicit OMPToClause (ArrayRef<OpenMPMotionModifierKind> TheMotionModifiers,
6358
+ ArrayRef<SourceLocation> TheMotionModifiersLoc,
6359
+ NestedNameSpecifierLoc MapperQualifierLoc,
6346
6360
DeclarationNameInfo MapperIdInfo,
6347
6361
const OMPVarListLocTy &Locs,
6348
6362
const OMPMappableExprListSizeTy &Sizes)
6349
6363
: OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes,
6350
6364
/* SupportsMapper=*/ true , &MapperQualifierLoc,
6351
- &MapperIdInfo) {}
6365
+ &MapperIdInfo) {
6366
+ assert (llvm::array_lengthof (MotionModifiers) == TheMotionModifiers.size () &&
6367
+ " Unexpected number of motion modifiers." );
6368
+ llvm::copy (TheMotionModifiers, std::begin (MotionModifiers));
6369
+
6370
+ assert (llvm::array_lengthof (MotionModifiersLoc) ==
6371
+ TheMotionModifiersLoc.size () &&
6372
+ " Unexpected number of motion modifier locations." );
6373
+ llvm::copy (TheMotionModifiersLoc, std::begin (MotionModifiersLoc));
6374
+ }
6352
6375
6353
6376
// / Build an empty clause.
6354
6377
// /
@@ -6361,6 +6384,29 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6361
6384
: OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), Sizes,
6362
6385
/* SupportsMapper=*/ true) {}
6363
6386
6387
+ // / Set motion-modifier for the clause.
6388
+ // /
6389
+ // / \param I index for motion-modifier.
6390
+ // / \param T motion-modifier for the clause.
6391
+ void setMotionModifier (unsigned I, OpenMPMotionModifierKind T) {
6392
+ assert (I < NumberOfOMPMotionModifiers &&
6393
+ " Unexpected index to store motion modifier, exceeds array size." );
6394
+ MotionModifiers[I] = T;
6395
+ }
6396
+
6397
+ // / Set location for the motion-modifier.
6398
+ // /
6399
+ // / \param I index for motion-modifier location.
6400
+ // / \param TLoc motion-modifier location.
6401
+ void setMotionModifierLoc (unsigned I, SourceLocation TLoc) {
6402
+ assert (I < NumberOfOMPMotionModifiers &&
6403
+ " Index to store motion modifier location exceeds array size." );
6404
+ MotionModifiersLoc[I] = TLoc;
6405
+ }
6406
+
6407
+ // / Set colon location.
6408
+ void setColonLoc (SourceLocation Loc) { ColonLoc = Loc; }
6409
+
6364
6410
// / Define the sizes of each trailing object array except the last one. This
6365
6411
// / is required for TrailingObjects to work properly.
6366
6412
size_t numTrailingObjects (OverloadToken<Expr *>) const {
@@ -6385,6 +6431,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6385
6431
// / \param Vars The original expression used in the clause.
6386
6432
// / \param Declarations Declarations used in the clause.
6387
6433
// / \param ComponentLists Component lists used in the clause.
6434
+ // / \param MotionModifiers Motion-modifiers.
6435
+ // / \param MotionModifiersLoc Location of motion-modifiers.
6388
6436
// / \param UDMapperRefs References to user-defined mappers associated with
6389
6437
// / expressions used in the clause.
6390
6438
// / \param UDMQualifierLoc C++ nested name specifier for the associated
@@ -6395,6 +6443,8 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6395
6443
ArrayRef<ValueDecl *> Declarations,
6396
6444
MappableExprComponentListsRef ComponentLists,
6397
6445
ArrayRef<Expr *> UDMapperRefs,
6446
+ ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
6447
+ ArrayRef<SourceLocation> MotionModifiersLoc,
6398
6448
NestedNameSpecifierLoc UDMQualifierLoc,
6399
6449
DeclarationNameInfo MapperId);
6400
6450
@@ -6409,6 +6459,38 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
6409
6459
static OMPToClause *CreateEmpty (const ASTContext &C,
6410
6460
const OMPMappableExprListSizeTy &Sizes);
6411
6461
6462
+ // / Fetches the motion-modifier at 'Cnt' index of array of modifiers.
6463
+ // /
6464
+ // / \param Cnt index for motion-modifier.
6465
+ OpenMPMotionModifierKind getMotionModifier (unsigned Cnt) const LLVM_READONLY {
6466
+ assert (Cnt < NumberOfOMPMotionModifiers &&
6467
+ " Requested modifier exceeds the total number of modifiers." );
6468
+ return MotionModifiers[Cnt];
6469
+ }
6470
+
6471
+ // / Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
6472
+ // / locations.
6473
+ // /
6474
+ // / \param Cnt index for motion-modifier location.
6475
+ SourceLocation getMotionModifierLoc (unsigned Cnt) const LLVM_READONLY {
6476
+ assert (Cnt < NumberOfOMPMotionModifiers &&
6477
+ " Requested modifier location exceeds total number of modifiers." );
6478
+ return MotionModifiersLoc[Cnt];
6479
+ }
6480
+
6481
+ // / Fetches ArrayRef of motion-modifiers.
6482
+ ArrayRef<OpenMPMotionModifierKind> getMotionModifiers () const LLVM_READONLY {
6483
+ return llvm::makeArrayRef (MotionModifiers);
6484
+ }
6485
+
6486
+ // / Fetches ArrayRef of location of motion-modifiers.
6487
+ ArrayRef<SourceLocation> getMotionModifiersLoc () const LLVM_READONLY {
6488
+ return llvm::makeArrayRef (MotionModifiersLoc);
6489
+ }
6490
+
6491
+ // / Get colon location.
6492
+ SourceLocation getColonLoc () const { return ColonLoc; }
6493
+
6412
6494
child_range children () {
6413
6495
return child_range (reinterpret_cast <Stmt **>(varlist_begin ()),
6414
6496
reinterpret_cast <Stmt **>(varlist_end ()));
@@ -6449,8 +6531,20 @@ class OMPFromClause final
6449
6531
friend OMPVarListClause;
6450
6532
friend TrailingObjects;
6451
6533
6534
+ // / Motion-modifiers for the 'from' clause.
6535
+ OpenMPMotionModifierKind MotionModifiers[NumberOfOMPMotionModifiers] = {
6536
+ OMPC_MOTION_MODIFIER_unknown, OMPC_MOTION_MODIFIER_unknown};
6537
+
6538
+ // / Location of motion-modifiers for the 'from' clause.
6539
+ SourceLocation MotionModifiersLoc[NumberOfOMPMotionModifiers];
6540
+
6541
+ // / Colon location.
6542
+ SourceLocation ColonLoc;
6543
+
6452
6544
// / Build clause with number of variables \a NumVars.
6453
6545
// /
6546
+ // / \param TheMotionModifiers Motion-modifiers.
6547
+ // / \param TheMotionModifiersLoc Locations of motion-modifiers.
6454
6548
// / \param MapperQualifierLoc C++ nested name specifier for the associated
6455
6549
// / user-defined mapper.
6456
6550
// / \param MapperIdInfo The identifier of associated user-defined mapper.
@@ -6462,13 +6556,24 @@ class OMPFromClause final
6462
6556
// / NumUniqueDeclarations: number of unique base declarations in this clause;
6463
6557
// / 3) NumComponentLists: number of component lists in this clause; and 4)
6464
6558
// / NumComponents: total number of expression components in the clause.
6465
- explicit OMPFromClause (NestedNameSpecifierLoc MapperQualifierLoc,
6559
+ explicit OMPFromClause (ArrayRef<OpenMPMotionModifierKind> TheMotionModifiers,
6560
+ ArrayRef<SourceLocation> TheMotionModifiersLoc,
6561
+ NestedNameSpecifierLoc MapperQualifierLoc,
6466
6562
DeclarationNameInfo MapperIdInfo,
6467
6563
const OMPVarListLocTy &Locs,
6468
6564
const OMPMappableExprListSizeTy &Sizes)
6469
6565
: OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes,
6470
6566
/* SupportsMapper=*/ true , &MapperQualifierLoc,
6471
- &MapperIdInfo) {}
6567
+ &MapperIdInfo) {
6568
+ assert (llvm::array_lengthof (MotionModifiers) == TheMotionModifiers.size () &&
6569
+ " Unexpected number of motion modifiers." );
6570
+ llvm::copy (TheMotionModifiers, std::begin (MotionModifiers));
6571
+
6572
+ assert (llvm::array_lengthof (MotionModifiersLoc) ==
6573
+ TheMotionModifiersLoc.size () &&
6574
+ " Unexpected number of motion modifier locations." );
6575
+ llvm::copy (TheMotionModifiersLoc, std::begin (MotionModifiersLoc));
6576
+ }
6472
6577
6473
6578
// / Build an empty clause.
6474
6579
// /
@@ -6481,6 +6586,29 @@ class OMPFromClause final
6481
6586
: OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(),
6482
6587
Sizes, /* SupportsMapper=*/ true) {}
6483
6588
6589
+ // / Set motion-modifier for the clause.
6590
+ // /
6591
+ // / \param I index for motion-modifier.
6592
+ // / \param T motion-modifier for the clause.
6593
+ void setMotionModifier (unsigned I, OpenMPMotionModifierKind T) {
6594
+ assert (I < NumberOfOMPMotionModifiers &&
6595
+ " Unexpected index to store motion modifier, exceeds array size." );
6596
+ MotionModifiers[I] = T;
6597
+ }
6598
+
6599
+ // / Set location for the motion-modifier.
6600
+ // /
6601
+ // / \param I index for motion-modifier location.
6602
+ // / \param TLoc motion-modifier location.
6603
+ void setMotionModifierLoc (unsigned I, SourceLocation TLoc) {
6604
+ assert (I < NumberOfOMPMotionModifiers &&
6605
+ " Index to store motion modifier location exceeds array size." );
6606
+ MotionModifiersLoc[I] = TLoc;
6607
+ }
6608
+
6609
+ // / Set colon location.
6610
+ void setColonLoc (SourceLocation Loc) { ColonLoc = Loc; }
6611
+
6484
6612
// / Define the sizes of each trailing object array except the last one. This
6485
6613
// / is required for TrailingObjects to work properly.
6486
6614
size_t numTrailingObjects (OverloadToken<Expr *>) const {
@@ -6505,18 +6633,21 @@ class OMPFromClause final
6505
6633
// / \param Vars The original expression used in the clause.
6506
6634
// / \param Declarations Declarations used in the clause.
6507
6635
// / \param ComponentLists Component lists used in the clause.
6636
+ // / \param MotionModifiers Motion-modifiers.
6637
+ // / \param MotionModifiersLoc Location of motion-modifiers.
6508
6638
// / \param UDMapperRefs References to user-defined mappers associated with
6509
6639
// / expressions used in the clause.
6510
6640
// / \param UDMQualifierLoc C++ nested name specifier for the associated
6511
6641
// / user-defined mapper.
6512
6642
// / \param MapperId The identifier of associated user-defined mapper.
6513
- static OMPFromClause *Create (const ASTContext &C, const OMPVarListLocTy &Locs,
6514
- ArrayRef<Expr *> Vars,
6515
- ArrayRef<ValueDecl *> Declarations,
6516
- MappableExprComponentListsRef ComponentLists,
6517
- ArrayRef<Expr *> UDMapperRefs,
6518
- NestedNameSpecifierLoc UDMQualifierLoc,
6519
- DeclarationNameInfo MapperId);
6643
+ static OMPFromClause *
6644
+ Create (const ASTContext &C, const OMPVarListLocTy &Locs,
6645
+ ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations,
6646
+ MappableExprComponentListsRef ComponentLists,
6647
+ ArrayRef<Expr *> UDMapperRefs,
6648
+ ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
6649
+ ArrayRef<SourceLocation> MotionModifiersLoc,
6650
+ NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId);
6520
6651
6521
6652
// / Creates an empty clause with the place for \a NumVars variables.
6522
6653
// /
@@ -6529,6 +6660,38 @@ class OMPFromClause final
6529
6660
static OMPFromClause *CreateEmpty (const ASTContext &C,
6530
6661
const OMPMappableExprListSizeTy &Sizes);
6531
6662
6663
+ // / Fetches the motion-modifier at 'Cnt' index of array of modifiers.
6664
+ // /
6665
+ // / \param Cnt index for motion-modifier.
6666
+ OpenMPMotionModifierKind getMotionModifier (unsigned Cnt) const LLVM_READONLY {
6667
+ assert (Cnt < NumberOfOMPMotionModifiers &&
6668
+ " Requested modifier exceeds the total number of modifiers." );
6669
+ return MotionModifiers[Cnt];
6670
+ }
6671
+
6672
+ // / Fetches the motion-modifier location at 'Cnt' index of array of modifiers'
6673
+ // / locations.
6674
+ // /
6675
+ // / \param Cnt index for motion-modifier location.
6676
+ SourceLocation getMotionModifierLoc (unsigned Cnt) const LLVM_READONLY {
6677
+ assert (Cnt < NumberOfOMPMotionModifiers &&
6678
+ " Requested modifier location exceeds total number of modifiers." );
6679
+ return MotionModifiersLoc[Cnt];
6680
+ }
6681
+
6682
+ // / Fetches ArrayRef of motion-modifiers.
6683
+ ArrayRef<OpenMPMotionModifierKind> getMotionModifiers () const LLVM_READONLY {
6684
+ return llvm::makeArrayRef (MotionModifiers);
6685
+ }
6686
+
6687
+ // / Fetches ArrayRef of location of motion-modifiers.
6688
+ ArrayRef<SourceLocation> getMotionModifiersLoc () const LLVM_READONLY {
6689
+ return llvm::makeArrayRef (MotionModifiersLoc);
6690
+ }
6691
+
6692
+ // / Get colon location.
6693
+ SourceLocation getColonLoc () const { return ColonLoc; }
6694
+
6532
6695
child_range children () {
6533
6696
return child_range (reinterpret_cast <Stmt **>(varlist_begin ()),
6534
6697
reinterpret_cast <Stmt **>(varlist_end ()));
@@ -7623,6 +7786,8 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
7623
7786
7624
7787
// / Process clauses with list of variables.
7625
7788
template <typename T> void VisitOMPClauseList (T *Node, char StartSym);
7789
+ // / Process motion clauses.
7790
+ template <typename T> void VisitOMPMotionClause (T *Node);
7626
7791
7627
7792
public:
7628
7793
OMPClausePrinter (raw_ostream &OS, const PrintingPolicy &Policy)
0 commit comments