Move DescriptorUniqueCount into CGM.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64481 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index d6c248d..e82569e 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -65,10 +65,8 @@
 
   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 091158d..2dbee58 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -52,6 +52,7 @@
   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 e79d189..020f74c 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -128,9 +128,10 @@
   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 @@
   llvm::Constant *getNSConcreteGlobalBlock();
   llvm::Constant *getNSConcreteStackBlock();
   int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
+  int getDescriptorUniqueCount() { return ++Block.DescriptorUniqueCount; }
   const llvm::Type *getBlockDescriptorType();
 
   const llvm::Type *getGenericBlockLiteralType();