[clang] [OpenMP] Support capturing structured bindings in OpenMP regions. (PR #190832)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 07:53:24 PDT 2026


================
@@ -3737,8 +3737,24 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
   // an enclosing scope.
   if (const auto *BD = dyn_cast<BindingDecl>(ND)) {
     if (E->refersToEnclosingVariableOrCapture()) {
-      auto *FD = LambdaCaptureFields.lookup(BD);
-      return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue);
+      if (auto *DD = dyn_cast<VarDecl>(BD->getDecomposedDecl())) {
+        auto I = LocalDeclMap.find(DD);
+        if (I != LocalDeclMap.end()) {
----------------
alexey-bataev wrote:

WE should always pass through the capture field here, why need a check?

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


More information about the cfe-commits mailing list