• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.nopch.ll %s
2// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-pch -o %t.pch %s
3// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.pch.ll %s -include-pch %t.pch
4// REQUIRES: x86-registered-target
5// RUN: diff %t.nopch.ll %t.pch.ll
6
7#ifndef HEADER
8#define HEADER
9
10@interface NSArray
11- (id)objectAtIndexedSubscript:(int)index;
12+ (id)arrayWithObjects:(id *)objects count:(unsigned)count;
13@end
14
15@interface NSMutableArray : NSArray
16- (void)setObject:(id)object atIndexedSubscript:(int)index;
17@end
18
19@interface NSDictionary
20- (id)objectForKeyedSubscript:(id)key;
21+ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count;
22@end
23
24@interface NSMutableDictionary : NSDictionary
25- (void)setObject:(id)object forKeyedSubscript:(id)key;
26@end
27
28@interface NSNumber
29+ (NSNumber *)numberWithInt:(int)value;
30@end
31
32@class NSString;
33
34@interface NSValue
35+ (NSValue *)valueWithBytes:(const void *)bytes objCType:(const char *)type;
36@end
37
38typedef struct __attribute__((objc_boxable)) _some_struct {
39  int dummy;
40} some_struct;
41
42id testArray(int idx, id p) {
43  NSMutableArray *array;
44  array[idx] = p;
45  NSArray *arr = @[ p, @7 ];
46  return array[idx];
47}
48
49void testDict(NSString *key, id newObject, id oldObject) {
50  NSMutableDictionary *dictionary;
51  oldObject = dictionary[key];
52  dictionary[key] = newObject;
53  NSDictionary *dict = @{ key: newObject, key: oldObject };
54}
55
56void testBoxableValue() {
57  some_struct ss;
58  id value = @(ss);
59}
60
61#endif
62