summaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/cast-value-logic.cpp8
-rw-r--r--test/Analysis/cast-value-state-dump.cpp4
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);