diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-08-23 03:24:01 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-08-23 03:24:01 +0000 |
commit | 65d0c48d81b73c359f40f6c068bd89a8b91229ac (patch) | |
tree | d24e2444d66e1c3c98e1db30ee04be56ca7fbcda /test/Analysis | |
parent | 622a812e81dd867825c2ba42d60167866664ece3 (diff) | |
download | clang-65d0c48d81b73c359f40f6c068bd89a8b91229ac.tar.gz |
[analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.
The idea to drop this requirement is good, but for now every other user
of DynamicTypeInfo expects pointer types.
Fixes a crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/cast-value-logic.cpp | 8 | ||||
-rw-r--r-- | test/Analysis/cast-value-state-dump.cpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/test/Analysis/cast-value-logic.cpp b/test/Analysis/cast-value-logic.cpp index c5083ef57c..531772825f 100644 --- a/test/Analysis/cast-value-logic.cpp +++ b/test/Analysis/cast-value-logic.cpp @@ -15,6 +15,8 @@ struct Shape { template <typename T> const T *getAs() const; + + virtual double area(); }; class Triangle : public Shape {}; class Circle : public Shape {}; @@ -141,4 +143,10 @@ void test_non_reference_temporary_crash() { auto P = foo(); auto Q = cast<Circle>(std::move(P)); // no-crash } + +double test_virtual_method_after_call(Shape *S) { + if (isa<Circle>(S)) + return S->area(); + return S->area() / 2; +} } // namespace crashes diff --git a/test/Analysis/cast-value-state-dump.cpp b/test/Analysis/cast-value-state-dump.cpp index 890fa18933..b8152d46da 100644 --- a/test/Analysis/cast-value-state-dump.cpp +++ b/test/Analysis/cast-value-state-dump.cpp @@ -35,8 +35,8 @@ void evalNonNullParamNonNullReturn(const Shape *S) { // CHECK-NEXT: ], // CHECK-NEXT: "dynamic_casts": [ // CHECK: { "region": "SymRegion{reg_$0<const struct clang::Shape * S>}", "casts": [ - // CHECK-NEXT: { "from": "struct clang::Shape", "to": "class clang::Circle", "kind": "success" }, - // CHECK-NEXT: { "from": "struct clang::Shape", "to": "class clang::Square", "kind": "fail" } + // CHECK-NEXT: { "from": "const struct clang::Shape *", "to": "const class clang::Circle *", "kind": "success" }, + // CHECK-NEXT: { "from": "const struct clang::Shape *", "to": "const class clang::Square *", "kind": "fail" } // CHECK-NEXT: ]} (void)(1 / !C); |