From cbb67b58313c1d9b33a77150b39d5298569ef023 Mon Sep 17 00:00:00 2001 From: Devin Coughlin Date: Fri, 19 Aug 2016 01:22:50 +0000 Subject: [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 --- www/analyzer/faq.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'www') 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?
  • How do I tell the static analyzer that I don't care about a specific dead store?
  • How do I tell the static analyzer that I don't care about a specific unused instance variable in Objective C?
  • How do I tell the static analyzer that I don't care about a specific unlocalized string?
  • +
  • How do I tell the analyzer that my instance variable does not need to be released in -dealloc under Manual Retain/Release?
  • 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?
  • How can I suppress a specific analyzer warning?
  • How can I selectively exclude code the analyzer examines?
  • @@ -105,6 +106,15 @@ NSString *s = NSLocalizedString(@"Hello <Do Not Localize>", @"For debug pu

    +

    Q: How do I tell the analyzer that my instance variable does not need to be released in -dealloc under Manual Retain/Release?

    + +

    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 assert(_ivar == nil) or an explicit release +[_ivar release] (which will be a no-op when the variable is nil) in +-dealloc.

    +

    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?

    example use assert -- cgit v1.2.1