summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/live-variables.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-12-06 18:56:29 +0000
committerAnna Zaks <ganna@apple.com>2013-12-06 18:56:29 +0000
commitcf8d2165ffebd254927463af7d86f61d8bbd3fd2 (patch)
treecd59cde242b50c800597e0d404729d22141ed601 /clang/test/Analysis/live-variables.cpp
parentba0aea16e1902cf39d32e2617b88582519e31a28 (diff)
downloadbcm5719-llvm-cf8d2165ffebd254927463af7d86f61d8bbd3fd2.tar.gz
bcm5719-llvm-cf8d2165ffebd254927463af7d86f61d8bbd3fd2.zip
Revert "[analyzer] Refactor conditional expression evaluating code"
This reverts commit r189090. The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem. The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default. llvm-svn: 196593
Diffstat (limited to 'clang/test/Analysis/live-variables.cpp')
-rw-r--r--clang/test/Analysis/live-variables.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Analysis/live-variables.cpp b/clang/test/Analysis/live-variables.cpp
new file mode 100644
index 00000000000..0cfaa1b41f5
--- /dev/null
+++ b/clang/test/Analysis/live-variables.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
+// expected-no-diagnostics
+class B {
+public:
+ bool m;
+ ~B() {} // The destructor ensures that the binary logical operator below is wrapped in the ExprWithCleanups.
+};
+B foo();
+int getBool();
+int *getPtr();
+int test() {
+ int r = 0;
+ for (int x = 0; x< 10; x++) {
+ int *p = getPtr();
+ // Liveness info is not computed correctly due to the following expression.
+ // This happens due to CFG being special cased for short circuit operators.
+ // PR18159
+ if (p != 0 && getBool() && foo().m && getBool()) {
+ r = *p; // no warning
+ }
+ }
+ return r;
+}
OpenPOWER on IntegriCloud