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

Jordy Rose jediknil at belkadan.com
Fri Apr 20 20:56:10 PDT 2012


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?


> 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
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list