Restore additional GEP deref for llvm.dbg.declare for LLVM < 5

This commit is contained in:
Martin 2017-09-08 00:02:12 +02:00
parent 8cc5ff6e79
commit e4e7eaa0da
3 changed files with 16 additions and 5 deletions

View file

@ -146,6 +146,11 @@ DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
}
if (!skipDIDeclaration && global.params.symdebug) {
#if LDC_LLVM_VER < 500
// Because we are passing a GEP instead of an alloca to
// llvm.dbg.declare, we have to make the address dereference explicit.
gIR->DBuilder.OpDeref(dwarfAddrOps);
#endif
gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false,
/*forceAsLocal=*/true, false, dwarfAddrOps);
}
@ -499,6 +504,11 @@ void DtoCreateNestedContext(FuncGenState &funcGen) {
}
if (global.params.symdebug) {
#if LDC_LLVM_VER < 500
// Because we are passing a GEP instead of an alloca to
// llvm.dbg.declare, we have to make the address dereference explicit.
gIR->DBuilder.OpDeref(dwarfAddrOps);
#endif
gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false, false, false,
dwarfAddrOps);
}