diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index d6c248dcef7..e82569e281c 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -65,10 +65,8 @@ llvm::Constant *CodeGenFunction::BuildDescriptorBlockDecl() { C = llvm::ConstantStruct::get(Elts); - // FIXME: Should be in module? - static int desc_unique_count; char Name[32]; - sprintf(Name, "__block_descriptor_tmp_%d", ++desc_unique_count); + sprintf(Name, "__block_descriptor_tmp_%d", CGM.getDescriptorUniqueCount()); C = new llvm::GlobalVariable(C->getType(), true, llvm::GlobalValue::InternalLinkage, C, Name, &CGM.getModule()); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 091158daba7..2dbee58a823 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -52,6 +52,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0; Block.GlobalUniqueCount = 0; + Block.DescriptorUniqueCount = 0; } CodeGenModule::~CodeGenModule() { diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index e79d18990d6..020f74cddda 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -128,9 +128,10 @@ class CodeGenModule { llvm::Constant *NSConcreteStackBlock; const llvm::Type *BlockDescriptorType; - const llvm::Type * GenericBlockLiteralType; + const llvm::Type *GenericBlockLiteralType; struct { int GlobalUniqueCount; + int DescriptorUniqueCount; } Block; std::vector<llvm::Function *> BuiltinFunctions; @@ -147,6 +148,7 @@ public: llvm::Constant *getNSConcreteGlobalBlock(); llvm::Constant *getNSConcreteStackBlock(); int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; } + int getDescriptorUniqueCount() { return ++Block.DescriptorUniqueCount; } const llvm::Type *getBlockDescriptorType(); const llvm::Type *getGenericBlockLiteralType(); |