[analyzer] Update alpha and potential checker documentation, esp. alpha.valist

Summary:
Move alpha.valist from potential to alpha since it was implemented in D15227

Cleanup some HTML comments, add a missing link

Reviewers: jordan_rose, zaks.anna

Subscribers: cfe-commits, xazax.hun

Differential Revision: https://reviews.llvm.org/D25663

llvm-svn: 284445
This commit is contained in:
Dominic Chen 2016-10-18 01:15:19 +00:00
parent 62113e854a
commit a1ab61cd8b
2 changed files with 78 additions and 65 deletions

View File

@ -26,13 +26,14 @@ Patches welcome!
<ul>
<li><a href="#core_alpha_checkers">Core Alpha Checkers</a></li>
<li><a href="#cplusplus_alpha_checkers">C++ Alpha Checkers</a></li>
<li><a href="#valist_alpha_checkers">Variable Argument Alpha Checkers</a></li>
<li><a href="#deadcode_alpha_checkers">Dead Code Alpha Checkers</a></li>
<li><a href="#osx_alpha_checkers">OS X Alpha Checkers</a></li>
<li><a href="#security_alpha_checkers">Security Alpha Checkers</a></li>
<li><a href="#unix_alpha_checkers">Unix Alpha Checkers</a></li>
</ul>
<!------------------------------ core alpha ----------------------------------->
<!-- ============================= core alpha ============================= -->
<h3 id="core_alpha_checkers">Core Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
@ -179,7 +180,7 @@ int test(struct s *p) {
</tbody></table>
<!--------------------------- cplusplus alpha --------------------------------->
<!-- =========================== cplusplus alpha =========================== -->
<h3 id="cplusplus_alpha_checkers">C++ Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
@ -226,7 +227,76 @@ public:
</tbody></table>
<!--------------------------- dead code alpha --------------------------------->
<!-- =============================== va_list =============================== -->
<h3 id="valist_alpha_checkers">Variable Argument Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
<thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
<tbody>
<tr><td><div class="namedescr expandable"><span class="name">
alpha.valist.CopyToSelf</span><span class="lang">
(C)</span><div class="descr">
Calls to the <code>va_copy</code> macro should not copy onto itself.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
va_start(args, x);
va_copy(args, args); // warn
va_end(args);
}
</pre></div></div></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
alpha.valist.Uninitialized</span><span class="lang">
(C)</span><div class="descr">
Calls to the <code>va_arg</code>, <code>va_copy</code>, or
<code>va_end</code> macro must happen after calling <code>va_start</code> and
before calling <code>va_end</code>.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
int y = va_arg(args, int); // warn
}
</pre></div>
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
va_start(args, x);
va_end(args);
int z = va_arg(args, int); // warn
}
</pre></div></div></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
alpha.valist.Unterminated</span><span class="lang">
(C)</span><div class="descr">
Every <code>va_start</code> must be matched by a <code>va_end</code>. A va_list
can only be ended once.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
va_start(args, x);
int y = x + va_arg(args, int);
} // warn: missing va_end
</pre></div></div></td></tr>
</tbody></table>
<!-- =========================== dead code alpha =========================== -->
<h3 id="deadcode_alpha_checkers">Dead Code Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
@ -267,7 +337,7 @@ void test(id x) {
</pre></div></div></td></tr>
</tbody></table>
<!---------------------------- OS X alpha -------------------------------------->
<!-- ============================== OS X alpha ============================== -->
<h3 id="osx_alpha_checkers">OS X Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
@ -433,7 +503,7 @@ invalidatable instance variables.</div></div></td>
</tbody></table>
<!------------------------- security alpha ------------------------------------>
<!-- =========================== security alpha =========================== -->
<h3 id="security_alpha_checkers">Security Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
@ -584,7 +654,7 @@ void test() {
</tbody></table>
<!--------------------------- unix alpha -------------------------------------->
<!-- ============================= unix alpha ============================= -->
<h3 id="unix_alpha_checkers">Unix Alpha Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>

View File

@ -180,64 +180,6 @@ void test(A *dst, A *src) {
</table>
<!-- =============================== va_list =============================== -->
<h3>va_list</h3>
<table class="checkers">
<col class="namedescr"><col class="example"><col class="progress">
<thead><tr><td>Name, Description</td><td>Example</td><td>Progress</td></tr></thead>
<tr><td><div class="namedescr expandable"><span class="name">
valist.Uninitialized</span><span class="lang">
(C)</span><div class="descr">
Calls to the <code>va_arg</code>, <code>va_copy</code>, or
<code>va_end</code> macro must happen after calling <code>va_start</code> and
before calling <code>va_end</code>.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
int y = va_arg(args, int); // warn
}
</pre></div>
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
va_start(args, x);
va_end(args);
int z = va_arg(args, int); // warn
}
</pre></div></div></td>
<td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=16812">
PR16811</a></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
valist.Unterminated</span><span class="lang">
(C)</span><div class="descr">
Every <code>va_start</code> must be matched by a <code>va_end</code>. A va_list
can only be ended once.
<i>This should be folded into the generalized "ownership checker"
described on the <a href="open_projects.html">
Open Projects</a> page.</i></div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
#include &lt;stdarg.h&gt;
void test(int x, ...) {
va_list args;
va_start(args, x);
int y = x + va_arg(args, int);
} // warn: missing va_end
</pre></div></div></td>
<td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=16812">
PR16812</a></td></tr>
</table>
<!-- ============================== exceptions ============================= -->
<h3>exceptions</h3>
<table class="checkers">
@ -384,7 +326,8 @@ void test() {
// warn: the right operand to '-' is always 0
}
</pre></div></div></td>
<td class="aligned">removed from alpha.deadcode.* at r198476</td></tr>
<td class="aligned">removed from alpha.deadcode.* at
<a href="https://reviews.llvm.org/rL198476">r198476</a></td></tr>
</table>