diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-31 04:46:53 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-31 04:46:53 +0000 |
commit | 94ae8fd470471134114599ccfc2301da05719212 (patch) | |
tree | 26bf9b954f9a3ba4660439d55b3d45f9be00ae56 /test/Analysis | |
parent | 41c5f498b2d10fab683f1c5685ff79c90a737d24 (diff) | |
download | clang-94ae8fd470471134114599ccfc2301da05719212.tar.gz |
Static analyzer: fix bug in handling of dynamic_cast<>. The sink node wouldn't always be the final node, thus causing the state to continue propagating. Instead,
recover some path-sensitivity by conjuring a symbol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/misc-ps-region-store.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp index 26a31526b7..4ead8bb617 100644 --- a/test/Analysis/misc-ps-region-store.cpp +++ b/test/Analysis/misc-ps-region-store.cpp @@ -264,3 +264,17 @@ void rdar9212512() { } } +// Test basic support for dynamic_cast<>. +struct Rdar9212495_C { virtual void bar() const; }; +class Rdar9212495_B : public Rdar9212495_C {}; +class Rdar9212495_A : public Rdar9212495_B {}; +const Rdar9212495_A& rdar9212495(const Rdar9212495_C* ptr) { + const Rdar9212495_A& val = dynamic_cast<const Rdar9212495_A&>(*ptr); + + if (&val == 0) { + val.bar(); // FIXME: This should eventually be a null dereference. + } + + return val; +} + |