[PATCH] D23236: When ARC is enabled, no warning will be generated when a method1. Returns 'nil' in a method that is attributed to return a 'nonnull'2. The return-statement is a ConditionalOperator, where the lhs is nil and rhs an objC-method-call (or the other...

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 13:34:36 PDT 2016

ahatanak added a subscriber: cfe-commits.
ahatanak added a comment.


If this patch is applied, does clang issue a warning if a method marked "nonnull" returns a null value? I see a warning is issued for conditional expressions in the test case you've added, but I don't see a test case for a function returning just nil or 0.

I was wondering whether the change made in this patch contradicts what's stated in r240146's commit log:

"Note that we don't warn about nil returns from Objective-C methods,

  because it's common for Objective-C methods to mimic the nil-swallowing
  behavior of the receiver by checking ostensibly non-null parameters
  and returning nil from otherwise non-null methods in that


More information about the cfe-commits mailing list