forked from OSchip/llvm-project
[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. llvm-svn: 179900
This commit is contained in:
parent
e632239d7b
commit
2a481fa63b
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue