[clang] [clang][OpenMP] Support for reduction clause with array elements as modifier (PR #160846)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 26 03:18:48 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (SunilKuravinakop)
<details>
<summary>Changes</summary>
Changes to support for array elements in reduction clause e.g. "reduction (+:a[1])"
---
Full diff: https://github.com/llvm/llvm-project/pull/160846.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+3-1)
``````````diff
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 48e06d1dc7579..187c091531eb7 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -2489,8 +2489,10 @@ VarDecl *SemaOpenMP::isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo,
return VD ? VD : Info.second;
DSAStackTy::DSAVarData DVarTop =
DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode());
+
if (DVarTop.CKind != OMPC_unknown && isOpenMPPrivate(DVarTop.CKind) &&
- (!VD || VD->hasLocalStorage() || !DVarTop.AppliedToPointee))
+ (!VD || VD->hasLocalStorage() ||
+ !(DVarTop.AppliedToPointee && DVarTop.CKind != OMPC_reduction)))
return VD ? VD : cast<VarDecl>(DVarTop.PrivateCopy->getDecl());
// Threadprivate variables must not be captured.
if (isOpenMPThreadPrivate(DVarTop.CKind))
``````````
</details>
https://github.com/llvm/llvm-project/pull/160846
More information about the cfe-commits
mailing list