mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-10 09:24:09 +02:00
Allow multiple declarations to share the same mangled name/LLVM global.
This is necessary to enable aliasing compiler-generated symbols with pragma(mangle, …). Note that globals for internal use are still directly created.
This commit is contained in:
@@ -56,7 +56,7 @@ LLGlobalVariable * IrAggr::getVtblSymbol()
|
||||
|
||||
LLType* vtblTy = stripModifiers(type)->irtype->isClass()->getVtbl();
|
||||
|
||||
vtbl = new llvm::GlobalVariable(
|
||||
vtbl = getOrCreateGlobal(aggrdecl->loc,
|
||||
*gIR->module, vtblTy, true, _linkage, NULL, initname);
|
||||
|
||||
return vtbl;
|
||||
@@ -86,7 +86,7 @@ LLGlobalVariable * IrAggr::getClassInfoSymbol()
|
||||
assert(tc && "invalid ClassInfo type");
|
||||
|
||||
// classinfos cannot be constants since they're used as locks for synchronized
|
||||
classInfo = new llvm::GlobalVariable(
|
||||
classInfo = getOrCreateGlobal(aggrdecl->loc,
|
||||
*gIR->module, tc->getMemoryLLType(), false, _linkage, NULL, initname);
|
||||
|
||||
// Generate some metadata on this ClassInfo if it's for a class.
|
||||
@@ -138,7 +138,7 @@ LLGlobalVariable * IrAggr::getInterfaceArraySymbol()
|
||||
name.append("16__interfaceInfosZ");
|
||||
|
||||
llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl);
|
||||
classInterfacesArray = new llvm::GlobalVariable(*gIR->module,
|
||||
classInterfacesArray = getOrCreateGlobal(cd->loc, *gIR->module,
|
||||
array_type, true, _linkage, NULL, name);
|
||||
|
||||
return classInterfacesArray;
|
||||
@@ -335,7 +335,7 @@ llvm::GlobalVariable * IrAggr::getInterfaceVtbl(BaseClass * b, bool new_instance
|
||||
mangle.append(b->base->mangle());
|
||||
mangle.append("6__vtblZ");
|
||||
|
||||
llvm::GlobalVariable* GV = new llvm::GlobalVariable(
|
||||
llvm::GlobalVariable* GV = getOrCreateGlobal(cd->loc,
|
||||
*gIR->module,
|
||||
vtbl_constant->getType(),
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user