@@ -9768,6 +9768,161 @@ class OMPXDynCGroupMemClause
97689768 Expr *getSize () const { return getStmtAs<Expr>(); }
97699769};
97709770
9771+ // / This represents 'dyn_groupprivate' clause in '#pragma omp target ...'
9772+ // / and '#pragma omp teams ...' directives.
9773+ // /
9774+ // / \code
9775+ // / #pragma omp target [...] dyn_groupprivate(a,b: N)
9776+ // / \endcode
9777+ class OMPDynGroupprivateClause : public OMPClause , public OMPClauseWithPreInit {
9778+ friend class OMPClauseReader ;
9779+
9780+ // / Location of '('.
9781+ SourceLocation LParenLoc;
9782+
9783+ // / Modifiers for 'dyn_groupprivate' clause.
9784+ enum { FIRST, SECOND, NUM_MODIFIERS };
9785+ OpenMPDynGroupprivateClauseModifier Modifiers[NUM_MODIFIERS];
9786+
9787+ // / Locations of modifiers.
9788+ SourceLocation ModifiersLoc[NUM_MODIFIERS];
9789+
9790+ // / The size of the dyn_groupprivate.
9791+ Expr *Size = nullptr ;
9792+
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; }
9838+
9839+ public:
9840+ // / Build 'dyn_groupprivate' clause with a size expression \a Size.
9841+ // /
9842+ // / \param StartLoc Starting location of the clause.
9843+ // / \param LParenLoc Location of '('.
9844+ // / \param EndLoc Ending location of the clause.
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, Expr *Size, Stmt *HelperSize,
9852+ OpenMPDirectiveKind CaptureRegion,
9853+ OpenMPDynGroupprivateClauseModifier M1,
9854+ SourceLocation M1Loc,
9855+ OpenMPDynGroupprivateClauseModifier M2,
9856+ SourceLocation M2Loc)
9857+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
9858+ OMPClauseWithPreInit (this ), LParenLoc(LParenLoc), Size(Size) {
9859+ setPreInitStmt (HelperSize, CaptureRegion);
9860+ Modifiers[FIRST] = M1;
9861+ Modifiers[SECOND] = M2;
9862+ ModifiersLoc[FIRST] = M1Loc;
9863+ ModifiersLoc[SECOND] = M2Loc;
9864+ }
9865+
9866+ // / Build an empty clause.
9867+ explicit OMPDynGroupprivateClause ()
9868+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
9869+ SourceLocation()),
9870+ OMPClauseWithPreInit(this ) {
9871+ Modifiers[FIRST] = OMPC_DYN_GROUPPRIVATE_unknown;
9872+ Modifiers[SECOND] = OMPC_DYN_GROUPPRIVATE_unknown;
9873+ }
9874+
9875+ // / Get the first modifier of the clause.
9876+ OpenMPDynGroupprivateClauseModifier getFirstDynGroupprivateModifier () const {
9877+ return Modifiers[FIRST];
9878+ }
9879+
9880+ // / Get the second modifier of the clause.
9881+ OpenMPDynGroupprivateClauseModifier getSecondDynGroupprivateModifier () const {
9882+ return Modifiers[SECOND];
9883+ }
9884+
9885+ // / Get location of '('.
9886+ SourceLocation getLParenLoc () { return LParenLoc; }
9887+
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+ }
9924+ };
9925+
97719926// / This represents the 'doacross' clause for the '#pragma omp ordered'
97729927// / directive.
97739928// /
0 commit comments