objc-arc/mrc: Allow ns_returns_not_retained attribute on properties
to turn off warning on those properties which follow Cocoa naming
convention for retaining objects and yet they were not meant for
such purposes. Also, perform consistancy checking for declared
getters of such methods. // rdar://9636091
llvm-svn: 133849
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 240c15a..9302277 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2716,6 +2716,8 @@
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(d))
returnType = MD->getResultType();
+ else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(d))
+ returnType = PD->getType();
else if (S.getLangOptions().ObjCAutoRefCount && hasDeclarator(d) &&
(attr.getKind() == AttributeList::AT_ns_returns_retained))
return; // ignore: was handled as a type attribute