@@ -118,6 +118,11 @@ class SemaOpenACC : public SemaBase {
118118 // / 'kernel' construct, this will have the source location for it. This
119119 // / permits us to implement the restriction of no further 'gang' clauses.
120120 SourceLocation LoopGangClauseOnKernelLoc;
121+ // / If there is a current 'active' loop construct with a 'worker' clause on it
122+ // / (on any sort of construct), this has the source location for it. This
123+ // / permits us to implement the restriction of no further 'gang' or 'worker'
124+ // / clauses.
125+ SourceLocation LoopWorkerClauseLoc;
121126
122127 // Redeclaration of the version in OpenACCClause.h.
123128 using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
@@ -224,11 +229,15 @@ class SemaOpenACC : public SemaBase {
224229 ClauseKind == OpenACCClauseKind::NumWorkers ||
225230 ClauseKind == OpenACCClauseKind::Async ||
226231 ClauseKind == OpenACCClauseKind::Tile ||
232+ ClauseKind == OpenACCClauseKind::Worker ||
233+ ClauseKind == OpenACCClauseKind::Vector ||
227234 ClauseKind == OpenACCClauseKind::VectorLength) &&
228235 " Parsed clause kind does not have a int exprs" );
229236
230237 // 'async' and 'wait' have an optional IntExpr, so be tolerant of that.
231238 if ((ClauseKind == OpenACCClauseKind::Async ||
239+ ClauseKind == OpenACCClauseKind::Worker ||
240+ ClauseKind == OpenACCClauseKind::Vector ||
232241 ClauseKind == OpenACCClauseKind::Wait) &&
233242 std::holds_alternative<std::monostate>(Details))
234243 return 0 ;
@@ -271,6 +280,8 @@ class SemaOpenACC : public SemaBase {
271280 ClauseKind == OpenACCClauseKind::Async ||
272281 ClauseKind == OpenACCClauseKind::Tile ||
273282 ClauseKind == OpenACCClauseKind::Gang ||
283+ ClauseKind == OpenACCClauseKind::Worker ||
284+ ClauseKind == OpenACCClauseKind::Vector ||
274285 ClauseKind == OpenACCClauseKind::VectorLength) &&
275286 " Parsed clause kind does not have a int exprs" );
276287
@@ -401,6 +412,8 @@ class SemaOpenACC : public SemaBase {
401412 ClauseKind == OpenACCClauseKind::NumWorkers ||
402413 ClauseKind == OpenACCClauseKind::Async ||
403414 ClauseKind == OpenACCClauseKind::Tile ||
415+ ClauseKind == OpenACCClauseKind::Worker ||
416+ ClauseKind == OpenACCClauseKind::Vector ||
404417 ClauseKind == OpenACCClauseKind::VectorLength) &&
405418 " Parsed clause kind does not have a int exprs" );
406419 Details = IntExprDetails{{IntExprs.begin (), IntExprs.end ()}};
@@ -410,6 +423,8 @@ class SemaOpenACC : public SemaBase {
410423 ClauseKind == OpenACCClauseKind::NumWorkers ||
411424 ClauseKind == OpenACCClauseKind::Async ||
412425 ClauseKind == OpenACCClauseKind::Tile ||
426+ ClauseKind == OpenACCClauseKind::Worker ||
427+ ClauseKind == OpenACCClauseKind::Vector ||
413428 ClauseKind == OpenACCClauseKind::VectorLength) &&
414429 " Parsed clause kind does not have a int exprs" );
415430 Details = IntExprDetails{std::move (IntExprs)};
@@ -663,6 +678,7 @@ class SemaOpenACC : public SemaBase {
663678 ComputeConstructInfo OldActiveComputeConstructInfo;
664679 OpenACCDirectiveKind DirKind;
665680 SourceLocation OldLoopGangClauseOnKernelLoc;
681+ SourceLocation OldLoopWorkerClauseLoc;
666682 llvm::SmallVector<OpenACCLoopConstruct *> ParentlessLoopConstructs;
667683 LoopInConstructRAII LoopRAII;
668684
0 commit comments