On Mar 15, 2016, at 12:30 PM, Jens Alfke <j...@mooseyard.com> wrote: > > I’ve got two inexplicable static analyzer warnings, which hinge on the > analyzer believing that an Obj-C ivar being nil. (In one case it's passed to > a parameter declared nonnull, in the other it’s tested for nil in an ‘if’, > and the bad situation happens inside the body of the ‘if’.) But in neither > case does the analyzer know that the ivar is nil. > > What kinds of assumptions does the static analyzer make about ivars? It can’t > just assume that any ivar may be nil on entry to any method, because that > would produce enormous numbers of false positives.
You're right about that. However, if the code being analyzed explicitly tests if the variable is nil, then that introduces the possibility that it might be, so the analyzer considers what happens if it is. In other words, some code may analyze as fine but then you add "if (someVar) {}" or similar to it and now the analyzer reports problems precisely because you've raised the possibility of the variable being nil. Not sure about the other case. Regards, Ken _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (Xcode-users@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to arch...@mail-archive.com