diff options
author | Tom Care <tom.care@uqconnect.edu.au> | 2010-08-25 22:37:26 +0000 |
---|---|---|
committer | Tom Care <tom.care@uqconnect.edu.au> | 2010-08-25 22:37:26 +0000 |
commit | 82b2a1dadae8546e9c6ce44e6201f2c1291dfd2b (patch) | |
tree | df0c0917e0cf335990a414418c57ce7a11b4e3c7 /clang/test/Analysis/idempotent-operations.c | |
parent | a0d7e434c0a2223ffdb78539dd7d498357c401ee (diff) | |
download | bcm5719-llvm-82b2a1dadae8546e9c6ce44e6201f2c1291dfd2b.tar.gz bcm5719-llvm-82b2a1dadae8546e9c6ce44e6201f2c1291dfd2b.zip |
Improved the handling of blocks and block variables in PseudoConstantAnalysis
- Removed the assumption that __block vars are all non-constant
- Simplified some repetitive code in RunAnalysis
- Added block walking support
- Code/comments cleanup
- Separated out test for block pseudoconstants
llvm-svn: 112098
Diffstat (limited to 'clang/test/Analysis/idempotent-operations.c')
-rw-r--r-- | clang/test/Analysis/idempotent-operations.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/clang/test/Analysis/idempotent-operations.c b/clang/test/Analysis/idempotent-operations.c index a730d031270..09df6dece0b 100644 --- a/clang/test/Analysis/idempotent-operations.c +++ b/clang/test/Analysis/idempotent-operations.c @@ -112,18 +112,34 @@ unsigned false4() { int c = 42; test(height * c); // no-warning - // Pseudo-constant (blockvar) - __block int a = 0; - int b = 10; - a *= b; // no-warning - test(a); - // Pseudo-constant (never changes after decl) int width = height; return width * 10; // no-warning } +// Block pseudoconstants +void false4a() { + // Pseudo-constant + __block int a = 1; + int b = 10; + __block int c = 0; + b *= a; // no-warning + + ^{ + // Psuedoconstant block var + test(b * c); // no-warning + + // Non-pseudoconstant block var + int d = 0; + test(b * d); // expected-warning{{The right operand to '*' is always 0}} + d = 5; + test(d); + }(); + + test(a + b); +} + // Static vars are common false positives int false5() { static int test = 0; |