diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-12-01 23:04:14 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-12-01 23:04:14 +0000 |
commit | 9a0459c0f59a09ac7287ca1f49083fc6b31e4142 (patch) | |
tree | 7be106eef6eba86f992a1b5185353f9a5587eba9 | |
parent | 39d9841ed4c0568d4b44dfbc12ac04491f60a374 (diff) |
Added dead-stores test cases that involve the use of blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90277 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/dead-stores.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index e29eefd8eb..ae5e3e3673 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -370,3 +370,39 @@ void f23_pos(int argc, char **argv) { f23_aux("I did too use it!\n"); }(); } + +void f24_A(int y) { + // FIXME: One day this should be reported as dead since 'z = x + y' is dead. + int x = (y > 2); // no-warning + ^ { + int z = x + y; // FIXME: Eventually this should be reported as a dead store. + }(); +} + +void f24_B(int y) { + // FIXME: One day this should be reported as dead since 'x' is just overwritten. + __block int x = (y > 2); // no-warning + ^{ + // FIXME: This should eventually be a dead store since it is never read either. + x = 5; // no-warning + }(); +} + +int f24_C(int y) { + // FIXME: One day this should be reported as dead since 'x' is just overwritten. + __block int x = (y > 2); // no-warning + ^{ + x = 5; // no-warning + }(); + return x; +} + +int f24_D(int y) { + __block int x = (y > 2); // no-warning + ^{ + if (y > 4) + x = 5; // no-warning + }(); + return x; +} + |