Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | fb41ca8 | 2009-02-26 23:05:51 +0000 | [diff] [blame] | 2 | |
| 3 | typedef signed char BOOL; |
| 4 | typedef unsigned int NSUInteger; |
| 5 | typedef struct _NSZone NSZone; |
| 6 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 7 | @protocol NSObject |
| 8 | - (BOOL)isEqual:(id)object; |
| 9 | @end |
| 10 | @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; |
| 11 | @end |
| 12 | @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; |
| 13 | @end |
| 14 | @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 15 | @end |
| 16 | @interface NSObject <NSObject> {} |
| 17 | @end |
| 18 | extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); |
| 19 | typedef struct { |
| 20 | id *itemsPtr; |
| 21 | unsigned long *mutationsPtr; |
| 22 | } NSFastEnumerationState; |
| 23 | @protocol NSFastEnumeration |
| 24 | - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; |
| 25 | @end |
| 26 | @class NSString; |
| 27 | @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; |
| 28 | @end |
| 29 | @interface NSMutableArray : NSArray - (void)addObject:(id)anObject; |
| 30 | @end |
| 31 | extern NSString * const NSUndoManagerCheckpointNotification; |
| 32 | @interface NSValueTransformer : NSObject {} @end |
| 33 | @class FooModel; |
| 34 | @interface FooObject : NSObject <NSCopying> {} |
| 35 | @end |
| 36 | @interface FooNode : FooObject {} |
| 37 | - (NSArray *) children; |
| 38 | @end |
| 39 | typedef enum { Foo_HUH_NONE } FooHUHCode; |
| 40 | @interface FooPlaypenEntry : FooNode { |
| 41 | NSMutableArray *_interestingChildren; |
| 42 | FooHUHCode _HUH; |
| 43 | __attribute__((objc_gc(weak))) FooPlaypenEntry *_mostInterestingChild; |
| 44 | id _author; |
| 45 | } |
| 46 | @property(copy) NSString *author; |
| 47 | - (BOOL) isInteresting; |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 48 | @end NSString *FooHUHCodeToString(FooHUHCode HUH) { return 0; } |
Fariborz Jahanian | fb41ca8 | 2009-02-26 23:05:51 +0000 | [diff] [blame] | 49 | @interface FooHUHCodeToStringTransformer: NSValueTransformer { |
| 50 | } |
| 51 | @end @implementation FooPlaypenEntry @synthesize author = _author; |
| 52 | - (BOOL) isInteresting { return 1; } |
| 53 | - (NSArray *) interestingChildren { |
| 54 | if (!_interestingChildren) { |
| 55 | for (FooPlaypenEntry *child in [self children]) { |
| 56 | if ([child isInteresting]) { |
| 57 | if (!_mostInterestingChild) |
| 58 | _mostInterestingChild = child; |
| 59 | else if (child->_HUH > _mostInterestingChild->_HUH) |
| 60 | _mostInterestingChild = child; |
| 61 | } |
| 62 | } |
| 63 | } |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 64 | return 0; |
Fariborz Jahanian | fb41ca8 | 2009-02-26 23:05:51 +0000 | [diff] [blame] | 65 | } |
| 66 | - (FooHUHCode) HUH { |
| 67 | if (_HUH == Foo_HUH_NONE) { |
| 68 | if (_mostInterestingChild) |
| 69 | return [_mostInterestingChild HUH]; |
| 70 | } |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 71 | return 0; |
Fariborz Jahanian | fb41ca8 | 2009-02-26 23:05:51 +0000 | [diff] [blame] | 72 | } |
| 73 | @end |
| 74 | |