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

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 11 11:00:56 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";
----------------
SunilKuravinakop wrote:

According to the spec version 5.0 (for c/c++) , default clause has only `shared` or `none` as modifier (data-sharing attribute). After spec version 5.1, we see, `shared | firstprivate | private | none` as the attributes. Do you want me to override spec version 5.1 and mark it as 5.2?

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


More information about the cfe-commits mailing list