================
@@ -1970,9 +1970,14 @@ ExprResult Sema::BuildCaptureInit(const Capture &Cap,
   } else {
     assert(Cap.isVariableCapture() && "unknown kind of capture");
     ValueDecl *Var = Cap.getVariable();
+    // For OpenMP structured bindings, capture the decomposed decl, not the
+    // binding.
+    if (IsOpenMPMapping && isa<BindingDecl>(Var)) {
+      Var = cast<BindingDecl>(Var)->getDecomposedDecl();
----------------
alexey-bataev wrote:

Redundant `cast<BindingDecl>(Var)` after `isa<BindingDecl>(Var)`. Use `auto *BD 
= dyn_cast<BindingDecl>(Var); if (IsOpenMPMapping && BD) Var = 
BD->getDecomposedDecl();`. Also drop the trailing braces around the single 
statement to match the surrounding style.

https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to