1*67e74705SXin Li// RUN: rm -rf %t 2*67e74705SXin Li// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11 3*67e74705SXin Li// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result 4*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result 5*67e74705SXin Li 6*67e74705SXin Litypedef signed char BOOL; 7*67e74705SXin Li#define nil ((void*) 0) 8*67e74705SXin Li 9*67e74705SXin Li@interface NSObject 10*67e74705SXin Li+ (id)alloc; 11*67e74705SXin Li@end 12*67e74705SXin Li 13*67e74705SXin Li@interface NSArray : NSObject 14*67e74705SXin Li- (id)objectAtIndex:(unsigned long)index; 15*67e74705SXin Li@end 16*67e74705SXin Li 17*67e74705SXin Li@interface NSArray (NSArrayCreation) 18*67e74705SXin Li+ (id)array; 19*67e74705SXin Li+ (id)arrayWithObject:(id)anObject; 20*67e74705SXin Li+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; 21*67e74705SXin Li+ (id)arrayWithObjects:(id)firstObj, ...; 22*67e74705SXin Li+ (id)arrayWithArray:(NSArray *)array; 23*67e74705SXin Li 24*67e74705SXin Li- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt; 25*67e74705SXin Li- (id)initWithObjects:(id)firstObj, ...; 26*67e74705SXin Li- (id)initWithArray:(NSArray *)array; 27*67e74705SXin Li@end 28*67e74705SXin Li 29*67e74705SXin Li@interface NSMutableArray : NSArray 30*67e74705SXin Li- (void)replaceObjectAtIndex:(unsigned long)index withObject:(id)anObject; 31*67e74705SXin Li@end 32*67e74705SXin Li 33*67e74705SXin Li@interface NSDictionary : NSObject 34*67e74705SXin Li@end 35*67e74705SXin Li 36*67e74705SXin Li@interface NSDictionary (NSDictionaryCreation) 37*67e74705SXin Li+ (id)dictionary; 38*67e74705SXin Li+ (id)dictionaryWithObject:(id)object forKey:(id)key; 39*67e74705SXin Li+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; 40*67e74705SXin Li+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...; 41*67e74705SXin Li+ (id)dictionaryWithDictionary:(NSDictionary *)dict; 42*67e74705SXin Li+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; 43*67e74705SXin Li 44*67e74705SXin Li- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; 45*67e74705SXin Li- (id)initWithObjectsAndKeys:(id)firstObject, ...; 46*67e74705SXin Li- (id)initWithDictionary:(NSDictionary *)otherDictionary; 47*67e74705SXin Li- (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; 48*67e74705SXin Li 49*67e74705SXin Li- (id)objectForKey:(id)aKey; 50*67e74705SXin Li@end 51*67e74705SXin Li 52*67e74705SXin Li@interface NSMutableDictionary : NSDictionary 53*67e74705SXin Li- (void)setObject:(id)anObject forKey:(id)aKey; 54*67e74705SXin Li@end 55*67e74705SXin Li 56*67e74705SXin Li@interface I 57*67e74705SXin Li@end 58*67e74705SXin Li@implementation I 59*67e74705SXin Li-(void) foo { 60*67e74705SXin Li id str; 61*67e74705SXin Li NSArray *arr; 62*67e74705SXin Li NSDictionary *dict; 63*67e74705SXin Li 64*67e74705SXin Li arr = [NSArray array]; 65*67e74705SXin Li arr = [NSArray arrayWithObject:str]; 66*67e74705SXin Li arr = [NSArray arrayWithObjects:str, str, nil]; 67*67e74705SXin Li dict = [NSDictionary dictionary]; 68*67e74705SXin Li dict = [NSDictionary dictionaryWithObject:arr forKey:str]; 69*67e74705SXin Li 70*67e74705SXin Li id o = [arr objectAtIndex:2]; 71*67e74705SXin Li o = [dict objectForKey:@"key"]; 72*67e74705SXin Li NSMutableArray *marr = 0; 73*67e74705SXin Li NSMutableDictionary *mdict = 0; 74*67e74705SXin Li [marr replaceObjectAtIndex:2 withObject:@"val"]; 75*67e74705SXin Li [mdict setObject:@"value" forKey:@"key"]; 76*67e74705SXin Li [marr replaceObjectAtIndex:2 withObject:[arr objectAtIndex:4]]; 77*67e74705SXin Li [mdict setObject:[dict objectForKey:@"key2"] forKey:@"key"]; 78*67e74705SXin Li} 79*67e74705SXin Li@end 80