summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/captured-statements.c
diff options
context:
space:
mode:
authorBen Langmuir <ben.langmuir@intel.com>2013-05-09 19:17:11 +0000
committerBen Langmuir <ben.langmuir@intel.com>2013-05-09 19:17:11 +0000
commit3b4c30b7e77edb76da538fb4989957a219c6438f (patch)
treecf67400674bb8e2328ec34116fc3261b1d46840c /clang/test/Sema/captured-statements.c
parent00681dc1f070496b2b0ddbd260e01b3e290ae9fd (diff)
downloadbcm5719-llvm-3b4c30b7e77edb76da538fb4989957a219c6438f.tar.gz
bcm5719-llvm-3b4c30b7e77edb76da538fb4989957a219c6438f.zip
CodeGen for CapturedStmts
EmitCapturedStmt creates a captured struct containing all of the captured variables, and then emits a call to the outlined function. This is similar in principle to EmitBlockLiteral. GenerateCapturedFunction actually produces the outlined function. It is based on GenerateBlockFunction, but is much simpler. The function type is determined by the parameters that are in the CapturedDecl. Some changes have been added to this patch that were reviewed as part of the serialization patch and moving the parameters to the captured decl. Differential Revision: http://llvm-reviews.chandlerc.com/D640 llvm-svn: 181536
Diffstat (limited to 'clang/test/Sema/captured-statements.c')
-rw-r--r--clang/test/Sema/captured-statements.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/test/Sema/captured-statements.c b/clang/test/Sema/captured-statements.c
index 9285a7802d5..86e9273944b 100644
--- a/clang/test/Sema/captured-statements.c
+++ b/clang/test/Sema/captured-statements.c
@@ -49,29 +49,29 @@ void test_nest() {
}
void test_nest_block() {
- __block int x;
+ __block int x; // expected-note {{'x' declared here}}
int y;
^{
int z;
#pragma clang __debug captured
{
- x = y; // OK
+ x = y; // expected-error{{__block variable 'x' cannot be captured in a captured statement}}
y = z; // expected-error{{variable is not assignable (missing __block type specifier)}}
z = y; // OK
}
}();
- __block int a;
+ __block int a; // expected-note 2 {{'a' declared here}}
int b;
#pragma clang __debug captured
{
__block int c;
int d;
^{
- a = b; // OK
- a = c; // OK
+ a = b; // expected-error{{__block variable 'a' cannot be captured in a captured statement}}
b = d; // OK - Consistent with block inside a lambda
- c = a; // OK
+ c = a; // expected-error{{__block variable 'a' cannot be captured in a captured statement}}
+ c = d; // OK
d = b; // expected-error{{variable is not assignable (missing __block type specifier)}}
}();
}
OpenPOWER on IntegriCloud