================
@@ -17341,43 +17341,62 @@ static std::string
getListOfPossibleValues(OpenMPClauseKind K, unsigned First,
}
OMPClause *SemaOpenMP::ActOnOpenMPNumThreadsClause(
- OpenMPNumThreadsClauseModifier Modifier, Expr *NumThreads,
- SourceLocation StartLoc, SourceLocation LParenLoc,
- SourceLocation ModifierLoc, SourceLocation EndLoc) {
- assert((ModifierLoc.isInvalid() || getLangOpts().OpenMP >= 60) &&
- "Unexpected num_threads modifier in OpenMP < 60.");
-
- if (ModifierLoc.isValid() && Modifier == OMPC_NUMTHREADS_unknown) {
- std::string Values = getListOfPossibleValues(OMPC_num_threads, /*First=*/0,
- OMPC_NUMTHREADS_unknown);
- Diag(ModifierLoc, diag::err_omp_unexpected_clause_value)
- << Values << getOpenMPClauseNameForDiag(OMPC_num_threads);
- return nullptr;
+ ArrayRef<Expr *> VarList,
+ OpenMPNumThreadsClauseModifier PrescriptivenessModifier,
+ SourceLocation PrescriptivenessModifierLoc,
+ OpenMPNumThreadsClauseModifier DimsModifier, Expr *DimsModifierExpr,
+ SourceLocation DimsModifierLoc, SourceLocation StartLoc,
+ SourceLocation LParenLoc, SourceLocation EndLoc) {
+ SmallVector<Expr *, 3> Vars(VarList.begin(), VarList.end());
+ for (Expr *&ValExpr : Vars) {
+ // OpenMP [2.5, Restrictions]
+ // The num_threads expression must evaluate to a positive integer value.
+ if (!isNonNegativeIntegerValue(ValExpr, SemaRef, OMPC_num_threads,
+ /*StrictlyPositive=*/true))
+ return nullptr;
}
----------------
kevinsala wrote:
@alexey-bataev Sorry for the late response.
I've updated the PR with the latest commit, moving more checks from parsing to
sema. Unknown modifiers are now checked in sema. The `dims` modifier still
needs to be identified in parsing, as it is a complex modifier that requires a
parameter within the parenthesis.
https://github.com/llvm/llvm-project/pull/208353
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits