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());
DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
Block.GlobalUniqueCount = 0;
+ Block.DescriptorUniqueCount = 0;
}
CodeGenModule::~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;
llvm::Constant *getNSConcreteGlobalBlock();
llvm::Constant *getNSConcreteStackBlock();
int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
+ int getDescriptorUniqueCount() { return ++Block.DescriptorUniqueCount; }
const llvm::Type *getBlockDescriptorType();
const llvm::Type *getGenericBlockLiteralType();