[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member

Deep Majumder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 7 21:22:59 PST 2021


RedDocMD added a comment.

In D96976#2605815 <https://reviews.llvm.org/D96976#2605815>, @steakhal wrote:

> What is that caveat?

The second point in the link I gave above.

> Do you have anything specific in mind about implementing the 3rd option?
> Why do you think it's //significantly complex//?

The modelling is not so complex. We need to store in the pointer-to-member a bool to remember that it was reinterpret_casted, and a  CXXRecordDecl pointer to store where it was reinterpret_casted from. If it is reinterpret_casted back properly, then these are reset. If we do further reinterpret_casting or static_cast on this, then we can store in a bool that the pointer-to-member is unsafe to de-reference.
The problem is utilizing this fact (that pointer-to-member is safe or not to de-reference). This, I reckon, is a big refactor.
@steakhal, @vsavchenko, @NoQ what do you think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96976/new/

https://reviews.llvm.org/D96976



More information about the cfe-commits mailing list