diff gen/toobj.cpp @ 683:b411c41a9716

Only allocate the module file name once. Fixes #90.
author Christian Kamm <kamm incasoftware de>
date Sun, 12 Oct 2008 10:35:16 +0200
parents 075c1272a01d
children 363bb6c0cc80
line wrap: on
line diff
--- a/gen/toobj.cpp	Sat Oct 11 22:44:17 2008 +0200
+++ b/gen/toobj.cpp	Sun Oct 12 10:35:16 2008 +0200
@@ -89,16 +89,17 @@
     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);