]> granicus.if.org Git - clang/commitdiff
Allow property in base class to be implemented in a
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 21 Apr 2008 23:57:08 +0000 (23:57 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 21 Apr 2008 23:57:08 +0000 (23:57 +0000)
derived class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50074 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp
test/Sema/objc-property-2.m [new file with mode: 0644]

index 04e9993101effa614fa4a310d4a5e24b14f54805..d3592e1416abd951ef8e13d51afaec4e0cbfe92d 100644 (file)
@@ -148,6 +148,8 @@ ObjCPropertyDecl *
     if (property->getIdentifier() == PropertyId)
       return property;
   }
+  if (getSuperClass())
+    return getSuperClass()->FindPropertyDeclaration(PropertyId);
   return 0;
 }
 
@@ -175,6 +177,8 @@ ObjCIvarDecl *
     if (Ivar->getIdentifier() == IvarId)
       return Ivar;
   }
+  if (getSuperClass())
+    return getSuperClass()->FindIvarDeclaration(IvarId);
   return 0;
 }
 
diff --git a/test/Sema/objc-property-2.m b/test/Sema/objc-property-2.m
new file mode 100644 (file)
index 0000000..4472a8f
--- /dev/null
@@ -0,0 +1,63 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@interface Tester 
+@property char PropertyAtomic_char;
+@property short PropertyAtomic_short;
+@property int PropertyAtomic_int;
+@property long PropertyAtomic_long;
+@property long long PropertyAtomic_longlong;
+@property float PropertyAtomic_float;
+@property double PropertyAtomic_double;
+@property(assign) id PropertyAtomic_id;
+@property(retain) id PropertyAtomicRetained_id;
+@property(copy) id PropertyAtomicRetainedCopied_id;
+@property(retain) id PropertyAtomicRetainedGCOnly_id;
+@property(copy) id PropertyAtomicRetainedCopiedGCOnly_id;
+@end
+
+@implementation Tester
+@dynamic PropertyAtomic_char;
+@dynamic PropertyAtomic_short;
+@dynamic PropertyAtomic_int;
+@dynamic PropertyAtomic_long;
+@dynamic PropertyAtomic_longlong;
+@dynamic PropertyAtomic_float;
+@dynamic PropertyAtomic_double;
+@dynamic PropertyAtomic_id;
+@dynamic PropertyAtomicRetained_id;
+@dynamic PropertyAtomicRetainedCopied_id;
+@dynamic PropertyAtomicRetainedGCOnly_id;
+@dynamic PropertyAtomicRetainedCopiedGCOnly_id;
+@end
+
+@interface SubClass : Tester
+{
+    char PropertyAtomic_char;
+    short PropertyAtomic_short;
+    int PropertyAtomic_int;
+    long PropertyAtomic_long;
+    long long PropertyAtomic_longlong;
+    float PropertyAtomic_float;
+    double PropertyAtomic_double;
+    id PropertyAtomic_id;
+    id PropertyAtomicRetained_id;
+    id PropertyAtomicRetainedCopied_id;
+    id PropertyAtomicRetainedGCOnly_id;
+    id PropertyAtomicRetainedCopiedGCOnly_id;
+}
+@end
+
+@implementation SubClass
+@synthesize PropertyAtomic_char;
+@synthesize PropertyAtomic_short;
+@synthesize PropertyAtomic_int;
+@synthesize PropertyAtomic_long;
+@synthesize PropertyAtomic_longlong;
+@synthesize PropertyAtomic_float;
+@synthesize PropertyAtomic_double;
+@synthesize PropertyAtomic_id;
+@synthesize PropertyAtomicRetained_id;
+@synthesize PropertyAtomicRetainedCopied_id;
+@synthesize PropertyAtomicRetainedGCOnly_id;
+@synthesize PropertyAtomicRetainedCopiedGCOnly_id;
+@end