зеркало из https://github.com/microsoft/clang-1.git
Clang static analyzer docs: fix a couple of HTML markup issues and non-UTF-8
characters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9074fbe189
Коммит
b4e45295a8
|
@ -127,6 +127,7 @@
|
|||
<tr>
|
||||
<td><b>osx.coreFoundation.CFRetainRelease</b></td><td>Check for null arguments to CFRetain/CFRelease.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>osx.coreFoundation.containers.OutOfBounds</b></td><td>Checks for index out-of-bounds when using 'CFArray' API.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<div id="content">
|
||||
<h1>List of potential checkers</h1>
|
||||
|
||||
<!---------------------------- allocation/deallocation -------------------------->
|
||||
<!-- ========================= allocation/deallocation ======================= -->
|
||||
<h3>allocation/deallocation</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -176,7 +176,7 @@ void test() {
|
|||
<tr><td><span class="name">memory.NegativeArraySize
|
||||
<br>enhancement to experimental.security.MallocOverflow<br>(C, C++)
|
||||
</span><br><br>
|
||||
‘n’ is used to specify the buffer size may be negative
|
||||
'n' is used to specify the buffer size may be negative
|
||||
</td><td><pre>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -189,7 +189,7 @@ void test() {
|
|||
|
||||
</table>
|
||||
|
||||
<!-------------------------- constructors/destructors ------------------------->
|
||||
<!-- ======================= constructors/destructors ====================== -->
|
||||
<h3>constructors/destructors</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -223,7 +223,7 @@ class A {
|
|||
|
||||
</table>
|
||||
|
||||
<!--------------------------------- exceptions -------------------------------->
|
||||
<!-- ============================== exceptions ============================= -->
|
||||
<h3>exceptions</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -260,7 +260,7 @@ void f() throw(int) {
|
|||
|
||||
</table>
|
||||
|
||||
<!---------------------------- smart pointers --------------------------------->
|
||||
<!-- ========================= smart pointers ============================== -->
|
||||
<h3>smart pointers</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -286,7 +286,7 @@ void test() {
|
|||
|
||||
</table>
|
||||
|
||||
<!---------------------------- undefined behavior ----------------------------->
|
||||
<!-- ========================= undefined behavior ========================== -->
|
||||
<h3>undefined behavior</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -432,7 +432,7 @@ void test() {
|
|||
B *b1 = new B;
|
||||
B b2;
|
||||
new (b1) T;
|
||||
new (&b2) T;
|
||||
new (&b2) T;
|
||||
delete b1; // warn
|
||||
} // warn
|
||||
</pre></td><td></td></tr>
|
||||
|
@ -485,7 +485,7 @@ void test() {
|
|||
*iq = 1; // warn
|
||||
|
||||
const Y y;
|
||||
Y* p = const_cast<Y*>(&y);
|
||||
Y* p = const_cast<Y*>(&y);
|
||||
p->x.i = 1; // ok
|
||||
p->x.j = 1; // warn
|
||||
}
|
||||
|
@ -544,10 +544,10 @@ struct non_POD : public POD {
|
|||
extern POD pod;
|
||||
extern non_POD non_pod;
|
||||
|
||||
int *p1 = &non_pod.j; // warn
|
||||
int *p2 = &non_pod.pod.i; // warn
|
||||
int *p3 = &pod.i; // ok
|
||||
POD *p4 = & non_pod; // warn
|
||||
int *p1 = &non_pod.j; // warn
|
||||
int *p2 = &non_pod.pod.i; // warn
|
||||
int *p3 = &pod.i; // ok
|
||||
POD *p4 = &non_pod; // warn
|
||||
|
||||
POD a;
|
||||
non_POD b;
|
||||
|
@ -555,7 +555,7 @@ non_POD b;
|
|||
struct S {
|
||||
int *k;
|
||||
non_POD non_pod;
|
||||
S() : k(&non_pod.j) {} // warn
|
||||
S() : k(&non_pod.j) {} // warn
|
||||
};
|
||||
|
||||
// C++11
|
||||
|
@ -572,10 +572,10 @@ struct non_trivial: public trivial {
|
|||
extern trivial t;
|
||||
extern non_trivial nt;
|
||||
|
||||
int *p1 = &nt.j; // warn
|
||||
int *p2 = &nt.i; // warn
|
||||
int *p3 = &t.i; // ok
|
||||
trivial *p4 = &nt;
|
||||
int *p1 = &nt.j; // warn
|
||||
int *p2 = &nt.i; // warn
|
||||
int *p3 = &t.i; // ok
|
||||
trivial *p4 = &nt;
|
||||
|
||||
trivial t;
|
||||
non_trivial nt;
|
||||
|
@ -583,7 +583,7 @@ non_trivial nt;
|
|||
struct S {
|
||||
int *k;
|
||||
non_trivial nt;
|
||||
S() : k(&nt.j) {} // warn
|
||||
S() : k(&nt.j) {} // warn
|
||||
};
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
|
@ -820,12 +820,12 @@ The effects are undefined if an exception is thrown.
|
|||
</td><td><pre>
|
||||
struct S {
|
||||
int i, j;
|
||||
S (const S &s) {
|
||||
S (const S &s) {
|
||||
i = s.i;
|
||||
throw 1; // warn
|
||||
j = s.j;
|
||||
};
|
||||
S& operator=(const S &s) {
|
||||
S &operator=(const S &s) {
|
||||
i = s.i;
|
||||
throw 1; // warn
|
||||
j = s.j;
|
||||
|
@ -993,8 +993,8 @@ class my_streambuf : public std::streambuf {
|
|||
|
||||
void test() {
|
||||
std::filebuf fb;
|
||||
std::istream in(&fb);
|
||||
std::ostream out(&fb);
|
||||
std::istream in(&fb);
|
||||
std::ostream out(&fb);
|
||||
std::filebuf::off_type pos(-1);
|
||||
in.seekg(pos); // warn
|
||||
out.seekp(-1); // warn
|
||||
|
@ -1002,7 +1002,7 @@ void test() {
|
|||
</pre></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
<!------------------------------- different ----------------------------------->
|
||||
<!-- ============================ different ================================ -->
|
||||
<h3>different</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -1175,8 +1175,8 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.WrongVarForStmt
|
||||
<br>(C, C++)</span><br><br>
|
||||
Possibly wrong variable is used in the loop/cond-expression of the ‘for’
|
||||
statement. Did you mean ‘proper_variable_name’?
|
||||
Possibly wrong variable is used in the loop/cond-expression of the 'for'
|
||||
statement. Did you mean 'proper_variable_name'?
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
int i;
|
||||
|
@ -1213,21 +1213,21 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.BitwiseOpBoolArg
|
||||
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
||||
bool value is used at the left/right part of the & (|) operator. Did you mean
|
||||
&& (||) ?
|
||||
bool value is used at the left/right part of the & (|) operator. Did you mean
|
||||
&& (||) ?
|
||||
</td><td><pre>
|
||||
int f();
|
||||
|
||||
void test() {
|
||||
bool b = true;
|
||||
if (b & f()) {} // warn
|
||||
if (b & f()) {} // warn
|
||||
}
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
<tr><td><span class="name">different.LabelInsideSwitch
|
||||
<br>(C)</span><br><br>
|
||||
Possible misprint: label found inside the switch() statement. (* did you mean
|
||||
‘default’?)
|
||||
'default'?)
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
int c = 7;
|
||||
|
@ -1242,7 +1242,7 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.IdenticalCondIfIf
|
||||
<br>(C)</span><br><br>
|
||||
The conditions of two subsequent ‘if’ statements are identical
|
||||
The conditions of two subsequent 'if' statements are identical
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
int c = 7;
|
||||
|
@ -1255,7 +1255,7 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.CondOpIdenticalReturn
|
||||
<br>(C)</span><br><br>
|
||||
The return expressions of the ‘?:’ operator are identical
|
||||
The return expressions of the '?:' operator are identical
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
unsigned a;
|
||||
|
@ -1265,7 +1265,7 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.UnaryPlusWithUnsigned
|
||||
<br>(C)</span><br><br>
|
||||
Using ‘unary +’ with unsigned is meaningless
|
||||
Using 'unary +' with unsigned is meaningless
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
unsigned a;
|
||||
|
@ -1275,11 +1275,11 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.LogicalOpUselessArg
|
||||
<br>(C)</span><br><br>
|
||||
The second operand of the && operator has no impact on expression result
|
||||
The second operand of the && operator has no impact on expression result
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
unsigned a;
|
||||
if (a<7 && a<10) {}; // warn
|
||||
if (a<7 && a<10) {}; // warn
|
||||
}
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
|
@ -1290,14 +1290,14 @@ The expression always evaluates to true/false
|
|||
void test() {
|
||||
int i=0;
|
||||
if (i!=0) {}; // warn
|
||||
if (i==0 && i==1) {}; // warn
|
||||
if (i==0 && i==1) {}; // warn
|
||||
if (i<0 || i>=0) {}; // warn
|
||||
}
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
<tr><td><span class="name">different.SameResUnsignedCmp
|
||||
<br>(C)</span><br><br>
|
||||
Comparison of unsigned expression ‘op expr’ is always true/false
|
||||
Comparison of unsigned expression 'op expr' is always true/false
|
||||
</td><td><pre>
|
||||
void test() {
|
||||
unsigned u;
|
||||
|
@ -1309,7 +1309,7 @@ void test() {
|
|||
<tr><td><span class="name">different.OpPrecedenceAssignCmp
|
||||
<br>(C)</span><br><br>
|
||||
Comparison operation has higher precedence then assignment. Bool value is
|
||||
assigned to variable of type ‘type’. Parenthesis may bee required around an
|
||||
assigned to variable of type 'type'. Parenthesis may bee required around an
|
||||
assignment
|
||||
</td><td><pre>
|
||||
int f();
|
||||
|
@ -1339,7 +1339,7 @@ void test() {
|
|||
<br>(C++)</span><br><br>
|
||||
The object was created but is not being used<br><br>
|
||||
The exception object was created but is not being used. Did you mean
|
||||
‘throw std::exception();’ ?
|
||||
'throw std::exception();'?
|
||||
</td><td><pre>
|
||||
#include <exception>
|
||||
|
||||
|
@ -1374,7 +1374,7 @@ void test() {
|
|||
|
||||
<tr><td><span class="name">different.ConversionToBool
|
||||
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
|
||||
Odd implicit conversion from ‘type’ to ‘bool’
|
||||
Odd implicit conversion from 'type' to 'bool'
|
||||
</td><td><pre>
|
||||
bool test() {
|
||||
return 1.; // warn
|
||||
|
@ -1488,7 +1488,7 @@ public:
|
|||
|
||||
</table>
|
||||
|
||||
<!------------------------------- WinAPI -------------------------------------->
|
||||
<!-- ============================ WinAPI =================================== -->
|
||||
<h3>WinAPI</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -1507,7 +1507,7 @@ void test() {
|
|||
BOOL fSuccess;
|
||||
fSuccess = CreateProcess(
|
||||
NULL, TEXT("MyProgram.exe"), NULL, NULL,
|
||||
TRUE, 0, NULL, NULL, &si, &pi);
|
||||
TRUE, 0, NULL, NULL, &si, &pi);
|
||||
} // warn
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
|
@ -1548,7 +1548,7 @@ void test()
|
|||
|
||||
</table>
|
||||
|
||||
<!------------------------------ optimization --------------------------------->
|
||||
<!-- =========================== optimization ============================== -->
|
||||
<h3>optimization</h3>
|
||||
<table class="checkers">
|
||||
<col class="namedescr"><col class="example"><col class="progress">
|
||||
|
@ -1593,14 +1593,14 @@ variable
|
|||
|
||||
void test() {
|
||||
const char* s = "abc";
|
||||
if (strlen(s) > 0 &&
|
||||
if (strlen(s) > 0 &&
|
||||
strlen(s) < 7) {}; // warn
|
||||
}
|
||||
</pre></td><td></td></tr>
|
||||
|
||||
<tr><td><span class="name">optimization.EmptyCstrDetect
|
||||
<br>(C)</span><br><br>
|
||||
Optimization: it is more efficient to use “str[0] != ‘\0’” to identify an empty
|
||||
Optimization: it is more efficient to use "str[0] != '\0'" to identify an empty
|
||||
string
|
||||
</td><td><pre>
|
||||
#include <string.h>
|
||||
|
|
Загрузка…
Ссылка в новой задаче