[cfe-commits] [PATCH] 3 small static analyzer patches

Jordan Rose jordan_rose at apple.com
Fri Sep 21 09:51:32 PDT 2012


On Sep 21, 2012, at 8:19 , Sean McBride <sean at rogue-research.com> wrote:

>> Also, these patches seem to lack tests. Could you provide tests?
> 
> Perhaps... as I said, I was merely perusing the analyzer code out of curiosity I don't really know my way around clang's codebase.  But of course searching for 'OSCompareAndSwap' found what looks like a test in tools/clang/test/Analysis/NSString.m.... I don't get the relation to NSString, but I guess I'll add tests for the others there?

Hi, Sean. Both patches look reasonable, though there are a zillion other CompareAndSwap variants on our system that we're not currently handling. However, Ted's recent work on synthesized function bodies may make OSAtomicChecker unnecessary -- we'd just synthesize a single-threaded version of the function, and then inline it like any other inlineable function. So it's probably not worth it to update that checker right now, even with such a benign change.

The reallocf change looks good. The place to add a test is unix-fns.c, which you probably already found. I'll let you come up with a test case just to practice. ;-) Welcome to the static analyzer!

Jordan



More information about the cfe-commits mailing list