• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
2
3typedef unsigned int size_t;
4@protocol P @end
5
6@interface NSMutableArray
7- (id)objectAtIndexedSubscript:(size_t)index;
8- (void)setObject:(id)object atIndexedSubscript:(size_t)index;
9@end
10
11@interface NSMutableDictionary
12- (id)objectForKeyedSubscript:(id)key;
13- (void)setObject:(id)object forKeyedSubscript:(id)key;
14@end
15
16int main() {
17  NSMutableArray *array;
18  id val;
19
20  id oldObject = array[10];
21// CHECK: [[ARR:%.*]] = load {{%.*}} [[array:%.*]], align 8
22// CHECK-NEXT: [[SEL:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_"
23// CHECK-NEXT: [[ARRC:%.*]] = bitcast {{%.*}} [[ARR]] to i8*
24// CHECK-NEXT: [[CALL:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* [[ARRC]], i8* [[SEL]], i32 10)
25// CHECK-NEXT: store i8* [[CALL]], i8** [[OLDOBJ:%.*]], align 8
26
27  val = (array[10] = oldObject);
28// CHECK: [[THREE:%.*]] = load {{%.*}} [[array:%.*]], align 8
29// CHECK-NEXT: [[FOUR:%.*]] = load i8** [[oldObject:%.*]], align 8
30// CHECK-NEXT: [[FIVE:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2"
31// CHECK-NEXT: [[SIX:%.*]] = bitcast {{%.*}} [[THREE]] to i8*
32// CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i32)*)(i8* [[SIX]], i8* [[FIVE]], i8* [[FOUR]], i32 10)
33// CHECK-NEXT: store i8* [[FOUR]], i8** [[val:%.*]]
34
35  NSMutableDictionary *dictionary;
36  id key;
37  id newObject;
38  oldObject = dictionary[key];
39// CHECK:  [[SEVEN:%.*]] = load {{%.*}} [[DICTIONARY:%.*]], align 8
40// CHECK-NEXT:  [[EIGHT:%.*]] = load i8** [[KEY:%.*]], align 8
41// CHECK-NEXT:  [[TEN:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_4"
42// CHECK-NEXT:  [[ELEVEN:%.*]] = bitcast {{%.*}} [[SEVEN]] to i8*
43// CHECK-NEXT:  [[CALL1:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* [[ELEVEN]], i8* [[TEN]], i8* [[EIGHT]])
44// CHECK-NEXT:  store i8* [[CALL1]], i8** [[oldObject:%.*]], align 8
45
46
47  val = (dictionary[key] = newObject);
48// CHECK: [[TWELVE:%.*]] = load {{%.*}} [[DICTIONARY]], align 8
49// CHECK-NEXT:  [[THIRTEEN:%.*]] = load i8** [[KEY]], align 8
50// CHECK-NEXT:  [[FOURTEEN:%.*]] = load i8** [[NEWOBJECT:%.*]], align 8
51// CHECK-NEXT:  [[SIXTEEN:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6"
52// CHECK-NEXT:  [[SEVENTEEN:%.*]] = bitcast {{%.*}} [[TWELVE]] to i8*
53// CHECK-NEXT:  call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, i8*)*)(i8* [[SEVENTEEN]], i8* [[SIXTEEN]], i8* [[FOURTEEN]], i8* [[THIRTEEN]])
54// CHECK-NEXT: store i8* [[FOURTEEN]], i8** [[val:%.*]]
55}
56
57