]> granicus.if.org Git - clang/commitdiff
Patch to remove bogus waring when a property declaration
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 24 Nov 2008 22:16:00 +0000 (22:16 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 24 Nov 2008 22:16:00 +0000 (22:16 +0000)
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
test/SemaObjC/property-noprotocol-warning.m [new file with mode: 0644]

index 4d4c82be6992f325d1a0d5fc7d32ce94eed17cb8..95737af18ac9e32e729140371a5b9c85e862a057 100644 (file)
@@ -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 (file)
index 0000000..021c787
--- /dev/null
@@ -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;
+}