mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-11 21:37:17 +03:00
Restore additional GEP deref for llvm.dbg.declare for LLVM < 5
This commit is contained in:
parent
8cc5ff6e79
commit
e4e7eaa0da
3 changed files with 16 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// REQUIRES: atleast_llvm500
|
||||
// REQUIRES: Windows
|
||||
// REQUIRES: cdb
|
||||
// RUN: %ldc -g -of=%t.exe %s
|
||||
|
@ -12,7 +13,7 @@
|
|||
void encloser(int arg0, ref int arg1)
|
||||
{
|
||||
int enc_n = 123;
|
||||
// CDB: bp `nested_cdb.d:15`
|
||||
// CDB: bp `nested_cdb.d:16`
|
||||
// CDB: g
|
||||
// CDB: dv /t
|
||||
// CHECK: int arg0 = 0n1
|
||||
|
@ -26,7 +27,7 @@ void encloser(int arg0, ref int arg1)
|
|||
void nested(int nes_i)
|
||||
{
|
||||
int blub = arg0 + arg1 + enc_n;
|
||||
// CDB: bp `nested_cdb.d:29`
|
||||
// CDB: bp `nested_cdb.d:30`
|
||||
// CDB: g
|
||||
// CDB: dv /t
|
||||
// CHECK: int arg0 = 0n1
|
||||
|
@ -35,7 +36,7 @@ void encloser(int arg0, ref int arg1)
|
|||
// CDB: ?? *arg1
|
||||
// CHECK: int 0n2
|
||||
arg0 = arg1 = enc_n = nes_i;
|
||||
// CDB: bp `nested_cdb.d:38`
|
||||
// CDB: bp `nested_cdb.d:39`
|
||||
// CDB: g
|
||||
// CDB: dv /t
|
||||
// CHECK: int arg0 = 0n456
|
||||
|
@ -46,7 +47,7 @@ void encloser(int arg0, ref int arg1)
|
|||
}
|
||||
|
||||
nested(456);
|
||||
// CDB: bp `nested_cdb.d:49`
|
||||
// CDB: bp `nested_cdb.d:50`
|
||||
// CDB: g
|
||||
// CDB: dv /t
|
||||
// CHECK: int arg0 = 0n456
|
||||
|
|
|
@ -43,7 +43,7 @@ void encloser(int arg0, ref int arg1)
|
|||
// GDB: b 43
|
||||
// GDB: c
|
||||
// GDB: p arg0
|
||||
// CHECK: $10 = 456
|
||||
// no-CHECK: $10 = 456 (`<optimized out>` for LLVM < 5.0)
|
||||
// GDB: p arg1
|
||||
// CHECK: $11 = (int &) @{{0x[0-9a-f]*}}: 456
|
||||
// GDB: p enc_n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue