]> granicus.if.org Git - clang/commitdiff
objective-C arc: ns_returns_retained is a type attribute in ARC,
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 28 Aug 2012 22:26:21 +0000 (22:26 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 28 Aug 2012 22:26:21 +0000 (22:26 +0000)
and when used in property type declaration, is handled as type
attribute. Do not issue the warning when declaraing the property.
// rdar://12173491

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

lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/arc-decls.m

index caa7b2f65a9dfce81f935e6b63b4667ce89ac5f8..fcfa574d599c7d85ffd58ae87e4e2ef0e8c7d78a 100644 (file)
@@ -3878,11 +3878,11 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
 
   if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D))
     returnType = MD->getResultType();
-  else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D))
-    returnType = PD->getType();
   else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) &&
            (Attr.getKind() == AttributeList::AT_NSReturnsRetained))
     return; // ignore: was handled as a type attribute
+  else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D))
+    returnType = PD->getType();
   else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
     returnType = FD->getResultType();
   else {
index 8d5cca26a74c90a10779b16af98e4df59000e352..a53b52acd862a5a176243a353322b39a606afae0 100644 (file)
@@ -85,6 +85,8 @@ void func()
 - (id)ns_non __attribute((ns_returns_not_retained)); // expected-error {{overriding method has mismatched ns_returns_not_retained attributes}}
 - (id)not_ret:(id) b __attribute((ns_returns_retained)); // expected-error {{overriding method has mismatched ns_returns_retained attributes}}
 - (id)both__returns_not_retained:(id) b __attribute((ns_returns_not_retained));
+// rdar://12173491
+@property (copy, nonatomic) __attribute__((ns_returns_retained)) id (^fblock)(void);
 @end
 
 // Test that we give a good diagnostic here that mentions the missing