• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple armv7-ios5.0 -std=c++11 -fobjc-arc -Os -emit-llvm -o - %s | FileCheck %s
2
3typedef __SIZE_TYPE__ size_t;
4
5namespace std {
6template <typename _Ep>
7class initializer_list {
8  const _Ep* __begin_;
9  size_t __size_;
10
11  initializer_list(const _Ep* __b, size_t __s);
12};
13}
14
15@interface I
16+ (instancetype) new;
17@end
18
19void function(std::initializer_list<I *>);
20
21extern "C" void single() { function({ [I new] }); }
22
23// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}})
24// CHECK-NEXT: [[CAST:%.*]] = bitcast [{{[0-9]+}} x %0*]* %{{.*}} to i8**
25// CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]],
26// CHECK: call void @objc_release(i8* {{.*}})
27
28extern "C" void multiple() { function({ [I new], [I new] }); }
29
30// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}})
31// CHECK-NEXT: [[CAST:%.*]] = bitcast [{{[0-9]+}} x %0*]* %{{.*}} to i8**
32// CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]],
33// CHECK: call void @objc_release(i8* {{.*}})
34// CHECK-NEXT: icmp eq
35
36void external();
37
38extern "C" void extended() {
39  const auto && temporary = { [I new] };
40  external();
41}
42
43// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}})
44// CHECK-NEXT: [[CAST:%.*]] = bitcast [1 x %0*]* %{{.*}} to i8**
45// CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]],
46// CHECK: {{.*}} call void @_Z8externalv()
47// CHECK: {{.*}} call void @objc_release(i8* {{.*}})
48
49std::initializer_list<I *> il = { [I new] };
50
51// CHECK: [[POOL:%.*]] = {{.*}} call i8* @objc_autoreleasePoolPush()
52// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}})
53// CHECK-NEXT: store i8* [[INSTANCE]], i8** bitcast ([1 x %0*]* @_ZGR2il_ to i8**)
54// CHECK: {{.*}} call void @objc_autoreleasePoolPop(i8* [[POOL]])
55
56