[cfe-commits] [PATCH] WIP: catch CFMakeCollectable(NULL) with static analyzer

Jordan Rose jordan_rose at apple.com
Fri Nov 2 09:49:37 PDT 2012


Hi, Sean. Thanks for the patch!

Most of the tests in retain-release.m are just top-level functions, numbered numerically from lack of imagination. The arguments are fairly arbitrary—'p' is just 'pointer' (I think), and 'x' is being used as a sort of "coin toss" to arbitrarily create conditions where the analyzer considers both branches equally likely.

The actual patch itself looks good, except I'd stick an 'llvm_unreachable' in a last 'else' case for that chained if-statement.

Your test output is fine; if something broke it would say "Unexpected Failures" and probably print output from that test as well.

Once you've updated the patch, please send it back to the list!
Jordan


On Nov 1, 2012, at 12:17 , Sean McBride <sean at rogue-research.com> wrote:

> Hi all,
> 
> Attached is a patch that expands the analyzer's check for CFRelease(NULL) to also catch CFMakeCollectable(NULL).
> 
> It builds, and the resulting clang does now warn on CFMakeCollectable(NULL), but I have not added a test.  I'm pretty sure the test belongs in retain-release.m in f16() and f17(), but don't see who calls them, what their parameters mean, or what their names mean.
> 
> I ran the test suite:
> 
> $ make check-clang
> 
> [100%] Running the Clang regression tests
> lit.py: lit.cfg:171: note: using clang: '/Users/smcbride/Documents/Development/llvm-bin/bin/./clang'
> Testing Time: 169.28s
>  Expected Passes    : 5511
>  Expected Failures  : 24
>  Unsupported Tests  : 5
> [100%] Built target check-clang
> 
> Not sure what output I should see... I guess this indicates nothing got broken?
> 
> Thanks,
> 
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
> <CFMakeCollectable-with-null.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list