diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-04-19 22:19:14 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-04-19 22:19:14 +0000 |
commit | e4cabeee0cc5903e5ebf1536f56c2d27c08fba72 (patch) | |
tree | a3c71d846bb77fd2b5d51c3a1f0abc2f9236a9cb | |
parent | 0105ae535397b1e876e896bf4eb6dccb780f2f2a (diff) |
[analyzer] Website: update lists of potential and actual checkers.
- memory.MismatchedDelete, memory.MultipleDelete, and memory.DeallocateNonPtr
are complete (unix.MismatchedDeallocator and cplusplus.NewDelete)
- Per discussion on the mailing list, different.UnaryPlusWithUnsigned has
dubious value; remove it.
- Add potential checker ctordtor.PlacementSelfCopy per an internal bug report.
- core.AttributeNonNull is now core.NonNullParamChecker, though no one should
be depending on this name anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179900 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | www/analyzer/available_checks.html | 21 | ||||
-rw-r--r-- | www/analyzer/potential_checkers.html | 83 |
2 files changed, 23 insertions, 81 deletions
diff --git a/www/analyzer/available_checks.html b/www/analyzer/available_checks.html index be15125a7e..8c7d9e987a 100644 --- a/www/analyzer/available_checks.html +++ b/www/analyzer/available_checks.html @@ -30,15 +30,15 @@ <td><b>core.AdjustedReturnValue</b></td><td>Check to see if the return value of a function call is different than the caller expects (e.g., from calls through function pointers).</td> </tr> <tr> -<td><b>core.AttributeNonNull</b></td><td>Check for null pointers passed as arguments to a function whose arguments are marked with the 'nonnull' attribute.</td> -</tr> -<tr> <td><b>core.CallAndMessage</b></td><td>Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).</td> </tr> <tr> <td><b>core.DivideZero</b></td><td>Check for division by zero.</td> </tr> <tr> +<td><b>core.NonNullParamChecker</b></td><td>Check for null pointers passed as arguments to a function whose arguments are known to be non-null.</td> +</tr> +<tr> <td><b>core.NullDereference</b></td><td>Check for dereferences of null pointers.</td> </tr> <tr> @@ -72,6 +72,9 @@ <td><b>core.uninitialized.UndefReturn</b></td><td>Check for uninitialized values being returned to the caller.</td> </tr> <tr> +<td><b>cplusplus.NewDelete</b></td><td>Check for double-free and use-after-free problems involving C++ <code>delete</code>.</td> +</tr> +<tr> <td><b>deadcode.DeadStores</b></td><td>Check for values stored to variables that are never read afterwards.</td> </tr> <!-- @@ -80,16 +83,13 @@ </tr> --> <tr> -<td><b>osx.API</b></td><td>Check for proper uses of various Mac OS X APIs.</td> -</tr> -<tr> -<td><b>osx.AtomicCAS</b></td><td>Evaluate calls to OSAtomic functions.</td> +<td><b>osx.API</b></td><td>Check for proper uses of various Apple APIs.</td> </tr> <tr> <td><b>osx.SecKeychainAPI</b></td><td>Check for proper uses of Secure Keychain APIs.</td> </tr> <tr> -<td><b>osx.cocoa.AtSync</b></td><td>Check for null pointers used as mutexes for @synchronized.</td> +<td><b>osx.cocoa.AtSync</b></td><td>Check for nil pointers used as mutexes for @synchronized.</td> </tr> <tr> <td><b>osx.cocoa.ClassRelease</b></td><td>Check for sending 'retain', 'release', or 'autorelease' directly to a Class.</td> @@ -164,12 +164,15 @@ <td><b>unix.API</b></td><td>Check calls to various UNIX/Posix functions.</td> </tr> <tr> -<td><b>unix.Malloc</b></td><td>Check for memory leaks, double free, and use-after-free problems.</td> +<td><b>unix.Malloc</b></td><td>Check for memory leaks, double free, and use-after-free problems involving <code>malloc</code>.</td> </tr> <tr> <td><b>unix.MallocSizeof</b></td><td>Check for dubious malloc arguments involving sizeof.</td> </tr> <tr> +<td><b>unix.MismatchedDeallocator</b></td><td>Check for mismatched deallocators (e.g. passing a pointer allocating with <code>new</code> to <code>free()</code>).</td> +</tr> +<tr> <td><b>unix.cstring.BadSizeArg</b></td><td>Check the size argument passed into C string functions for common erroneous patterns.</td> </tr> <tr> diff --git a/www/analyzer/potential_checkers.html b/www/analyzer/potential_checkers.html index 04bf9fe45d..c769541e70 100644 --- a/www/analyzer/potential_checkers.html +++ b/www/analyzer/potential_checkers.html @@ -62,43 +62,6 @@ void test() { </pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15238">PR15238</a> </td></tr> -<tr><td><span class="name">memory.MismatchedDelete -<br>(C, C++)</span><br><br> -Mismatched deallocation function is used -</td><td><pre> -#include <stdlib.h> - -void test() { - int *p1 = new int; - int *p2 = new int[1]; - int *p3 = (int*)malloc(sizeof(int)); - - delete[] p1; // warn - delete p2; // warn - delete p3; // warn -} -</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15238">PR15238</a> -</td></tr> - -<tr><td><span class="name">memory.MultipleDelete -<br>(C++)</span><br><br> -Attempt to deallocate released memory -</td><td><pre> -#include <new> - -void test() { - int *p1 = new int; - int *p2 = new(p1) int; - int *p3 = p1; - delete p1; - delete p1; // warn - delete p2; // warn - delete p3; // warn -} -</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15237">PR15237</a> -</td></tr> - - <tr><td><span class="name">memory.LeakPtrValChanged <br>enhancement to unix.Malloc<br>(C, C++)</span><br><br> Potential memory leak: a pointer to newly allocated data loses its original @@ -124,31 +87,6 @@ void test() { </pre></td><td class="aligned">done at r174678 (C case) </td></tr> - -<tr><td><span class="name">memory.DeallocateNonPtr -<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br> -Deallocation function is applied to non-pointer -</td><td><pre> -#include <stdlib.h> - -class A { - int *p; -public: - operator int *() { return p; } -}; - -void test() { - A a; - delete a; // warn - free(a); // warn - const char *s = "text"; - delete s; // warn - free(s); // warn -} -</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15237">PR15237</a> -</td></tr> - - <tr><td><span class="name">memory.LeakEvalOrder<br> (C, C++)</span><br><br> Potential memory leak: argument evaluation order is undefined, g() may never be called @@ -232,6 +170,17 @@ class A { }; </pre></td><td class="aligned"></td></tr> +<tr><td><span class="name">ctordtor.PlacementSelfCopy<br> +(C++11)</span><br><br> +For a placement copy or move, it is almost certainly an error if the constructed object is also the object being copied from. +</td><td><pre> +class A {}; + +void test(A *dst, A *src) { + ::new (dst) A(*dst); // warn (should be 'src') +} +</pre></td><td class="aligned"><!--rdar://problem/13688366--></td></tr> + </table> <!-- ============================== exceptions ============================= --> @@ -1276,16 +1225,6 @@ void test() { } </pre></td><td class="aligned"></td></tr> -<tr><td><span class="name">different.UnaryPlusWithUnsigned -<br>(C)</span><br><br> -Using 'unary +' with unsigned is meaningless -</td><td><pre> -void test() { - unsigned a; - a = +a; // warn -} -</pre></td><td class="aligned"></td></tr> - <tr><td><span class="name">different.LogicalOpUselessArg <br>(C)</span><br><br> The second operand of the && operator has no impact on expression result |