summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-05 06:10:46 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-05 06:10:46 +0000
commit94e6d98caecc7e32eb5a31248631507fc6af6230 (patch)
tree3f1414e47e40b464c2ca0e6b0235d5b3ca308870
parentad0ef840408ea54384e96c1d3b36650d95308828 (diff)
downloadbcm5719-llvm-94e6d98caecc7e32eb5a31248631507fc6af6230.tar.gz
bcm5719-llvm-94e6d98caecc7e32eb5a31248631507fc6af6230.zip
Add test case showing the analyzer invalidates '__block' variables when the block is passed as an argument to an ObjC method.
llvm-svn: 95366
-rw-r--r--clang/test/Analysis/misc-ps-region-store.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m
index 20284fe95b5..6666dae2ed8 100644
--- a/clang/test/Analysis/misc-ps-region-store.m
+++ b/clang/test/Analysis/misc-ps-region-store.m
@@ -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.
OpenPOWER on IntegriCloud