1/*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LLVM_LICENSE_HEADER@
5 */
6
7/*  block_layout.m
8    Created by Patrick Beard on 3 Sep 2010
9*/
10
11// rdar://problem/8389489 rdar://problem/8389489 need Block layout accessor
12// TEST_CONFIG MEM=gc
13// TEST_CFLAGS -framework Foundation
14// TEST_DISABLED
15
16#import <Foundation/Foundation.h>
17#import <Block.h>
18#import <Block_private.h>
19#import <dispatch/dispatch.h>
20#import <assert.h>
21#import "test.h"
22
23int main (int argc, char const* argv[]) {
24    NSAutoreleasePool *pool = [NSAutoreleasePool new];
25
26    NSObject *o = [NSObject new];
27    NSString *s = [NSString stringWithFormat:@"argc = arg, argv = %p", argc, argv];
28
29    dispatch_block_t block = ^{
30        NSLog(@"o = %@", o);
31        NSLog(@"s = %@", s);
32    };
33    block = [block copy];
34
35    const char *layout = _Block_layout(block);
36    assert (layout != NULL);
37
38    block();
39    [block release];
40
41    [pool drain];
42
43    succeed(__FILE__);
44}
45