Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
      2 
      3 @interface NSObject
      4 - (id)self;
      5 - (id)copy;
      6 @end
      7 
      8 typedef struct _foo  *__attribute__((NSObject)) Foo_ref;
      9 
     10 @interface TestObject {
     11     Foo_ref dict;
     12 }
     13 @property(retain) Foo_ref dict;
     14 @end
     15 
     16 @implementation TestObject
     17 @synthesize dict;
     18 @end
     19 
     20 @interface NSDictionary
     21 - (int)retainCount;
     22 @end
     23 
     24 int main(int argc, char *argv[]) {
     25     NSDictionary *dictRef;
     26     Foo_ref foo = (Foo_ref)dictRef;
     27 
     28     // do Properties retain?
     29     int before = [dictRef retainCount];
     30     int after = [dictRef retainCount];
     31 
     32     if ([foo retainCount] != [dictRef retainCount]) {
     33     }
     34 
     35     // do Blocks retain?
     36     {
     37         void (^block)(void) = ^{
     38             [foo self];
     39         };
     40         before = [foo retainCount];
     41         id save = [block copy];
     42         after = [foo retainCount];
     43         if (after <= before) {
     44             ;
     45         }
     46     }
     47     return 0;
     48 }
     49