diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-04-03 21:51:32 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-04-03 21:51:32 +0000 |
commit | 2705859981d12d1f66e9d480b682690ce47a2b72 (patch) | |
tree | 273023e40bd8e29f5b99a48cece7105986120440 /clang/lib | |
parent | 6c7917a844d49178eac40fd78f569bb63e20d622 (diff) | |
download | bcm5719-llvm-2705859981d12d1f66e9d480b682690ce47a2b72.tar.gz bcm5719-llvm-2705859981d12d1f66e9d480b682690ce47a2b72.zip |
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
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index fb042651f6d..299f101bdbf 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -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(), |