[cfe-commits] r155245 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/arc-property-lifetime.m

Fariborz Jahanian fjahanian at apple.com
Sat Apr 21 10:54:34 PDT 2012


On Apr 20, 2012, at 8:56 PM, Jordy Rose wrote:

> 
> On Apr 20, 2012, at 18:00, Fariborz Jahanian wrote:
> 
>> 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;
>>  }
>> 
> 
> If you dyn_cast to ObjCMethodDecl, the isa will always be true. On the other hand, /should/ there be a way to annotate a property as an inner pointer?
Unneeded check removed in r155290. Currently this annotation is allowed on methods only. We are discussing the property issue as a possible
future enhancement.

- Fariborz

> 




More information about the cfe-commits mailing list