blob: 0cfaa1b41f529fa27479b243425cbfffc0c2b0c1 [file] [log] [blame]
Bill Wendlingdd9e9ce2013-12-09 18:37:00 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
2// expected-no-diagnostics
3class B {
4public:
5 bool m;
6 ~B() {} // The destructor ensures that the binary logical operator below is wrapped in the ExprWithCleanups.
7};
8B foo();
9int getBool();
10int *getPtr();
11int 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}