Real corener case of a method declared in a protocol

used in a class which declares a property of the same
name. This should not result in an unimplemented
method warning.

llvm-svn: 68409
This commit is contained in:
Fariborz Jahanian 2009-04-03 21:51:32 +00:00
parent 6c7917a844
commit 2705859981
2 changed files with 26 additions and 2 deletions

View File

@ -866,8 +866,15 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc,
ObjCMethodDecl *method = *I;
if (method->getImplementationControl() != ObjCMethodDecl::Optional &&
!method->isSynthesized() && !InsMap.count(method->getSelector()) &&
(!Super || !Super->lookupInstanceMethod(method->getSelector())))
WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
(!Super || !Super->lookupInstanceMethod(method->getSelector()))) {
// Ugly, but necessary. Method declared in protcol might have
// have been synthesized due to a property declared in the class which
// uses the protocol.
ObjCMethodDecl *MethodInClass =
IDecl->lookupInstanceMethod(method->getSelector());
if (!MethodInClass || !MethodInClass->isSynthesized())
WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
}
}
// check unimplemented class methods
for (ObjCProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(),

View File

@ -0,0 +1,17 @@
// RUN: clang-cc -fsyntax-only -verify %s
@protocol CYCdef
- (int)name;
@end
@interface JSCdef <CYCdef> {
int name;
}
@property (assign) int name;
@end
@implementation JSCdef
@synthesize name;
@end