aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/base-init.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2011-01-13 12:30:12 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2011-01-13 12:30:12 +0000
commitd074441e027471a914cbb909a7aad1d43224950f (patch)
tree00b080ed9a0662effebaaa7d09294534403900cf /test/Analysis/base-init.cpp
parentbda1efd0daf6fca9f515c6ce38d1ed71a3cca5b7 (diff)
Support inlining base initializers. We still haven't got it completely right,
since the bindings are purged after they are set up. Need to investigate RemoveDeadBindings algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123374 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/base-init.cpp')
-rw-r--r--test/Analysis/base-init.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Analysis/base-init.cpp b/test/Analysis/base-init.cpp
new file mode 100644
index 0000000000..e82f443ced
--- /dev/null
+++ b/test/Analysis/base-init.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -analyzer-inline-call -cfg-add-initializers -verify -analyzer-no-purge-dead %s
+
+class A {
+ int x;
+public:
+ A();
+ int getx() const {
+ return x;
+ }
+};
+
+A::A() : x(0) {
+}
+
+class B : public A {
+ int y;
+public:
+ B();
+};
+
+B::B() {
+}
+
+void f() {
+ B b;
+ if (b.getx() != 0) {
+ int *p = 0;
+ *p = 0; // no-warning
+ }
+}