From: Fariborz Jahanian Date: Mon, 21 Apr 2008 23:57:08 +0000 (+0000) Subject: Allow property in base class to be implemented in a X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c70bee863b6f800d7c88f409e89dc85ed867ef64;p=clang Allow property in base class to be implemented in a derived class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50074 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 04e9993101..d3592e1416 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -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 index 0000000000..4472a8f695 --- /dev/null +++ b/test/Sema/objc-property-2.m @@ -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