Static Analyzer doesn't always analyze all touched files?
Static Analyzer doesn't always analyze all touched files?
- Subject: Static Analyzer doesn't always analyze all touched files?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 21 Jan 2014 00:25:43 -0800
Ever since we got the Product > Analyze, I’d assumed that this was supposed to analyze, at least, all touched files, analogous to the behavior of Product > Build. But I’ve long suspected that it doesn’t always do that.
Tonight, after coding some memory-management tricks on a non-ARC project, I did a Product > Analyze and, after a few *seconds*, it did not report an issue I was expecting it to. (It did report the usual 1 warning in the Sparkle framework and 36 warnings in sqlite.c, which are known false alarms.) So, as a test, I added this obvious memory management error to a method…
NSString* x = [[NSString alloc] initWithString:@"Hello"] ;
NSLog(@"%@", x) ;
// No further reference to x
I then executed Product > Analyze again, and after a few seconds again, this issue was not reported in the results either.
Then I looked at Build Settings. I found that “Improper Memory Management” *was* at its default setting of YES. I left it that way and changed a different build setting, then did Product > Analyze again. This time, after several minutes, (instead of seconds), it found the obvious memory management error, also found my trick memory management, and also found another little memory leak which was apparently shipped in my most recent update! Of course, changing a Build Setting “touches” everything and hence the longer analysis time.
After playing with this for about an hour I think that the reporting or non-reporting of memory management errors (at least) can only occur on the first Analyze after Build Settings have been touched, but may not. In one test, I pasted the exact same memory management error into two files. The one in which I had pasted it in most recently was reported, but the one where it had been for several build cycles, although its file was touched in other ways, was never reported.
Does anyone know how this works? I’d like to have a procedure as part of my automatic build and ship that would be guaranteed to analyze everything. During my testing, I also tried a Product > Clean, before Analyze, but that did not help, just took much longer to analyze.
Thanks,
Jerry Krinock
_______________________________________________
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