Dominic Chen | 184c624 | 2017-03-03 18:02:02 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core -fobjc-arc -verify %s |
Anna Zaks | cf8d216 | 2013-12-06 18:56:29 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
| 3 | @interface NSObject |
| 4 | @end |
| 5 | @interface NSString : NSObject |
| 6 | - (id)lastPathComponent; |
| 7 | @end |
| 8 | int getBool(); |
| 9 | int *getPtr(); |
| 10 | int foo() { |
| 11 | int r = 0; |
| 12 | NSString *filename = @"filename"; |
| 13 | for (int x = 0; x< 10; x++) { |
| 14 | int *p = getPtr(); |
| 15 | // Liveness info is not computed correctly due to the following expression. |
| 16 | // This happens due to CFG being special cased for short circuit operators. |
| 17 | // Note, due to ObjC method call, the outermost logical operator is wrapped in ExprWithCleanups. |
| 18 | // PR18159 |
| 19 | if ((p != 0) && (getBool()) && ([filename lastPathComponent]) && (getBool())) { |
| 20 | r = *p; // no-warning |
| 21 | } |
| 22 | } |
| 23 | return r; |
| 24 | } |