diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/Analysis/method-call.cpp | |
parent | bb67ca86b31f67faee50bd10c3b036d65751745a (diff) | |
download | FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz |
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/Analysis/method-call.cpp')
-rw-r--r-- | test/Analysis/method-call.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp index 323fffe..91da532 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}} } |