diff ir/irmodule.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 e3355ce5444b
children 1714836f2c0b
line wrap: on
line diff
--- a/ir/irmodule.cpp	Sat Oct 11 22:44:17 2008 +0200
+++ b/ir/irmodule.cpp	Sun Oct 12 10:35:16 2008 +0200
@@ -1,9 +1,16 @@
 #include "gen/llvm.h"
+#include "gen/tollvm.h"
+#include "gen/irstate.h"
 #include "ir/irmodule.h"
 
-IrModule::IrModule(Module* module)
+IrModule::IrModule(Module* module, const char* srcfilename)
 {
     M = module;
+
+    LLConstant* slice = DtoConstString(srcfilename);
+    fileName = new llvm::GlobalVariable(
+        slice->getType(), true, LLGlobalValue::InternalLinkage, slice, ".modulefilename", gIR->module);
+
     dwarfCompileUnit = NULL;
 }