@@ -1149,6 +1149,80 @@ class OMPFullClause final : public OMPNoChildClause<llvm::omp::OMPC_full> {
1149
1149
static OMPFullClause *CreateEmpty (const ASTContext &C);
1150
1150
};
1151
1151
1152
+ // / This class represents the 'looprange' clause in the
1153
+ // / '#pragma omp fuse' directive
1154
+ // /
1155
+ // / \code {c}
1156
+ // / #pragma omp fuse looprange(1,2)
1157
+ // / {
1158
+ // / for(int i = 0; i < 64; ++i)
1159
+ // / for(int j = 0; j < 256; j+=2)
1160
+ // / for(int k = 127; k >= 0; --k)
1161
+ // / \endcode
1162
+ class OMPLoopRangeClause final : public OMPClause {
1163
+ friend class OMPClauseReader ;
1164
+ // / Location of '('
1165
+ SourceLocation LParenLoc;
1166
+
1167
+ // / Location of first and count expressions
1168
+ SourceLocation FirstLoc, CountLoc;
1169
+
1170
+ // / Number of looprange arguments (always 2: first, count)
1171
+ enum { FirstExpr, CountExpr, NumArgs };
1172
+ Stmt *Args[NumArgs] = {nullptr , nullptr };
1173
+
1174
+ // / Set looprange 'first' expression
1175
+ void setFirst (Expr *E) { Args[FirstExpr] = E; }
1176
+
1177
+ // / Set looprange 'count' expression
1178
+ void setCount (Expr *E) { Args[CountExpr] = E; }
1179
+
1180
+ // / Build an empty clause for deserialization.
1181
+ explicit OMPLoopRangeClause ()
1182
+ : OMPClause(llvm::omp::OMPC_looprange, {}, {}) {}
1183
+
1184
+ public:
1185
+ // / Build a 'looprange' clause AST node.
1186
+ static OMPLoopRangeClause *
1187
+ Create (const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
1188
+ SourceLocation FirstLoc, SourceLocation CountLoc,
1189
+ SourceLocation EndLoc, Expr *First, Expr *Count);
1190
+
1191
+ // / Build an empty 'looprange' clause node.
1192
+ static OMPLoopRangeClause *CreateEmpty (const ASTContext &C);
1193
+
1194
+ // Location getters/setters
1195
+ SourceLocation getLParenLoc () const { return LParenLoc; }
1196
+ SourceLocation getFirstLoc () const { return FirstLoc; }
1197
+ SourceLocation getCountLoc () const { return CountLoc; }
1198
+
1199
+ void setLParenLoc (SourceLocation Loc) { LParenLoc = Loc; }
1200
+ void setFirstLoc (SourceLocation Loc) { FirstLoc = Loc; }
1201
+ void setCountLoc (SourceLocation Loc) { CountLoc = Loc; }
1202
+
1203
+ // / Get looprange 'first' expression
1204
+ Expr *getFirst () const { return cast_or_null<Expr>(Args[FirstExpr]); }
1205
+
1206
+ // / Get looprange 'count' expression
1207
+ Expr *getCount () const { return cast_or_null<Expr>(Args[CountExpr]); }
1208
+
1209
+ child_range children () { return child_range (Args, Args + NumArgs); }
1210
+ const_child_range children () const {
1211
+ return const_child_range (Args, Args + NumArgs);
1212
+ }
1213
+
1214
+ child_range used_children () {
1215
+ return child_range (child_iterator (), child_iterator ());
1216
+ }
1217
+ const_child_range used_children () const {
1218
+ return const_child_range (const_child_iterator (), const_child_iterator ());
1219
+ }
1220
+
1221
+ static bool classof (const OMPClause *T) {
1222
+ return T->getClauseKind () == llvm::omp::OMPC_looprange;
1223
+ }
1224
+ };
1225
+
1152
1226
// / Representation of the 'partial' clause of the '#pragma omp unroll'
1153
1227
// / directive.
1154
1228
// /
0 commit comments