<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -Wshadow-ivar fires at point of use"
   href="http://llvm.org/bugs/show_bug.cgi?id=16958">16958</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wshadow-ivar fires at point of use
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gwynne@darkrainfall.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The warning controlled by -Wshadow-ivar (declaration shadows instance variable)
for Objective-C is issued at every instance where such the shadowing variable
is used, rather than at the point of the shadowing declaration. For example:

@interface A : NSObject
@end

@implementation A
{
    NSString * __weak _str;
}

- (void)doSomethingHere
{
   _Pragma("clang diagnostic push");
   _Pragma("clang diagnostic ignored \"-Wshadow\"");
   _Pragma("clang diagnostic ignored \"-Wshadow-ivar\"");
   NSString * __strong _str = _str; // -Wshadow-ivar does not fire here
   _Pragma("clang diagnostic pop");

   NSLog(@"%@", _str); // -Wshadow-ivar DOES fire here
   [self doSomethingElseWith:_str]; // -Wshadow-ivar fires again here
}

@end

This makes it impractical to deliberately shadow instance variables. A common
use case is temporarily taking a strong reference to a weak ivar, as in the
example given.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>