From e793a6ec1617376c7c320dc0b9808dce5450d726 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 24 Nov 2008 22:16:00 +0000 Subject: [PATCH] Patch to remove bogus waring when a property declaration is imported from a protocol into the implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59988 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclObjC.cpp | 2 +- test/SemaObjC/property-noprotocol-warning.m | 36 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/SemaObjC/property-noprotocol-warning.m diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 4d4c82be69..95737af18a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -610,7 +610,7 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, E = PDecl->instmeth_end(); I != E; ++I) { ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && - !InsMap.count(method->getSelector()) && + !method->isSynthesized() && !InsMap.count(method->getSelector()) && (!Super || !Super->lookupInstanceMethod(method->getSelector()))) WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); } diff --git a/test/SemaObjC/property-noprotocol-warning.m b/test/SemaObjC/property-noprotocol-warning.m new file mode 100644 index 0000000000..021c7874a9 --- /dev/null +++ b/test/SemaObjC/property-noprotocol-warning.m @@ -0,0 +1,36 @@ +// RUN: clang -fsyntax-only -verify %s + + +@interface Object +- (id) new; +@end + +@protocol GCObject +@property int class; +@end + +@protocol DerivedGCObject +@property int Dclass; +@end + +@interface GCObject : Object { + int ifield; + int iOwnClass; + int iDclass; +} +@property int OwnClass; +@end + +@implementation GCObject : Object +@synthesize class=ifield; +@synthesize Dclass=iDclass; +@synthesize OwnClass=iOwnClass; +@end + +int main(int argc, char **argv) { + GCObject *f = [GCObject new]; + f.class = 5; + f.Dclass = 1; + f.OwnClass = 3; + return f.class + f.Dclass + f.OwnClass - 9; +} -- 2.40.0