================
@@ -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:

My reasoning was that while it was asserted here, it may not apply in general. 
Given that I abstract this code in a separate function, I may shouldn't enforce 
this invariant.
Although, the `assert˙wouldn't fire in any of the tests we have.
What I could do, is to have an assert and also a graceful return in that case. 
That way we would get the benefit of both world.

https://github.com/llvm/llvm-project/pull/111138
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to