[cfe-commits] r79008 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/warn-assign-property-nscopying.m

Fariborz Jahanian fjahanian at apple.com
Fri Aug 14 11:06:25 PDT 2009


Author: fjahanian
Date: Fri Aug 14 13:06:25 2009
New Revision: 79008

URL: http://llvm.org/viewvc/llvm-project?rev=79008&view=rev
Log:
Fixed a regression in deciding when to issue warning on properties which
implement NSCopying protocol in GC mode.

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/warn-assign-property-nscopying.m

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Aug 14 13:06:25 2009
@@ -1931,14 +1931,16 @@
       isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign))
       if (T->isObjCObjectPointerType()) {
         QualType InterfaceTy = T->getPointeeType();
-        ObjCInterfaceDecl *IDecl= 
-          InterfaceTy->getAsObjCInterfaceType()->getDecl();
+        if (const ObjCInterfaceType *OIT = 
+              InterfaceTy->getAsObjCInterfaceType()) {
+        ObjCInterfaceDecl *IDecl = OIT->getDecl();
         if (IDecl)
           if (ObjCProtocolDecl* PNSCopying = 
                 LookupProtocol(&Context.Idents.get("NSCopying")))
             if (IDecl->ClassImplementsProtocol(PNSCopying, true))
               Diag(AtLoc, diag::warn_implements_nscopying)  
                 << FD.D.getIdentifier();
+        }
       }
   if (T->isObjCInterfaceType())
     Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object);

Modified: cfe/trunk/test/SemaObjC/warn-assign-property-nscopying.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-assign-property-nscopying.m?rev=79008&r1=79007&r2=79008&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/warn-assign-property-nscopying.m (original)
+++ cfe/trunk/test/SemaObjC/warn-assign-property-nscopying.m Fri Aug 14 13:06:25 2009
@@ -10,5 +10,6 @@
 
 @interface INTF
   @property NSDictionary* undoAction;  // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}} // expected-warning {{default assign attribute on property 'undoAction' which implements NSCopying protocol is not appropriate with}}
+  @property id okAction;  // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}
 @end
 





More information about the cfe-commits mailing list