diff gen/todebug.cpp @ 1271:0686701178d3

Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp. Fixed filenames for array bounds errors and probably others, fixes #271 .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Mon, 27 Apr 2009 13:30:48 +0200
parents 73b56541152c
children b8c2f3e05b52
line wrap: on
line diff
--- a/gen/todebug.cpp	Mon Apr 27 03:40:40 2009 +0200
+++ b/gen/todebug.cpp	Mon Apr 27 13:30:48 2009 +0200
@@ -476,13 +476,13 @@
     LOG_SCOPE;
 
     // we might be generating for an import
-    if (!m->ir.irModule)
-        m->ir.irModule = new IrModule(m, m->srcfile->toChars());
-    else if (!m->ir.irModule->diCompileUnit.isNull())
+    IrModule* irmod = getIrModule(m);
+
+    if (!irmod->diCompileUnit.isNull())
     {
-        assert (m->ir.irModule->diCompileUnit.getGV()->getParent() == gIR->module
+        assert (irmod->diCompileUnit.getGV()->getParent() == gIR->module
             && "debug info compile unit belongs to incorrect llvm module!");
-        return m->ir.irModule->diCompileUnit;
+        return irmod->diCompileUnit;
     }
 
     // prepare srcpath
@@ -496,7 +496,7 @@
     }
 
     // make compile unit
-    m->ir.irModule->diCompileUnit = gIR->difactory.CreateCompileUnit(
+    irmod->diCompileUnit = gIR->difactory.CreateCompileUnit(
         global.params.symdebug == 2 ? DW_LANG_C : DW_LANG_D,
         m->srcfile->name->toChars(),
         srcpath,
@@ -509,10 +509,10 @@
     // if the linkage stays internal, we can't llvm-link the generated modules together:
     // llvm's DwarfWriter uses path and filename to determine the symbol name and we'd
     // end up with duplicate symbols
-    m->ir.irModule->diCompileUnit.getGV()->setLinkage(DEBUGINFO_LINKONCE_LINKAGE_TYPE);
-    m->ir.irModule->diCompileUnit.getGV()->setName(std::string("llvm.dbg.compile_unit_") + srcpath + m->srcfile->name->toChars());
+    irmod->diCompileUnit.getGV()->setLinkage(DEBUGINFO_LINKONCE_LINKAGE_TYPE);
+    irmod->diCompileUnit.getGV()->setName(std::string("llvm.dbg.compile_unit_") + srcpath + m->srcfile->name->toChars());
 
-    return m->ir.irModule->diCompileUnit;
+    return irmod->diCompileUnit;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////////////