forked from OSchip/llvm-project
Objective-C: Warn when fast enumeration variable isn't used.
// rdar://14182680. llvm-svn: 185762
This commit is contained in:
parent
c947ad2a2d
commit
ae26bb67f8
|
@ -93,9 +93,6 @@ void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) {
|
|||
return;
|
||||
}
|
||||
|
||||
// suppress any potential 'unused variable' warning.
|
||||
var->setUsed();
|
||||
|
||||
// foreach variables are never actually initialized in the way that
|
||||
// the parser came up with.
|
||||
var->setInit(0);
|
||||
|
|
|
@ -13,8 +13,8 @@ void f(NSArray *a) {
|
|||
* and no diagnostics even in pedantic mode should happen.
|
||||
* rdar://6814674
|
||||
*/
|
||||
for (id thisKey in keys);
|
||||
for (id thisKey in keys);
|
||||
for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
|
||||
for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
|
||||
}
|
||||
|
||||
/* // rdar://9072298 */
|
||||
|
@ -41,7 +41,7 @@ typedef struct {
|
|||
int main ()
|
||||
{
|
||||
NSObject<NSFastEnumeration>* collection = ((void*)0);
|
||||
for (id thing in collection) { }
|
||||
for (id thing in collection) { } /* expected-warning {{unused variable 'thing'}} */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue