Unused ivars checker: also check methods in categories that are defined in the same translation unit. Fixes <rdar://problem/6260004>.

llvm-svn: 85442
This commit is contained in:
Ted Kremenek 2009-10-28 22:18:22 +00:00
parent 3ab552ec74
commit 1c9401ec15
2 changed files with 30 additions and 0 deletions

View File

@ -74,6 +74,14 @@ static void Scan(IvarUsageMap& M, const ObjCContainerDecl* D) {
for (ObjCImplementationDecl::propimpl_iterator I = ID->propimpl_begin(),
E = ID->propimpl_end(); I!=E; ++I)
Scan(M, *I);
// Scan the associated categories as well.
for (const ObjCCategoryDecl *CD =
ID->getClassInterface()->getCategoryList(); CD ;
CD = CD->getNextClassCategory()) {
if (const ObjCCategoryImplDecl *CID = CD->getImplementation())
Scan(M, CID);
}
}
}

View File

@ -43,3 +43,25 @@
b();
}
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6260004> Detect that ivar is in use, if used in category
// in the same file as the implementation
//===----------------------------------------------------------------------===//
@protocol Protocol6260004
- (id) getId;
@end
@interface RDar6260004 {
@private
id x; // no-warning
}
@end
@implementation RDar6260004 @end
@implementation RDar6260004 (Protocol6260004)
- (id) getId {
return x;
}
@end