From 77361761fbcf92fa5138a54b8425e76e76a852a1 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 31 Mar 2011 22:32:41 +0000 Subject: -Wuninitialized should not warn about variables captured by blocks as byref. Note this can potentially be enhanced to detect if the __block variable is actually written by the block, or only when the block "escapes" or is actually used, but that requires more analysis than it is probably worth for this simple check. llvm-svn: 128681 --- clang/test/Sema/uninit-variables.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/Sema/uninit-variables.c') diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c index 85e6394edac..17bd07f3e55 100644 --- a/clang/test/Sema/uninit-variables.c +++ b/clang/test/Sema/uninit-variables.c @@ -328,3 +328,12 @@ void test50() char c[1 ? : 2]; // no-warning } +int test51(void) +{ + __block int a; + ^(void) { + a = 42; + }(); + return a; // no-warning +} + -- cgit v1.2.3