[cfe-commits] r70414 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/ivar-sem-check-2.m

Fariborz Jahanian fjahanian at apple.com
Wed Apr 29 14:45:03 PDT 2009


Author: fjahanian
Date: Wed Apr 29 16:45:02 2009
New Revision: 70414

URL: http://llvm.org/viewvc/llvm-project?rev=70414&view=rev
Log:
use of an ivar specified on a property @synthesize
and found in super class triggers a diagnostics.


Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/ivar-sem-check-2.m

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=70414&r1=70413&r2=70414&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Apr 29 16:45:02 2009
@@ -1895,7 +1895,6 @@
   // Check that we have a valid, previously declared ivar for @synthesize
   if (Synthesize) {
     // @synthesize
-    bool NoExplicitPropertyIvar = (!PropertyIvar);
     if (!PropertyIvar)
       PropertyIvar = PropertyId;
     QualType PropType = Context.getCanonicalType(property->getType());
@@ -1914,7 +1913,7 @@
         // a property implementation and to avoid future warnings.
     }
     else if (getLangOptions().ObjCNonFragileABI &&
-             NoExplicitPropertyIvar && ClassDeclared != IDecl) {
+             ClassDeclared != IDecl) {
       Diag(PropertyLoc, diag::error_ivar_in_superclass_use)
         << property->getDeclName() << Ivar->getDeclName() 
         << ClassDeclared->getDeclName();

Modified: cfe/trunk/test/SemaObjC/ivar-sem-check-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ivar-sem-check-2.m?rev=70414&r1=70413&r2=70414&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/ivar-sem-check-2.m (original)
+++ cfe/trunk/test/SemaObjC/ivar-sem-check-2.m Wed Apr 29 16:45:02 2009
@@ -1,17 +1,23 @@
 // RUN: clang-cc  -fsyntax-only -triple x86_64-apple-darwin10 -verify %s
 
 @interface Super  {
-  id value; // expected-note {{previously declared 'value' here}}
+  id value2; // expected-note {{previously declared 'value2' here}}
 } 
 @property(retain) id value;
 @property(retain) id value1;
+ at property(retain) id prop;
 @end
 
- at interface Sub : Super @end
+ at interface Sub : Super 
+{
+  id value; 
+}
+ at end
 
 @implementation Sub
- at synthesize value; // expected-error {{property 'value' attempting to use ivar 'value' declared in in super class 'Super'}} // expected-note {{previous use is here}}
- at synthesize value1=value; // expected-error {{synthesized properties 'value1' and 'value' both claim ivar 'value'}}
+ at synthesize value; // expected-note {{previous use is here}}
+ at synthesize value1=value; // expected-error {{synthesized properties 'value1' and 'value' both claim ivar 'value'}} 
+ at synthesize prop=value2;  // expected-error {{property 'prop' attempting to use ivar 'value2' declared in in super class 'Super'}}
 @end
 
 





More information about the cfe-commits mailing list