Mike Stump | d883d84 | 2009-03-04 15:35:22 +0000 | [diff] [blame^] | 1 | //===-- 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 | |
| 17 | namespace clang { |
| 18 | |
| 19 | namespace CodeGen { |
| 20 | |
| 21 | class BlockBase { |
| 22 | public: |
| 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 | |
| 33 | class BlockModule : public BlockBase { |
| 34 | }; |
| 35 | |
| 36 | class BlockFunction : public BlockBase { |
| 37 | public: |
| 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 |