brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b1e8c69 Raw
37 lines · plain
1// We run this twice, once as Objective-C and once as Objective-C++.2// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s3// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ | FileCheck %s4 5 6// CHECK: define{{.*}} ptr @{{.*}}test07// CHECK: define internal void @{{.*}}_block_invoke(8// CHECK:      call ptr @objc_assign_strongCast(9// CHECK-NEXT: ret void10id test0(id x) {11  __block id result;12  ^{ result = x; }();13  return result;14}15 16// cleanup __block variables on EH path17// CHECK: define{{.*}} void @{{.*}}test118void test1(void) {19  extern void test1_help(void (^x)(void));20 21  // CHECK:      [[N:%.*]] = alloca [[N_T:%.*]], align 822  // CHECK:      [[T0:%.*]] = getelementptr inbounds nuw [[N_T]], ptr [[N]], i32 0, i32 423  // CHECK-NEXT: store double 1.000000e+{{0?}}01, ptr [[T0]], align 824  __block double n = 10;25 26  // CHECK:      invoke void @{{.*}}test1_help27  test1_help(^{ n = 20; });28 29  // CHECK: call void @_Block_object_dispose(ptr [[N]], i32 8)30  // CHECK-NEXT: ret void31 32  // CHECK:      landingpad { ptr, i32 }33  // CHECK-NEXT:   cleanup34  // CHECK: call void @_Block_object_dispose(ptr [[N]], i32 8)35  // CHECK:      resume { ptr, i32 }36}37