[cfe-commits] r155245 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/arc-property-lifetime.m
Fariborz Jahanian
fjahanian at apple.com
Fri Apr 20 15:00:46 PDT 2012
Author: fjahanian
Date: Fri Apr 20 17:00:46 2012
New Revision: 155245
URL: http://llvm.org/viewvc/llvm-project?rev=155245&view=rev
Log:
objective-c arc: With currnt documentation,
objc_returns_inner_pointer attribute can be applied to
methods only. Diagnsose otherwise, instead of
crashing. // rdar://11253688
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/arc-property-lifetime.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=155245&r1=155244&r2=155245&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Apr 20 17:00:46 2012
@@ -3334,8 +3334,8 @@
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;
}
Modified: cfe/trunk/test/SemaObjC/arc-property-lifetime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-property-lifetime.m?rev=155245&r1=155244&r2=155245&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-property-lifetime.m (original)
+++ cfe/trunk/test/SemaObjC/arc-property-lifetime.m Fri Apr 20 17:00:46 2012
@@ -168,3 +168,8 @@
f.realy_strong_attr_prop = [[Baz alloc] init];
f.implicit = [[Baz alloc] init];
}
+
+// rdar://11253688
+ at interface Boom
+ at property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods}}
+ at end
More information about the cfe-commits
mailing list