diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h')
-rw-r--r-- | contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h b/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h index 6e71c1f..095cfdb 100644 --- a/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h +++ b/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h @@ -23,6 +23,7 @@ #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" +#include "CodeGenFunction.h" #include "CGBuilder.h" #include "CGCall.h" #include "CGValue.h" @@ -128,13 +129,14 @@ inline BlockFieldFlags operator|(BlockFieldFlag_t l, BlockFieldFlag_t r) { class CGBlockInfo { public: /// Name - The name of the block, kindof. - const char *Name; + llvm::StringRef Name; /// The field index of 'this' within the block, if there is one. unsigned CXXThisIndex; class Capture { uintptr_t Data; + EHScopeStack::stable_iterator Cleanup; public: bool isIndex() const { return (Data & 1) != 0; } @@ -144,6 +146,14 @@ public: assert(isConstant()); return reinterpret_cast<llvm::Value*>(Data); } + EHScopeStack::stable_iterator getCleanup() const { + assert(isIndex()); + return Cleanup; + } + void setCleanup(EHScopeStack::stable_iterator cleanup) { + assert(isIndex()); + Cleanup = cleanup; + } static Capture makeIndex(unsigned index) { Capture v; @@ -158,9 +168,6 @@ public: } }; - /// The mapping of allocated indexes within the block. - llvm::DenseMap<const VarDecl*, Capture> Captures; - /// CanBeGlobal - True if the block can be global, i.e. it has /// no non-constant captures. bool CanBeGlobal : 1; @@ -176,22 +183,44 @@ public: /// because it gets set later in the block-creation process. mutable bool UsesStret : 1; + /// The mapping of allocated indexes within the block. + llvm::DenseMap<const VarDecl*, Capture> Captures; + + llvm::AllocaInst *Address; llvm::StructType *StructureType; - const BlockExpr *Block; + const BlockDecl *Block; + const BlockExpr *BlockExpression; CharUnits BlockSize; CharUnits BlockAlign; + /// An instruction which dominates the full-expression that the + /// block is inside. + llvm::Instruction *DominatingIP; + + /// The next block in the block-info chain. Invalid if this block + /// info is not part of the CGF's block-info chain, which is true + /// if it corresponds to a global block or a block whose expression + /// has been encountered. + CGBlockInfo *NextBlockInfo; + const Capture &getCapture(const VarDecl *var) const { - llvm::DenseMap<const VarDecl*, Capture>::const_iterator + return const_cast<CGBlockInfo*>(this)->getCapture(var); + } + Capture &getCapture(const VarDecl *var) { + llvm::DenseMap<const VarDecl*, Capture>::iterator it = Captures.find(var); assert(it != Captures.end() && "no entry for variable!"); return it->second; } - const BlockDecl *getBlockDecl() const { return Block->getBlockDecl(); } - const BlockExpr *getBlockExpr() const { return Block; } + const BlockDecl *getBlockDecl() const { return Block; } + const BlockExpr *getBlockExpr() const { + assert(BlockExpression); + assert(BlockExpression->getBlockDecl() == Block); + return BlockExpression; + } - CGBlockInfo(const BlockExpr *blockExpr, const char *Name); + CGBlockInfo(const BlockDecl *blockDecl, llvm::StringRef Name); }; } // end namespace CodeGen |