@@ -10068,6 +10068,152 @@ class OMPXDynCGroupMemClause
1006810068 Expr *getSize () const { return getStmtAs<Expr>(); }
1006910069};
1007010070
10071+ // / This represents 'dyn_groupprivate' clause in '#pragma omp target ...'
10072+ // / and '#pragma omp teams ...' directives.
10073+ // /
10074+ // / \code
10075+ // / #pragma omp target [...] dyn_groupprivate(a,b: N)
10076+ // / \endcode
10077+ class OMPDynGroupprivateClause : public OMPClause , public OMPClauseWithPreInit {
10078+ friend class OMPClauseReader ;
10079+
10080+ // / Location of '('.
10081+ SourceLocation LParenLoc;
10082+
10083+ // / Modifiers for 'dyn_groupprivate' clause.
10084+ enum { SIMPLE, FALLBACK, NUM_MODIFIERS };
10085+ unsigned Modifiers[NUM_MODIFIERS];
10086+
10087+ // / Locations of modifiers.
10088+ SourceLocation ModifiersLoc[NUM_MODIFIERS];
10089+
10090+ // / The size of the dyn_groupprivate.
10091+ Expr *Size = nullptr ;
10092+
10093+ // / Set the first dyn_groupprivate modifier.
10094+ // /
10095+ // / \param M The modifier.
10096+ void setDynGroupprivateModifier (OpenMPDynGroupprivateClauseModifier M) {
10097+ Modifiers[SIMPLE] = M;
10098+ }
10099+
10100+ // / Set the second dyn_groupprivate modifier.
10101+ // /
10102+ // / \param M The modifier.
10103+ void setDynGroupprivateFallbackModifier (
10104+ OpenMPDynGroupprivateClauseFallbackModifier M) {
10105+ Modifiers[FALLBACK] = M;
10106+ }
10107+
10108+ // / Set location of the first dyn_groupprivate modifier.
10109+ void setDynGroupprivateModifierLoc (SourceLocation Loc) {
10110+ ModifiersLoc[SIMPLE] = Loc;
10111+ }
10112+
10113+ // / Set location of the second dyn_groupprivate modifier.
10114+ void setDynGroupprivateFallbackModifierLoc (SourceLocation Loc) {
10115+ ModifiersLoc[FALLBACK] = Loc;
10116+ }
10117+
10118+ // / Sets the location of '('.
10119+ // /
10120+ // / \param Loc Location of '('.
10121+ void setLParenLoc (SourceLocation Loc) { LParenLoc = Loc; }
10122+
10123+ // / Set size.
10124+ // /
10125+ // / \param E Size.
10126+ void setSize (Expr *E) { Size = E; }
10127+
10128+ public:
10129+ // / Build 'dyn_groupprivate' clause with a size expression \a Size.
10130+ // /
10131+ // / \param StartLoc Starting location of the clause.
10132+ // / \param LParenLoc Location of '('.
10133+ // / \param EndLoc Ending location of the clause.
10134+ // / \param Size Size.
10135+ // / \param M1 The first modifier applied to 'dyn_groupprivate' clause.
10136+ // / \param M1Loc Location of the first modifier.
10137+ // / \param M2 The second modifier applied to 'dyn_groupprivate' clause.
10138+ // / \param M2Loc Location of the second modifier.
10139+ OMPDynGroupprivateClause (SourceLocation StartLoc, SourceLocation LParenLoc,
10140+ SourceLocation EndLoc, Expr *Size, Stmt *HelperSize,
10141+ OpenMPDirectiveKind CaptureRegion,
10142+ OpenMPDynGroupprivateClauseModifier M1,
10143+ SourceLocation M1Loc,
10144+ OpenMPDynGroupprivateClauseFallbackModifier M2,
10145+ SourceLocation M2Loc)
10146+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
10147+ OMPClauseWithPreInit (this ), LParenLoc(LParenLoc), Size(Size) {
10148+ setPreInitStmt (HelperSize, CaptureRegion);
10149+ Modifiers[SIMPLE] = M1;
10150+ Modifiers[FALLBACK] = M2;
10151+ ModifiersLoc[SIMPLE] = M1Loc;
10152+ ModifiersLoc[FALLBACK] = M2Loc;
10153+ }
10154+
10155+ // / Build an empty clause.
10156+ explicit OMPDynGroupprivateClause ()
10157+ : OMPClause(llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
10158+ SourceLocation()),
10159+ OMPClauseWithPreInit(this ) {
10160+ Modifiers[SIMPLE] = OMPC_DYN_GROUPPRIVATE_unknown;
10161+ Modifiers[FALLBACK] = OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown;
10162+ }
10163+
10164+ // / Get the first modifier of the clause.
10165+ OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier () const {
10166+ return static_cast <OpenMPDynGroupprivateClauseModifier>(Modifiers[SIMPLE]);
10167+ }
10168+
10169+ // / Get the second modifier of the clause.
10170+ OpenMPDynGroupprivateClauseFallbackModifier
10171+ getDynGroupprivateFallbackModifier () const {
10172+ return static_cast <OpenMPDynGroupprivateClauseFallbackModifier>(
10173+ Modifiers[FALLBACK]);
10174+ }
10175+
10176+ // / Get location of '('.
10177+ SourceLocation getLParenLoc () { return LParenLoc; }
10178+
10179+ // / Get the first modifier location.
10180+ SourceLocation getDynGroupprivateModifierLoc () const {
10181+ return ModifiersLoc[SIMPLE];
10182+ }
10183+
10184+ // / Get the second modifier location.
10185+ SourceLocation getDynGroupprivateFallbackModifierLoc () const {
10186+ return ModifiersLoc[FALLBACK];
10187+ }
10188+
10189+ // / Get size.
10190+ Expr *getSize () { return Size; }
10191+
10192+ // / Get size.
10193+ const Expr *getSize () const { return Size; }
10194+
10195+ child_range children () {
10196+ return child_range (reinterpret_cast <Stmt **>(&Size),
10197+ reinterpret_cast <Stmt **>(&Size) + 1 );
10198+ }
10199+
10200+ const_child_range children () const {
10201+ auto Children = const_cast <OMPDynGroupprivateClause *>(this )->children ();
10202+ return const_child_range (Children.begin (), Children.end ());
10203+ }
10204+
10205+ child_range used_children () {
10206+ return child_range (child_iterator (), child_iterator ());
10207+ }
10208+ const_child_range used_children () const {
10209+ return const_child_range (const_child_iterator (), const_child_iterator ());
10210+ }
10211+
10212+ static bool classof (const OMPClause *T) {
10213+ return T->getClauseKind () == llvm::omp::OMPC_dyn_groupprivate;
10214+ }
10215+ };
10216+
1007110217// / This represents the 'doacross' clause for the '#pragma omp ordered'
1007210218// / directive.
1007310219// /
0 commit comments