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());
}
// 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() {
const llvm::Type *BlockDescriptorType;
const llvm::Type * GenericBlockLiteralType;
+ struct {
+ int GlobalUniqueCount;
+ } Block;
std::vector<llvm::Function *> BuiltinFunctions;
public:
void Release();
llvm::Constant *getNSConcreteGlobalBlock();
-
+ int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
const llvm::Type *getBlockDescriptorType();
const llvm::Type *getGenericBlockLiteralType();