<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 --- - -Wunused-property-ivar false positive with non-trivial setter override"
href="http://llvm.org/bugs/show_bug.cgi?id=18137">18137</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wunused-property-ivar false positive with non-trivial setter override
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sean@rogue-research.com
</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>Created <span class=""><a href="attachment.cgi?id=11666" name="attach_11666" title="repro case">attachment 11666</a> <a href="attachment.cgi?id=11666&action=edit" title="repro case">[details]</a></span>
repro case
With today's svn trunk, i.e.:
$ clang --version
clang version 3.5 (196392)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
I get a false positive from -Wunused-property-ivar with this code:
------------------
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@property (readwrite, copy, nonatomic) NSArray* array;
@end
@implementation Foo
@synthesize array = _array;
- (void)setArray:(NSArray*)inArray
{
NSMutableArray* lameCopy = [NSMutableArray array];
#if 1
for (id obj in inArray)
{
[lameCopy addObject:obj];
}
#endif
_array = lameCopy;
}
@end
int main (void)
{
return 0;
}
------------------
clang -fsyntax-only -Wunused-property-ivar ~/Desktop/test.m
/Users/sean/Desktop/test.m:10:1: warning: ivar '_array' which backs the
property is not referenced in this property's accessor [-Wunused-property-ivar]
- (void)setArray:(NSArray*)inArray
^
/Users/sean/Desktop/test.m:4:49: note: property declared here
@property (readwrite, copy, nonatomic) NSArray* array;
If I toggle the "#if 1" to "#if 0" the warning goes away, oddly. I see many
similar false positives in my actual codebase.
This warning seems to have been added in r193439 for <rdar://14989999> by
fjahanian.
If this exists in 3.4, please fix it there before 3.4 release.</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>