xref: /aosp_15_r20/external/clang/test/ARCMT/objcmt-subscripting-literals-in-arc.m.result (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// 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*67e74705SXin Li// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
4*67e74705SXin Li// RUN: %clang_cc1 -fobjc-arc -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 Litypedef const struct __CFString * CFStringRef;
10*67e74705SXin Li
11*67e74705SXin Li@interface NSObject
12*67e74705SXin Li+ (id)alloc;
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li@protocol NSCopying
16*67e74705SXin Li@end
17*67e74705SXin Li
18*67e74705SXin Li@interface NSString : NSObject
19*67e74705SXin Li+ (id)stringWithString:(NSString *)string;
20*67e74705SXin Li- (id)initWithString:(NSString *)aString;
21*67e74705SXin Li@end
22*67e74705SXin Li
23*67e74705SXin Li@interface NSArray : NSObject
24*67e74705SXin Li- (id)objectAtIndex:(unsigned long)index;
25*67e74705SXin Li@end
26*67e74705SXin Li
27*67e74705SXin Li@interface NSArray (NSExtendedArray)
28*67e74705SXin Li- (id)objectAtIndexedSubscript:(unsigned)idx;
29*67e74705SXin Li@end
30*67e74705SXin Li
31*67e74705SXin Li@interface NSArray (NSArrayCreation)
32*67e74705SXin Li+ (id)array;
33*67e74705SXin Li+ (id)arrayWithObject:(id)anObject;
34*67e74705SXin Li+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
35*67e74705SXin Li+ (id)arrayWithObjects:(id)firstObj, ...;
36*67e74705SXin Li+ (id)arrayWithArray:(NSArray *)array;
37*67e74705SXin Li
38*67e74705SXin Li- (id)initWithObjects:(const id [])objects count:(unsigned long)cnt;
39*67e74705SXin Li- (id)initWithObjects:(id)firstObj, ...;
40*67e74705SXin Li- (id)initWithArray:(NSArray *)array;
41*67e74705SXin Li@end
42*67e74705SXin Li
43*67e74705SXin Li@interface NSMutableArray : NSArray
44*67e74705SXin Li- (void)replaceObjectAtIndex:(unsigned long)index withObject:(id)anObject;
45*67e74705SXin Li@end
46*67e74705SXin Li
47*67e74705SXin Li@interface NSMutableArray (NSExtendedMutableArray)
48*67e74705SXin Li- (void)setObject:(id)obj atIndexedSubscript:(unsigned)idx;
49*67e74705SXin Li@end
50*67e74705SXin Li
51*67e74705SXin Li@interface NSDictionary : NSObject
52*67e74705SXin Li- (id)objectForKey:(id)aKey;
53*67e74705SXin Li@end
54*67e74705SXin Li
55*67e74705SXin Li@interface NSDictionary (NSExtendedDictionary)
56*67e74705SXin Li- (id)objectForKeyedSubscript:(id)key;
57*67e74705SXin Li@end
58*67e74705SXin Li
59*67e74705SXin Li@interface NSDictionary (NSDictionaryCreation)
60*67e74705SXin Li+ (id)dictionary;
61*67e74705SXin Li+ (id)dictionaryWithObject:(id)object forKey:(id)key;
62*67e74705SXin Li+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
63*67e74705SXin Li+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...;
64*67e74705SXin Li+ (id)dictionaryWithDictionary:(NSDictionary *)dict;
65*67e74705SXin Li+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
66*67e74705SXin Li
67*67e74705SXin Li- (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
68*67e74705SXin Li- (id)initWithObjectsAndKeys:(id)firstObject, ...;
69*67e74705SXin Li- (id)initWithDictionary:(NSDictionary *)otherDictionary;
70*67e74705SXin Li- (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
71*67e74705SXin Li@end
72*67e74705SXin Li
73*67e74705SXin Li@interface NSMutableDictionary : NSDictionary
74*67e74705SXin Li- (void)setObject:(id)anObject forKey:(id)aKey;
75*67e74705SXin Li@end
76*67e74705SXin Li
77*67e74705SXin Li@interface NSMutableDictionary (NSExtendedMutableDictionary)
78*67e74705SXin Li- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
79*67e74705SXin Li@end
80*67e74705SXin Li
81*67e74705SXin Li@interface NSNumber : NSObject
82*67e74705SXin Li@end
83*67e74705SXin Li
84*67e74705SXin Li@interface NSNumber (NSNumberCreation)
85*67e74705SXin Li+ (NSNumber *)numberWithInt:(int)value;
86*67e74705SXin Li- (id)initWithInt:(int)value;
87*67e74705SXin Li@end
88*67e74705SXin Li
89*67e74705SXin Li@interface I {
90*67e74705SXin Li  NSArray *ivarArr;
91*67e74705SXin Li}
92*67e74705SXin Li@end
93*67e74705SXin Li@implementation I
94*67e74705SXin Li-(void) foo {
95*67e74705SXin Li  NSString *str;
96*67e74705SXin Li  NSArray *arr;
97*67e74705SXin Li  NSDictionary *dict;
98*67e74705SXin Li
99*67e74705SXin Li  arr = @[str, str];
100*67e74705SXin Li  arr = @[str, str];
101*67e74705SXin Li  dict = @{@"key1": @"value1", @"key2": @"value2"};
102*67e74705SXin Li  dict = @{@"key1": @"value1", @"key2": @"value2"};
103*67e74705SXin Li
104*67e74705SXin Li  dict = @{@"A": @"1", @"B": @"2"};
105*67e74705SXin Li
106*67e74705SXin Li  NSNumber *n = @2;
107*67e74705SXin Li}
108*67e74705SXin Li@end
109