[clang] [Clang][OpenMP]Default clause variable category (PR #157063)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 11 08:42:54 PDT 2025


================
@@ -3932,6 +3958,18 @@ OMPClause *Parser::ParseOpenMPSingleExprWithArgClause(OpenMPDirectiveKind DKind,
   if (NeedAnExpression && Val.isInvalid())
     return nullptr;
 
+  if (Kind == OMPC_default && getLangOpts().OpenMP < 51 && Arg[0] &&
+      (static_cast<DefaultKind>(Arg[0]) == OMP_DEFAULT_private ||
+       static_cast<DefaultKind>(Arg[0]) == OMP_DEFAULT_firstprivate)) {
+    Diag(KLoc[0], diag::err_omp_invalid_dsa)
+        << getOpenMPClauseName(static_cast<DefaultKind>(Arg[0]) ==
+                                       OMP_DEFAULT_private
+                                   ? OMPC_private
+                                   : OMPC_firstprivate)
+        << getOpenMPClauseName(OMPC_default) << "5.1";
----------------
alexey-bataev wrote:

```suggestion
        << getOpenMPClauseName(OMPC_default) << "5.1";
```
5.1 is not always correct here, it may be 5.2 or 4.5

https://github.com/llvm/llvm-project/pull/157063


More information about the cfe-commits mailing list