summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/reference.cpp
diff options
context:
space:
mode:
authorDominic Chen <d.c.ddcc@gmail.com>2017-03-03 18:02:02 +0000
committerDominic Chen <d.c.ddcc@gmail.com>2017-03-03 18:02:02 +0000
commit184c6242faca0be0188611d45b41235e68ef282a (patch)
tree665c12a7810e2719b93cb0fa9b0b8cafea9e2ecd /clang/test/Analysis/reference.cpp
parent58e241896db3fd52df5414f867406c4b333bf590 (diff)
downloadbcm5719-llvm-184c6242faca0be0188611d45b41235e68ef282a.tar.gz
bcm5719-llvm-184c6242faca0be0188611d45b41235e68ef282a.zip
Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers
Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296895
Diffstat (limited to 'clang/test/Analysis/reference.cpp')
-rw-r--r--clang/test/Analysis/reference.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/test/Analysis/reference.cpp b/clang/test/Analysis/reference.cpp
index 951079d43e4..b323b966610 100644
--- a/clang/test/Analysis/reference.cpp
+++ b/clang/test/Analysis/reference.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -verify -Wno-null-dereference -Wno-tautological-undefined-compare %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -verify -Wno-null-dereference -Wno-tautological-undefined-compare %s
void clang_analyzer_eval(bool);
@@ -118,16 +118,30 @@ void testRetroactiveNullReference(int *x) {
}
void testReferenceAddress(int &x) {
+// FIXME: Move non-zero reference assumption out of RangeConstraintManager.cpp:422
+#ifdef ANALYZER_CM_Z3
+ clang_analyzer_eval(&x != 0); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(&ref() != 0); // expected-warning{{UNKNOWN}}
+#else
clang_analyzer_eval(&x != 0); // expected-warning{{TRUE}}
clang_analyzer_eval(&ref() != 0); // expected-warning{{TRUE}}
+#endif
struct S { int &x; };
extern S getS();
+#ifdef ANALYZER_CM_Z3
+ clang_analyzer_eval(&getS().x != 0); // expected-warning{{UNKNOWN}}
+#else
clang_analyzer_eval(&getS().x != 0); // expected-warning{{TRUE}}
+#endif
extern S *getSP();
+#ifdef ANALYZER_CM_Z3
+ clang_analyzer_eval(&getSP()->x != 0); // expected-warning{{UNKNOWN}}
+#else
clang_analyzer_eval(&getSP()->x != 0); // expected-warning{{TRUE}}
+#endif
}
OpenPOWER on IntegriCloud