mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 17:43:35 +03:00
Fixed problem with moduleinfo thinking it imports itself, causing assertion failure, fixes #138
This commit is contained in:
parent
3111ff1fc4
commit
a012859bae
1 changed files with 5 additions and 6 deletions
|
@ -743,7 +743,7 @@ void Module::genmoduleinfo()
|
|||
for (size_t i = 0; i < aimports.dim; i++)
|
||||
{
|
||||
Module *m = (Module *)aimports.data[i];
|
||||
if (!m->needModuleInfo())
|
||||
if (!m->needModuleInfo() || m == this)
|
||||
continue;
|
||||
|
||||
// declare the imported module info
|
||||
|
@ -867,13 +867,12 @@ void Module::genmoduleinfo()
|
|||
MIname.append(mangle());
|
||||
MIname.append("8__ModuleZ");
|
||||
|
||||
// declare
|
||||
// declare global
|
||||
// flags will be modified at runtime so can't make it constant
|
||||
|
||||
llvm::GlobalVariable* gvar = gIR->module->getGlobalVariable(MIname);
|
||||
if (!gvar) gvar = new llvm::GlobalVariable(constMI->getType(), false, llvm::GlobalValue::ExternalLinkage, NULL, MIname, gIR->module);
|
||||
else assert(gvar->getType()->getContainedType(0) == constMI->getType());
|
||||
gvar->setInitializer(constMI);
|
||||
// it makes no sense that the our own module info already exists!
|
||||
assert(!gIR->module->getGlobalVariable(MIname));
|
||||
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(constMI->getType(), false, llvm::GlobalValue::ExternalLinkage, constMI, MIname, gIR->module);
|
||||
|
||||
// build the modulereference and ctor for registering it
|
||||
LLFunction* mictor = build_module_reference_and_ctor(gvar);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue