Static analyzer making unwarranted assumptions about ivars
Static analyzer making unwarranted assumptions about ivars
- Subject: Static analyzer making unwarranted assumptions about ivars
- From: Jens Alfke <email@hidden>
- Date: Tue, 15 Mar 2016 10:30:45 -0700
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. Likewise, it can’t assume that another thread randomly sets ivars to nil concurrently with the current thread. But those seem to be the only explanations for the warnings I’m getting.
The actual code is fairly complex, and when I’ve tried to extract it into a small test case I don’t get the warnings anymore. I should probably preprocess the entire files and attach them to some bug reports, but before I do that I’m asking whether there are things about the analyzer that I’m unaware of that might explain some of these.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden