xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/subscripting-literals.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.nopch.ll %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-pch -o %t.pch %s
3*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.pch.ll %s -include-pch %t.pch
4*f4a2713aSLionel Sambuc// RUN: diff %t.nopch.ll %t.pch.ll
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc#ifndef HEADER
7*f4a2713aSLionel Sambuc#define HEADER
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc@interface NSArray
10*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(int)index;
11*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(id *)objects count:(unsigned)count;
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc@interface NSMutableArray : NSArray
15*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(int)index;
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@interface NSDictionary
19*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key;
20*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count;
21*f4a2713aSLionel Sambuc@end
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc@interface NSMutableDictionary : NSDictionary
24*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key;
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@interface NSNumber
28*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithInt:(int)value;
29*f4a2713aSLionel Sambuc@end
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambuc@class NSString;
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambucid testArray(int idx, id p) {
34*f4a2713aSLionel Sambuc  NSMutableArray *array;
35*f4a2713aSLionel Sambuc  array[idx] = p;
36*f4a2713aSLionel Sambuc  NSArray *arr = @[ p, @7 ];
37*f4a2713aSLionel Sambuc  return array[idx];
38*f4a2713aSLionel Sambuc}
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambucvoid testDict(NSString *key, id newObject, id oldObject) {
41*f4a2713aSLionel Sambuc  NSMutableDictionary *dictionary;
42*f4a2713aSLionel Sambuc  oldObject = dictionary[key];
43*f4a2713aSLionel Sambuc  dictionary[key] = newObject;
44*f4a2713aSLionel Sambuc  NSDictionary *dict = @{ key: newObject, key: oldObject };
45*f4a2713aSLionel Sambuc}
46*f4a2713aSLionel Sambuc
47*f4a2713aSLionel Sambuc#endif
48