[cfe-commits] r50074 - in /cfe/trunk: lib/AST/DeclObjC.cpp test/Sema/objc-property-2.m

Fariborz Jahanian fjahanian at apple.com
Mon Apr 21 16:57:08 PDT 2008


Author: fjahanian
Date: Mon Apr 21 18:57:08 2008
New Revision: 50074

URL: http://llvm.org/viewvc/llvm-project?rev=50074&view=rev
Log:
Allow property in base class to be implemented in a 
derived class.

Added:
    cfe/trunk/test/Sema/objc-property-2.m
Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=50074&r1=50073&r2=50074&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Apr 21 18:57:08 2008
@@ -148,6 +148,8 @@
     if (property->getIdentifier() == PropertyId)
       return property;
   }
+  if (getSuperClass())
+    return getSuperClass()->FindPropertyDeclaration(PropertyId);
   return 0;
 }
 
@@ -175,6 +177,8 @@
     if (Ivar->getIdentifier() == IvarId)
       return Ivar;
   }
+  if (getSuperClass())
+    return getSuperClass()->FindIvarDeclaration(IvarId);
   return 0;
 }
 

Added: cfe/trunk/test/Sema/objc-property-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-property-2.m?rev=50074&view=auto

==============================================================================
--- cfe/trunk/test/Sema/objc-property-2.m (added)
+++ cfe/trunk/test/Sema/objc-property-2.m Mon Apr 21 18:57:08 2008
@@ -0,0 +1,63 @@
+// RUN: clang -fsyntax-only -verify %s
+
+ at interface Tester 
+ at property char PropertyAtomic_char;
+ at property short PropertyAtomic_short;
+ at property int PropertyAtomic_int;
+ at property long PropertyAtomic_long;
+ at property long long PropertyAtomic_longlong;
+ at property float PropertyAtomic_float;
+ at property double PropertyAtomic_double;
+ at property(assign) id PropertyAtomic_id;
+ at property(retain) id PropertyAtomicRetained_id;
+ at property(copy) id PropertyAtomicRetainedCopied_id;
+ at property(retain) id PropertyAtomicRetainedGCOnly_id;
+ at property(copy) id PropertyAtomicRetainedCopiedGCOnly_id;
+ at end
+
+ at implementation Tester
+ at dynamic PropertyAtomic_char;
+ at dynamic PropertyAtomic_short;
+ at dynamic PropertyAtomic_int;
+ at dynamic PropertyAtomic_long;
+ at dynamic PropertyAtomic_longlong;
+ at dynamic PropertyAtomic_float;
+ at dynamic PropertyAtomic_double;
+ at dynamic PropertyAtomic_id;
+ at dynamic PropertyAtomicRetained_id;
+ at dynamic PropertyAtomicRetainedCopied_id;
+ at dynamic PropertyAtomicRetainedGCOnly_id;
+ at dynamic PropertyAtomicRetainedCopiedGCOnly_id;
+ at end
+
+ at 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;
+}
+ at end
+
+ at implementation SubClass
+ at synthesize PropertyAtomic_char;
+ at synthesize PropertyAtomic_short;
+ at synthesize PropertyAtomic_int;
+ at synthesize PropertyAtomic_long;
+ at synthesize PropertyAtomic_longlong;
+ at synthesize PropertyAtomic_float;
+ at synthesize PropertyAtomic_double;
+ at synthesize PropertyAtomic_id;
+ at synthesize PropertyAtomicRetained_id;
+ at synthesize PropertyAtomicRetainedCopied_id;
+ at synthesize PropertyAtomicRetainedGCOnly_id;
+ at synthesize PropertyAtomicRetainedCopiedGCOnly_id;
+ at end





More information about the cfe-commits mailing list