diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-04-22 21:36:44 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-04-22 21:36:44 +0000 |
commit | fbc4444eb2675934b44f3720ef9a5f368ecbeb0a (patch) | |
tree | 35b92f3a54b9ae81d03cffec5c251c85356281e2 /test | |
parent | 387f8aadab92dd67cc0610424b78bf6088b8c28b (diff) |
[analyzer] Type information from C++ new expressions is perfect.
This improves our handling of dynamic_cast and devirtualization for
objects allocated by 'new'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/inline.cpp | 4 | ||||
-rw-r--r-- | test/Analysis/inlining/dyn-dispatch-bifurcate.cpp | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/test/Analysis/inline.cpp b/test/Analysis/inline.cpp index a16fa00d12..62bce28472 100644 --- a/test/Analysis/inline.cpp +++ b/test/Analysis/inline.cpp @@ -351,9 +351,7 @@ namespace VirtualWithSisterCasts { void testCastViaNew(B *b) { Grandchild *g = new (b) Grandchild(); - // FIXME: We actually now have perfect type info because of 'new'. - // This should be TRUE. - clang_analyzer_eval(g->foo() == 42); // expected-warning{{UNKNOWN}} + clang_analyzer_eval(g->foo() == 42); // expected-warning{{TRUE}} g->x = 42; clang_analyzer_eval(g->x == 42); // expected-warning{{TRUE}} diff --git a/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp b/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp index 890e5640ce..d219446fc9 100644 --- a/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp +++ b/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp @@ -16,6 +16,11 @@ void testKnown() { clang_analyzer_eval(a.get() == 0); // expected-warning{{TRUE}} } +void testNew() { + A *a = new A(); + clang_analyzer_eval(a->get() == 0); // expected-warning{{TRUE}} +} + namespace ReinterpretDisruptsDynamicTypeInfo { class Parent {}; |