diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2012-08-10 22:26:46 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-10 22:26:46 +0000 |
| commit | b6d2bea04801cb66263de2f3fe99ef8e1dcd9f53 (patch) | |
| tree | e56cb46315bfa93624640958c1de3c7944a0e6e7 /test/Analysis/inline.cpp | |
| parent | 9584f67b6da17283a31dedf0a1cab2d83a3d121c (diff) | |
| download | clang-b6d2bea04801cb66263de2f3fe99ef8e1dcd9f53.tar.gz clang-b6d2bea04801cb66263de2f3fe99ef8e1dcd9f53.tar.bz2 clang-b6d2bea04801cb66263de2f3fe99ef8e1dcd9f53.tar.xz | |
[analyzer] Strip CXXBaseObjectRegions when devirtualizing method calls.
This was causing a crash when we tried to re-apply a base object region to
itself. It probably also caused incorrect offset calculations in RegionStore.
PR13569 / <rdar://problem/12076683>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/inline.cpp')
| -rw-r--r-- | test/Analysis/inline.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Analysis/inline.cpp b/test/Analysis/inline.cpp index 4298e1aac8..9a867849e5 100644 --- a/test/Analysis/inline.cpp +++ b/test/Analysis/inline.cpp @@ -71,3 +71,41 @@ namespace PureVirtualParent { } +namespace PR13569 { + class Parent { + protected: + int m_parent; + virtual int impl() const = 0; + + Parent() : m_parent(0) {} + + public: + int interface() const { + clang_analyzer_checkInlined(true); // expected-warning{{TRUE}} + return impl(); + } + }; + + class Child : public Parent { + protected: + virtual int impl() const { + clang_analyzer_checkInlined(true); // expected-warning{{TRUE}} + return m_parent + m_child; + } + + public: + Child() : m_child(0) {} + + int m_child; + }; + + void testVirtual() { + Child x; + x.m_child = 42; + + // Don't crash when inlining and devirtualizing. + x.interface(); + } +} + + |
