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
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;
}
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