Mercurial > projects > ldc
diff gen/llvmhelpers.cpp @ 250:fc9c1a0eabbd trunk
[svn r267] Fixed debug info for global variables.
Cleaned up the debug info code in general.
author | lindquist |
---|---|
date | Wed, 11 Jun 2008 20:53:26 +0200 |
parents | a95056b3c996 |
children | 70c370e97944 |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Tue Jun 10 21:44:04 2008 +0200 +++ b/gen/llvmhelpers.cpp Wed Jun 11 20:53:26 2008 +0200 @@ -14,6 +14,7 @@ #include "gen/classes.h" #include "gen/functions.h" #include "gen/typeinf.h" +#include "gen/todebug.h" /****************************************************************************************/ /*//////////////////////////////////////////////////////////////////////////////////////// @@ -810,6 +811,13 @@ if (!(vd->storage_class & STCextern) && (vd->getModule() == gIR->dmodule || istempl)) { gvar->setInitializer(_init); + // do debug info + if (global.params.symdebug) + { + LLGlobalVariable* gv = DtoDwarfGlobalVariable(gvar, vd); + // keep a reference so GDCE doesn't delete it ! + gIR->usedArray.push_back(llvm::ConstantExpr::getBitCast(gv, getVoidPtrType())); + } } if (emitRTstaticInit)