blob: 4ba699b7dac75a14a414a94793bd0c8d0f2b7d94 [file] [log] [blame]
Mike Stumpd883d842009-03-04 15:35:22 +00001//===-- CGBlocks.h - state for LLVM CodeGen for blocks ----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This is the internal state used for llvm translation for block literals.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_CODEGEN_CGBLOCKS_H
15#define CLANG_CODEGEN_CGBLOCKS_H
16
17namespace clang {
18
19namespace CodeGen {
20
21class BlockBase {
22public:
23 enum {
24 BLOCK_NEEDS_FREE = (1 << 24),
25 BLOCK_HAS_COPY_DISPOSE = (1 << 25),
26 BLOCK_HAS_CXX_OBJ = (1 << 26),
27 BLOCK_IS_GC = (1 << 27),
28 BLOCK_IS_GLOBAL = (1 << 28),
29 BLOCK_HAS_DESCRIPTOR = (1 << 29)
30 };
31};
32
33class BlockModule : public BlockBase {
34};
35
36class BlockFunction : public BlockBase {
37public:
38 enum {
39 BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)),
40 block, ... */
41 BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
42 BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the __block
43 variable */
44 BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
45 helpers */
46 BLOCK_BYREF_CALLER = 128 /* called from __block (byref) copy/dispose
47 support routines */
48 };
49};
50
51} // end namespace CodeGen
52} // end namespace clang
53
54#endif