| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s |
| 2 |
// expected-no-diagnostics |
| 3 |
class B { |
| 4 |
public: |
| 5 |
bool m; |
| 6 |
~B() {} // The destructor ensures that the binary logical operator below is wrapped in the ExprWithCleanups. |
| 7 |
}; |
| 8 |
B foo(); |
| 9 |
int getBool(); |
| 10 |
int *getPtr(); |
| 11 |
int test() { |
| 12 |
int r = 0; |
| 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 |
// PR18159 |
| 18 |
if (p != 0 && getBool() && foo().m && getBool()) { |
| 19 |
r = *p; // no warning |
| 20 |
} |
| 21 |
} |
| 22 |
return r; |
| 23 |
} |