History log of /external/clang/test/SemaCXX/cxx1y-init-captures.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a4de17562d13d7a8188108243c4cfbd52f33229a 04-Mar-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master clang for rebase to r256229

http://b/26987366

(cherry picked from commit 87d948ecccffea9e9e37d0d053b246e2d6d6c47b)

Change-Id: I10ca401a280e905253aafabad9118693a2f24ffb
/external/clang/test/SemaCXX/cxx1y-init-captures.cpp
b6d6993e6e6d3daf4d9876794254d20a134e37c2 01-Jul-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master clang for rebase to r239765

Change-Id: I0393bcc952590a7226af8c4b58534a8ee5fd2d99
/external/clang/test/SemaCXX/cxx1y-init-captures.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/test/SemaCXX/cxx1y-init-captures.cpp
2434dcfb022778b06cfd257d830d0249680b87cf 05-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r196454:
------------------------------------------------------------------------
r196454 | faisalv | 2013-12-04 17:40:41 -0800 (Wed, 04 Dec 2013) | 43 lines

Fix init-captures for generic lambdas.

For an init capture, process the initialization expression
right away. For lambda init-captures such as the following:
const int x = 10;
auto L = [i = x+1](int a) {
return [j = x+2,
&k = x](char b) { };
};
keep in mind that each lambda init-capture has to have:
- its initialization expression executed in the context
of the enclosing/parent decl-context.
- but the variable itself has to be 'injected' into the
decl-context of its lambda's call-operator (which has
not yet been created).
Each init-expression is a full-expression that has to get
Sema-analyzed (for capturing etc.) before its lambda's
call-operator's decl-context, scope & scopeinfo are pushed on their
respective stacks. Thus if any variable is odr-used in the init-capture
it will correctly get captured in the enclosing lambda, if one exists.
The init-variables above are created later once the lambdascope and
call-operators decl-context is pushed onto its respective stack.

Since the lambda init-capture's initializer expression occurs in the
context of the enclosing function or lambda, therefore we can not wait
till a lambda scope has been pushed on before deciding whether the
variable needs to be captured. We also need to process all
lvalue-to-rvalue conversions and discarded-value conversions,
so that we can avoid capturing certain constant variables.
For e.g.,
void test() {
const int x = 10;
auto L = [&z = x](char a) { <-- don't capture by the current lambda
return [y = x](int i) { <-- don't capture by enclosing lambda
return y;
}
};
If x was not const, the second use would require 'L' to capture, and
that would be an error.
Make sure TranformLambdaExpr is also aware of this.

Patch approved by Richard (Thanks!!)
http://llvm-reviews.chandlerc.com/D2092
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/cxx1y-init-captures.cpp
1851715dd6e2111e4c503f473f7bd4917df0ff7b 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add extra testing for init-captures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/cxx1y-init-captures.cpp