1// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s
2
3// rdar://12759433
4@class NSString;
5
6void Test12759433() {
7 __block __unsafe_unretained NSString *uuByref = (__bridge NSString *)(void*)0x102030405060708;
8 void (^block)() = ^{ uuByref = 0; };
9 block();
10}
11// CHECK: %struct.__block_byref_uuByref = type { i8*, %struct.__block_byref_uuByref*, i32, i32, [[ZERO:%.*]]* }
12int main() {
13  __block __weak id wid;
14  __block long XXX;
15  __block id ID;
16  __block struct S {
17     int iS;
18     double iD;
19     void *pv;
20     __unsafe_unretained id unsunr;
21  } import;
22  void (^c)() = ^{
23// Inline flag for BYREF variable layout (1107296256): BLOCK_BYREF_HAS_COPY_DISPOSE BLOCK_BYREF_LAYOUT_WEAK
24// CHECK: store i32 1107296256, i32* [[T0:%.*]]
25  wid = 0;
26
27// Inline flag for BYREF variable layout (536870912): BLOCK_BYREF_LAYOUT_NON_OBJECT
28// CHECK: store i32 536870912, i32* [[T1:%.*]]
29    XXX = 12345;
30
31// Inline flag for BYREF variable layout (838860800): BLOCK_BYREF_HAS_COPY_DISPOSE BLOCK_BYREF_LAYOUT_STRONG
32// CHECK: store i32 838860800, i32* [[T2:%.*]]
33    ID = 0;
34
35// Inline flag for BYREF variable layout (268435456): BLOCK_BYREF_LAYOUT_EXTENDED
36// BYREF variable layout: BL_NON_OBJECT_WORD:3, BL_UNRETAINED:1, BL_OPERATOR:0
37// CHECK: store i32 268435456, i32* [[T3:%.*]]
38    import.iD = 3.14;
39
40  };
41  c();
42}
43
44// rdar://12787751
45typedef char mds_path_t[1024];
46void directVolumePerfWaitForStoreState()
47{
48 __block mds_path_t path;
49}
50