Move debugVariable and debugFunc from VarDeclaration to IrVar

This commit is contained in:
Alexey Prokhin 2014-09-22 16:13:18 +04:00
parent caa2f15c8a
commit 9ead7f7996
4 changed files with 24 additions and 21 deletions

View file

@ -1202,6 +1202,8 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr)
{
addr = DtoAlloca(var->type, var->toChars());
// add debug info
if (!irLocal)
irLocal = getIrLocal(var, true);
gIR->DBuilder.EmitLocalVariable(addr, var);
}
@ -1222,7 +1224,7 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr)
else
{
// if this already has storage, it must've been handled already
if (irLocal && irLocal->value) {
if (irLocal->value) {
if (addr && addr != irLocal->value) {
// This can happen, for example, in scope(exit) blocks which
// are translated to IR multiple times.
@ -1240,8 +1242,6 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr)
}
assert(addr);
if (!irLocal)
irLocal = getIrLocal(var, true);
irLocal->value = addr;
}