@@ -486,7 +486,8 @@ class OMPAlignClause final
486486// / #pragma omp parallel private(a) allocate(omp_default_mem_alloc :a)
487487// / \endcode
488488// / In this example directive '#pragma omp parallel' has clause 'private'
489- // / and clause 'allocate' for the variable 'a'.
489+ // / and clause 'allocate' for the variable 'a', which specifies an explicit
490+ // / memory allocator.
490491class OMPAllocateClause final
491492 : public OMPVarListClause<OMPAllocateClause>,
492493 private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
@@ -499,6 +500,10 @@ class OMPAllocateClause final
499500 Expr *Allocator = nullptr ;
500501 // / Position of the ':' delimiter in the clause;
501502 SourceLocation ColonLoc;
503+ // / Modifier of 'allocate' clause.
504+ OpenMPAllocateClauseModifier AllocatorModifier = OMPC_ALLOCATE_unknown;
505+ // / Location of allocator modifier if any.
506+ SourceLocation AllocatorModifierLoc;
502507
503508 // / Build clause with number of variables \a N.
504509 // /
@@ -510,10 +515,14 @@ class OMPAllocateClause final
510515 // / \param N Number of the variables in the clause.
511516 OMPAllocateClause (SourceLocation StartLoc, SourceLocation LParenLoc,
512517 Expr *Allocator, SourceLocation ColonLoc,
513- SourceLocation EndLoc, unsigned N)
518+ OpenMPAllocateClauseModifier AllocatorModifier,
519+ SourceLocation AllocatorModifierLoc, SourceLocation EndLoc,
520+ unsigned N)
514521 : OMPVarListClause<OMPAllocateClause>(llvm::omp::OMPC_allocate, StartLoc,
515522 LParenLoc, EndLoc, N),
516- Allocator (Allocator), ColonLoc(ColonLoc) {}
523+ Allocator (Allocator), ColonLoc(ColonLoc),
524+ AllocatorModifier (AllocatorModifier),
525+ AllocatorModifierLoc (AllocatorModifierLoc) {}
517526
518527 // / Build an empty clause.
519528 // /
@@ -527,6 +536,9 @@ class OMPAllocateClause final
527536 void setColonLoc (SourceLocation CL) { ColonLoc = CL; }
528537
529538 void setAllocator (Expr *A) { Allocator = A; }
539+ void setAllocatorModifier (OpenMPAllocateClauseModifier AM) {
540+ AllocatorModifier = AM;
541+ }
530542
531543public:
532544 // / Creates clause with a list of variables \a VL.
@@ -536,18 +548,31 @@ class OMPAllocateClause final
536548 // / \param LParenLoc Location of '('.
537549 // / \param Allocator Allocator expression.
538550 // / \param ColonLoc Location of ':' delimiter.
551+ // / \param AllocatorModifier Allocator modifier.
552+ // / \param SourceLocation Allocator modifier location.
539553 // / \param EndLoc Ending location of the clause.
540554 // / \param VL List of references to the variables.
541- static OMPAllocateClause *Create (const ASTContext &C, SourceLocation StartLoc,
542- SourceLocation LParenLoc, Expr *Allocator,
543- SourceLocation ColonLoc,
544- SourceLocation EndLoc, ArrayRef<Expr *> VL);
555+ static OMPAllocateClause *
556+ 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);
545561
546562 // / Returns the allocator expression or nullptr, if no allocator is specified.
547563 Expr *getAllocator () const { return Allocator; }
548564
565+ // / Return 'allocate' modifier.
566+ OpenMPAllocateClauseModifier getAllocatorModifier () const {
567+ return AllocatorModifier;
568+ }
569+
549570 // / Returns the location of the ':' delimiter.
550571 SourceLocation getColonLoc () const { return ColonLoc; }
572+ // / Return the location of the modifier.
573+ SourceLocation getAllocatorModifierLoc () const {
574+ return AllocatorModifierLoc;
575+ }
551576
552577 // / Creates an empty clause with the place for \a N variables.
553578 // /
0 commit comments