summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-08-23 03:24:01 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-08-23 03:24:01 +0000
commit62a76d0ae349f53d4ebd911412591ec1bb74f4e7 (patch)
tree54ff31bf338c1f15a6df6cc5670484ffc181db72 /clang/test/Analysis
parentaf992e6d0137d798e6b2cd27737b7a73300676a1 (diff)
downloadbcm5719-llvm-62a76d0ae349f53d4ebd911412591ec1bb74f4e7.tar.gz
bcm5719-llvm-62a76d0ae349f53d4ebd911412591ec1bb74f4e7.zip
[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. llvm-svn: 369728
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/cast-value-logic.cpp8
-rw-r--r--clang/test/Analysis/cast-value-state-dump.cpp4
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/Analysis/cast-value-logic.cpp b/clang/test/Analysis/cast-value-logic.cpp
index c5083ef57c9..531772825f9 100644
--- a/clang/test/Analysis/cast-value-logic.cpp
+++ b/clang/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/clang/test/Analysis/cast-value-state-dump.cpp b/clang/test/Analysis/cast-value-state-dump.cpp
index 890fa189335..b8152d46da4 100644
--- a/clang/test/Analysis/cast-value-state-dump.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud