diff options
Diffstat (limited to 'lib/CodeGen/CGBlocks.h')
-rw-r--r-- | lib/CodeGen/CGBlocks.h | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/lib/CodeGen/CGBlocks.h b/lib/CodeGen/CGBlocks.h index 5646d00..e9b2bd5 100644 --- a/lib/CodeGen/CGBlocks.h +++ b/lib/CodeGen/CGBlocks.h @@ -148,26 +148,6 @@ public: BLOCK_BYREF_CURRENT_MAX = 256 }; - /// BlockInfo - Information to generate a block literal. - struct BlockInfo { - /// BlockLiteralTy - The type of the block literal. - const llvm::Type *BlockLiteralTy; - - /// Name - the name of the function this block was created for, if any. - const char *Name; - - /// ByCopyDeclRefs - Variables from parent scopes that have been imported - /// into this block. - llvm::SmallVector<const BlockDeclRefExpr *, 8> DeclRefs; - - BlockInfo(const llvm::Type *blt, const char *n) - : BlockLiteralTy(blt), Name(n) { - // Skip asm prefix, if any. - if (Name && Name[0] == '\01') - ++Name; - } - }; - CGBuilderTy &Builder; BlockFunction(CodeGenModule &cgm, CodeGenFunction &cgf, CGBuilderTy &B); @@ -179,19 +159,31 @@ public: /// characters. CharUnits BlockAlign; - /// getBlockOffset - Allocate an offset for the ValueDecl from a - /// BlockDeclRefExpr in a block literal (BlockExpr). - CharUnits getBlockOffset(const BlockDeclRefExpr *E); + /// getBlockOffset - Allocate a location within the block's storage + /// for a value with the given size and alignment requirements. + CharUnits getBlockOffset(CharUnits Size, CharUnits Align); /// BlockHasCopyDispose - True iff the block uses copy/dispose. bool BlockHasCopyDispose; - /// BlockDeclRefDecls - Decls from BlockDeclRefExprs in apperance order - /// in a block literal. Decls without names are used for padding. - llvm::SmallVector<const Expr *, 8> BlockDeclRefDecls; + /// BlockLayout - The layout of the block's storage, represented as + /// a sequence of expressions which require such storage. The + /// expressions can be: + /// - a BlockDeclRefExpr, indicating that the given declaration + /// from an enclosing scope is needed by the block; + /// - a DeclRefExpr, which always wraps an anonymous VarDecl with + /// array type, used to insert padding into the block; or + /// - a CXXThisExpr, indicating that the C++ 'this' value should + /// propagate from the parent to the block. + /// This is a really silly representation. + llvm::SmallVector<const Expr *, 8> BlockLayout; /// BlockDecls - Offsets for all Decls in BlockDeclRefExprs. - std::map<const Decl*, CharUnits> BlockDecls; + llvm::DenseMap<const Decl*, CharUnits> BlockDecls; + + /// BlockCXXThisOffset - The offset of the C++ 'this' value within + /// the block structure. + CharUnits BlockCXXThisOffset; ImplicitParamDecl *BlockStructDecl; ImplicitParamDecl *getBlockStructDecl() { return BlockStructDecl; } |