]> granicus.if.org Git - clang/commitdiff
Move DescriptorUniqueCount into CGM.
authorMike Stump <mrs@apple.com>
Fri, 13 Feb 2009 19:36:03 +0000 (19:36 +0000)
committerMike Stump <mrs@apple.com>
Fri, 13 Feb 2009 19:36:03 +0000 (19:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64481 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h

index d6c248dcef76e391b07076199250151309961f64..e82569e281c4ca98769667900210cf704b6ed29b 100644 (file)
@@ -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());
index 091158daba759d61414ee8c1a45936893615aa39..2dbee58a823b6495d866da8c272f11c5c44c0232 100644 (file)
@@ -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() {
index e79d18990d61e1caacd087df14dae9b2f52fd565..020f74cddda6a7a1ef0e03c905a8c6ee398124a6 100644 (file)
@@ -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();