diff options
author | Corentin Jabot <corentinjabot@gmail.com> | 2022-03-30 14:27:44 +0200 |
---|---|---|
committer | Corentin Jabot <corentinjabot@gmail.com> | 2022-08-04 10:12:53 +0200 |
commit | 127bf44385424891eb04cff8e52d3f157fc2cb7c (patch) | |
tree | 697631f96fe660ed24466bf3989b94fd705cd57d /clang/lib/CodeGen/CodeGenFunction.h | |
parent | b6b0690355ccf2bb17750e7766e6b8ff758630e7 (diff) | |
download | llvm-127bf44385424891eb04cff8e52d3f157fc2cb7c.zip llvm-127bf44385424891eb04cff8e52d3f157fc2cb7c.tar.gz llvm-127bf44385424891eb04cff8e52d3f157fc2cb7c.tar.bz2 |
[Clang][C++20] Support capturing structured bindings in lambdas
This completes the implementation of P1091R3 and P1381R1.
This patch allow the capture of structured bindings
both for C++20+ and C++17, with extension/compat warning.
In addition, capturing an anonymous union member,
a bitfield, or a structured binding thereof now has a
better diagnostic.
We only support structured bindings - as opposed to other kinds
of structured statements/blocks. We still emit an error for those.
In addition, support for structured bindings capture is entirely disabled in
OpenMP mode as this needs more investigation - a specific diagnostic indicate the feature is not yet supported there.
Note that the rest of P1091R3 (static/thread_local structured bindings) was already implemented.
at the request of @shafik, i can confirm the correct behavior of lldb wit this change.
Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/52720
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D122768
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index fe0890f..b61a2a6 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -609,7 +609,7 @@ public: const CodeGen::CGBlockInfo *BlockInfo = nullptr; llvm::Value *BlockPointer = nullptr; - llvm::DenseMap<const VarDecl *, FieldDecl *> LambdaCaptureFields; + llvm::DenseMap<const ValueDecl *, FieldDecl *> LambdaCaptureFields; FieldDecl *LambdaThisCaptureField = nullptr; /// A mapping from NRVO variables to the flags used to indicate |