@@ -9772,63 +9772,155 @@ class OMPXDynCGroupMemClause
97729772// / and '#pragma omp teams ...' directives.
97739773// /
97749774// / \code
9775- // / #pragma omp target [...] dyn_groupprivate(N)
9775+ // / #pragma omp target [...] dyn_groupprivate(a,b: N)
97769776// / \endcode
9777- class OMPDynGroupprivateClause
9778- : public OMPOneStmtClause<llvm::omp::OMPC_dyn_groupprivate, OMPClause>,
9779- public OMPClauseWithPreInit {
9777+ class OMPDynGroupprivateClause : public OMPClause , public OMPClauseWithPreInit {
97809778 friend class OMPClauseReader ;
97819779
9782- // / Modifiers for 'grainsize' clause .
9783- OpenMPDynGroupprivateClauseModifier Modifier = OMPC_DYN_GROUPPRIVATE_unknown ;
9780+ // / Location of '(' .
9781+ SourceLocation LParenLoc ;
97849782
9785- // / Location of the modifier.
9786- SourceLocation ModifierLoc;
9783+ // / Modifiers for 'dyn_groupprivate' clause.
9784+ enum {FIRST, SECOND, NUM_MODIFIERS};
9785+ OpenMPDynGroupprivateClauseModifier Modifiers[NUM_MODIFIERS];
97879786
9788- // / Set size .
9789- void setSize (Expr *E) { setStmt (E); }
9787+ // / Locations of modifiers .
9788+ SourceLocation ModifiersLoc[NUM_MODIFIERS];
97909789
9791- // / Sets modifier .
9792- void setModifier (OpenMPDynGroupprivateClauseModifier M) { Modifier = M; }
9790+ // / The size of the dyn_groupprivate .
9791+ Expr *Size = nullptr ;
97939792
9794- // / Sets modifier location.
9795- void setModifierLoc (SourceLocation Loc) { ModifierLoc = Loc; }
9793+ // / Set the first dyn_groupprivate modifier.
9794+ // /
9795+ // / \param M The modifier.
9796+ void setFirstDynGroupprivateModifier (OpenMPDynGroupprivateClauseModifier M) {
9797+ Modifiers[FIRST] = M;
9798+ }
9799+
9800+ // / Set the second dyn_groupprivate modifier.
9801+ // /
9802+ // / \param M The modifier.
9803+ void setSecondDynGroupprivateModifier (OpenMPDynGroupprivateClauseModifier M) {
9804+ Modifiers[SECOND] = M;
9805+ }
9806+
9807+ // / Set location of the first dyn_groupprivate modifier.
9808+ void setFirstDynGroupprivateModifierLoc (SourceLocation Loc) {
9809+ ModifiersLoc[FIRST] = Loc;
9810+ }
9811+
9812+ // / Set location of the second dyn_groupprivate modifier.
9813+ void setSecondDynGroupprivateModifierLoc (SourceLocation Loc) {
9814+ ModifiersLoc[SECOND] = Loc;
9815+ }
9816+
9817+ // / Set dyn_groupprivate modifier location.
9818+ // /
9819+ // / \param M The modifier location.
9820+ void setDynGroupprivateModifer (OpenMPDynGroupprivateClauseModifier M) {
9821+ if (Modifiers[FIRST] == OMPC_DYN_GROUPPRIVATE_unknown)
9822+ Modifiers[FIRST] = M;
9823+ else {
9824+ assert (Modifiers[SECOND] == OMPC_DYN_GROUPPRIVATE_unknown);
9825+ Modifiers[SECOND] = M;
9826+ }
9827+ }
9828+
9829+ // / Sets the location of '('.
9830+ // /
9831+ // / \param Loc Location of '('.
9832+ void setLParenLoc (SourceLocation Loc) { LParenLoc = Loc; }
9833+
9834+ // / Set size.
9835+ // /
9836+ // / \param E Size.
9837+ void setSize (Expr *E) { Size = E; }
97969838
97979839public:
9798- // / Build 'dyn_groupprivate' clause.
9840+ // / Build 'dyn_groupprivate' clause with a size expression \a Size .
97999841 // /
9800- // / \param Modifier Clause modifier.
9801- // / \param Size Size expression.
9802- // / \param HelperSize Helper Size expression
9803- // / \param CaptureRegion Innermost OpenMP region where expressions in this
98049842 // / \param StartLoc Starting location of the clause.
98059843 // / \param LParenLoc Location of '('.
9806- // / \param ModifierLoc Modifier location.
98079844 // / \param EndLoc Ending location of the clause.
9808- OMPDynGroupprivateClause (OpenMPDynGroupprivateClauseModifier Modifier,
9809- Expr *Size, Stmt *HelperSize,
9810- OpenMPDirectiveKind CaptureRegion,
9811- SourceLocation StartLoc, SourceLocation LParenLoc,
9812- SourceLocation ModifierLoc, SourceLocation EndLoc)
9813- : OMPOneStmtClause(Size, StartLoc, LParenLoc, EndLoc),
9814- OMPClauseWithPreInit (this ), Modifier(Modifier), ModifierLoc(ModifierLoc) {
9845+ // / \param Size Size.
9846+ // / \param M1 The first modifier applied to 'dyn_groupprivate' clause.
9847+ // / \param M1Loc Location of the first modifier.
9848+ // / \param M2 The second modifier applied to 'dyn_groupprivate' clause.
9849+ // / \param M2Loc Location of the second modifier.
9850+ OMPDynGroupprivateClause (SourceLocation StartLoc, SourceLocation LParenLoc,
9851+ SourceLocation EndLoc,
9852+ Expr *Size, Stmt *HelperSize,
9853+ OpenMPDirectiveKind CaptureRegion,
9854+ OpenMPDynGroupprivateClauseModifier M1,
9855+ SourceLocation M1Loc,
9856+ OpenMPDynGroupprivateClauseModifier M2,
9857+ SourceLocation M2Loc)
9858+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
9859+ OMPClauseWithPreInit (this ), LParenLoc(LParenLoc), Size(Size) {
98159860 setPreInitStmt (HelperSize, CaptureRegion);
9861+ Modifiers[FIRST] = M1;
9862+ Modifiers[SECOND] = M2;
9863+ ModifiersLoc[FIRST] = M1Loc;
9864+ ModifiersLoc[SECOND] = M2Loc;
98169865 }
98179866
98189867 // / Build an empty clause.
9819- OMPDynGroupprivateClause () : OMPOneStmtClause(), OMPClauseWithPreInit(this ) {}
9868+ explicit OMPDynGroupprivateClause ()
9869+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, SourceLocation(), SourceLocation()),
9870+ OMPClauseWithPreInit(this ) {
9871+ Modifiers[FIRST] = OMPC_DYN_GROUPPRIVATE_unknown;
9872+ Modifiers[SECOND] = OMPC_DYN_GROUPPRIVATE_unknown;
9873+ }
98209874
9821- // / Return the size expression.
9822- Expr *getSize () { return getStmtAs<Expr>(); }
9875+ // / Get the first modifier of the clause.
9876+ OpenMPDynGroupprivateClauseModifier getFirstDynGroupprivateModifier () const {
9877+ return Modifiers[FIRST];
9878+ }
98239879
9824- // / Return the size expression.
9825- Expr *getSize () const { return getStmtAs<Expr>(); }
9880+ // / Get the second modifier of the clause.
9881+ OpenMPDynGroupprivateClauseModifier getSecondDynGroupprivateModifier () const {
9882+ return Modifiers[SECOND];
9883+ }
98269884
9827- // / Gets modifier .
9828- OpenMPDynGroupprivateClauseModifier getModifier () const { return Modifier ; }
9885+ // / Get location of '(' .
9886+ SourceLocation getLParenLoc () { return LParenLoc ; }
98299887
9830- // / Gets modifier location.
9831- SourceLocation getModifierLoc () const { return ModifierLoc; }
9888+ // / Get the first modifier location.
9889+ SourceLocation getFirstDynGroupprivateModifierLoc () const {
9890+ return ModifiersLoc[FIRST];
9891+ }
9892+
9893+ // / Get the second modifier location.
9894+ SourceLocation getSecondDynGroupprivateModifierLoc () const {
9895+ return ModifiersLoc[SECOND];
9896+ }
9897+
9898+ // / Get size.
9899+ Expr *getSize () { return Size; }
9900+
9901+ // / Get size.
9902+ const Expr *getSize () const { return Size; }
9903+
9904+ child_range children () {
9905+ return child_range (reinterpret_cast <Stmt **>(&Size),
9906+ reinterpret_cast <Stmt **>(&Size) + 1 );
9907+ }
9908+
9909+ const_child_range children () const {
9910+ auto Children = const_cast <OMPDynGroupprivateClause *>(this )->children ();
9911+ return const_child_range (Children.begin (), Children.end ());
9912+ }
9913+
9914+ child_range used_children () {
9915+ return child_range (child_iterator (), child_iterator ());
9916+ }
9917+ const_child_range used_children () const {
9918+ return const_child_range (const_child_iterator (), const_child_iterator ());
9919+ }
9920+
9921+ static bool classof (const OMPClause *T) {
9922+ return T->getClauseKind () == llvm::omp::OMPC_dyn_groupprivate;
9923+ }
98329924};
98339925
98349926// / This represents the 'doacross' clause for the '#pragma omp ordered'
0 commit comments