summaryrefslogtreecommitdiff
path: root/test/Analysis/method-call.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-08-19 10:33:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-08-19 10:33:04 +0000
commit657bc3d9848e3be92029b2416031340988cd0111 (patch)
tree5b9c2fa9d79942fbdce3d618e37e27c18263af9a /test/Analysis/method-call.cpp
parent56d91b49b13fe55c918afbda19f6165b5fbff87a (diff)
Notes
Diffstat (limited to 'test/Analysis/method-call.cpp')
-rw-r--r--test/Analysis/method-call.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index 91da532456d7c..912062739c340 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -1,25 +1,37 @@
// 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; }
int getx() const { return x; }
};
+void testNullObject(A *a) {
+ clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
+ (void)a->getx(); // assume we know what we're doing
+ clang_analyzer_eval(a); // expected-warning{{TRUE}}
+}
+
+
+// FIXME: These require constructor inlining to be enabled.
+
void f1() {
A x(3);
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
+ // should be TRUE
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
}
void f2() {
const A &x = A(3);
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
+ // should be TRUE
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
}
void f3() {
const A &x = (A)3;
- clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
+ // should be TRUE
+ clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
}