summaryrefslogtreecommitdiff
path: root/test/Analysis/method-call.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit56d91b49b13fe55c918afbda19f6165b5fbff87a (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e /test/Analysis/method-call.cpp
parent41e20f564abdb05101d6b2b29c59459a966c22cc (diff)
Notes
Diffstat (limited to 'test/Analysis/method-call.cpp')
-rw-r--r--test/Analysis/method-call.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index 323fffebcdbe..91da532456d7 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -analyzer-store region -verify %s
// XFAIL: *
+void clang_analyzer_eval(bool);
+
struct A {
int x;
A(int a) { x = a; }
@@ -9,33 +11,15 @@ struct A {
void f1() {
A x(3);
- if (x.getx() == 3) {
- int *p = 0;
- *p = 3; // expected-warning{{Dereference of null pointer}}
- } else {
- int *p = 0;
- *p = 3; // no-warning
- }
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}
void f2() {
const A &x = A(3);
- if (x.getx() == 3) {
- int *p = 0;
- *p = 3; // expected-warning{{Dereference of null pointer}}
- } else {
- int *p = 0;
- *p = 3; // no-warning
- }
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}
void f3() {
const A &x = (A)3;
- if (x.getx() == 3) {
- int *p = 0;
- *p = 3; // expected-warning{{Dereference of null pointer}}
- } else {
- int *p = 0;
- *p = 3; // no-warning
- }
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}