[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:18 PDT 2026


================
@@ -2733,10 +2870,14 @@ void CodeGenFunction::EmitOMPLinearClause(
   for (const auto *C : D.getClausesOfKind<OMPLinearClause>()) {
     auto CurPrivate = C->privates().begin();
     for (const Expr *E : C->varlist()) {
-      const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
+      const auto *VD = cast<DeclRefExpr>(E)->getDecl();
       const auto *PrivateVD =
           cast<VarDecl>(cast<DeclRefExpr>(*CurPrivate)->getDecl());
-      if (!SIMDLCVs.count(VD->getCanonicalDecl())) {
+      bool IsSIMDLCV = false;
+      if (const auto *VarD = dyn_cast<VarDecl>(VD)) {
+        IsSIMDLCV = SIMDLCVs.count(VarD->getCanonicalDecl());
+      }
----------------
alexey-bataev wrote:

```suggestion
      if (const auto *VarD = dyn_cast<VarDecl>(VD))
        IsSIMDLCV = SIMDLCVs.count(VarD->getCanonicalDecl());
```

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


More information about the cfe-commits mailing list