aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/method-call.cpp
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2012-05-16 16:01:10 +0000
committerJordy Rose <jediknil@belkadan.com>2012-05-16 16:01:10 +0000
commit43d9f0d4e9b88dcab473a359a7b5579c2a619b22 (patch)
treea0d4d813a792c3043bbe17a70db3c7228614d688 /test/Analysis/method-call.cpp
parent93a9d828378b5c969344f27aeb275b8c2a19d918 (diff)
[analyzer] Convert many existing tests to use clang_analyzer_eval.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156920 91177308-0d34-0410-b5e6-96231b3b80d8
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 323fffebcd..91da532456 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}}
}