1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 typedef signed char BOOL;
4 typedef unsigned int NSUInteger;
5 typedef struct _NSZone NSZone;
6 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
8 - (BOOL)isEqual:(id)object;
10 @protocol NSCopying - (id)copyWithZone:(NSZone *)zone;
12 @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone;
14 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
16 @interface NSObject <NSObject> {}
18 extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
21 unsigned long *mutationsPtr;
22 } NSFastEnumerationState;
23 @protocol NSFastEnumeration
24 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
27 @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count;
29 @interface NSMutableArray : NSArray - (void)addObject:(id)anObject;
31 extern NSString * const NSUndoManagerCheckpointNotification;
32 @interface NSValueTransformer : NSObject {} @end
34 @interface FooObject : NSObject <NSCopying> {}
36 @interface FooNode : FooObject {}
37 - (NSArray *) children;
39 typedef enum { Foo_HUH_NONE } FooHUHCode;
40 @interface FooPlaypenEntry : FooNode {
41 NSMutableArray *_interestingChildren;
43 __attribute__((objc_gc(weak))) FooPlaypenEntry *_mostInterestingChild;
46 @property(copy) NSString *author;
47 - (BOOL) isInteresting;
48 @end NSString *FooHUHCodeToString(FooHUHCode HUH) { return 0; }
49 @interface FooHUHCodeToStringTransformer: NSValueTransformer {
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;
67 if (_HUH == Foo_HUH_NONE) {
68 if (_mostInterestingChild)
69 return [_mostInterestingChild HUH];
77 id ivar __attribute__((objc_gc(weak)));
79 @property (assign) id prop __attribute((objc_gc(weak)));
81 void test1(Test1 *t) {
82 id *(__attribute__((objc_gc(strong))) x) = &t->ivar; // expected-warning {{initializing '__strong id *' with an expression of type '__weak id *' discards qualifiers}}