From: Fariborz Jahanian Date: Wed, 27 Jun 2012 20:52:46 +0000 (+0000) Subject: objective-c mrc: Issue warning for mrc, as is done for arc, when X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c16d58f8546365d1f56468e9ae1ecfa182afca0;p=clang objective-c mrc: Issue warning for mrc, as is done for arc, when property retains a block object as it could be on the stack. // rdar://11761511 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159293 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 13350eaf37..1794f6618a 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -2143,8 +2143,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, && getLangOpts().getGC() == LangOptions::GCOnly && PropertyTy->isBlockPointerType()) Diag(Loc, diag::warn_objc_property_copy_missing_on_block); - else if (getLangOpts().ObjCAutoRefCount && - (Attributes & ObjCDeclSpec::DQ_PR_retain) && + else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) && !(Attributes & ObjCDeclSpec::DQ_PR_readonly) && !(Attributes & ObjCDeclSpec::DQ_PR_strong) && PropertyTy->isBlockPointerType()) diff --git a/test/SemaObjC/arc-retain-block-property.m b/test/SemaObjC/warn-retain-block-property.m similarity index 92% rename from test/SemaObjC/arc-retain-block-property.m rename to test/SemaObjC/warn-retain-block-property.m index 3b66d14930..3a54baf0f5 100644 --- a/test/SemaObjC/arc-retain-block-property.m +++ b/test/SemaObjC/warn-retain-block-property.m @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -verify -Wno-objc-root-class %s // rdar://9829425 +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -Wno-objc-root-class %s +// rdar://11761511 extern void doSomething();