summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-08-19 01:22:50 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-08-19 01:22:50 +0000
commitcbb67b58313c1d9b33a77150b39d5298569ef023 (patch)
tree3ab713659f6f3b3416ac67d39c7c013c4053a41e /www
parent1319614c1b7fd72d64c7561b89f3b9872a4f7a69 (diff)
downloadclang-cbb67b58313c1d9b33a77150b39d5298569ef023.tar.gz
[www] Add analyzer FAQ about not releasing ivars in -dealloc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www')
-rw-r--r--www/analyzer/faq.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/www/analyzer/faq.html b/www/analyzer/faq.html
index cf3dc70035..26ed91a88f 100644
--- a/www/analyzer/faq.html
+++ b/www/analyzer/faq.html
@@ -29,6 +29,7 @@ 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="#unlocalized_string">How do I tell the static analyzer that I don't care about a specific unlocalized string?</a></li>
+ <li><a href="#dealloc_mrr">How do I tell the analyzer that my instance variable does not need to be released in -dealloc under Manual Retain/Release?</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>
@@ -105,6 +106,15 @@ NSString *s = NSLocalizedString(@"Hello &lt;Do Not Localize&gt;", @"For debug pu
</pre>
</p>
+<h4 id="dealloc_mrr" class="faq">Q: How do I tell the analyzer that my instance variable does not need to be released in -dealloc under Manual Retain/Release?</h4>
+
+<p>If your class only uses an instance variable for part of its lifetime, it may
+maintain an invariant guaranteeing that the instance variable is always released
+before -dealloc. In this case, you can silence a warning about a missing release
+by either adding <tt>assert(_ivar == nil)</tt> or an explicit release
+<tt>[_ivar release]</tt> (which will be a no-op when the variable is nil) in
+-dealloc. </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">