Fixed a regression in deciding when to issue warning on properties which
implement NSCopying protocol in GC mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79008 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 75ac336..7f7bcd2 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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);