aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-01-25 19:13:48 +0000
committerTed Kremenek <kremenek@apple.com>2011-01-25 19:13:48 +0000
commita8c17a5babab35f2db26bf218e7571d1af4afedf (patch)
treeba2d1e33c9fbe93b088bf9fdf632e7537f38a215 /test/Sema/uninit-variables.c
parent937596fc25bba3ac7519e9ffff3e4fab2c97863e (diff)
Teach -Wuninitialized-experimental to also warn
about uninitialized variables captured by blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r--test/Sema/uninit-variables.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index faf94c024b..200fc83b10 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only -fblocks %s -verify
int test1() {
int x; // expected-warning{{use of uninitialized variable 'x'}} expected-note{{add initialization to silence this warning}}
@@ -192,3 +192,23 @@ int test28() {
return sizeof(int[len]); // expected-note{{variable 'len' is possibly uninitialized when used here}}
}
+void test29() {
+ int x; // expected-warning{{use of uninitialized variable 'x'}} expected-note{{add initialization to silence this warning}}
+ (void) ^{ (void) x; }; // expected-note{{variable 'x' is possibly uninitialized when captured by block}}
+}
+
+void test30() {
+ static int x; // no-warning
+ (void) ^{ (void) x; };
+}
+
+void test31() {
+ __block int x; // no-warning
+ (void) ^{ (void) x; };
+}
+
+int test32_x;
+void test32() {
+ (void) ^{ (void) test32_x; }; // no-warning
+}
+