Home | History | Annotate | Download | only in ARCMT
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
      2 // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t
      3 // RUN: diff %t %s.result
      4 // DISABLE: mingw32
      5 
      6 #include "Common.h"
      7 
      8 @interface A : NSObject {
      9 @package
     10     id object;
     11 }
     12 @end
     13 
     14 @interface B : NSObject {
     15   id _prop;
     16   xpc_object_t _xpc_prop;
     17 }
     18 - (BOOL)containsSelf:(A*)a;
     19 @property (strong) id prop;
     20 @property (strong) xpc_object_t xpc_prop;
     21 @end
     22 
     23 @implementation A
     24 @end
     25 
     26 @implementation B
     27 - (BOOL)containsSelf:(A*)a {
     28     return a->object == self;
     29 }
     30 
     31 -(id) prop {
     32   return _prop;
     33 }
     34 -(void) setProp:(id) newVal {
     35   _prop = newVal;
     36 }
     37 -(void) setProp2:(CFTypeRef) newVal {
     38   _prop = (id)CFBridgingRelease(CFRetain(newVal));
     39 }
     40 
     41 -(id) xpc_prop {
     42   return _xpc_prop;
     43 }
     44 -(void) setXpc_prop:(xpc_object_t) newVal {
     45   _xpc_prop = newVal;
     46 }
     47 @end
     48 
     49 void NSLog(id, ...);
     50 
     51 int main (int argc, const char * argv[]) {
     52     @autoreleasepool {
     53         A *a = [A new];
     54         B *b = [B new];
     55         NSLog(@"%s", [b containsSelf:a] ? "YES" : "NO");
     56     }
     57     return 0;
     58 }
     59 
     60 void test(A *prevVal, A *newVal) {
     61   prevVal = newVal;
     62 }
     63 
     64 id test2(A* val) {
     65   return val;
     66 }
     67 
     68 id test3() {
     69   id a = [[A alloc] init];
     70 }
     71