summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/inline.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-10 22:26:46 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-10 22:26:46 +0000
commit02e5309b3502082399f0c5f616f7ce3f8ee57f28 (patch)
treef9b867b262d62a43af936983f58043326dfe2791 /clang/test/Analysis/inline.cpp
parent51bcb226a2745d6a7416b30bc2cf54ed4b6c2209 (diff)
downloadbcm5719-llvm-02e5309b3502082399f0c5f616f7ce3f8ee57f28.tar.gz
bcm5719-llvm-02e5309b3502082399f0c5f616f7ce3f8ee57f28.zip
[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> llvm-svn: 161710
Diffstat (limited to 'clang/test/Analysis/inline.cpp')
-rw-r--r--clang/test/Analysis/inline.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/Analysis/inline.cpp b/clang/test/Analysis/inline.cpp
index 4298e1aac82..9a867849e5c 100644
--- a/clang/test/Analysis/inline.cpp
+++ b/clang/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();
+ }
+}
+
+
OpenPOWER on IntegriCloud