1// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s 2// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s 3// rdar://8991729 4 5__weak id wid; 6void x(id y) {} 7void y(int a) {} 8 9extern id opaque_id(); 10 11void f() { 12 __block int byref_int = 0; 13 char ch = 'a'; 14 char ch1 = 'b'; 15 char ch2 = 'c'; 16 short sh = 2; 17 const id bar = (id) opaque_id(); 18 id baz = 0; 19 __strong id strong_void_sta; 20 __block id byref_bab = (id)0; 21 __block id bl_var1; 22 int i; double dob; 23 24// The patterns here are a sequence of bytes, each saying first how 25// many sizeof(void*) chunks to skip (high nibble) and then how many 26// to scan (low nibble). A zero byte says that we've reached the end 27// of the pattern. 28// 29// All of these patterns start with 01 3x because the block header on 30// LP64 consists of an isa pointer (which we're supposed to scan for 31// some reason) followed by three words (2 ints, a function pointer, 32// and a descriptor pointer). 33 34// Test 1 35// byref int, short, char, char, char, id, id, strong id, byref id 36// 01 35 10 00 37// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\015\10\00" 38 void (^b)() = ^{ 39 byref_int = sh + ch+ch1+ch2 ; 40 x(bar); 41 x(baz); 42 x((id)strong_void_sta); 43 x(byref_bab); 44 }; 45 b(); 46 47// Test 2 48// byref int, short, char, char, char, id, id, strong id, byref void*, byref id 49// 01 36 10 00 50// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\016\10\00" 51 void (^c)() = ^{ 52 byref_int = sh + ch+ch1+ch2 ; 53 x(bar); 54 x(baz); 55 x((id)strong_void_sta); 56 x(wid); 57 bl_var1 = 0; 58 x(byref_bab); 59 }; 60} 61