Ted Kremenek | 565e465 | 2010-02-05 02:06:54 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s |
| 2 | // RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s |
Ted Kremenek | fb8a7fd | 2008-09-19 20:53:52 +0000 | [diff] [blame] | 3 | |
| 4 | typedef unsigned int NSUInteger; |
| 5 | |
| 6 | @interface A |
| 7 | - (NSUInteger)foo; |
| 8 | @end |
| 9 | |
| 10 | NSUInteger f8(A* x){ |
| 11 | const NSUInteger n = [x foo]; |
| 12 | int* bogus; |
| 13 | |
| 14 | if (n > 0) { // tests const cast transfer function logic |
| 15 | NSUInteger i; |
| 16 | |
| 17 | for (i = 0; i < n; ++i) |
| 18 | bogus = 0; |
| 19 | |
| 20 | if (bogus) // no-warning |
| 21 | return n+1; |
| 22 | } |
| 23 | |
| 24 | return n; |
| 25 | } |