diff gen/llvmhelpers.cpp @ 936:2ebac4750adb

Removed some dead code. Fixed assertion filenames for imported template instances. Fixes #152 .
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 04 Feb 2009 02:10:23 +0100
parents b56f3571c450
children 39519a1ff603
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp	Tue Feb 03 17:27:01 2009 -0700
+++ b/gen/llvmhelpers.cpp	Wed Feb 04 02:10:23 2009 +0100
@@ -109,7 +109,7 @@
 // ASSERT HELPER
 ////////////////////////////////////////////////////////////////////////////////////////*/
 
-void DtoAssert(Loc* loc, DValue* msg)
+void DtoAssert(Module* M, Loc* loc, DValue* msg)
 {
     std::vector<LLValue*> args;
 
@@ -124,7 +124,12 @@
     }
 
     // file param
-    args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName));
+
+    // we might be generating for an imported template function
+    if (!M->ir.irModule)
+        M->ir.irModule = new IrModule(M, M->srcfile->toChars());
+
+    args.push_back(DtoLoad(M->ir.irModule->fileName));
 
     // line param
     LLConstant* c = DtoConstUint(loc->linnum);