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