From: Fariborz Jahanian Date: Fri, 14 Aug 2009 18:06:25 +0000 (+0000) Subject: Fixed a regression in deciding when to issue warning on properties which X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b11d798984a4cef5beeea8c0152090d8af77ab6e;p=clang 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 75ac33673c..7f7bcd2a94 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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); diff --git a/test/SemaObjC/warn-assign-property-nscopying.m b/test/SemaObjC/warn-assign-property-nscopying.m index f906d8efda..cf1acc466a 100644 --- a/test/SemaObjC/warn-assign-property-nscopying.m +++ b/test/SemaObjC/warn-assign-property-nscopying.m @@ -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