We now return early when the 'this' value cannot be converted to a MemRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252506
91177308-0d34-0410-b5e6-
96231b3b80d8
return;
// Preserve CXXThis.
const MemRegion *ThisRegion = ThisVal.getAsRegion();
- assert(ThisRegion && "ThisValue was not a memory region");
+ if (!ThisRegion)
+ return;
+
ETraits->setTrait(ThisRegion->getBaseRegion(),
RegionAndSymbolInvalidationTraits::TK_PreserveContents);
}
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