[PATCH] D120992: [analyzer] ReverseNull: New checker to warn for pointer value conditions, if the pointer value is unconditionally non-null

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 11:08:00 PST 2022


NoQ added a comment.

In D120992#3359864 <https://reviews.llvm.org/D120992#3359864>, @steakhal wrote:

> BTW what is the semantics of `[p retain]` in ObjC? Can `p` be null in that context? Or does it count as a dereferences, hence it constraints the pointer?

In Objective-C "methods" can be "called" on null pointers. The well-defined result is that nothing happens and null is returned. If the method returns an integer, a zero is returned. If the method returns a structure by value, a zero-filled structure is returned. In Objective-C++, if the method returns a C++ object by value, a zero-filled object is returned (without calling the constructor; in particular, the object may be ill-formed from the start).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120992



More information about the cfe-commits mailing list