Only allocate the module file name once. Fixes #90.

This commit is contained in:
Christian Kamm
2008-10-12 10:35:16 +02:00
parent 40f724234d
commit 6cb213badf
7 changed files with 29 additions and 57 deletions

View File

@@ -89,16 +89,17 @@ void Module::genobjfile(int multiobj, char** envp)
IrDsymbol::resetAll();
IrType::resetAll();
// module ir state
// might already exist via import, just overwrite...
this->ir.irModule = new IrModule(this);
// name the module
std::string mname(toChars());
if (md != 0)
mname = md->toChars();
ir.module = new llvm::Module(mname);
// module ir state
// might already exist via import, just overwrite...
//FIXME: is there a good reason for overwriting?
this->ir.irModule = new IrModule(this, srcfile->toChars());
// set target stuff
std::string target_triple(global.params.tt_arch);
target_triple.append(global.params.tt_os);