[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 26 04:44:02 PST 2021
steakhal added a comment.
In D96976#2587513 <https://reviews.llvm.org/D96976#2587513>, @RedDocMD wrote:
> Many thanks for you comments, @steakhal!
> I will address the issues you have pointed out in this comment. To clean things up I should perhaps add some more clarification to the summary.
>
>> Could you elaborate on what approach did you choose and more importantly, why that approach?
>> Why do we need a graph search here?
>
> Pointer-to-members contain two things - a pointer to a NamedDecl to store the field/method being pointed to and a list of CXXBaseSpeciifier. This list is used to determine which sub-object the member lies in. This path needs to be determined and unfortunately with `reinterpret_cast`, the AST provides no structural assistance (unlike `static_cast`). Hence, it needs to be searched by searching through the BaseSpecifiers of the `CXXRecordDecl`.
So here you are implying that for reinterpret casts, the `CastE->path_begin()-end()` range is empty? And that is why you need to manually come up with a //possible// CXXBaseSpecifier list?
I strongly encourage you to find a better alternative to this manual graph search.
This information must be available somewhere.
Have you looked at `CXXRecordDecl::isDerivedFrom()`? Or any other member functions of that class?
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