blob: d974a2564d4302b386b62641efa88c4dc4ece693 [file] [log] [blame]
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +00001// RUN: rm -rf %t
2// RUN: %clang_cc1 -fobjc-arc -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 -fobjc-arc -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result
5
6typedef signed char BOOL;
7#define nil ((void*) 0)
8
9typedef const struct __CFString * CFStringRef;
10
11@interface NSObject
12+ (id)alloc;
13@end
14
Argyrios Kyrtzidis12b732a2012-06-19 02:22:02 +000015@protocol NSCopying
16@end
17
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000018@interface NSString : NSObject
19+ (id)stringWithString:(NSString *)string;
20- (id)initWithString:(NSString *)aString;
21@end
22
23@interface NSArray : NSObject
24- (id)objectAtIndex:(unsigned long)index;
Argyrios Kyrtzidis12b732a2012-06-19 02:22:02 +000025@end
26
27@interface NSArray (NSExtendedArray)
28- (id)objectAtIndexedSubscript:(unsigned)idx;
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000029@end
30
31@interface NSArray (NSArrayCreation)
32+ (id)array;
33+ (id)arrayWithObject:(id)anObject;
34+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
35+ (id)arrayWithObjects:(id)firstObj, ...;
36+ (id)arrayWithArray:(NSArray *)array;
37
38- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt;
39- (id)initWithObjects:(id)firstObj, ...;
40- (id)initWithArray:(NSArray *)array;
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000041@end
42
43@interface NSMutableArray : NSArray
44- (void)replaceObjectAtIndex:(unsigned long)index withObject:(id)anObject;
Argyrios Kyrtzidis12b732a2012-06-19 02:22:02 +000045@end
46
47@interface NSMutableArray (NSExtendedMutableArray)
48- (void)setObject:(id)obj atIndexedSubscript:(unsigned)idx;
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000049@end
50
51@interface NSDictionary : NSObject
Argyrios Kyrtzidis12b732a2012-06-19 02:22:02 +000052- (id)objectForKey:(id)aKey;
53@end
54
55@interface NSDictionary (NSExtendedDictionary)
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000056- (id)objectForKeyedSubscript:(id)key;
57@end
58
59@interface NSDictionary (NSDictionaryCreation)
60+ (id)dictionary;
61+ (id)dictionaryWithObject:(id)object forKey:(id)key;
62+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
63+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...;
64+ (id)dictionaryWithDictionary:(NSDictionary *)dict;
65+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
66
67- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
68- (id)initWithObjectsAndKeys:(id)firstObject, ...;
69- (id)initWithDictionary:(NSDictionary *)otherDictionary;
70- (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000071@end
72
73@interface NSMutableDictionary : NSDictionary
74- (void)setObject:(id)anObject forKey:(id)aKey;
Argyrios Kyrtzidis12b732a2012-06-19 02:22:02 +000075@end
76
77@interface NSMutableDictionary (NSExtendedMutableDictionary)
78- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +000079@end
80
81@interface NSNumber : NSObject
82@end
83
84@interface NSNumber (NSNumberCreation)
85+ (NSNumber *)numberWithInt:(int)value;
86- (id)initWithInt:(int)value;
87@end
88
89@interface I {
90 NSArray *ivarArr;
91}
92@end
93@implementation I
94-(void) foo {
95 NSString *str;
96 NSArray *arr;
97 NSDictionary *dict;
98
99 arr = @[str, str];
100 arr = @[str, str];
101 dict = @{@"key1": @"value1", @"key2": @"value2"};
102 dict = @{@"key1": @"value1", @"key2": @"value2"};
103
Argyrios Kyrtzidisa44b9702013-01-16 23:54:48 +0000104 dict = @{@"A": @"1", @"B": @"2"};
105
Argyrios Kyrtzidis6b4db9b2012-06-06 22:23:12 +0000106 NSNumber *n = @2;
107}
108@end