[clang] [OpenMP] Support capturing structured bindings in OpenMP regions. (PR #190832)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 18 06:37:16 PDT 2026
================
@@ -1227,8 +1235,16 @@ class CodeGenFunction : public CodeGenTypeCache {
/// PrivateGen is the address of the generated private variable.
/// \return true if the variable is registered as private, false if it has
/// been privatized already.
- bool addPrivate(const VarDecl *LocalVD, Address Addr) {
+ bool addPrivate(const ValueDecl *LocalVD, Address Addr) {
assert(PerformCleanup && "adding private to dead scope");
+ if (const auto *BD = dyn_cast<BindingDecl>(LocalVD->getCanonicalDecl())) {
+ auto It = CGF.OMPPrivatizedBindings.find(BD);
+ if (It != CGF.OMPPrivatizedBindings.end()) {
+ BindingChanges.emplace_back(BD, It->second);
+ } else {
+ BindingChanges.emplace_back(BD, std::nullopt);
+ }
----------------
alexey-bataev wrote:
```suggestion
BindingChanges.emplace_back(BD, CGF.OMPPrivatizedBindings.lookup(BD));
```
https://github.com/llvm/llvm-project/pull/190832
More information about the cfe-commits
mailing list