[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
================
@@ -797,6 +798,10 @@ RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const {
return {};
}
+ const MemRegion *R = getCXXThisVal().getAsRegion();
+ DynamicTypeInfo DynType = getDynamicTypeInfo(getState(), R);
----------------
Xazax-hun wrote:
My understanding is that we do this lookup twice now and we only need the result of `DynType.canBeASubClass()`.
I wonder if it would make sense for ` getDeclForDynamicType()` to return a pair, the pointer to a declaration and a bool if the dynamic type could be a subclass to avoid the extra lookup. Other clients of that API might also want to know how precise is the dynamic type.
https://github.com/llvm/llvm-project/pull/111138
More information about the cfe-commits
mailing list