diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.h | 14 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 8aabada259c..d877b171b9e 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -501,7 +501,7 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const BlockDeclRefExpr *E) { } llvm::Constant * -CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) { +BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) { // Generate the block descriptor. const llvm::Type *UnsignedLongTy = Types.ConvertType(Context.UnsignedLongTy); const llvm::IntegerType *IntTy = cast<llvm::IntegerType>( @@ -534,9 +534,9 @@ CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) { uint64_t subBlockSize, subBlockAlign; llvm::SmallVector<const Expr *, 8> subBlockDeclRefDecls; llvm::Function *Fn - = CodeGenFunction(*this).GenerateBlockFunction(BE, Info, subBlockSize, - subBlockAlign, - subBlockDeclRefDecls); + = CodeGenFunction(CGM).GenerateBlockFunction(BE, Info, subBlockSize, + subBlockAlign, + subBlockDeclRefDecls); assert(subBlockSize == BlockLiteralSize && "no imports allowed for global block"); diff --git a/clang/lib/CodeGen/CGBlocks.h b/clang/lib/CodeGen/CGBlocks.h index a55c578c0e1..f58831423ef 100644 --- a/clang/lib/CodeGen/CGBlocks.h +++ b/clang/lib/CodeGen/CGBlocks.h @@ -43,6 +43,7 @@ namespace llvm { namespace clang { namespace CodeGen { +class CodeGenModule; class BlockBase { public: @@ -59,11 +60,14 @@ public: class BlockModule : public BlockBase { ASTContext &Context; llvm::Module &TheModule; + const llvm::TargetData &TheTargetData; CodeGenTypes &Types; + CodeGenModule &CGM; ASTContext &getContext() const { return Context; } llvm::Module &getModule() const { return TheModule; } CodeGenTypes &getTypes() { return Types; } + const llvm::TargetData &getTargetData() const { return TheTargetData; } public: llvm::Constant *getNSConcreteGlobalBlock(); llvm::Constant *getNSConcreteStackBlock(); @@ -73,6 +77,8 @@ public: const llvm::Type *getGenericBlockLiteralType(); const llvm::Type *getGenericExtendedBlockLiteralType(); + llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *); + /// NSConcreteGlobalBlock - Cached reference to the class pointer for global /// blocks. llvm::Constant *NSConcreteGlobalBlock; @@ -88,9 +94,11 @@ public: int GlobalUniqueCount; } Block; - BlockModule(ASTContext &C, llvm::Module &M, CodeGenTypes &T) - : Context(C), TheModule(M), Types(T), NSConcreteGlobalBlock(0), - NSConcreteStackBlock(0), BlockDescriptorType(0), + BlockModule(ASTContext &C, llvm::Module &M, const llvm::TargetData &TD, + CodeGenTypes &T, CodeGenModule &CodeGen) + : Context(C), TheModule(M), TheTargetData(TD), Types(T), + CGM(CodeGen), + NSConcreteGlobalBlock(0), NSConcreteStackBlock(0), BlockDescriptorType(0), GenericBlockLiteralType(0) { Block.GlobalUniqueCount = 0; } diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c0dba74ad02..422415c2e24 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -34,7 +34,7 @@ using namespace CodeGen; CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, llvm::Module &M, const llvm::TargetData &TD, Diagnostic &diags, bool GenerateDebugInfo) - : BlockModule(C, M, Types), Context(C), Features(LO), TheModule(M), + : BlockModule(C, M, TD, Types, *this), Context(C), Features(LO), TheModule(M), TheTargetData(TD), Diags(diags), Types(C, M, TD), Runtime(0), MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0) { diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index d20d22bc09f..a2b45a0b749 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -217,8 +217,6 @@ public: llvm::Constant *GetAddrOfConstantCString(const std::string &str, const char *GlobalName=0); - llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *); - /// getBuiltinLibFunction - Given a builtin id for a function like /// "__builtin_fabsf", return a Function* for "fabsf". llvm::Value *getBuiltinLibFunction(unsigned BuiltinID); |