[clang] [analyzer] Use dynamic type when invalidating by a member function call (PR #111138)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 23 03:38:03 PDT 2024


================
@@ -748,6 +747,22 @@ SVal CXXInstanceCall::getCXXThisVal() const {
   return ThisVal;
 }
 
+const CXXRecordDecl *CXXInstanceCall::getDeclForDynamicType() const {
+  const MemRegion *R = getCXXThisVal().getAsRegion();
+  if (!R)
+    return nullptr;
+
+  DynamicTypeInfo DynType = getDynamicTypeInfo(getState(), R);
+  if (!DynType.isValid())
+    return nullptr;
+
+  QualType Ty = DynType.getType()->getPointeeType();
+  if (Ty.isNull())
----------------
Xazax-hun wrote:

Previously we had an assertion here. Is this invariant of "DynamicTypeInfo" is not always a pointer not actually true?

https://github.com/llvm/llvm-project/pull/111138


More information about the cfe-commits mailing list