[PATCH] D99260: [analyzer] Fix false positives in inner pointer checker (PR49628)

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 29 02:33:45 PDT 2021


vsavchenko added a comment.

In D99260#2650201 <https://reviews.llvm.org/D99260#2650201>, @steakhal wrote:

> I recommend splitting this into two. I would happily accept the part about `std::data()`.
>
> IMO `std::addressof()` should be modelled via `evalCall` as a pure function, instead of hacking it into the `InnerPtrChecker`.

It does make sense to split these in two, but I'm not so sure about `evalCall`.  It is definitely not something that `InnerPtrChecker` should be bothered with.  Another point is that `std::addressof` might be only one of the function receiving a non-const reference and not modifying it, so it would
be nice to have a place in this checker where such exception is made.

> It is overloaded to accept `const T&` as well, so the comment about //"std::addressof function accepts a non-const reference as an argument"// is not entirely true.

But it has a `T &` overload as well, and this is the one causing the FP.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99260



More information about the cfe-commits mailing list