[SmallPtrSet] Remove SmallArray member (NFC) (#118099)
[llvm-project.git] / clang / test / SemaObjC / nsobject-attribute-1.m
blob4a75f5ce8efa2cdeba37da0e2b757f23824b9640
1 // RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wno-objc-root-class %s
2 // expected-no-diagnostics
4 @interface NSObject
5 - (id)self;
6 - (id)copy;
7 @end
9 typedef struct _foo  *__attribute__((NSObject)) Foo_ref;
11 @interface TestObject {
12     Foo_ref dict;
14 @property(retain) Foo_ref dict;
15 @end
17 @implementation TestObject
18 @synthesize dict;
19 @end
21 @interface NSDictionary
22 - (int)retainCount;
23 @end
25 int main(int argc, char *argv[]) {
26     NSDictionary *dictRef;
27     Foo_ref foo = (Foo_ref)dictRef;
29     // do Properties retain?
30     int before = [dictRef retainCount];
31     int after = [dictRef retainCount];
33     if ([foo retainCount] != [dictRef retainCount]) {
34     }
36     // do Blocks retain?
37     {
38         void (^block)(void) = ^{
39             [foo self];
40         };
41         before = [foo retainCount];
42         id save = [block copy];
43         after = [foo retainCount];
44         if (after <= before) {
45             ;
46         }
47     }
48     return 0;