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
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 4d4c82b..95737af 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -610,7 +610,7 @@
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 0000000..021c787
--- /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 <GCObject>
+@property int Dclass;
+@end
+
+@interface GCObject : Object <DerivedGCObject> {
+ 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;
+}