http://llvm.org/bugs/show_bug.cgi?id=15928

            Bug ID: 15928
           Summary: Clang is missing the 'retain' code (&) when returning
                    property_getAttributes
           Product: clang
           Version: 3.1
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

#import <Cocoa/Cocoa.h>
#import <objc/objc-class.h>

@interface Sample : NSObject
@property(nonatomic, readonly, retain) NSObject* readonlyObject;
@property(nonatomic, readwrite, retain) NSObject* readwriteObject;
@end
@implementation Sample
@synthesize readonlyObject = readonlyObject_;
@synthesize readwriteObject = readwriteObject_;
@end

int main(int argc, char *argv[]) {
  id SampleClass = objc_getClass("Sample");
  unsigned int outCount, i;
  objc_property_t *properties =
      class_copyPropertyList(SampleClass, &outCount);
  for (i = 0; i < outCount; i++) {
    objc_property_t property = properties[i];
    fprintf(stdout, "%s %s\n", 
        property_getName(property), 
        property_getAttributes(property));
  }
}

/*
clang -c main.m -o main.o
clang -o main main.o -framework Foundation

$ gcc -c main.m -o main.o; gcc -o main main.o -framework Foundation; ./main
readonlyObject T@"NSObject",R,&,N,VreadonlyObject_
readwriteObject T@"NSObject",&,N,VreadwriteObject_

$ clang -c main.m -o main.o; clang -o main main.o -framework Foundation; ./main
readwriteObject T@"NSObject",&,N,VreadwriteObject_
readonlyObject T@"NSObject",R,N,VreadonlyObject_

Clang is missing the & for the readonly property.
*/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to