]> granicus.if.org Git - clang/commitdiff
objective-c arc: With currnt documentation,
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 20 Apr 2012 22:00:46 +0000 (22:00 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 20 Apr 2012 22:00:46 +0000 (22:00 +0000)
objc_returns_inner_pointer attribute can be applied to
methods only. Diagnsose otherwise, instead of
crashing. // rdar://11253688

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

lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/arc-property-lifetime.m

index 3770b3c37301f56f5a3a82742175757a20db5f58..9004508a47e1e4f835feb80ff8320dfb8d14741a 100644 (file)
@@ -3334,8 +3334,8 @@ static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D,
 
   ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(D);
 
-  if (!isa<ObjCMethodDecl>(method)) {
-    S.Diag(method->getLocStart(), diag::err_attribute_wrong_decl_type)
+  if (!method || !isa<ObjCMethodDecl>(method)) {
+    S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type)
       << SourceRange(loc, loc) << attr.getName() << ExpectedMethod;
     return;
   }
index fad37ccbf46397da7c08970f88a655070d405959..bd393e0bf51fe7f20c4f5487434c6a781a946270 100644 (file)
@@ -168,3 +168,8 @@ void foo(Baz *f) {
         f.realy_strong_attr_prop = [[Baz alloc] init];
         f.implicit = [[Baz alloc] init];
 }
+
+// rdar://11253688
+@interface Boom 
+@property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods}}
+@end