Home | History | Annotate | Download | only in CodeGenObjCXX
      1 // RUN: %clang_cc1 -triple armv7-ios5.0 -std=c++11 -fobjc-arc -Os -emit-llvm -o - %s | FileCheck %s
      2 
      3 typedef __SIZE_TYPE__ size_t;
      4 
      5 namespace std {
      6 template <typename _Ep>
      7 class 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 
     19 void function(std::initializer_list<I *>);
     20 
     21 extern "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 
     28 extern "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 
     36 void external();
     37 
     38 extern "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: {{.*}} call void @_Z8externalv()
     45 // CHECK: {{.*}} call void @objc_release(i8* {{.*}})
     46 
     47 std::initializer_list<I *> il = { [I new] };
     48 
     49 // CHECK: [[POOL:%.*]] = {{.*}} call i8* @objc_autoreleasePoolPush()
     50 // CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}})
     51 // CHECK-NEXT: store i8* [[INSTANCE]], i8** bitcast ([1 x %0*]* @_ZGR2il_ to i8**)
     52 // CHECK: {{.*}} call void @objc_autoreleasePoolPop(i8* [[POOL]])
     53 
     54