John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result |
Argyrios Kyrtzidis | eaed19e | 2011-06-16 00:53:46 +0000 | [diff] [blame^] | 2 | // RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
| 4 | |
| 5 | typedef unsigned char BOOL; |
| 6 | |
| 7 | @interface NSObject { |
| 8 | id isa; |
| 9 | } |
| 10 | +new; |
| 11 | +alloc; |
| 12 | -init; |
| 13 | -autorelease; |
| 14 | @end |
| 15 | |
| 16 | @interface NSAutoreleasePool : NSObject |
| 17 | - drain; |
| 18 | @end |
| 19 | |
| 20 | @interface A : NSObject { |
| 21 | @package |
| 22 | id object; |
| 23 | } |
| 24 | @end |
| 25 | |
| 26 | @interface B : NSObject |
| 27 | - (BOOL)containsSelf:(A*)a; |
| 28 | @end |
| 29 | |
| 30 | @implementation A |
| 31 | @end |
| 32 | |
| 33 | @implementation B |
| 34 | - (BOOL)containsSelf:(A*)a { |
| 35 | return a->object == self; |
| 36 | } |
| 37 | @end |
| 38 | |
| 39 | void NSLog(id, ...); |
| 40 | |
| 41 | int main (int argc, const char * argv[]) { |
| 42 | @autoreleasepool { |
| 43 | A *a = [A new]; |
| 44 | B *b = [B new]; |
| 45 | NSLog(@"%s", [b containsSelf:a] ? "YES" : "NO"); |
| 46 | } |
| 47 | return 0; |
| 48 | } |