summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorVlad Tsyrklevich <vlad@tsyrklevich.net>2018-06-06 06:25:51 +0000
committerVlad Tsyrklevich <vlad@tsyrklevich.net>2018-06-06 06:25:51 +0000
commita7d25d5934409cdf5ef00b10cb3216bc338a88e2 (patch)
tree94abd0d71627a92f0771595127dd7ab6794303ab /clang/test
parent80a764bab17cf984db298078ba9010a553a15335 (diff)
downloadbcm5719-llvm-a7d25d5934409cdf5ef00b10cb3216bc338a88e2.tar.gz
bcm5719-llvm-a7d25d5934409cdf5ef00b10cb3216bc338a88e2.zip
[Analyzer][Z3] Test fixes for Z3 constraint manager
Summary: Since Z3 tests have been not been running [1] some tests needed to be updated. I also added a regression test for [1]. [1] https://reviews.llvm.org/D47722 Reviewers: george.karpenkov, NoQ, ddcc Reviewed By: george.karpenkov Subscribers: mikhail.ramalho, dcoughlin, xazax.hun, szepet, zzheng, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D47726 llvm-svn: 334067
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/PR24184.cpp1
-rw-r--r--clang/test/Analysis/constant-folding.c4
-rw-r--r--clang/test/Analysis/loop-unrolling.cpp4
-rw-r--r--clang/test/Analysis/z3/enabled.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Analysis/PR24184.cpp b/clang/test/Analysis/PR24184.cpp
index 1280334d4d6..bfc5ae6ea56 100644
--- a/clang/test/Analysis/PR24184.cpp
+++ b/clang/test/Analysis/PR24184.cpp
@@ -1,3 +1,4 @@
+// UNSUPPORTED: z3
// RUN: %clang_analyze_cc1 -w -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
diff --git a/clang/test/Analysis/constant-folding.c b/clang/test/Analysis/constant-folding.c
index 8189868be2e..e21d629e9a4 100644
--- a/clang/test/Analysis/constant-folding.c
+++ b/clang/test/Analysis/constant-folding.c
@@ -108,7 +108,11 @@ void testBitwiseRules(unsigned int a, int b) {
clang_analyzer_eval((b | -2) == 0); // expected-warning{{FALSE}}
clang_analyzer_eval((b | 10) == 0); // expected-warning{{FALSE}}
clang_analyzer_eval((b | 0) == 0); // expected-warning{{UNKNOWN}}
+#ifdef ANALYZER_CM_Z3
+ clang_analyzer_eval((b | -2) >= 0); // expected-warning{{FALSE}}
+#else
clang_analyzer_eval((b | -2) >= 0); // expected-warning{{UNKNOWN}}
+#endif
// Check that dynamically computed constants also work.
int constant = 1 << 3;
diff --git a/clang/test/Analysis/loop-unrolling.cpp b/clang/test/Analysis/loop-unrolling.cpp
index ce7ada8bd72..b7375df38b6 100644
--- a/clang/test/Analysis/loop-unrolling.cpp
+++ b/clang/test/Analysis/loop-unrolling.cpp
@@ -368,7 +368,11 @@ int nested_inlined_unroll1() {
int nested_inlined_no_unroll1() {
int k;
for (int i = 0; i < 9; i++) {
+#ifdef ANALYZER_CM_Z3
+ clang_analyzer_numTimesReached(); // expected-warning {{13}}
+#else
clang_analyzer_numTimesReached(); // expected-warning {{15}}
+#endif
k = simple_unknown_bound_loop(); // reevaluation without inlining, splits the state as well
}
int a = 22 / k; // no-warning
diff --git a/clang/test/Analysis/z3/enabled.c b/clang/test/Analysis/z3/enabled.c
new file mode 100644
index 00000000000..9f44233b266
--- /dev/null
+++ b/clang/test/Analysis/z3/enabled.c
@@ -0,0 +1,3 @@
+// REQUIRES: z3
+// RUN: echo %clang_analyze_cc1 | FileCheck %s
+// CHECK: -analyzer-constraints=z3
OpenPOWER on IntegriCloud