[PATCH] [C++11] Support for capturing of variable length arrays in lambda expression.

Richard Smith richard at metafoo.co.uk
Mon Aug 25 21:33:39 PDT 2014


================
Comment at: include/clang/AST/LambdaCapture.h:67
@@ -66,3 +66,3 @@
   /// \brief Determine the kind of capture.
   LambdaCaptureKind getCaptureKind() const;
 
----------------
ABataev wrote:
> rsmith wrote:
> > Have you considered adding an LCK_ value for VLA capture? Calling it `LCK_ByCopy` doesn't seem quite right.
> Yes, I tried this. But the problem is that there is no more space for another one LCK_ value in field DeclAndBits. It is declared as llvm::PointerIntPair<Decl *, 2> and its integer argument may have values Capture_Implicit = 0x01 or Capture_ByCopy = 0x02. I can't add vallue 0x03v without changing llvm::PointerIntPair<Decl *, 2> to llvm::PointerIntPair<Decl *, 3>. The only way to do it is to split DeclAndBits into 2 independent fields - pointer and flags.
`DeclAndBits` stores `Capture_` values, not `LCK_` values. The `LCK_` values are defined in `Basic/Lambda.h` and there are only 3 different values right now.

http://reviews.llvm.org/D4368






More information about the cfe-commits mailing list