================
@@ -7904,11 +7898,69 @@ static bool checkPreferTypeArgs(SemaOpenMP &S, const 
OMPInteropInfo &Info) {
   return true;
 }
 
+enum class OMPAdjustArgsVal { Known, Dependent, Invalid };
+
+/// Check one 'adjust_args' integer expression for the constant property plus
+/// either the positive or the non-negative property (OpenMP 6.0 [5.2.1]).
+static OMPAdjustArgsVal checkOMPAdjustArgsValue(SemaOpenMP &S, Expr *E,
+                                                bool StrictlyPositive,
+                                                llvm::APSInt &Result) {
+  if (E->isInstantiationDependent())
+    return OMPAdjustArgsVal::Dependent; // re-checked on instantiation
+  if (S.SemaRef.VerifyIntegerConstantExpression(E, &Result).isInvalid())
+    return OMPAdjustArgsVal::Invalid; // already diagnosed
+  if (StrictlyPositive ? !Result.isStrictlyPositive() : Result.isNegative()) {
+    S.Diag(E->getExprLoc(), diag::err_omp_negative_expression_in_clause)
+        << getOpenMPClauseNameForDiag(OMPC_adjust_args)
+        << (StrictlyPositive ? 1 : 0) << E->getSourceRange();
+    return OMPAdjustArgsVal::Invalid;
+  }
----------------
alexey-bataev wrote:

```suggestion
  }
  if (!Result.isRepresentableByInt64()) {
    S.Diag(E->getExprLoc(), diag::err_omp_large_expression_in_clause)
        << getOpenMPClauseNameForDiag(OMPC_adjust_args) << E->getSourceRange();
    return OMPAdjustArgsVal::Invalid;
  }
```

https://github.com/llvm/llvm-project/pull/225081
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to