]> granicus.if.org Git - clang/commitdiff
Fixed a regression in deciding when to issue warning on properties which
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 14 Aug 2009 18:06:25 +0000 (18:06 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 14 Aug 2009 18:06:25 +0000 (18:06 +0000)
implement NSCopying protocol in GC mode.

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

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/warn-assign-property-nscopying.m

index 75ac33673ca2abbdaf480d6047d81c3c13f025ba..7f7bcd2a94c35ccad92c17db8fa0df6e259d8302 100644 (file)
@@ -1931,14 +1931,16 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
       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);
index f906d8efda8838e5c06030d969a6da0e16bedaa1..cf1acc466a27497f69a0c74e771ce7d19f7dc07f 100644 (file)
@@ -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