[cfe-dev] Obj-C Retain Property Issues

Fariborz Jahanian fjahanian at apple.com
Fri Dec 16 07:58:49 PST 2011


On Dec 15, 2011, at 2:37 PM, Keaton Mowery wrote:

> Hi all,
> 
> I'm encountering an issue with LLVM/Clang's handling of Objective-C
> properties. Notably, adding the retain property to a non-NSObject is
> failing, even when the retain property can still be applied. Here's a
> minimal testcase:
> 
> main.m
> ------------------
> #import <Foundation/Foundation.h>
> 
> @interface Foo : NSObject {
>  CFDictionaryRef dict;
> }
> @property (nonatomic, retain) __attribute__((NSObject)) CFDictionaryRef dict;
> @end
> @implementation Foo @synthesize dict; @end
> ------------------
> 
> When compiled via llvm/clang (svn r146687), this generates an error:
>    main.m:7:1: error: property with 'retain (or strong)' attribute
> must be of object type
>    @property (nonatomic, retain) __attribute__((NSObject))
> CFDictionaryRef dict;

This is fixed in r146737
- Fariborz

> 
> When using the clang shipped with OSX (Apple clang version 3.0
> (tags/Apple/clang-211.12) (based on LLVM 3.0svn)), this compiles
> properly.
> 
> The issue crops up when including the system header at
> /System/Library/Frameworks/AVFoundation.framework/Headers/AVVideoComposition.h:112,
> which leads me to believe that this is proper Objective-C syntax.
> 
> Does anyone know what the problem might be?
> 
> Thank you!
> 
> Keaton Mowery
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list