aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-02-13 18:36:05 +0000
committerMike Stump <mrs@apple.com>2009-02-13 18:36:05 +0000
commit26efc3388adb010984da2f70e1f24e8286e6476d (patch)
tree02bad34ce20657f11f364e9d76cf0b29576062b7 /lib/CodeGen
parentc1ced28c0262698de9877afa74589038c7aad0df (diff)
Move GlobalUniqueCount up into CGM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGBlocks.cpp4
-rw-r--r--lib/CodeGen/CodeGenModule.cpp4
-rw-r--r--lib/CodeGen/CodeGenModule.h5
3 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index f61e0bcd39..045f7338e0 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -154,9 +154,7 @@ llvm::Constant *CodeGenFunction::BuildBlockLiteralTmp() {
C = llvm::ConstantStruct::get(Elts);
char Name[32];
- // FIXME: Boost in CGM?
- static int global_unique_count;
- sprintf(Name, "__block_holder_tmp_%d", ++global_unique_count);
+ sprintf(Name, "__block_holder_tmp_%d", CGM.getGlobalUniqueCount());
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 53d99f07eb..091158daba 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -49,7 +49,9 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
}
// If debug info generation is enabled, create the CGDebugInfo object.
- DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
+ DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
+
+ Block.GlobalUniqueCount = 0;
}
CodeGenModule::~CodeGenModule() {
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index 4b1a06edc5..0d9caaa95d 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -129,6 +129,9 @@ class CodeGenModule {
const llvm::Type *BlockDescriptorType;
const llvm::Type * GenericBlockLiteralType;
+ struct {
+ int GlobalUniqueCount;
+ } Block;
std::vector<llvm::Function *> BuiltinFunctions;
public:
@@ -142,7 +145,7 @@ public:
void Release();
llvm::Constant *getNSConcreteGlobalBlock();
-
+ int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
const llvm::Type *getBlockDescriptorType();
const llvm::Type *getGenericBlockLiteralType();