1 // RUN: %clang_cc1 -fblocks -fobjc-gc -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
19 extern id opaque_id();
22 __block int byref_int = 0;
27 const id bar = (id) opaque_id();
29 __strong void *strong_void_sta;
30 __block id byref_bab = (id)0;
31 __block void *bl_var1;
34 // The patterns here are a sequence of bytes, each saying first how
35 // many sizeof(void*) chunks to skip (high nibble) and then how many
36 // to scan (low nibble). A zero byte says that we've reached the end
39 // All of these patterns start with 01 3x because the block header on
40 // LP64 consists of an isa pointer (which we're supposed to scan for
41 // some reason) followed by three words (2 ints, a function pointer,
42 // and a descriptor pointer).
44 // FIXME: do these really have to be named L_OBJC_CLASS_NAME_xxx?
45 // FIXME: sequences should never end in x0 00 instead of just 00
48 // byref int, short, char, char, char, id, id, strong void*, byref id
50 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\015\10\00"
52 byref_int = sh + ch+ch1+ch2 ;
55 x((id)strong_void_sta);
61 // byref int, short, char, char, char, id, id, strong void*, byref void*, byref id
63 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\016\10\00"
65 byref_int = sh + ch+ch1+ch2 ;
68 x((id)strong_void_sta);
76 // byref int, short, char, char, char, id, id, byref void*, int, double, byref id
78 // FIXME: we'd get a better format here if we sorted by scannability, not just alignment
79 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\014\11 \00"
81 byref_int = sh + ch+ch1+ch2 ;
92 // struct S (int, id, int, id, int, id)
94 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\01A\11\11\00"
102 // Test 5 (unions/structs and their nesting):
130 // struct s2 (int, id, int, id, int, id?), union u2 (id?)
132 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [6 x i8] c"\01A\11\12p\00"
142 void notifyBlock(id dependentBlock) {
143 id singleObservationToken;
149 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [3 x i8] c"\013\00"
150 void (^wrapperBlock)() = ^() {
151 CFRelease(singleObservationToken);
152 CFRelease(singleObservationToken);
154 CFRelease(singleObservationToken);
160 void test_empty_block() {
162 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [2 x i8] c"\01\00"
163 void (^wrapperBlock)() = ^() {