| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 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; |
| 48 |
@end NSString *FooHUHCodeToString(FooHUHCode HUH) { return 0; } |
| 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 |
} |
| 64 |
return 0; |
| 65 |
} |
| 66 |
- (FooHUHCode) HUH { |
| 67 |
if (_HUH == Foo_HUH_NONE) { |
| 68 |
if (_mostInterestingChild) |
| 69 |
return [_mostInterestingChild HUH]; |
| 70 |
} |
| 71 |
return 0; |
| 72 |
} |
| 73 |
@end |
| 74 |
|
| 75 |
@interface Test1 { |
| 76 |
@public |
| 77 |
id ivar __attribute__((objc_gc(weak))); |
| 78 |
} |
| 79 |
@property (assign) id prop __attribute((objc_gc(weak))); |
| 80 |
@end |
| 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}} |
| 83 |
} |