[cfe-commits] r95366 - /cfe/trunk/test/Analysis/misc-ps-region-store.m

Ted Kremenek kremenek at apple.com
Thu Feb 4 22:10:47 PST 2010


Author: kremenek
Date: Fri Feb  5 00:10:46 2010
New Revision: 95366

URL: http://llvm.org/viewvc/llvm-project?rev=95366&view=rev
Log:
Add test case showing the analyzer invalidates '__block' variables when the block is passed as an argument to an ObjC method.

Modified:
    cfe/trunk/test/Analysis/misc-ps-region-store.m

Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=95366&r1=95365&r2=95366&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Fri Feb  5 00:10:46 2010
@@ -590,6 +590,19 @@
   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);
+ at interface RDar7582031
+- rdar7582031:RDar7582031CB;
+ at 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.





More information about the cfe-commits mailing list