[PATCH] D122768: [Clang][C++20] Support capturing structured bindings in lambdas
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 3 09:35:58 PDT 2022
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
I mostly only have minor nits, but otherwise this LGTM!
================
Comment at: clang/docs/ReleaseNotes.rst:104-105
+- Support capturing structured bindings in lambdas
+ (`P1091R3 <https://wg21.link/p1091r3>`_ and `P1381R1 <https://wg21.link/P1381R1>`)
+
----------------
You should probably mention some of the issues that it fixes as well, since it handles a bunch of them.
================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:9060
continue;
- const VarDecl *VD = LC.getCapturedVar();
+ const VarDecl *VD = cast<VarDecl>(LC.getCapturedVar());
if (LC.getCaptureKind() != LCK_ByRef && !VD->getType()->isPointerType())
----------------
ABataev wrote:
> aaron.ballman wrote:
> > aaron.ballman wrote:
> > > cor3ntin wrote:
> > > > cor3ntin wrote:
> > > > > I'm not sure we currently prohibit capturing a structured binding in openmp, i should fix that
> > > > I disabled the feature in OpenMP mode, as this needs more investigation
> > > Ping @jdoerfert -- do you happen to know what's up here?
> > Ping @mikerice or @ABataev in case @jdoerfert is on vacation.
> >
> > (Note, I don't think an answer to this question is needed to accept this review.)
> Need to support capturing of structured bindings in OpenMP regions, some people asked for it long time ago.
Thank you for confirming @ABataev -- I had missed that https://github.com/llvm/llvm-project/issues/33025 was already filed. Nothing to do here for this review, what's happening is an improvement.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:18324
+
+ if (VarDecl *VD = dyn_cast<VarDecl>(Underlying)) {
+ if (VD->hasLocalStorage() && Diagnose)
----------------
================
Comment at: clang/lib/Sema/SemaLambda.cpp:1207-1211
+ if (isa<BindingDecl>(Var)) {
+ Underlying =
+ dyn_cast<VarDecl>(cast<BindingDecl>(Var)->getDecomposedDecl());
+ } else
+ Underlying = cast<VarDecl>(Var);
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122768/new/
https://reviews.llvm.org/D122768
More information about the cfe-commits
mailing list