aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CGBlocks.cpp4
-rw-r--r--lib/CodeGen/CodeGenModule.cpp1
-rw-r--r--lib/CodeGen/CodeGenModule.h4
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index d6c248dcef..e82569e281 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/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/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 091158daba..2dbee58a82 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/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/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index e79d18990d..020f74cddd 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/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();