]> granicus.if.org Git - clang/commitdiff
Add test case showing the analyzer invalidates '__block' variables when the block...
authorTed Kremenek <kremenek@apple.com>
Fri, 5 Feb 2010 06:10:46 +0000 (06:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 5 Feb 2010 06:10:46 +0000 (06:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95366 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/misc-ps-region-store.m

index 20284fe95b52ae136db179dbae5c36edb085a0d8..6666dae2ed8bcf374e9a3ab89ddfbaf1388daeab 100644 (file)
@@ -590,6 +590,19 @@ int blocks_2(int *p, int z) {
   return z;
 }
 
+// Test that the value of 'x' is considered invalidated after the block
+// is passed as an argument to the message expression.
+typedef void (^RDar7582031CB)(void);
+@interface RDar7582031
+- rdar7582031:RDar7582031CB;
+@end
+
+unsigned rdar7582031(RDar7582031 *o) {
+  __block unsigned x;
+  [o rdar7582031:^{ x = 1; }];
+  return x; // no-warning
+}
+
 //===----------------------------------------------------------------------===//
 // <rdar://problem/7462324> - Test that variables passed using __blocks
 //  are not treated as being uninitialized.