Obj-C Retain Property Issues

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

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;

I don't believe this was ever intentionally supported;

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

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?

__attribute__((NSObject)) was only ever intended to be used on
typedefs, and even that usage is not recommended.

That said, I'm pretty sure r145358 was not intended to break anything.
I've opened an Apple-internal bug report to track the issue
(<rdar://problem/10591336>).

-Eli

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