[analyzer] Fix assertion failure invalidating on const member function calls (PR25392).
We now return early when the 'this' value cannot be converted to a MemRegion.
llvm-svn: 252506
diff --git a/clang/test/Analysis/const-method-call.cpp b/clang/test/Analysis/const-method-call.cpp
index 25909f8..b8aaeea 100644
--- a/clang/test/Analysis/const-method-call.cpp
+++ b/clang/test/Analysis/const-method-call.cpp
@@ -204,6 +204,25 @@
s2().f(0);
}
+// --- PR25392 --- //
+
+struct HasConstMemberFunction {
+public:
+ void constMemberFunction() const;
+};
+
+HasConstMemberFunction hasNoReturn() { } // expected-warning {{control reaches end of non-void function}}
+
+void testUnknownWithConstMemberFunction() {
+ hasNoReturn().constMemberFunction();
+}
+
+void testNonRegionLocWithConstMemberFunction() {
+ (*((HasConstMemberFunction *)(&&label))).constMemberFunction();
+
+ label: return;
+}
+
// FIXME
// When there is a circular reference to an object and a const method is called
// the object is not invalidated because TK_PreserveContents has already been