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

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Sat May 9 09:14:40 PDT 2026


================
@@ -3771,6 +3815,14 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
   // an enclosing scope.
   if (const auto *BD = dyn_cast<BindingDecl>(ND)) {
     if (E->refersToEnclosingVariableOrCapture()) {
+      // OpenMP case: binding was captured via its decomposed decl.
+      if (CapturedStmtInfo &&
+          CapturedStmtInfo->getKind() == CapturedRegionKind::CR_OpenMP &&
+          CGM.getLangOpts().OpenMP) {
+        // OpenMP case: binding was captured via its decomposed decl.
+        return EmitOMPCapturedBindingLValue(BD);
----------------
alexey-bataev wrote:

Same comment text appears twice (lines 3818 and 3822). Drop the inner duplicate.

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


More information about the cfe-commits mailing list