Mercurial > projects > ldc
diff gen/toobj.cpp @ 946:1714836f2c0b
Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Add getCompilationModule to Dsymbol and fix template compile unit decision code.
Runtime compiles with -g again.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 08 Feb 2009 16:50:22 +0100 |
parents | 03d7c4aac654 |
children | e71c61befd6d |
line wrap: on
line diff
--- a/gen/toobj.cpp Sun Feb 08 05:26:54 2009 +0100 +++ b/gen/toobj.cpp Sun Feb 08 16:50:22 2009 +0100 @@ -82,9 +82,14 @@ // start by deleting the old object file deleteObjFile(); + // name the module + std::string mname(toChars()); + if (md != 0) + mname = md->toChars(); + // create a new ir state // TODO look at making the instance static and moving most functionality into IrModule where it belongs - IRState ir; + IRState ir(new llvm::Module(mname)); gIR = &ir; ir.dmodule = this; @@ -92,12 +97,6 @@ IrDsymbol::resetAll(); IrType::resetAll(); - // 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 since // the global created for the filename must belong to the right llvm module @@ -426,7 +425,7 @@ // debug info LLGlobalVariable* subprog; if(global.params.symdebug) { - subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()); + subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()).getGV(); builder.CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), DBG_CAST(subprog)); } @@ -471,7 +470,7 @@ // debug info LLGlobalVariable* subprog; if(global.params.symdebug) { - subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()); + subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()).getGV(); builder.CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), DBG_CAST(subprog)); } @@ -516,7 +515,7 @@ // debug info LLGlobalVariable* subprog; if(global.params.symdebug) { - subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()); + subprog = DtoDwarfSubProgramInternal(name.c_str(), name.c_str()).getGV(); builder.CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), DBG_CAST(subprog)); } @@ -573,7 +572,7 @@ // debug info LLGlobalVariable* subprog; if(global.params.symdebug) { - subprog = DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str()); + subprog = DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str()).getGV(); builder.CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), DBG_CAST(subprog)); }