summaryrefslogtreecommitdiffstats
path: root/clang/www
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2015-10-27 20:19:38 +0000
committerAnna Zaks <ganna@apple.com>2015-10-27 20:19:38 +0000
commitac98dbc33ba4d510700b4235cb4007ed94247515 (patch)
tree009f006a9cd2783807c5d07f492f1a08e0cab0c1 /clang/www
parent9a95c9a633d3dd8ca04d984e655dca85acd1d090 (diff)
downloadbcm5719-llvm-ac98dbc33ba4d510700b4235cb4007ed94247515.tar.gz
bcm5719-llvm-ac98dbc33ba4d510700b4235cb4007ed94247515.zip
[analyzer] Enhance FAQ with instructions on handing unused variables.
llvm-svn: 251448
Diffstat (limited to 'clang/www')
-rw-r--r--clang/www/analyzer/faq.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/www/analyzer/faq.html b/clang/www/analyzer/faq.html
index 129bfb63bb1..9d2962b1121 100644
--- a/clang/www/analyzer/faq.html
+++ b/clang/www/analyzer/faq.html
@@ -26,6 +26,8 @@ the bug is reached?</a></li>
<li><a href="#null_pointer">The analyzer reports a null dereference, but I know that the
pointer is never null. How can I tell the analyzer that a pointer can never be
null?</a></li>
+ <li><a href="#dead_store">How do I tell the static analyzer that I don't care about a specific dead store?</a></li>
+ <li><a href="#unused_ivar">How do I tell the static analyzer that I don't care about a specific unused instance variable in Objective C?</a></li>
<li><a href="#use_assert">The analyzer assumes that a loop body is never entered. How can I tell it that the loop body will be entered at least once?</a></li>
<li><a href="#suppress_issue">How can I suppress a specific analyzer warning?</a></li>
<li><a href="#exclude_code">How can I selectively exclude code the analyzer examines?</a></li>
@@ -64,6 +66,18 @@ int foo(int *b) {
return *b;
}</pre>
+<h4 id="dead_store" class="faq">Q: How do I tell the static analyzer that I don't care about a specific dead store?</h4>
+
+<p>When the analyzer sees that a value stored into a variable is never used, it's going to produce a message similar to this one:
+<pre class="code_example">Value stored to 'x' is never read</pre>
+You can use the <tt>(void)x;</tt> idiom to acknowledge that there is a dead store in your code but you do not want it to be reported in the future.</p>
+
+<h4 id="unused_ivar" class="faq">Q: How do I tell the static analyzer that I don't care about a specific unused instance variable in Objective C?</h4>
+
+<p>When the analyzer sees that a value stored into a variable is never used, it is going to produce a message similar to this one:
+<pre class="code_example">Instance variable 'commonName' in class 'HappyBird' is never used by the methods in its @implementation</pre>
+You can add <tt>__attribute__((unused))</tt> to the instance variable declaration to suppress the warning.</p>
+
<h4 id="use_assert" class="faq">Q: The analyzer assumes that a loop body is never entered. How can I tell it that the loop body will be entered at least once?</h4>
<img src="images/example_use_assert.png" alt="example use assert">
OpenPOWER on IntegriCloud