summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-08-28 04:28:19 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-08-28 04:28:19 +0000
commit39c81e281629886bfa491434e31516b2056d0985 (patch)
treeb0b1ff5b7d83d851e804aad3c20379024760bb7b /clang/lib/AST/ExprCXX.cpp
parentc5cafbb074d216d6fa6bc5beb05f236e736490d2 (diff)
downloadbcm5719-llvm-39c81e281629886bfa491434e31516b2056d0985.tar.gz
bcm5719-llvm-39c81e281629886bfa491434e31516b2056d0985.zip
[C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368 llvm-svn: 216649
Diffstat (limited to 'clang/lib/AST/ExprCXX.cpp')
-rw-r--r--clang/lib/AST/ExprCXX.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 1b3476a4f6a..08230bebed1 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -909,16 +909,21 @@ LambdaCapture::LambdaCapture(SourceLocation Loc, bool Implicit,
case LCK_ByRef:
assert(Var && "capture must have a variable!");
break;
+ case LCK_VLAType:
+ assert(!Var && "VLA type capture cannot have a variable!");
+ Bits |= Capture_ByCopy;
+ break;
}
DeclAndBits.setInt(Bits);
}
LambdaCaptureKind LambdaCapture::getCaptureKind() const {
Decl *D = DeclAndBits.getPointer();
+ bool CapByCopy = DeclAndBits.getInt() & Capture_ByCopy;
if (!D)
- return LCK_This;
+ return CapByCopy ? LCK_VLAType : LCK_This;
- return (DeclAndBits.getInt() & Capture_ByCopy) ? LCK_ByCopy : LCK_ByRef;
+ return CapByCopy ? LCK_ByCopy : LCK_ByRef;
}
LambdaExpr::LambdaExpr(QualType T,
OpenPOWER on IntegriCloud