1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc %s -fsyntax-only -Wobjc-cocoa-api -verify 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -x objective-c %s.fixed -fsyntax-only 3*f4a2713aSLionel Sambuc// RUN: cp %s %t.m 4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc %t.m -fixit -Wobjc-cocoa-api 5*f4a2713aSLionel Sambuc// RUN: diff %s.fixed %t.m 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuctypedef signed char BOOL; 8*f4a2713aSLionel Sambuc#define nil ((void*) 0) 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc@interface NSObject 11*f4a2713aSLionel Sambuc+ (id)alloc; 12*f4a2713aSLionel Sambuc@end 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc@interface NSString : NSObject 15*f4a2713aSLionel Sambuc+ (id)stringWithString:(NSString *)string; 16*f4a2713aSLionel Sambuc- (id)initWithString:(NSString *)aString; 17*f4a2713aSLionel Sambuc@end 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc@interface NSArray : NSObject 20*f4a2713aSLionel Sambuc- (id)objectAtIndex:(unsigned long)index; 21*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(int)index; 22*f4a2713aSLionel Sambuc@end 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc@interface NSArray (NSArrayCreation) 25*f4a2713aSLionel Sambuc+ (id)array; 26*f4a2713aSLionel Sambuc+ (id)arrayWithObject:(id)anObject; 27*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; 28*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(id)firstObj, ...; 29*f4a2713aSLionel Sambuc+ (id)arrayWithArray:(NSArray *)array; 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt; 32*f4a2713aSLionel Sambuc- (id)initWithObjects:(id)firstObj, ...; 33*f4a2713aSLionel Sambuc- (id)initWithArray:(NSArray *)array; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc- (id)objectAtIndex:(unsigned long)index; 36*f4a2713aSLionel Sambuc@end 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc@interface NSMutableArray : NSArray 39*f4a2713aSLionel Sambuc- (void)replaceObjectAtIndex:(unsigned long)index withObject:(id)anObject; 40*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(int)index; 41*f4a2713aSLionel Sambuc@end 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc@interface NSDictionary : NSObject 44*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key; 45*f4a2713aSLionel Sambuc@end 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc@interface NSDictionary (NSDictionaryCreation) 48*f4a2713aSLionel Sambuc+ (id)dictionary; 49*f4a2713aSLionel Sambuc+ (id)dictionaryWithObject:(id)object forKey:(id)key; 50*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; 51*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...; 52*f4a2713aSLionel Sambuc+ (id)dictionaryWithDictionary:(NSDictionary *)dict; 53*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; 56*f4a2713aSLionel Sambuc- (id)initWithObjectsAndKeys:(id)firstObject, ...; 57*f4a2713aSLionel Sambuc- (id)initWithDictionary:(NSDictionary *)otherDictionary; 58*f4a2713aSLionel Sambuc- (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; 59*f4a2713aSLionel Sambuc 60*f4a2713aSLionel Sambuc- (id)objectForKey:(id)aKey; 61*f4a2713aSLionel Sambuc@end 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc@interface NSMutableDictionary : NSDictionary 64*f4a2713aSLionel Sambuc- (void)setObject:(id)anObject forKey:(id)aKey; 65*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key; 66*f4a2713aSLionel Sambuc@end 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc@interface NSNumber : NSObject 69*f4a2713aSLionel Sambuc@end 70*f4a2713aSLionel Sambuc 71*f4a2713aSLionel Sambuc@interface NSNumber (NSNumberCreation) 72*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithInt:(int)value; 73*f4a2713aSLionel Sambuc@end 74*f4a2713aSLionel Sambuc 75*f4a2713aSLionel Sambuc#define M(x) (x) 76*f4a2713aSLionel Sambuc#define PAIR(x) @#x, [NSNumber numberWithInt:(x)] 77*f4a2713aSLionel Sambuc#define TWO(x) ((x), (x)) 78*f4a2713aSLionel Sambuc 79*f4a2713aSLionel Sambucvoid foo() { 80*f4a2713aSLionel Sambuc NSString *str = M(@"foo"); // expected-warning {{redundant}} 81*f4a2713aSLionel Sambuc str = @"foo"; // expected-warning {{redundant}} 82*f4a2713aSLionel Sambuc NSArray *arr = @[str]; // expected-warning {{redundant}} 83*f4a2713aSLionel Sambuc NSDictionary *dict = @{str: arr}; // expected-warning {{redundant}} 84*f4a2713aSLionel Sambuc} 85