@@ -498,13 +498,51 @@ class OMPAllocateClause final
498498 // / Allocator specified in the clause, or 'nullptr' if the default one is
499499 // / used.
500500 Expr *Allocator = nullptr ;
501+ // / Alignment specified in the clause, or 'nullptr' if the default one is
502+ // / used.
503+ Expr *Alignment = nullptr ;
501504 // / Position of the ':' delimiter in the clause;
502505 SourceLocation ColonLoc;
503506 // / Modifier of 'allocate' clause.
504507 OpenMPAllocateClauseModifier AllocatorModifier = OMPC_ALLOCATE_unknown;
505508 // / Location of allocator modifier if any.
506509 SourceLocation AllocatorModifierLoc;
507510
511+ // ----------------------------------------------------------------------------
512+
513+ // / Modifiers for 'allocate' clause.
514+ enum { FIRST, SECOND, NUM_MODIFIERS };
515+ OpenMPAllocateClauseModifier Modifiers[NUM_MODIFIERS];
516+
517+ // / Locations of modifiers.
518+ SourceLocation ModifiersLoc[NUM_MODIFIERS];
519+
520+ // / Set the first allocate modifier.
521+ // /
522+ // / \param M Allocate modifier.
523+ void setFirstAllocateModifier (OpenMPAllocateClauseModifier M) {
524+ Modifiers[FIRST] = M;
525+ }
526+
527+ // / Set the second allocate modifier.
528+ // /
529+ // / \param M Allocate modifier.
530+ void setSecondAllocateModifier (OpenMPAllocateClauseModifier M) {
531+ Modifiers[SECOND] = M;
532+ }
533+
534+ // / Set location of the first allocate modifier.
535+ void setFirstAllocateModifierLoc (SourceLocation Loc) {
536+ ModifiersLoc[FIRST] = Loc;
537+ }
538+
539+ // / Set location of the second allocate modifier.
540+ void setSecondAllocateModifierLoc (SourceLocation Loc) {
541+ ModifiersLoc[SECOND] = Loc;
542+ }
543+
544+ // ----------------------------------------------------------------------------
545+
508546 // / Build clause with number of variables \a N.
509547 // /
510548 // / \param StartLoc Starting location of the clause.
@@ -514,23 +552,31 @@ class OMPAllocateClause final
514552 // / \param EndLoc Ending location of the clause.
515553 // / \param N Number of the variables in the clause.
516554 OMPAllocateClause (SourceLocation StartLoc, SourceLocation LParenLoc,
517- Expr *Allocator, SourceLocation ColonLoc,
518- OpenMPAllocateClauseModifier AllocatorModifier,
519- SourceLocation AllocatorModifierLoc, SourceLocation EndLoc,
555+ Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
556+ OpenMPAllocateClauseModifier Modifier1,
557+ SourceLocation Modifier1Loc,
558+ OpenMPAllocateClauseModifier Modifier2,
559+ SourceLocation Modifier2Loc, SourceLocation EndLoc,
520560 unsigned N)
521561 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
522562 LParenLoc, EndLoc, N),
523- Allocator (Allocator), ColonLoc(ColonLoc),
524- AllocatorModifier (AllocatorModifier),
525- AllocatorModifierLoc (AllocatorModifierLoc) {}
563+ Allocator (Allocator), Alignment(Alignment), ColonLoc(ColonLoc) {
564+ Modifiers[FIRST] = Modifier1;
565+ Modifiers[SECOND] = Modifier2;
566+ ModifiersLoc[FIRST] = Modifier1Loc;
567+ ModifiersLoc[SECOND] = Modifier2Loc;
568+ }
526569
527570 // / Build an empty clause.
528571 // /
529572 // / \param N Number of variables.
530573 explicit OMPAllocateClause (unsigned N)
531574 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate,
532575 SourceLocation (), SourceLocation(),
533- SourceLocation(), N) {}
576+ SourceLocation(), N) {
577+ Modifiers[FIRST] = OMPC_ALLOCATE_unknown;
578+ Modifiers[SECOND] = OMPC_ALLOCATE_unknown;
579+ }
534580
535581 // / Sets location of ':' symbol in clause.
536582 void setColonLoc (SourceLocation CL) { ColonLoc = CL; }
@@ -539,6 +585,7 @@ class OMPAllocateClause final
539585 void setAllocatorModifier (OpenMPAllocateClauseModifier AM) {
540586 AllocatorModifier = AM;
541587 }
588+ void setAlignment (Expr *A) { Alignment = A; }
542589
543590public:
544591 // / Creates clause with a list of variables \a VL.
@@ -554,19 +601,42 @@ class OMPAllocateClause final
554601 // / \param VL List of references to the variables.
555602 static OMPAllocateClause *
556603 Create (const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
557- Expr *Allocator, SourceLocation ColonLoc,
558- OpenMPAllocateClauseModifier AllocatorModifier ,
559- SourceLocation AllocatorModifierLoc , SourceLocation EndLoc ,
560- ArrayRef<Expr *> VL);
604+ Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc,
605+ OpenMPAllocateClauseModifier Modifier1, SourceLocation Modifier1Loc ,
606+ OpenMPAllocateClauseModifier Modifier2 , SourceLocation Modifier2Loc ,
607+ SourceLocation EndLoc, ArrayRef<Expr *> VL);
561608
562609 // / Returns the allocator expression or nullptr, if no allocator is specified.
563610 Expr *getAllocator () const { return Allocator; }
564611
612+ // / Returns the alignment expression or nullptr, if no alignment specified.
613+ Expr *getAlignment () const { return Alignment; }
614+
565615 // / Return 'allocate' modifier.
566616 OpenMPAllocateClauseModifier getAllocatorModifier () const {
567617 return AllocatorModifier;
568618 }
569619
620+ // / Get the first modifier of the clause.
621+ OpenMPAllocateClauseModifier getFirstAllocateModifier () const {
622+ return Modifiers[FIRST];
623+ }
624+
625+ // / Get location of first modifier of the clause.
626+ SourceLocation getFirstAllocateModifierLoc () const {
627+ return ModifiersLoc[FIRST];
628+ }
629+
630+ // / Get the second modifier of the clause.
631+ OpenMPAllocateClauseModifier getSecondAllocateModifier () const {
632+ return Modifiers[SECOND];
633+ }
634+
635+ // / Get location of second modifier of the clause.
636+ SourceLocation getSecondAllocateModifierLoc () const {
637+ return ModifiersLoc[SECOND];
638+ }
639+
570640 // / Returns the location of the ':' delimiter.
571641 SourceLocation getColonLoc () const { return ColonLoc; }
572642 // / Return the location of the modifier.
0 commit comments