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

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 01:48:27 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())
----------------
steakhal wrote:

Fixed.

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


More information about the cfe-commits mailing list