Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
249:fa9fef362a98 | 250:fc9c1a0eabbd |
---|---|
12 #include "gen/dvalue.h" | 12 #include "gen/dvalue.h" |
13 #include "gen/complex.h" | 13 #include "gen/complex.h" |
14 #include "gen/classes.h" | 14 #include "gen/classes.h" |
15 #include "gen/functions.h" | 15 #include "gen/functions.h" |
16 #include "gen/typeinf.h" | 16 #include "gen/typeinf.h" |
17 #include "gen/todebug.h" | |
17 | 18 |
18 /****************************************************************************************/ | 19 /****************************************************************************************/ |
19 /*//////////////////////////////////////////////////////////////////////////////////////// | 20 /*//////////////////////////////////////////////////////////////////////////////////////// |
20 // DYNAMIC MEMORY HELPERS | 21 // DYNAMIC MEMORY HELPERS |
21 ////////////////////////////////////////////////////////////////////////////////////////*/ | 22 ////////////////////////////////////////////////////////////////////////////////////////*/ |
808 | 809 |
809 llvm::GlobalVariable* gvar = llvm::cast<llvm::GlobalVariable>(vd->ir.irGlobal->value); | 810 llvm::GlobalVariable* gvar = llvm::cast<llvm::GlobalVariable>(vd->ir.irGlobal->value); |
810 if (!(vd->storage_class & STCextern) && (vd->getModule() == gIR->dmodule || istempl)) | 811 if (!(vd->storage_class & STCextern) && (vd->getModule() == gIR->dmodule || istempl)) |
811 { | 812 { |
812 gvar->setInitializer(_init); | 813 gvar->setInitializer(_init); |
814 // do debug info | |
815 if (global.params.symdebug) | |
816 { | |
817 LLGlobalVariable* gv = DtoDwarfGlobalVariable(gvar, vd); | |
818 // keep a reference so GDCE doesn't delete it ! | |
819 gIR->usedArray.push_back(llvm::ConstantExpr::getBitCast(gv, getVoidPtrType())); | |
820 } | |
813 } | 821 } |
814 | 822 |
815 if (emitRTstaticInit) | 823 if (emitRTstaticInit) |
816 DtoLazyStaticInit(istempl, gvar, vd->init, t); | 824 DtoLazyStaticInit(istempl, gvar, vd->init, t); |
817 } | 825 } |