r176335 - [analyzer] Reword FAQ

Anna Zaks ganna at apple.com
Thu Feb 28 22:38:16 PST 2013


Author: zaks
Date: Fri Mar  1 00:38:16 2013
New Revision: 176335

URL: http://llvm.org/viewvc/llvm-project?rev=176335&view=rev
Log:
[analyzer] Reword FAQ
Reword the FAQ to stress more that the assert should be used only in case
the developer is sure that the issue is a false positive.

Modified:
    cfe/trunk/www/analyzer/faq.html

Modified: cfe/trunk/www/analyzer/faq.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/faq.html?rev=176335&r1=176334&r2=176335&view=diff
==============================================================================
--- cfe/trunk/www/analyzer/faq.html (original)
+++ cfe/trunk/www/analyzer/faq.html Fri Mar  1 00:38:16 2013
@@ -68,13 +68,15 @@ int foo(int *b) {
 
 <img src="images/example_use_assert.png" alt="example use assert">
 
-<p>You can teach the analyzer facts about your code as well as document it by
-using assertions. In the contrived example above, the analyzer reports an error
-on the path which assumes that the loop is never entered. However, the owner of
-the code might know that the loop is always entered because the input parameter
-<tt>length</tt> is always greater than <tt>0</tt>. The false positive can be
-suppressed by asserting this knowledge, adding <tt>assert(length > 0)</tt> in
-the beginning of the function.</p>
+<p> In the contrived example above, the analyzer has detected that the body of 
+the loop is never entered for the case where <tt>length <= 0</tt>. In this 
+particular example, you may know that the loop will always be entered because 
+the input parameter <tt>length</tt> will be greater than zero in all calls to this 
+function. You can teach the analyzer facts about your code as well as document 
+it by using assertions. By adding <tt>assert(length > 0)</tt> in the beginning 
+of the function, you tell the analyzer that your code is never expecting a zero 
+or a negative value, so it won't need to test the correctness of those paths.
+</p>
 
 <pre class="code_example">
 int foo(int length) {





More information about the cfe-commits mailing list